if {![have_spec x86] || [have_spec linux]} {
puts "Platform is unsupported."
exit 0
}
if {[have_spec nova]} {
proc kernel_output { } { return "novga serial logmem" }
}
create_boot_directory
import_from_depot [depot_user]/src/[base_src] \
[depot_user]/pkg/sculpt
proc config_system_content {} { return {\
} }
install_config {
} [config_system_content] {
### start ###}
foreach file [glob "[genode_dir]/repos/gems/run/sculpt/*.config"] {
file copy -force $file [run_dir]/genode/ }
#
# 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.
#
file copy -force [genode_dir]/repos/gems/recipes/pkg/sculpt/README [run_dir]/genode/
file copy -force [genode_dir]/repos/gems/run/sculpt/vimrc [run_dir]/genode/
file copy -force [genode_dir]/repos/gems/run/sculpt/machine.vbox [run_dir]/genode/
file copy -force [genode_dir]/repos/gems/recipes/raw/drivers_managed-pc/drivers.config \
[run_dir]/genode/drivers.config
foreach file { en_us.chargen de_ch.chargen de_de.chargen fr_ch.chargen fr_fr.chargen special.chargen } {
file copy -force [genode_dir]/repos/os/src/server/input_filter/$file \
[run_dir]/genode/$file }
file copy -force [genode_dir]/repos/gems/recipes/raw/drivers_managed-pc/input_filter.config \
[run_dir]/genode/input_filter.config
file copy -force [genode_dir]/repos/gems/recipes/raw/depot_download/depot_download.config \
[run_dir]/genode/depot_download.config
file copy -force [genode_dir]/VERSION [run_dir]/genode/
file copy -force [genode_dir]/repos/gems/src/app/backdrop/genode_logo.png [run_dir]/genode/
file copy -force [genode_dir]/repos/gems/run/sculpt/drop_shadow.png [run_dir]/genode/
exec gzip -dc [genode_dir]/repos/gems/run/sculpt/machine.vdi.gz > [run_dir]/genode/machine.vdi
#
# Define 'VERSION' ROM module
#
# Note: the string must be exactly 5 bytes long.
#
proc sculpt_version { } {
return "20.03" }
# write file with newline (for producing nice output when using 'cat /VERSION')
set fd [open [run_dir]/genode/VERSION w]
puts $fd "[sculpt_version]"
close $fd
#
# 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.
#
append manual_deploy_config {
}
set fd [open [run_dir]/genode/manual_deploy.config w]
puts $fd $manual_deploy_config
close $fd
#
# 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
#
# 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
# filter 'pkg' attribute
set pattern {(\]+?path=")([^/]+)(")}
while {[regexp $pattern $pkg_index dummy head pkg tail]} {
set pkg_path [depot_user]/pkg/[current_pkg $pkg]
regsub $pattern $pkg_index "$head$pkg_path$tail" pkg_index
}
# write filtered pkg index into the depot
file mkdir [depot_dir]/[depot_user]/index
set fd [open [depot_dir]/[depot_user]/index/[sculpt_version] w]
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_users_files [exec sh -c "cd [genode_dir]; \
find depot -maxdepth 3 -name pubkey \
-or -name download"]
exec sh -c "tar cf [run_dir]/genode/depot_users.tar -C [genode_dir] \
[join $depot_users_files]"
#
# Create boot image
#
append boot_modules { }
build_boot_image $boot_modules