mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-18 17:00:26 +00:00
parent
f3313b6603
commit
6e437674f7
2
repos/gems/recipes/pkg/dbg_download/README
Normal file
2
repos/gems/recipes/pkg/dbg_download/README
Normal file
@ -0,0 +1,2 @@
|
||||
|
||||
Subsystem for downloading debug info depot content
|
3
repos/gems/recipes/pkg/dbg_download/archives
Normal file
3
repos/gems/recipes/pkg/dbg_download/archives
Normal file
@ -0,0 +1,3 @@
|
||||
_/pkg/depot_download
|
||||
_/src/dbg_download
|
||||
_/src/vfs_lxip
|
1
repos/gems/recipes/pkg/dbg_download/hash
Normal file
1
repos/gems/recipes/pkg/dbg_download/hash
Normal file
@ -0,0 +1 @@
|
||||
2023-12-03 6d3ae110891ef272496abf7dfa9217ff2566cf64
|
145
repos/gems/recipes/pkg/dbg_download/runtime
Normal file
145
repos/gems/recipes/pkg/dbg_download/runtime
Normal file
@ -0,0 +1,145 @@
|
||||
<runtime ram="128M" caps="3000" binary="init" config="depot_download.config">
|
||||
|
||||
<requires>
|
||||
<file_system label="system_config" writeable="no"/>
|
||||
<file_system label="used" writeable="yes"/>
|
||||
<rom label="build_info"/>
|
||||
<nic/>
|
||||
<rm/>
|
||||
<timer/>
|
||||
</requires>
|
||||
|
||||
<content>
|
||||
<rom label="init"/>
|
||||
<rom label="depot_download.config"/>
|
||||
<rom label="report_rom"/>
|
||||
<rom label="chroot"/>
|
||||
<rom label="depot_download_manager"/>
|
||||
<rom label="vfs"/>
|
||||
<rom label="vfs.lib.so"/>
|
||||
<rom label="vfs_lxip.lib.so"/>
|
||||
<rom label="lxip.lib.so"/>
|
||||
<rom label="depot_query"/>
|
||||
<rom label="fs_rom"/>
|
||||
<rom label="fetchurl"/>
|
||||
<rom label="curl.lib.so"/>
|
||||
<rom label="libc.lib.so"/>
|
||||
<rom label="libssh.lib.so"/>
|
||||
<rom label="libcrypto.lib.so"/>
|
||||
<rom label="zlib.lib.so"/>
|
||||
<rom label="libssl.lib.so"/>
|
||||
<rom label="verify"/>
|
||||
<rom label="extract"/>
|
||||
<rom label="libarchive.lib.so"/>
|
||||
<rom label="liblzma.lib.so"/>
|
||||
<rom label="dbg_download"/>
|
||||
</content>
|
||||
|
||||
<config>
|
||||
|
||||
<parent-provides>
|
||||
<service name="CPU"/>
|
||||
<service name="LOG"/>
|
||||
<service name="PD"/>
|
||||
<service name="RM"/>
|
||||
<service name="ROM"/>
|
||||
<service name="File_system"/>
|
||||
<service name="Timer"/>
|
||||
<service name="Report"/>
|
||||
<service name="Nic"/>
|
||||
</parent-provides>
|
||||
|
||||
<default caps="100"/>
|
||||
|
||||
<start name="depot_rw">
|
||||
<binary name="chroot"/>
|
||||
<resource name="RAM" quantum="2M" />
|
||||
<provides> <service name="File_system"/> </provides>
|
||||
<config>
|
||||
<default-policy path="/depot" writeable="yes"/>
|
||||
</config>
|
||||
<route>
|
||||
<service name="File_system">
|
||||
<parent label="used"/>
|
||||
</service>
|
||||
<any-service> <parent/> </any-service>
|
||||
</route>
|
||||
</start>
|
||||
|
||||
<start name="public_rw">
|
||||
<binary name="chroot"/>
|
||||
<resource name="RAM" quantum="2M" />
|
||||
<provides> <service name="File_system"/> </provides>
|
||||
<config>
|
||||
<default-policy path="/public" writeable="yes"/>
|
||||
</config>
|
||||
<route>
|
||||
<service name="File_system">
|
||||
<parent label="used"/>
|
||||
</service>
|
||||
<any-service> <parent/> </any-service>
|
||||
</route>
|
||||
</start>
|
||||
|
||||
<start name="report_rom">
|
||||
<binary name="report_rom"/>
|
||||
<resource name="RAM" quantum="2M"/>
|
||||
<provides> <service name="Report"/> <service name="ROM"/> </provides>
|
||||
<config verbose="no">
|
||||
<policy label="depot_download -> installation"
|
||||
report="dbg_download -> installation"/>
|
||||
</config>
|
||||
<route>
|
||||
<any-service> <parent/> </any-service>
|
||||
</route>
|
||||
</start>
|
||||
|
||||
<start name="depot_download" caps="2000">
|
||||
<binary name="init"/>
|
||||
<resource name="RAM" quantum="70M"/>
|
||||
<route>
|
||||
<service name="ROM" label="config">
|
||||
<parent label="depot_download.config"/>
|
||||
</service>
|
||||
<service name="ROM" label_suffix="installation">
|
||||
<child name="report_rom" label="depot_download -> installation"/>
|
||||
</service>
|
||||
<service name="File_system" label="depot">
|
||||
<child name="depot_rw"/>
|
||||
</service>
|
||||
<service name="File_system" label="public">
|
||||
<child name="public_rw"/>
|
||||
</service>
|
||||
<service name="Report">
|
||||
<child name="report_rom"/>
|
||||
</service>
|
||||
<any-service> <parent/> </any-service>
|
||||
</route>
|
||||
</start>
|
||||
|
||||
<start name="dbg_download">
|
||||
<resource name="RAM" quantum="16M"/>
|
||||
<config>
|
||||
<vfs>
|
||||
<dir name="config">
|
||||
<fs label="config"/>
|
||||
</dir>
|
||||
</vfs>
|
||||
</config>
|
||||
<route>
|
||||
<service name="File_system" label="config">
|
||||
<parent label="system_config"/>
|
||||
</service>
|
||||
<service name="Report">
|
||||
<child name="report_rom"/>
|
||||
</service>
|
||||
<service name="ROM" label="build_info">
|
||||
<parent label="build_info"/>
|
||||
</service>
|
||||
<any-service> <parent/> </any-service>
|
||||
</route>
|
||||
</start>
|
||||
|
||||
</config>
|
||||
|
||||
</runtime>
|
@ -23,3 +23,4 @@ _/pkg/trace_logger
|
||||
_/pkg/mixer
|
||||
_/pkg/dynamic_rom
|
||||
_/pkg/unconfigured_nano3d
|
||||
_/pkg/dbg_download
|
||||
|
2
repos/gems/recipes/src/dbg_download/content.mk
Normal file
2
repos/gems/recipes/src/dbg_download/content.mk
Normal file
@ -0,0 +1,2 @@
|
||||
SRC_DIR = src/app/dbg_download
|
||||
include $(GENODE_DIR)/repos/base/recipes/src/content.inc
|
1
repos/gems/recipes/src/dbg_download/hash
Normal file
1
repos/gems/recipes/src/dbg_download/hash
Normal file
@ -0,0 +1 @@
|
||||
2023-12-05-i 1d3df6ce30d962877acce17d07b09173373116d4
|
4
repos/gems/recipes/src/dbg_download/used_apis
Normal file
4
repos/gems/recipes/src/dbg_download/used_apis
Normal file
@ -0,0 +1,4 @@
|
||||
base
|
||||
os
|
||||
report_session
|
||||
vfs
|
@ -7,7 +7,7 @@ gpu_drv: intel
|
||||
import: pkg/drivers_managed-pc pkg/pc_wifi src/pc_nic_drv
|
||||
|
||||
# selection of launcher-menu entries
|
||||
launcher: vm_fs shared_fs usb_devices_rom
|
||||
launcher: vm_fs shared_fs usb_devices_rom download_debug_info
|
||||
|
||||
# selection of accepted depot-package providers
|
||||
depot: genodelabs cnuke alex-ab mstein nfeske cproc chelmuth jschlatow
|
||||
|
19
repos/gems/sculpt/launcher/download_debug_info
Normal file
19
repos/gems/sculpt/launcher/download_debug_info
Normal file
@ -0,0 +1,19 @@
|
||||
<launcher pkg="dbg_download">
|
||||
<route>
|
||||
<service name="File_system" label="system_config">
|
||||
<parent label="config"/>
|
||||
</service>
|
||||
<service name="File_system" label="used">
|
||||
<child name="default_fs_rw"/>
|
||||
</service>
|
||||
<service name="ROM" label="build_info">
|
||||
<parent label="build_info"/>
|
||||
</service>
|
||||
<service name="Nic">
|
||||
<child name="nic_router"/>
|
||||
</service>
|
||||
<service name="RM">
|
||||
<parent/>
|
||||
</service>
|
||||
</route>
|
||||
</launcher>
|
175
repos/gems/src/app/dbg_download/main.cc
Normal file
175
repos/gems/src/app/dbg_download/main.cc
Normal file
@ -0,0 +1,175 @@
|
||||
/*
|
||||
* \brief Component which initiates the download of missing 'bin' and 'dbg'
|
||||
* depot archives based on the current runtime/monitor configuration
|
||||
* \author Christian Prochaska
|
||||
* \date 2023-12-04
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2023-2024 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.
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/attached_rom_dataspace.h>
|
||||
#include <base/component.h>
|
||||
#include <base/heap.h>
|
||||
#include <base/log.h>
|
||||
#include <os/reporter.h>
|
||||
#include <os/vfs.h>
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
struct Main
|
||||
{
|
||||
Genode::Env &_env;
|
||||
Heap _heap { _env.ram(), _env.rm() };
|
||||
|
||||
Attached_rom_dataspace _config { _env, "config" };
|
||||
Attached_rom_dataspace _build_info { _env, "build_info" };
|
||||
|
||||
Session_label _base_archive { };
|
||||
|
||||
Root_directory _root_dir { _env, _heap, _config.xml().sub_node("vfs") };
|
||||
|
||||
static constexpr char const *_runtime_config_path { "/config/managed/runtime" };
|
||||
|
||||
Watch_handler<Main> _runtime_config_watch_handler {
|
||||
_env.ep(), _root_dir, _runtime_config_path,
|
||||
*this, &Main::_handle_runtime_config_update };
|
||||
|
||||
Expanding_reporter _installation { _env, "installation", "installation" };
|
||||
|
||||
|
||||
void _process_monitor_config(Xml_node const &config, Xml_node const &monitor)
|
||||
{
|
||||
_installation.generate([&] (Xml_generator &xml) {
|
||||
|
||||
monitor.for_each_sub_node("policy", [&] (Xml_node const &policy) {
|
||||
|
||||
Session_label policy_label {
|
||||
policy.attribute_value("label", Session_label::String()) };
|
||||
|
||||
config.for_each_sub_node("start", [&] (Xml_node const &start) {
|
||||
|
||||
if (start.attribute_value("name", Session_label::String()) !=
|
||||
policy_label)
|
||||
return;
|
||||
|
||||
start.with_sub_node("route", [&] (Xml_node const &route) {
|
||||
|
||||
route.for_each_sub_node("service", [&] (Xml_node const &service) {
|
||||
|
||||
if (service.attribute_value("name", String<8>()) != "ROM")
|
||||
return;
|
||||
|
||||
if (!service.has_attribute("label_last"))
|
||||
return;
|
||||
|
||||
Session_label rom_session_label;
|
||||
|
||||
if (service.attribute_value("label_last", Session_label::String()) ==
|
||||
"ld.lib.so") {
|
||||
|
||||
rom_session_label = { _base_archive, "/ld.lib.so" };
|
||||
|
||||
} else {
|
||||
|
||||
service.with_sub_node("child", [&] (Xml_node const &child) {
|
||||
|
||||
if (child.attribute_value("name", String<16>()) !=
|
||||
"depot_rom")
|
||||
return;
|
||||
|
||||
rom_session_label =
|
||||
child.attribute_value("label", Session_label::String());
|
||||
|
||||
}, [&] () {
|
||||
Genode::warning("<child> XML node not found");
|
||||
return;
|
||||
});
|
||||
}
|
||||
|
||||
Vfs::Absolute_path rom_session_label_path { rom_session_label };
|
||||
|
||||
Vfs::Absolute_path depot_user_path { rom_session_label_path };
|
||||
while (!depot_user_path.has_single_element())
|
||||
depot_user_path.strip_last_element();
|
||||
|
||||
Vfs::Absolute_path depot_type_path { rom_session_label_path };
|
||||
depot_type_path.strip_prefix(depot_user_path.string());
|
||||
while (!depot_type_path.has_single_element())
|
||||
depot_type_path.strip_last_element();
|
||||
if (depot_type_path != "/bin")
|
||||
return;
|
||||
|
||||
Vfs::Absolute_path depot_component_path { rom_session_label_path };
|
||||
depot_component_path.strip_prefix(
|
||||
Directory::join(depot_user_path, depot_type_path).string());
|
||||
|
||||
Vfs::Absolute_path bin_installation_path { depot_user_path };
|
||||
bin_installation_path.append("/bin");
|
||||
bin_installation_path.append(depot_component_path.string());
|
||||
bin_installation_path.strip_last_element();
|
||||
|
||||
xml.node("archive", [&] () {
|
||||
xml.attribute("path", &bin_installation_path.string()[1]);
|
||||
xml.attribute("source", "no");
|
||||
});
|
||||
|
||||
Vfs::Absolute_path dbg_installation_path { depot_user_path };
|
||||
dbg_installation_path.append("/dbg");
|
||||
dbg_installation_path.append(depot_component_path.string());
|
||||
dbg_installation_path.strip_last_element();
|
||||
|
||||
xml.node("archive", [&] () {
|
||||
xml.attribute("path", &dbg_installation_path.string()[1]);
|
||||
xml.attribute("source", "no");
|
||||
});
|
||||
});
|
||||
}, [&] () {
|
||||
Genode::error("<route> XML node not found");
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
void _handle_runtime_config_update()
|
||||
{
|
||||
try {
|
||||
File_content const runtime_config {
|
||||
_heap, _root_dir, _runtime_config_path,
|
||||
File_content::Limit(512*1024)
|
||||
};
|
||||
|
||||
runtime_config.xml([&] (Xml_node const config) {
|
||||
config.with_sub_node("monitor", [&] (Xml_node const &monitor) {
|
||||
_process_monitor_config(config, monitor);
|
||||
}, [&] () {
|
||||
Genode::error("<monitor> XML node not found");
|
||||
});
|
||||
});
|
||||
} catch (File_content::Truncated_during_read) {
|
||||
Genode::error("Could not read ", _runtime_config_path);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Main(Genode::Env &env)
|
||||
: _env(env)
|
||||
{
|
||||
_base_archive = _build_info.xml().attribute_value("base",
|
||||
Session_label::String());
|
||||
_handle_runtime_config_update();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
void Component::construct(Genode::Env &env)
|
||||
{
|
||||
static Main main(env);
|
||||
}
|
3
repos/gems/src/app/dbg_download/target.mk
Normal file
3
repos/gems/src/app/dbg_download/target.mk
Normal file
@ -0,0 +1,3 @@
|
||||
TARGET = dbg_download
|
||||
SRC_CC = main.cc
|
||||
LIBS = base vfs
|
Loading…
x
Reference in New Issue
Block a user