mirror of
https://github.com/mmueller41/genode.git
synced 2026-01-21 12:32:56 +01:00
This patch equips Sculpt with the ability to customize the system image in very flexible ways. All customizable aspects of the image have been relocated from the former sculpt.run script and the accompanied gems/run/sculpt/ directory to a new location - the sculpt/ directory - which can exist in any repository. The directory at repos/gems/sculpt/ serves as reference. The sculpt directory can host any number of <name>-<board>.sculpt files, each containing a list of ingredients to be incorporated into the Sculpt system image. The <name> can be specified to the sculpt.run script. E.g., the following command refers to the 'default-pc.sculpt' file: make run/sculpt KERNEL=nova BOARD=pc SCULPT=default If no 'SCULPT' argument is supplied, the value 'default' is used. A .sculpt file refers to a selection of files found at various subdirectries named after their respective purpose. In particular, There exists a subdirectory for each file in Sculpt's config fs, like nitpicker, drivers... The .sculpt file selects the alternative to use by a simple tag-value notation. drivers: pc The supported tags are as follows. *Optional* selection of /config files. If not specified, those files are omitted, which prompts Sculpt to manage those configurations automatically or via the Leitzentrale GUI: fonts nic_router event_filter wifi runtime gpu_drv Selection of mandatory /config files. If not specified, the respective 'default' alternative will be used. nitpicker deploy fb_drv clipboard drivers numlock_remap leitzentrale usb system ram_fs Furthermore, the .sculpt file supports the optional selection of supplemental content such as a set of launchers. launches: nano3d system_shell Another type of content are the set of blessed pubkey/download files used for installing and verifying software on target. With the new version, it has become possible to supply a depot with the the system image. The depot content is assembled according to the 'pkg' attributes found in launcher files and the selected deploy config. The resulting depot is incorporated into the system image as 'depot.tar' archive. It can be supplied to the Sculpt system by mounting it into the ram fs as done by the 'ram_fs/depot' configuration for the ram fs. It is possible to add additional boot modules to the system image. There are two options. build: <list of targets> This tag prompts the sculpt.run script to build the specified targets directly using the Genode build system and add the created artifacts into the system image as boot modules. import: <list of depot src or pkg archives> This tag instructs Sculpt to supply the specifid depot-archive content as boot modules to the system image. This change eliminates the need for board-specific pkg/sculpt-<board> archives. The board-specific specializations can now be placed directly into the respective .sculpt files by using 'import:'. To make the use of Sculpt as testbed during development more convenient, the log output of the drivers, leitzentrale, and runtime subsystems can be redirected to core using the optional 'LOG=core' argument, e.g., make run/sculpt KERNEL=linux BOARD=linux LOG=core The former pkg/sculpt-installation and pkg/sculpt-installation-pc archives have been replaced by pkg/sculpt_distribution-pc, which references the generic pkg/sculpt_distribution archive. Those pkgs are solely used for publishing / distribution purposes. Fixes #4369
400 lines
11 KiB
C++
400 lines
11 KiB
C++
/*
|
|
* \brief Graph view of runtime state
|
|
* \author Norman Feske
|
|
* \date 2018-07-05
|
|
*/
|
|
|
|
/*
|
|
* Copyright (C) 2018 Genode Labs GmbH
|
|
*
|
|
* This file is part of the Genode OS framework, which is distributed
|
|
* under the terms of the GNU Affero General Public License version 3.
|
|
*/
|
|
|
|
#include <graph.h>
|
|
#include <view/dialog.h>
|
|
|
|
using namespace Sculpt;
|
|
|
|
|
|
void Graph::_gen_selected_node_content(Xml_generator &xml, Start_name const &name,
|
|
Runtime_state::Info const &info) const
|
|
{
|
|
if (_deploy_children.exists(name)) {
|
|
|
|
gen_named_node(xml, "frame", "operations", [&] () {
|
|
xml.node("hbox", [&] () {
|
|
gen_named_node(xml, "button", "remove", [&] () {
|
|
_action_item.gen_button_attr(xml, "remove");
|
|
xml.node("label", [&] () {
|
|
xml.attribute("text", "Remove"); }); });
|
|
|
|
gen_named_node(xml, "button", "restart", [&] () {
|
|
_action_item.gen_button_attr(xml, "restart");
|
|
xml.node("label", [&] () {
|
|
xml.attribute("text", "Restart"); }); });
|
|
});
|
|
});
|
|
|
|
} else if (name == "nic_drv" ||
|
|
name == "wifi_drv") {
|
|
|
|
gen_named_node(xml, "frame", "operations", [&] () {
|
|
xml.node("hbox", [&] () {
|
|
|
|
gen_named_node(xml, "button", "restart", [&] () {
|
|
_action_item.gen_button_attr(xml, "restart");
|
|
xml.node("label", [&] () {
|
|
xml.attribute("text", "Restart"); }); });
|
|
});
|
|
});
|
|
}
|
|
|
|
if (name == "ram_fs")
|
|
gen_named_node(xml, "frame", "ram_fs_operations", [&] () {
|
|
xml.node("vbox", [&] () {
|
|
_ram_fs_dialog.generate(xml, _ram_fs_state); }); });
|
|
|
|
String<100> const
|
|
ram (Capacity{info.assigned_ram - info.avail_ram}, " / ",
|
|
Capacity{info.assigned_ram}),
|
|
caps(info.assigned_caps - info.avail_caps, " / ",
|
|
info.assigned_caps, " caps");
|
|
|
|
gen_named_node(xml, "label", "hspace", [&] () {
|
|
xml.attribute("min_ex", 25); });
|
|
|
|
gen_named_node(xml, "label", "ram", [&] () {
|
|
xml.attribute("text", ram); });
|
|
|
|
gen_named_node(xml, "label", "caps", [&] () {
|
|
xml.attribute("text", caps); });
|
|
}
|
|
|
|
|
|
void Graph::_gen_parent_node(Xml_generator &xml, Start_name const &name,
|
|
Label const &label) const
|
|
{
|
|
gen_named_node(xml, "frame", name, [&] () {
|
|
xml.node("label", [&] () {
|
|
xml.attribute("text", Start_name(" ", label, " ")); }); });
|
|
}
|
|
|
|
|
|
void Graph::_gen_storage_node(Xml_generator &xml) const
|
|
{
|
|
char const * const name = "storage";
|
|
|
|
bool const any_selected = _runtime_state.selected().valid();
|
|
bool const unimportant = any_selected && !_runtime_state.storage_in_tcb();
|
|
|
|
gen_named_node(xml, "frame", name, [&] () {
|
|
|
|
if (unimportant)
|
|
xml.attribute("style", "unimportant");
|
|
|
|
xml.node("vbox", [&] () {
|
|
|
|
gen_named_node(xml, "button", name, [&] () {
|
|
|
|
_node_button_item.gen_button_attr(xml, name);
|
|
|
|
if (unimportant)
|
|
xml.attribute("style", "unimportant");
|
|
|
|
if (_storage_selected)
|
|
xml.attribute("selected", "yes");
|
|
|
|
xml.node("label", [&] () { xml.attribute("text", "Storage"); });
|
|
});
|
|
|
|
if (_storage_selected)
|
|
gen_named_node(xml, "frame", "storage_operations", [&] () {
|
|
xml.node("vbox", [&] () {
|
|
_storage_dialog->gen_block_devices(xml); }); });
|
|
});
|
|
});
|
|
}
|
|
|
|
|
|
void Graph::_gen_usb_node(Xml_generator &xml) const
|
|
{
|
|
char const * const name = "usb";
|
|
|
|
bool const any_selected = _runtime_state.selected().valid();
|
|
bool const unimportant = any_selected && !_runtime_state.usb_in_tcb();
|
|
|
|
gen_named_node(xml, "frame", name, [&] () {
|
|
|
|
if (unimportant)
|
|
xml.attribute("style", "unimportant");
|
|
|
|
xml.node("vbox", [&] () {
|
|
|
|
gen_named_node(xml, "button", name, [&] () {
|
|
|
|
_node_button_item.gen_button_attr(xml, name);
|
|
|
|
if (unimportant)
|
|
xml.attribute("style", "unimportant");
|
|
|
|
if (_usb_selected)
|
|
xml.attribute("selected", "yes");
|
|
|
|
xml.node("label", [&] () { xml.attribute("text", "USB"); });
|
|
});
|
|
|
|
if (_usb_selected)
|
|
gen_named_node(xml, "frame", "usb_operations", [&] () {
|
|
xml.node("vbox", [&] () {
|
|
_storage_dialog->gen_usb_storage_devices(xml); }); });
|
|
});
|
|
});
|
|
}
|
|
|
|
|
|
void Graph::generate(Xml_generator &xml) const
|
|
{
|
|
xml.node("depgraph", [&] () {
|
|
|
|
if (_sculpt_partition.valid()) {
|
|
gen_named_node(xml, "button", "global+", [&] () {
|
|
_add_button_item.gen_button_attr(xml, "global+");
|
|
|
|
if (_popup_state == Popup::VISIBLE)
|
|
xml.attribute("selected", "yes");
|
|
|
|
xml.node("label", [&] () {
|
|
xml.attribute("text", "+"); }); });
|
|
}
|
|
|
|
_gen_storage_node(xml);
|
|
|
|
if (_storage_devices.usb_present)
|
|
_gen_usb_node(xml);
|
|
else
|
|
_gen_parent_node(xml, "usb", "USB");
|
|
|
|
/* parent roles */
|
|
_gen_parent_node(xml, "hardware", "Hardware");
|
|
_gen_parent_node(xml, "config", "Config");
|
|
_gen_parent_node(xml, "info", "Info");
|
|
_gen_parent_node(xml, "GUI", "GUI");
|
|
|
|
typedef Runtime_config::Component Component;
|
|
|
|
bool const any_selected = _runtime_state.selected().valid();
|
|
|
|
_runtime_config.for_each_component([&] (Component const &component) {
|
|
|
|
Start_name const name = component.name;
|
|
Start_name const pretty_name { Pretty(name) };
|
|
|
|
/* omit sculpt's helpers from the graph */
|
|
bool const blacklisted = (name == "runtime_view"
|
|
|| name == "popup_view"
|
|
|| name == "menu_view"
|
|
|| name == "panel_view"
|
|
|| name == "settings_view"
|
|
|| name == "network_view"
|
|
|| name == "file_browser_view"
|
|
|| name == "editor"
|
|
|| name == "launcher_query"
|
|
|| name == "update"
|
|
|| name == "fs_tool"
|
|
|| name == "depot_rw"
|
|
|| name == "public_rw"
|
|
|| name == "depot_rom"
|
|
|| name == "dynamic_depot_rom"
|
|
|| name == "depot_query");
|
|
if (blacklisted)
|
|
return;
|
|
|
|
Runtime_state::Info const info = _runtime_state.info(name);
|
|
|
|
bool const unimportant = any_selected && !info.tcb;
|
|
|
|
gen_named_node(xml, "frame", name, [&] () {
|
|
|
|
if (unimportant)
|
|
xml.attribute("style", "unimportant");
|
|
|
|
Start_name primary_dep = component.primary_dependency;
|
|
|
|
if (primary_dep == "default_fs_rw")
|
|
primary_dep = _sculpt_partition.fs();
|
|
|
|
if (primary_dep.valid()) {
|
|
xml.attribute("dep", primary_dep);
|
|
if (unimportant)
|
|
xml.attribute("dep_visible", false);
|
|
}
|
|
|
|
xml.node("vbox", [&] () {
|
|
|
|
gen_named_node(xml, "button", name, [&] () {
|
|
|
|
if (unimportant)
|
|
xml.attribute("style", "unimportant");
|
|
|
|
_node_button_item.gen_button_attr(xml, name);
|
|
|
|
if (info.selected)
|
|
xml.attribute("selected", "yes");
|
|
|
|
xml.node("label", [&] () {
|
|
xml.attribute("text", pretty_name);
|
|
});
|
|
});
|
|
|
|
if (info.selected)
|
|
_gen_selected_node_content(xml, name, info);
|
|
});
|
|
});
|
|
});
|
|
|
|
_runtime_config.for_each_component([&] (Component const &component) {
|
|
|
|
Start_name const name = component.name;
|
|
|
|
if (name == "ram_fs")
|
|
return;
|
|
|
|
Runtime_state::Info const info = _runtime_state.info(name);
|
|
|
|
bool const show_details = info.tcb;
|
|
|
|
if (show_details) {
|
|
component.for_each_secondary_dep([&] (Start_name dep) {
|
|
|
|
if (Runtime_state::blacklisted_from_graph(dep))
|
|
return;
|
|
|
|
if (dep == "default_fs_rw")
|
|
dep = _sculpt_partition.fs();
|
|
|
|
xml.node("dep", [&] () {
|
|
xml.attribute("node", name);
|
|
xml.attribute("on", dep);
|
|
});
|
|
});
|
|
}
|
|
});
|
|
});
|
|
}
|
|
|
|
|
|
Dialog::Hover_result Graph::hover(Xml_node hover)
|
|
{
|
|
Hover_result const storage_dialog_hover_result =
|
|
_storage_dialog->match_sub_dialog(hover, "depgraph", "frame", "vbox", "frame", "vbox");
|
|
|
|
Dialog::Hover_result const hover_result = Dialog::any_hover_changed(
|
|
storage_dialog_hover_result,
|
|
_ram_fs_dialog.match_sub_dialog(hover, "depgraph", "frame", "vbox", "frame", "vbox"),
|
|
_node_button_item.match(hover, "depgraph", "frame", "vbox", "button", "name"),
|
|
_add_button_item .match(hover, "depgraph", "button", "name"),
|
|
_action_item .match(hover, "depgraph", "frame", "vbox",
|
|
"frame", "hbox", "button", "name"));
|
|
|
|
if (_add_button_item.hovered("global+")) {
|
|
|
|
/* update anchor geometry of popup menu */
|
|
auto hovered_rect = [] (Xml_node const dialog)
|
|
{
|
|
if (!dialog.has_type("dialog")) return Rect();
|
|
|
|
auto point_from_xml = [] (Xml_node node) {
|
|
return Point((int)node.attribute_value("xpos", 0L),
|
|
(int)node.attribute_value("ypos", 0L)); };
|
|
|
|
auto area_from_xml = [] (Xml_node node) {
|
|
return Area(node.attribute_value("width", 0U),
|
|
node.attribute_value("height", 0U)); };
|
|
|
|
if (!dialog.has_sub_node("depgraph")) return Rect();
|
|
Xml_node const depgraph = dialog.sub_node("depgraph");
|
|
|
|
if (!depgraph.has_sub_node("button")) return Rect();
|
|
Xml_node const button = depgraph.sub_node("button");
|
|
|
|
return Rect(point_from_xml(dialog) + point_from_xml(depgraph) +
|
|
point_from_xml(button),
|
|
area_from_xml(button));
|
|
};
|
|
|
|
_popup_anchor = hovered_rect(hover);
|
|
}
|
|
|
|
return hover_result;
|
|
}
|
|
|
|
|
|
void Graph::click(Action &action)
|
|
{
|
|
if (_ram_fs_dialog.click(action) == Click_result::CONSUMED)
|
|
return;
|
|
|
|
if (_storage_dialog_visible())
|
|
if (_storage_dialog->click(action) == Click_result::CONSUMED)
|
|
return;
|
|
|
|
if (_add_button_item._hovered.valid())
|
|
action.toggle_launcher_selector(_popup_anchor);
|
|
|
|
if (_node_button_item._hovered.valid()) {
|
|
|
|
_storage_selected = !_storage_selected && _node_button_item.hovered("storage");
|
|
_usb_selected = !_usb_selected && _node_button_item.hovered("usb");
|
|
|
|
/* reset storage dialog */
|
|
if (_usb_selected || _storage_selected)
|
|
_storage_dialog.construct(_storage_devices, _sculpt_partition);
|
|
|
|
_runtime_state.toggle_selection(_node_button_item._hovered,
|
|
_runtime_config);
|
|
_action_item.reset();
|
|
}
|
|
|
|
if (_action_item.hovered("remove") || _action_item.hovered("restart"))
|
|
_action_item.propose_activation_on_click();
|
|
}
|
|
|
|
|
|
void Graph::clack(Action &action, Ram_fs_dialog::Action &ram_fs_action)
|
|
{
|
|
if (_ram_fs_dialog.clack(ram_fs_action) == Clack_result::CONSUMED)
|
|
return;
|
|
|
|
if (_storage_dialog_visible())
|
|
if (_storage_dialog->clack(action) == Clack_result::CONSUMED)
|
|
return;
|
|
|
|
if (_action_item.hovered("remove")) {
|
|
|
|
_action_item.confirm_activation_on_clack();
|
|
|
|
if (_action_item.activated("remove")) {
|
|
action.remove_deployed_component(_runtime_state.selected());
|
|
|
|
/*
|
|
* Unselect the removed component to bring graph into
|
|
* default state.
|
|
*/
|
|
_runtime_state.toggle_selection(_runtime_state.selected(),
|
|
_runtime_config);
|
|
}
|
|
}
|
|
|
|
if (_action_item.hovered("restart")) {
|
|
|
|
_action_item.confirm_activation_on_clack();
|
|
|
|
if (_action_item.activated("restart"))
|
|
action.restart_deployed_component(_runtime_state.selected());
|
|
}
|
|
|
|
_action_item.reset();
|
|
}
|
|
|