From b723b11b30bee0ef80ddc24523b2696489971839 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Thu, 6 Jan 2022 17:44:51 +0100 Subject: [PATCH] Modularize Sculpt OS image creation 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 -.sculpt files, each containing a list of ingredients to be incorporated into the Sculpt system image. The 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: 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: 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- 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 --- .../recipes/pkg/drivers_managed-pc/archives | 2 + .../recipes/pkg/sculpt-installation/README | 1 - repos/gems/recipes/pkg/sculpt-linux/README | 1 - repos/gems/recipes/pkg/sculpt-linux/archives | 2 - repos/gems/recipes/pkg/sculpt-linux/hash | 1 - repos/gems/recipes/pkg/sculpt-pc/README | 1 - repos/gems/recipes/pkg/sculpt-pc/archives | 7 - repos/gems/recipes/pkg/sculpt-pc/hash | 1 - .../recipes/pkg/sculpt_distribution-pc/README | 1 + .../pkg/sculpt_distribution-pc/archives | 12 + .../hash | 0 .../recipes/pkg/sculpt_distribution/README | 1 + .../archives | 10 - .../gems/recipes/pkg/sculpt_distribution/hash | 1 + .../recipes/raw/drivers_managed-pc/content.mk | 14 +- repos/gems/run/sculpt.run | 629 +++++++++++------- repos/gems/run/sculpt/machine.vbox | 61 -- repos/gems/run/sculpt/machine.vdi.gz | Bin 2236 -> 0 bytes .../clipboard/default} | 0 repos/gems/sculpt/default-linux.sculpt | 10 + repos/gems/sculpt/default-pc.sculpt | 14 + repos/gems/sculpt/deploy/default | 11 + repos/gems/sculpt/deploy/example | 62 ++ repos/gems/sculpt/drivers/linux | 48 ++ .../drivers.config => sculpt/drivers/pc} | 0 repos/gems/sculpt/event_filter/default | 15 + .../event_filter/pc} | 0 .../fb_drv.config => sculpt/fb_drv/default} | 0 .../fonts.config => sculpt/fonts/default} | 0 repos/gems/sculpt/global_keys/default | 16 + .../sculpt/gpu_drv/intel} | 0 repos/gems/sculpt/launcher/nano3d | 6 + .../gems/{run => }/sculpt/launcher/shared_fs | 0 .../gems/sculpt/launcher/sticks_blue_backdrop | 6 + repos/gems/sculpt/launcher/system_shell | 15 + .../{run => }/sculpt/launcher/usb_devices_rom | 0 repos/gems/{run => }/sculpt/launcher/vm_fs | 0 .../leitzentrale/default} | 0 .../nitpicker/default} | 0 .../numlock_remap/default} | 0 repos/gems/sculpt/ram_fs/default | 6 + repos/gems/sculpt/ram_fs/depot | 9 + .../runtime/default} | 0 repos/gems/sculpt/system/default | 1 + repos/gems/sculpt/system/pc | 3 + .../sculpt/usb.config => sculpt/usb/default} | 0 .../wifi.config => sculpt/wifi/default} | 0 repos/gems/src/app/sculpt_manager/graph.cc | 3 + .../sculpt_manager/runtime/inspect_view.cc | 4 - .../src/app/sculpt_manager/runtime/prepare.cc | 3 +- .../src/app/sculpt_manager/runtime/ram_fs.cc | 10 +- 51 files changed, 638 insertions(+), 349 deletions(-) delete mode 100644 repos/gems/recipes/pkg/sculpt-installation/README delete mode 100644 repos/gems/recipes/pkg/sculpt-linux/README delete mode 100644 repos/gems/recipes/pkg/sculpt-linux/archives delete mode 100644 repos/gems/recipes/pkg/sculpt-linux/hash delete mode 100644 repos/gems/recipes/pkg/sculpt-pc/README delete mode 100644 repos/gems/recipes/pkg/sculpt-pc/archives delete mode 100644 repos/gems/recipes/pkg/sculpt-pc/hash create mode 100644 repos/gems/recipes/pkg/sculpt_distribution-pc/README create mode 100644 repos/gems/recipes/pkg/sculpt_distribution-pc/archives rename repos/gems/recipes/pkg/{sculpt-installation => sculpt_distribution-pc}/hash (100%) create mode 100644 repos/gems/recipes/pkg/sculpt_distribution/README rename repos/gems/recipes/pkg/{sculpt-installation => sculpt_distribution}/archives (69%) create mode 100644 repos/gems/recipes/pkg/sculpt_distribution/hash delete mode 100644 repos/gems/run/sculpt/machine.vbox delete mode 100644 repos/gems/run/sculpt/machine.vdi.gz rename repos/gems/{run/sculpt/clipboard.config => sculpt/clipboard/default} (100%) create mode 100644 repos/gems/sculpt/default-linux.sculpt create mode 100644 repos/gems/sculpt/default-pc.sculpt create mode 100644 repos/gems/sculpt/deploy/default create mode 100644 repos/gems/sculpt/deploy/example create mode 100644 repos/gems/sculpt/drivers/linux rename repos/gems/{recipes/raw/drivers_managed-pc/drivers.config => sculpt/drivers/pc} (100%) create mode 100644 repos/gems/sculpt/event_filter/default rename repos/gems/{recipes/raw/drivers_managed-pc/event_filter.config => sculpt/event_filter/pc} (100%) rename repos/gems/{run/sculpt/fb_drv.config => sculpt/fb_drv/default} (100%) rename repos/gems/{run/sculpt/fonts.config => sculpt/fonts/default} (100%) create mode 100644 repos/gems/sculpt/global_keys/default rename repos/{os/src/drivers/gpu/intel/gpu_drv.config => gems/sculpt/gpu_drv/intel} (100%) create mode 100644 repos/gems/sculpt/launcher/nano3d rename repos/gems/{run => }/sculpt/launcher/shared_fs (100%) create mode 100644 repos/gems/sculpt/launcher/sticks_blue_backdrop create mode 100644 repos/gems/sculpt/launcher/system_shell rename repos/gems/{run => }/sculpt/launcher/usb_devices_rom (100%) rename repos/gems/{run => }/sculpt/launcher/vm_fs (100%) rename repos/gems/{run/sculpt/leitzentrale.config => sculpt/leitzentrale/default} (100%) rename repos/gems/{run/sculpt/nitpicker.config => sculpt/nitpicker/default} (100%) rename repos/gems/{recipes/raw/drivers_managed-pc/numlock_remap.config => sculpt/numlock_remap/default} (100%) create mode 100644 repos/gems/sculpt/ram_fs/default create mode 100644 repos/gems/sculpt/ram_fs/depot rename repos/gems/{run/sculpt/empty_runtime.config => sculpt/runtime/default} (100%) create mode 100644 repos/gems/sculpt/system/default create mode 100644 repos/gems/sculpt/system/pc rename repos/gems/{run/sculpt/usb.config => sculpt/usb/default} (100%) rename repos/gems/{run/sculpt/wifi.config => sculpt/wifi/default} (100%) diff --git a/repos/gems/recipes/pkg/drivers_managed-pc/archives b/repos/gems/recipes/pkg/drivers_managed-pc/archives index 731eb056df..f0a93b0bb5 100644 --- a/repos/gems/recipes/pkg/drivers_managed-pc/archives +++ b/repos/gems/recipes/pkg/drivers_managed-pc/archives @@ -6,8 +6,10 @@ _/src/usb_hid_drv _/src/usb_block_drv _/src/vesa_drv _/src/intel_fb_drv +_/src/intel_gpu_drv _/src/boot_fb_drv _/src/ahci_drv +_/src/nvme_drv _/src/report_rom _/src/event_filter _/src/init diff --git a/repos/gems/recipes/pkg/sculpt-installation/README b/repos/gems/recipes/pkg/sculpt-installation/README deleted file mode 100644 index 2a93f86324..0000000000 --- a/repos/gems/recipes/pkg/sculpt-installation/README +++ /dev/null @@ -1 +0,0 @@ -Default installation for a sculpt-based desktop diff --git a/repos/gems/recipes/pkg/sculpt-linux/README b/repos/gems/recipes/pkg/sculpt-linux/README deleted file mode 100644 index c24630ce2c..0000000000 --- a/repos/gems/recipes/pkg/sculpt-linux/README +++ /dev/null @@ -1 +0,0 @@ -Minimal version of Sculpt executable on Linux diff --git a/repos/gems/recipes/pkg/sculpt-linux/archives b/repos/gems/recipes/pkg/sculpt-linux/archives deleted file mode 100644 index e4847ce2a7..0000000000 --- a/repos/gems/recipes/pkg/sculpt-linux/archives +++ /dev/null @@ -1,2 +0,0 @@ -_/pkg/drivers_interactive-linux -_/pkg/sculpt diff --git a/repos/gems/recipes/pkg/sculpt-linux/hash b/repos/gems/recipes/pkg/sculpt-linux/hash deleted file mode 100644 index e23c8794d2..0000000000 --- a/repos/gems/recipes/pkg/sculpt-linux/hash +++ /dev/null @@ -1 +0,0 @@ -2022-01-03-a c6a760c01679c9213f0ae83b4075a5c73c3f09a9 diff --git a/repos/gems/recipes/pkg/sculpt-pc/README b/repos/gems/recipes/pkg/sculpt-pc/README deleted file mode 100644 index f3e32bc16d..0000000000 --- a/repos/gems/recipes/pkg/sculpt-pc/README +++ /dev/null @@ -1 +0,0 @@ -The x86-PC specific parts needed to run sculpt. diff --git a/repos/gems/recipes/pkg/sculpt-pc/archives b/repos/gems/recipes/pkg/sculpt-pc/archives deleted file mode 100644 index 08e9cfd0a3..0000000000 --- a/repos/gems/recipes/pkg/sculpt-pc/archives +++ /dev/null @@ -1,7 +0,0 @@ -_/pkg/drivers_managed-pc -_/pkg/sculpt -_/pkg/wifi -_/src/ipxe_nic_drv -_/src/nvme_drv -_/src/intel_gpu_drv - diff --git a/repos/gems/recipes/pkg/sculpt-pc/hash b/repos/gems/recipes/pkg/sculpt-pc/hash deleted file mode 100644 index 148dfc66f3..0000000000 --- a/repos/gems/recipes/pkg/sculpt-pc/hash +++ /dev/null @@ -1 +0,0 @@ -2021-12-16 f45375a47663d677e8f13447a1dc38e61ebc1450 diff --git a/repos/gems/recipes/pkg/sculpt_distribution-pc/README b/repos/gems/recipes/pkg/sculpt_distribution-pc/README new file mode 100644 index 0000000000..7f67f5a454 --- /dev/null +++ b/repos/gems/recipes/pkg/sculpt_distribution-pc/README @@ -0,0 +1 @@ +Default Sculpt distribution for PC platforms diff --git a/repos/gems/recipes/pkg/sculpt_distribution-pc/archives b/repos/gems/recipes/pkg/sculpt_distribution-pc/archives new file mode 100644 index 0000000000..9ae1b6f1d8 --- /dev/null +++ b/repos/gems/recipes/pkg/sculpt_distribution-pc/archives @@ -0,0 +1,12 @@ +_/pkg/sculpt +_/pkg/drivers_managed-pc +_/pkg/wifi +_/pkg/ipxe_nic_drv +_/pkg/vbox6 +_/pkg/vbox6-capture +_/pkg/vbox5-nova-sculpt +_/pkg/acpica +_/pkg/system_clock-pc +_/pkg/mesa_gpu-intel +_/pkg/file_vault +_/pkg/bsd_audio_drv diff --git a/repos/gems/recipes/pkg/sculpt-installation/hash b/repos/gems/recipes/pkg/sculpt_distribution-pc/hash similarity index 100% rename from repos/gems/recipes/pkg/sculpt-installation/hash rename to repos/gems/recipes/pkg/sculpt_distribution-pc/hash diff --git a/repos/gems/recipes/pkg/sculpt_distribution/README b/repos/gems/recipes/pkg/sculpt_distribution/README new file mode 100644 index 0000000000..d6cb89110a --- /dev/null +++ b/repos/gems/recipes/pkg/sculpt_distribution/README @@ -0,0 +1 @@ +Hardware-agnostic parts of the default Sculpt OS distribution diff --git a/repos/gems/recipes/pkg/sculpt-installation/archives b/repos/gems/recipes/pkg/sculpt_distribution/archives similarity index 69% rename from repos/gems/recipes/pkg/sculpt-installation/archives rename to repos/gems/recipes/pkg/sculpt_distribution/archives index 419e019776..c70d752092 100644 --- a/repos/gems/recipes/pkg/sculpt-installation/archives +++ b/repos/gems/recipes/pkg/sculpt_distribution/archives @@ -1,6 +1,4 @@ _/pkg/system_shell -_/pkg/wifi -_/pkg/ipxe_nic_drv _/pkg/chroot _/pkg/recall_fs _/pkg/black_hole @@ -8,9 +6,6 @@ _/pkg/nit_focus _/pkg/rom_filter _/pkg/rom_reporter _/pkg/nic_router-nat -_/pkg/vbox6 -_/pkg/vbox6-capture -_/pkg/vbox5-nova-sculpt _/pkg/wm _/pkg/themed_wm _/pkg/themed_decorator @@ -21,13 +16,8 @@ _/pkg/nano3d _/pkg/mesa_gears _/pkg/fonts_fs _/pkg/report_dump -_/pkg/acpica _/pkg/qt5_textedit -_/pkg/system_clock-pc _/pkg/mesa_gpu-cpu -_/pkg/mesa_gpu-intel _/pkg/usb_webcam -_/pkg/file_vault _/pkg/test-capture -_/pkg/bsd_audio_drv _/pkg/mixer diff --git a/repos/gems/recipes/pkg/sculpt_distribution/hash b/repos/gems/recipes/pkg/sculpt_distribution/hash new file mode 100644 index 0000000000..469e60201d --- /dev/null +++ b/repos/gems/recipes/pkg/sculpt_distribution/hash @@ -0,0 +1 @@ +2021-12-16 3d12db23d24f0c953ac013ec9adb9ec60ce3da13 diff --git a/repos/gems/recipes/raw/drivers_managed-pc/content.mk b/repos/gems/recipes/raw/drivers_managed-pc/content.mk index 864b024deb..50da72e44b 100644 --- a/repos/gems/recipes/raw/drivers_managed-pc/content.mk +++ b/repos/gems/recipes/raw/drivers_managed-pc/content.mk @@ -1,14 +1,20 @@ content: drivers.config fb_drv.config event_filter.config en_us.chargen \ special.chargen numlock_remap.config gpu_drv.config -drivers.config numlock_remap.config event_filter.config: - cp $(REP_DIR)/recipes/raw/drivers_managed-pc/$@ $@ +drivers.config: + cp $(REP_DIR)/sculpt/drivers/pc $@ + +numlock_remap.config: + cp $(REP_DIR)/sculpt/numlock_remap/default $@ + +event_filter.config: + cp $(REP_DIR)/sculpt/event_filter/pc $@ fb_drv.config: - cp $(GENODE_DIR)/repos/os/recipes/raw/drivers_interactive-pc/$@ $@ + cp $(REP_DIR)/sculpt/fb_drv/default $@ gpu_drv.config: - cp $(GENODE_DIR)/repos/os/src/drivers/gpu/intel/$@ $@ + cp $(REP_DIR)/sculpt/gpu_drv/intel $@ en_us.chargen special.chargen: cp $(GENODE_DIR)/repos/os/src/server/event_filter/$@ $@ diff --git a/repos/gems/run/sculpt.run b/repos/gems/run/sculpt.run index 3a517fa22a..509789950d 100644 --- a/repos/gems/run/sculpt.run +++ b/repos/gems/run/sculpt.run @@ -1,9 +1,22 @@ +# +# \brief Sculpt OS +# \author Norman Feske +# \date 2017-09-07 +# + +# +# Note: the string must be exactly 5 bytes long. +# +proc sculpt_version { } { return "21.11" } + + proc assert_platform_supported { } { if {[have_board pc]} return if {[have_board imx8q_evk]} return if {[have_board mnt_reform2]} return if {[have_board linux]} return + if {[have_board pinephone]} return puts "Platform is unsupported."; exit 0; @@ -11,14 +24,130 @@ proc assert_platform_supported { } { assert_platform_supported + if {[have_spec nova]} { proc kernel_output { } { return "novga serial logmem" } } + +## +## Utilities for querying the ingredients of Sculpt +## + +## +# Return path to the sculpt definition file that contains the list of +# ingredients +# +proc sculpt_path { } { + + global ::env + + set filename "default-[board].sculpt" + if {[info exists ::env(SCULPT)]} { + set filename "$::env(SCULPT)-[board].sculpt" } + + return [select_from_repositories [file join sculpt $filename]] +} + + +## +# Return list of ingredients of scenario supplied via the 'SCULPT' argument +# +# If 'SCULPT' is not specified, use 'sculpt/default.sculpt'. +# +proc sculpt_ingredients { } { + + global _sculpt_ingredients + + if {![info exists _sculpt_ingredients]} { + set fh [open [sculpt_path] "RDONLY"] + set _sculpt_ingredients [split [read $fh] "\n"] + close $fh + } + + return $_sculpt_ingredients +} + + +proc ingredients_of_type { type } { + + set result {} + set line 1 + foreach i [sculpt_ingredients] { + + # skip comment lines + if {[string match "#*" $i]} { + continue } + + # skip empty lines + if {[string match "" $i]} { + continue } + + regexp {^(.*?):\s*(.*)\s*$} $i dummy tag values + + if {$tag == $type} { + lappend result {*}$values} + + incr line + } + return $result +} + + +proc single_ingredient { type default } { + + set ingredient [ingredients_of_type $type] + + if {[llength $ingredient] == 0} { + return $default } + + if {[llength $ingredient] > 1} { + puts stderr "Error: ambigious selection of '$type' in [sculpt_path]" + exit + } + return $ingredient +} + + +proc ingredient_path { type ingredient } { + return [select_from_repositories [file join sculpt $type $ingredient]] } + +proc initial_config_dir { } { + return [file join [run_dir] initial_config] } + +proc initial_config_file { rel_path } { + return [file join [initial_config_dir] $rel_path] } + + +## +## System-image content imported from depot archives +## + create_boot_directory + +proc prefixed_with_depot_user { paths } { + return [lmap path $paths { file join [depot_user] $path }] } + + import_from_depot [depot_user]/src/[base_src] \ - [depot_user]/pkg/sculpt-[board] + [depot_user]/pkg/sculpt \ + {*}[prefixed_with_depot_user [ingredients_of_type import]] + + +## +## Static init configuration +## + +proc log_route { } { + + global ::env + if {[info exists ::env(LOG)]} { + if {$::env(LOG) == "core"} { + return { } } } + + return { } +} proc nic_drv { } { @@ -26,10 +155,8 @@ proc nic_drv { } { if {[have_board pc]} { return ipxe_nic_drv } if {[have_board imx8q_evk]} { return fec_nic_drv } if {[have_board mnt_reform2]} { return fec_nic_drv } - if {[have_board linux]} { return nic_unavailable } - puts "\n Run script is not supported on this platform. \n"; - exit 0; + return nic_unavailable } @@ -70,43 +197,6 @@ proc log_kernel_start_node { } { } -proc config_fs_gpu_drv { } { - - if {[have_board linux]} return - - return {} -} - - -proc config_fs_system { } { - - return { - - -} -} - - -proc config_fs_numlock_remap { } { - - # the drivers_interactive pkg does not host a numlock_remap_rom component - if {[have_board linux]} return - - return {} -} - - -proc config_fs_event_filter { } { - - # - # Prevent the sculpt manager from generating the event-filter configuration. - # Use the configuration provided by drivers_interactive pkg instead. - # - if {[have_board linux]} { - return {} } -} - - install_config { @@ -178,37 +268,7 @@ install_config { - - - - - - - - - - - - - - - - - - - - - - - - - - - - } [config_fs_gpu_drv] { - } [config_fs_system] { - } [config_fs_numlock_remap] { - + @@ -307,7 +367,7 @@ install_config { - + } [log_route] { @@ -421,26 +481,12 @@ install_config { - - - - - - - - - - - - - - - - - - - + + + + + @@ -483,7 +529,7 @@ install_config { - + } [log_route] { @@ -559,7 +605,7 @@ install_config { - + } [log_route] { @@ -571,47 +617,247 @@ install_config { } -foreach file [glob "[genode_dir]/repos/gems/run/sculpt/*.config"] { - copy_file $file [run_dir]/genode/ } + +## +## Initial content of the config file system +## # -# Override files normally obtained from depot archive with the most current -# version found in the Genode source tree. This way, we don't need to -# rebuild the corresponding depot archives each time we tweak one of the -# files. This is just a hack to accelerate the work flow. +# The directory structure for the initial content is created at the run +# directory, which is imported as 'initial_config.tar' into the config fs. # -copy_file [genode_dir]/repos/gems/recipes/pkg/sculpt/README [run_dir]/genode/ +# directory structure +foreach subdir { launcher depot managed keyboard } { + file mkdir [file join [initial_config_dir] $subdir] } -copy_file [genode_dir]/repos/gems/run/sculpt/vimrc [run_dir]/genode/ - -foreach file { en_us.chargen de_ch.chargen de_de.chargen fr_ch.chargen fr_fr.chargen special.chargen } { - copy_file [genode_dir]/repos/os/src/server/event_filter/$file \ - [run_dir]/genode/$file } - -copy_file [genode_dir]/repos/gems/recipes/raw/depot_download/depot_download.config \ - [run_dir]/genode/depot_download.config - -copy_file [genode_dir]/VERSION [run_dir]/genode/ - -copy_file [genode_dir]/repos/gems/src/app/backdrop/genode_logo.png [run_dir]/genode/ -copy_file [genode_dir]/repos/gems/run/sculpt/drop_shadow.png [run_dir]/genode/ - -if {[have_board pc]} { - copy_file [genode_dir]/repos/gems/recipes/raw/drivers_managed-pc/event_filter.config \ - [run_dir]/genode/event_filter.config - - copy_file [genode_dir]/repos/os/src/drivers/gpu/intel/gpu_drv.config \ - [run_dir]/genode/gpu_drv.config - - copy_file [genode_dir]/repos/gems/run/sculpt/machine.vbox [run_dir]/genode/ - - copy_file [genode_dir]/repos/gems/recipes/raw/drivers_managed-pc/drivers.config \ - [run_dir]/genode/drivers.config - - exec gzip -dc [genode_dir]/repos/gems/run/sculpt/machine.vdi.gz > [run_dir]/genode/machine.vdi +# configs that are managed by the sculpt manager if absent +set optional_configs { + fonts + nic_router + event_filter + wifi + runtime + gpu_drv } +foreach config $optional_configs { + set ingredient [single_ingredient $config ""] + if {$ingredient != ""} { + set from [ingredient_path $config $ingredient] + set to [initial_config_file $config] + copy_file $from $to } } + +# configs that are expected to be always present +set required_configs { + nitpicker + deploy + fb_drv + clipboard + drivers + numlock_remap + global_keys + leitzentrale + usb + system + ram_fs +} + +foreach config $required_configs { + set ingredient [single_ingredient $config "default"] + set from [ingredient_path $config $ingredient] + set to [initial_config_file $config] + copy_file $from $to } + +# selection of depot users (pubkey and download files) and launchers +foreach type { depot launcher } { + foreach ingredient [ingredients_of_type $type] { + set from [ingredient_path $type $ingredient] + set to [file join [initial_config_dir] $type $ingredient] + file copy $from $to } } + +copy_file [genode_dir]/repos/gems/recipes/pkg/sculpt/README [initial_config_file README] +copy_file [genode_dir]/repos/gems/run/sculpt/vimrc [initial_config_file vimrc] + +# keyboard layouts +foreach file { en_us de_ch de_de fr_ch fr_fr special } { + set from [genode_dir]/repos/os/src/server/event_filter/$file.chargen + set to [file join [initial_config_dir] keyboard $file] + copy_file $from $to } + + +# +# Pre-populate the managed/ directory of the config fs to avoid diagnostic +# warnings by components starting up before the sculpt manager has generated +# the directory content for the first time. +# + +proc managed_config_path { name } { + return [file join [initial_config_dir] managed $name] } + +set fd [open [managed_config_path installation] w] +puts $fd "" +close $fd + +set fd [open [managed_config_path depot_query] w] +puts $fd "" +close $fd + +foreach config { fonts wifi runtime event_filter } { + file copy [ingredient_path $config default] [managed_config_path $config] } + +copy_file [file join [initial_config_dir] fb_drv] [managed_config_path fb_drv] + + +# +# VERSION file at the root of the config fs, add newline for 'cat /VERSION' +# + +set fd [open [initial_config_file VERSION] w] +puts $fd "[sculpt_version]" +close $fd + +# supply VERSION as a boot module to the sculpt manager +file copy [initial_config_file VERSION] [run_dir]/genode/VERSION + + +## +# Return list of 'pkg' attribute values found in 'type' nodes in an XML file +# +proc pkg_attribute_values { xml_file node_path } { + + set xpath "$node_path/attribute::pkg" + set values {} + + if {[catch { + foreach attr [exec xmllint --xpath $xpath $xml_file] { + regexp {^pkg="(.*)"$} $attr dummy value + lappend values $value + } + }]} { + # no pkg attribute present in 'xml_file' + } + return $values +} + + +## +# Return list of pkg archives reference by the launchers and deploy config +# +proc referenced_pkg_values { } { + + set values {} + + # scan launchers + foreach launcher [ingredients_of_type launcher] { + set path [file join [initial_config_dir] launcher $launcher] + lappend values {*}[pkg_attribute_values $path launcher] + } + + # scan deploy config + lappend values {*}[pkg_attribute_values [initial_config_file deploy] config/start] + + return [lsort -unique $values] +} + + +# +# Replace pkg values of the form "name" by the form "user/pkg/name" suitable as +# arguments for '_collect_from_depot'. +# +proc pkg_archive_paths { values } { + + set result {} + foreach value $values { + if {[regexp {/} $value dummy]} { + lappend result $value + } else { + lappend result "[depot_user]/pkg/$value" + } + } + return $result +} + + +# +# Trigger the creation / updating of referenced depot content +# +# This step may update pkg versions if '--depot-auto-update' is enabled. +# +_collect_from_depot [pkg_archive_paths [referenced_pkg_values]] + + +# +# Augment deploy config or launcher file with current package versions +# + +proc current_pkg { pkg } { return $pkg/[_current_depot_archive_version pkg $pkg] } + + +# +# Supplement file with versioned pkg archive paths +# +# \path deploy config or launcher to augment +# \node XML node type containing the 'pkg' attribute to modify +# +# Each matching XML node is inspected regarding its 'pkg' attribute. If its +# 'pkg' attribute contains a single identifier (rather than a valid pkg path), +# the attribute value is replaced by a valid pkg path referring to the current +# version of the pkg and the [depot_user]. +# +proc augment_pkg_versions { path node } { + + set fd [open $path r] + set content [read $fd] + close $fd + + # filter 'pkg' attribute + set pattern "(\<$node\[^\>\]+?pkg=\")(\[^/\]+)(\")" + while {[regexp $pattern $content dummy head pkg tail]} { + set pkg_path [depot_user]/pkg/[current_pkg $pkg] + regsub $pattern $content "$head$pkg_path$tail" content + } + + # write back the filtered launcher snippet + set fd [open $path w] + puts $fd $content + close $fd +} + + +# launcher snippets +foreach launcher [ingredients_of_type launcher] { + augment_pkg_versions [file join [initial_config_dir] launcher $launcher] "launcher" } + + +# deploy config +augment_pkg_versions [initial_config_file deploy] "start" + + +# update arch attribute of deploy config +exec sed -i "/config/s/arch=\"\"/arch=\"[depot_spec]\"/" [initial_config_file deploy] + + +## +## Depot content integrated in the Sculpt image +## + +create_tar_from_depot_binaries [run_dir]/genode/depot.tar \ + {*}[pkg_archive_paths [referenced_pkg_values]] + + +# +# Create initial_config.tar to be mounted at the root of the config fs +# + +exec sh -c "tar cf [run_dir]/genode/initial_config.tar -C [initial_config_dir] ." + +file delete -force [initial_config_dir] + + +## +## Auxiliary boot modules +## # # Linux-specific tweaks @@ -627,111 +873,18 @@ if {[have_board linux]} { # Managed dataspaces as used by cached_fs_rom are not supported on Linux. # copy_file [run_dir]/genode/fs_rom [run_dir]/genode/cached_fs_rom - - # - # The drivers_interactive-linux pkg does not offer a numlock.remap ROM as - # referenced by the event-filter config generated by sculpt manager. - # - install_boot_module "numlock.remap" {} } -# -# Define 'VERSION' ROM module -# -# Note: the string must be exactly 5 bytes long. -# -proc sculpt_version { } { - return "21.11" } - -# write file with newline (for producing nice output when using 'cat /VERSION') -install_boot_module VERSION "[sculpt_version]" - - -# -# Depot packages to be included in the default installation -# - -proc current_pkg { pkg } { return $pkg/[_current_depot_archive_version pkg $pkg] } - -set pkgs_to_install { } - -set fd [open [run_dir]/genode/installation w] -puts $fd "" -foreach pkg $pkgs_to_install { - puts $fd " " } -puts $fd "" -close $fd - - -# -# Configuration of deploy runtime -# -# This configuration is not provided as a file at run/sculpt/ because some -# parts need to be filled in at run-script execution time, in particular the -# current versions of the packages to deploy. -# -install_boot_module "manual_deploy.config" { - - - - - - - - - -} - - -# -# Install launcher snippets -# -# The launcher snippets are wrapped into a tar archive to be loaded as boot -# module. This procedure involves the following steps: -# -# The launcher snippets are copied from run/sculpt/launcher/ to -# [run_dir]/genode/launcher. Each launcher is inspected regarding its 'pkg' -# attribute. If its 'pkg' attribute contains a single identifier (rather than -# a valid pkg path), the attribute value is replaced by a valid pkg path -# referring to the current version of the pkg and the [depot_user]. The -# filtered launchers are archived into 'launcher.tar' and removed from the -# [run_dir]. -# - -set launchers [glob -tails -directory [genode_dir]/repos/gems/run/sculpt/launcher/ *] - -foreach file $launchers { - - # skip backup files - if {[regexp {~$} $file dummy]} { continue } - - set fd [open [genode_dir]/repos/gems/run/sculpt/launcher/$file r] - set content [read $fd] - close $fd - - # filter 'pkg' attribute - set pattern {(\]+?pkg=")([^/]+)(")} - if {[regexp $pattern $content dummy head pkg tail]} { - set pkg_path [depot_user]/pkg/[current_pkg $pkg] - regsub $pattern $content "$head$pkg_path$tail" content - } - - # write filtered launcher snippet - file mkdir [run_dir]/genode/launcher - set fd [open [run_dir]/genode/launcher/$file w] - puts $fd $content - close $fd -} - -# wrap launcher snippets into tar archive and remove individual snippets -exec tar cf [run_dir]/genode/launcher.tar -C [run_dir]/genode launcher -exec rm -r [run_dir]/genode/launcher +# support for the Leitzentrale GUI +copy_file [genode_dir]/repos/gems/src/app/backdrop/genode_logo.png [run_dir]/genode/ +copy_file [genode_dir]/repos/gems/run/sculpt/drop_shadow.png [run_dir]/genode/ # # Generate depot index from gems/run/sculpt/index # + set fd [open [genode_dir]/repos/gems/run/sculpt/index r] set pkg_index [read $fd] close $fd @@ -750,28 +903,12 @@ puts $fd $pkg_index close $fd -# -# Assemble 'depot_users.tar' with the keys and download locations of the -# depot user found at genode/depot/. -# -# Add current depot index of [depot_user] as generated above. -# -set depot_selection { genodelabs cnuke alex-ab mstein nfeske cproc chelmuth - jschlatow ssumpf skalk } +## +## Create boot image +## -set depot_users_files {} -foreach user $depot_selection { - lappend depot_users_files [file join depot $user pubkey] \ - [file join depot $user download] } +build [ingredients_of_type build] -exec sh -c "tar cf [run_dir]/genode/depot_users.tar -C [genode_dir]/repos/gems/sculpt \ - [join $depot_users_files]" - - -# -# Create boot image -# - -append boot_modules { } +append boot_modules [build_artifacts] build_boot_image $boot_modules diff --git a/repos/gems/run/sculpt/machine.vbox b/repos/gems/run/sculpt/machine.vbox deleted file mode 100644 index 9e90f44c1b..0000000000 --- a/repos/gems/run/sculpt/machine.vbox +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/repos/gems/run/sculpt/machine.vdi.gz b/repos/gems/run/sculpt/machine.vdi.gz deleted file mode 100644 index ee3af925fbbdd9def6c17ac1a1861098eb9a427b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2236 zcmb2|=HL*EZ;4`H&P`0t$jnRCD@(~_czf2`i#bq)?Sb`1@5d%l5wQnTd6?~Hi5yg0 zBCq0cqQ${vf}WnEKvUT^vrJa*yREIg3P}&ySfph+Sae)mcGt+yVQ-iBo0eKwA0abk z?v1=-W#tt%TBqh7w0KwAU$ya~KA*MW`Oj59j;Yk{@O2XMn;cO3?9!@7*MoC6#;(&d zn)?0cj_CFAxqEZp#o25-_kRBR<^KBFPfwmb^)2$3)oqC$sr^;)zb%;V!Z diff --git a/repos/gems/run/sculpt/clipboard.config b/repos/gems/sculpt/clipboard/default similarity index 100% rename from repos/gems/run/sculpt/clipboard.config rename to repos/gems/sculpt/clipboard/default diff --git a/repos/gems/sculpt/default-linux.sculpt b/repos/gems/sculpt/default-linux.sculpt new file mode 100644 index 0000000000..277fe8e23d --- /dev/null +++ b/repos/gems/sculpt/default-linux.sculpt @@ -0,0 +1,10 @@ +# configuration decisions +drivers: linux +deploy: example +ram_fs: depot + +# selection of launcher-menu entries +launcher: sticks_blue_backdrop nano3d system_shell + +# supplemental depot content added to the system image +import: pkg/drivers_interactive-linux diff --git a/repos/gems/sculpt/default-pc.sculpt b/repos/gems/sculpt/default-pc.sculpt new file mode 100644 index 0000000000..06b73d2e8a --- /dev/null +++ b/repos/gems/sculpt/default-pc.sculpt @@ -0,0 +1,14 @@ +# configuration decisions +drivers: pc +system: pc +gpu_drv: intel + +# supplemental depot content added to the system image +import: pkg/drivers_managed-pc pkg/wifi src/ipxe_nic_drv + +# selection of launcher-menu entries +launcher: vm_fs shared_fs usb_devices_rom + +# selection of accepted depot-package providers +depot: genodelabs cnuke alex-ab mstein nfeske cproc chelmuth jschlatow +depot: ssumpf skalk diff --git a/repos/gems/sculpt/deploy/default b/repos/gems/sculpt/deploy/default new file mode 100644 index 0000000000..8d175660c4 --- /dev/null +++ b/repos/gems/sculpt/deploy/default @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/repos/gems/sculpt/deploy/example b/repos/gems/sculpt/deploy/example new file mode 100644 index 0000000000..3097fb806f --- /dev/null +++ b/repos/gems/sculpt/deploy/example @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/repos/gems/sculpt/drivers/linux b/repos/gems/sculpt/drivers/linux new file mode 100644 index 0000000000..c43fb2a742 --- /dev/null +++ b/repos/gems/sculpt/drivers/linux @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/repos/gems/recipes/raw/drivers_managed-pc/drivers.config b/repos/gems/sculpt/drivers/pc similarity index 100% rename from repos/gems/recipes/raw/drivers_managed-pc/drivers.config rename to repos/gems/sculpt/drivers/pc diff --git a/repos/gems/sculpt/event_filter/default b/repos/gems/sculpt/event_filter/default new file mode 100644 index 0000000000..ac904ac270 --- /dev/null +++ b/repos/gems/sculpt/event_filter/default @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/repos/gems/recipes/raw/drivers_managed-pc/event_filter.config b/repos/gems/sculpt/event_filter/pc similarity index 100% rename from repos/gems/recipes/raw/drivers_managed-pc/event_filter.config rename to repos/gems/sculpt/event_filter/pc diff --git a/repos/gems/run/sculpt/fb_drv.config b/repos/gems/sculpt/fb_drv/default similarity index 100% rename from repos/gems/run/sculpt/fb_drv.config rename to repos/gems/sculpt/fb_drv/default diff --git a/repos/gems/run/sculpt/fonts.config b/repos/gems/sculpt/fonts/default similarity index 100% rename from repos/gems/run/sculpt/fonts.config rename to repos/gems/sculpt/fonts/default diff --git a/repos/gems/sculpt/global_keys/default b/repos/gems/sculpt/global_keys/default new file mode 100644 index 0000000000..fda94ae891 --- /dev/null +++ b/repos/gems/sculpt/global_keys/default @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/repos/os/src/drivers/gpu/intel/gpu_drv.config b/repos/gems/sculpt/gpu_drv/intel similarity index 100% rename from repos/os/src/drivers/gpu/intel/gpu_drv.config rename to repos/gems/sculpt/gpu_drv/intel diff --git a/repos/gems/sculpt/launcher/nano3d b/repos/gems/sculpt/launcher/nano3d new file mode 100644 index 0000000000..6f5be9f8a7 --- /dev/null +++ b/repos/gems/sculpt/launcher/nano3d @@ -0,0 +1,6 @@ + + + + + + diff --git a/repos/gems/run/sculpt/launcher/shared_fs b/repos/gems/sculpt/launcher/shared_fs similarity index 100% rename from repos/gems/run/sculpt/launcher/shared_fs rename to repos/gems/sculpt/launcher/shared_fs diff --git a/repos/gems/sculpt/launcher/sticks_blue_backdrop b/repos/gems/sculpt/launcher/sticks_blue_backdrop new file mode 100644 index 0000000000..29045f20bb --- /dev/null +++ b/repos/gems/sculpt/launcher/sticks_blue_backdrop @@ -0,0 +1,6 @@ + + + + + + diff --git a/repos/gems/sculpt/launcher/system_shell b/repos/gems/sculpt/launcher/system_shell new file mode 100644 index 0000000000..3bb2b2dc8a --- /dev/null +++ b/repos/gems/sculpt/launcher/system_shell @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/repos/gems/run/sculpt/launcher/usb_devices_rom b/repos/gems/sculpt/launcher/usb_devices_rom similarity index 100% rename from repos/gems/run/sculpt/launcher/usb_devices_rom rename to repos/gems/sculpt/launcher/usb_devices_rom diff --git a/repos/gems/run/sculpt/launcher/vm_fs b/repos/gems/sculpt/launcher/vm_fs similarity index 100% rename from repos/gems/run/sculpt/launcher/vm_fs rename to repos/gems/sculpt/launcher/vm_fs diff --git a/repos/gems/run/sculpt/leitzentrale.config b/repos/gems/sculpt/leitzentrale/default similarity index 100% rename from repos/gems/run/sculpt/leitzentrale.config rename to repos/gems/sculpt/leitzentrale/default diff --git a/repos/gems/run/sculpt/nitpicker.config b/repos/gems/sculpt/nitpicker/default similarity index 100% rename from repos/gems/run/sculpt/nitpicker.config rename to repos/gems/sculpt/nitpicker/default diff --git a/repos/gems/recipes/raw/drivers_managed-pc/numlock_remap.config b/repos/gems/sculpt/numlock_remap/default similarity index 100% rename from repos/gems/recipes/raw/drivers_managed-pc/numlock_remap.config rename to repos/gems/sculpt/numlock_remap/default diff --git a/repos/gems/sculpt/ram_fs/default b/repos/gems/sculpt/ram_fs/default new file mode 100644 index 0000000000..53d5ba3e58 --- /dev/null +++ b/repos/gems/sculpt/ram_fs/default @@ -0,0 +1,6 @@ + + + + + + diff --git a/repos/gems/sculpt/ram_fs/depot b/repos/gems/sculpt/ram_fs/depot new file mode 100644 index 0000000000..265bb530b2 --- /dev/null +++ b/repos/gems/sculpt/ram_fs/depot @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/repos/gems/run/sculpt/empty_runtime.config b/repos/gems/sculpt/runtime/default similarity index 100% rename from repos/gems/run/sculpt/empty_runtime.config rename to repos/gems/sculpt/runtime/default diff --git a/repos/gems/sculpt/system/default b/repos/gems/sculpt/system/default new file mode 100644 index 0000000000..13c78a2e76 --- /dev/null +++ b/repos/gems/sculpt/system/default @@ -0,0 +1 @@ + diff --git a/repos/gems/sculpt/system/pc b/repos/gems/sculpt/system/pc new file mode 100644 index 0000000000..2d42462719 --- /dev/null +++ b/repos/gems/sculpt/system/pc @@ -0,0 +1,3 @@ + + + diff --git a/repos/gems/run/sculpt/usb.config b/repos/gems/sculpt/usb/default similarity index 100% rename from repos/gems/run/sculpt/usb.config rename to repos/gems/sculpt/usb/default diff --git a/repos/gems/run/sculpt/wifi.config b/repos/gems/sculpt/wifi/default similarity index 100% rename from repos/gems/run/sculpt/wifi.config rename to repos/gems/sculpt/wifi/default diff --git a/repos/gems/src/app/sculpt_manager/graph.cc b/repos/gems/src/app/sculpt_manager/graph.cc index b9337f5314..2e179f5e8b 100644 --- a/repos/gems/src/app/sculpt_manager/graph.cc +++ b/repos/gems/src/app/sculpt_manager/graph.cc @@ -257,6 +257,9 @@ void Graph::generate(Xml_generator &xml) const 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; diff --git a/repos/gems/src/app/sculpt_manager/runtime/inspect_view.cc b/repos/gems/src/app/sculpt_manager/runtime/inspect_view.cc index 71eb8405c7..4593d0efec 100644 --- a/repos/gems/src/app/sculpt_manager/runtime/inspect_view.cc +++ b/repos/gems/src/app/sculpt_manager/runtime/inspect_view.cc @@ -77,9 +77,6 @@ static void gen_vfs_start(Xml_generator &xml, }); }); - gen_named_node(xml, "dir", "share", [&] () { - gen_named_node(xml, "tar", "depot_users.tar"); }); - auto fs_dir = [&] (String<64> const &label) { gen_named_node(xml, "dir", label, [&] () { xml.node("fs", [&] () { xml.attribute("label", label); }); }); }; @@ -271,7 +268,6 @@ void Sculpt::gen_inspect_view(Xml_generator &xml, gen_parent_rom_route(xml, "vim-minimal.tar"); gen_parent_rom_route(xml, "ncurses.lib.so"); gen_parent_rom_route(xml, "posix.lib.so"); - gen_parent_rom_route(xml, "depot_users.tar"); gen_parent_rom_route(xml, "vimrc", "config -> vimrc"); gen_parent_rom_route(xml, "VERSION"); gen_parent_rom_route(xml, "Vera.ttf"); diff --git a/repos/gems/src/app/sculpt_manager/runtime/prepare.cc b/repos/gems/src/app/sculpt_manager/runtime/prepare.cc index 6cd2dc5e06..d8d38b8c97 100644 --- a/repos/gems/src/app/sculpt_manager/runtime/prepare.cc +++ b/repos/gems/src/app/sculpt_manager/runtime/prepare.cc @@ -31,7 +31,7 @@ void Sculpt::gen_prepare_vfs_start(Xml_generator &xml) "export VERSION=`cat /VERSION`\n" "cp -r /rw/config/$VERSION/* /config/\n" "mkdir -p /rw/depot\n" - "cp -r depot/* /rw/depot\n" + "cp -r /config/depot/* /rw/depot\n" "exit\n"; gen_provides<::File_system::Session>(xml); @@ -41,7 +41,6 @@ void Sculpt::gen_prepare_vfs_start(Xml_generator &xml) xml.node("vfs", [&] () { gen_named_node(xml, "tar", "bash-minimal.tar"); gen_named_node(xml, "tar", "coreutils-minimal.tar"); - gen_named_node(xml, "tar", "depot_users.tar"); gen_named_node(xml, "inline", ".bash_profile", [&] () { xml.append(script); }); diff --git a/repos/gems/src/app/sculpt_manager/runtime/ram_fs.cc b/repos/gems/src/app/sculpt_manager/runtime/ram_fs.cc index 3d4228f616..9c2765c6fe 100644 --- a/repos/gems/src/app/sculpt_manager/runtime/ram_fs.cc +++ b/repos/gems/src/app/sculpt_manager/runtime/ram_fs.cc @@ -22,14 +22,6 @@ void Sculpt::gen_ram_fs_start_content(Xml_generator &xml, gen_provides<::File_system::Session>(xml); - xml.node("config", [&] () { - xml.node("vfs", [&] () { xml.node("ram", [&] () { }); }); - xml.node("default-policy", [&] () { - xml.attribute("root", "/"); - xml.attribute("writeable", "yes"); - }); - }); - xml.node("route", [&] () { gen_parent_rom_route(xml, "vfs"); gen_parent_rom_route(xml, "ld.lib.so"); @@ -37,5 +29,7 @@ void Sculpt::gen_ram_fs_start_content(Xml_generator &xml, gen_parent_route (xml); gen_parent_route (xml); gen_parent_route (xml); + gen_parent_rom_route(xml, "config", "config -> ram_fs"); + gen_parent_route (xml); }); }