From 3355d14b652e1c0c1e58086b96f400a03eb2337d Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Tue, 24 Jan 2023 15:36:26 +0100 Subject: [PATCH] sculpt_image.run script for creating system images Issue #4744 --- repos/gems/run/sculpt_image.run | 71 +++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 repos/gems/run/sculpt_image.run diff --git a/repos/gems/run/sculpt_image.run b/repos/gems/run/sculpt_image.run new file mode 100644 index 0000000000..0373664ff0 --- /dev/null +++ b/repos/gems/run/sculpt_image.run @@ -0,0 +1,71 @@ +# +# Generates publishable Sculpt system image +# + +proc board_supported { } { + if {[have_board pinephone]} { return true } + if {[have_board pc]} { return true } + return false +} + +if {![board_supported]} { + puts stderr "board is not supported by the run script" + exit 1 +} + +proc assert_include { include } { + if {![have_include $include]} { + puts stderr "missing run-tool argument: --include $include" + exit 1 + } +} + +proc assert_run_arg { arg_name } { + global argv + if {[lsearch $argv $arg_name] == -1} { + puts stderr "missing run-tool argument: $arg" + exit 1 + } +} + +if {[have_board pinephone]} { + assert_include image/uboot + assert_include image/pine_uboot_sdcard + assert_run_arg "--image-uboot-gzip-best" +} + +if {[have_board pc]} { + assert_include image/disk +} + +source ${genode_dir}/repos/gems/run/sculpt.run + +set image_name "sculpt-$board_var-[build_date]" +set depot_image_dir [file join [depot_dir] [depot_user] image] +set depot_image_path [file join $depot_image_dir $image_name] + +# install disk image into depot +exec mkdir -p $depot_image_dir +copy_file [run_dir].img $depot_image_path.img +puts "Disk image: $depot_image_path.img" + +# install content of boot directory into depot +exec rm -rf $depot_image_path +exec cp -r [run_dir]/boot $depot_image_path +puts "Boot directory: $depot_image_path" + +puts "" +puts "Don't forget to extend your [file join $depot_image_dir index] file" +puts "" +puts "" +puts "\t" +puts "\t\t" +puts "\t" +puts "\t..." +puts "" +puts "" +puts "Once updated, publish the image index along with the new image as follows:" +puts "" +puts " [genode_dir]/tool/depot/publish [depot_user]/image/$image_name [depot_user]/image/index" +puts "" +