From 41ebf3bd94e5ccf9bacc7b0c42bd5724cbb8350b Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Wed, 18 Jan 2023 16:56:28 +0100 Subject: [PATCH] run: remove argument from 'run_image' function The argument is superfluous because only run/image/uboot evaluated it anyway, and the argument is always boot/image.elf. With this change, the official semantics of run_image become: "replace the boot/image.elf file by platform-specific file(s) at boot/ that can actually be booted". Issue #4730 --- tool/run/boot_dir/foc | 2 +- tool/run/boot_dir/hw | 2 +- tool/run/boot_dir/sel4 | 2 +- tool/run/image/disk | 2 +- tool/run/image/iso | 2 +- tool/run/image/uboot | 6 +++--- tool/run/image/uefi | 2 +- tool/run/run | 8 ++++++-- 8 files changed, 15 insertions(+), 11 deletions(-) diff --git a/tool/run/boot_dir/foc b/tool/run/boot_dir/foc index e8a7673b59..eb2cb1746c 100644 --- a/tool/run/boot_dir/foc +++ b/tool/run/boot_dir/foc @@ -187,7 +187,7 @@ proc run_boot_dir_arm { binaries } { exec mkdir -p [run_dir]/boot exec mv [run_dir]/image.elf [run_dir]/boot/core.elf exec cp [l4_bin_dir]/bootstrap.elf [run_dir]/boot/image.elf - run_image [run_dir]/boot/image.elf + run_image puts "\nboot image: [run_dir]/image.elf\n" diff --git a/tool/run/boot_dir/hw b/tool/run/boot_dir/hw index 0768a115cf..1adafa99dd 100644 --- a/tool/run/boot_dir/hw +++ b/tool/run/boot_dir/hw @@ -143,7 +143,7 @@ proc run_boot_dir {binaries} { close $fh } - run_image [run_dir]/boot/image.elf + run_image # install image.elf file in TFTP directory for PXE boot if {[expr [have_spec arm] || [have_spec arm_64]] && [have_include "load/tftp"]} { diff --git a/tool/run/boot_dir/sel4 b/tool/run/boot_dir/sel4 index 2787eeb701..4a627131a7 100644 --- a/tool/run/boot_dir/sel4 +++ b/tool/run/boot_dir/sel4 @@ -117,7 +117,7 @@ proc run_boot_dir {binaries} { exec [sel4_elfloader_dir]/gen_boot_image.sh [pwd]/[run_dir]/boot/kernel.elf [pwd]/[run_dir]/boot/genode.elf [pwd]/[run_dir]/boot/image.elf } - run_image [run_dir]/boot/image.elf + run_image # install image.elf file in TFTP directory for PXE boot if {[have_spec arm] && [have_include "load/tftp"]} { diff --git a/tool/run/image/disk b/tool/run/image/disk index 59245d05be..3bbe605ef7 100644 --- a/tool/run/image/disk +++ b/tool/run/image/disk @@ -13,7 +13,7 @@ proc image_disk_size { } { return [get_cmd_arg --image-disk-size 0] } ## # Create disk image with the content of the run directory # -proc run_image { {unused ""} } { +proc run_image { } { set sgdisk [installed_command sgdisk] diff --git a/tool/run/image/iso b/tool/run/image/iso index d0578420fa..44e628fb63 100644 --- a/tool/run/image/iso +++ b/tool/run/image/iso @@ -4,7 +4,7 @@ source [genode_dir]/tool/run/iso.inc ## # Create ISO image with the content of the run directory # -proc run_image { {unused ""} } { +proc run_image { } { puts "creating ISO image..." exec rm -f "[run_dir].iso" diff --git a/tool/run/image/uboot b/tool/run/image/uboot index abc3bf8b0a..7b5248cb4d 100644 --- a/tool/run/image/uboot +++ b/tool/run/image/uboot @@ -35,9 +35,9 @@ proc image_uboot_gzip_opt { } { ## # Build U-boot bootloader specific uImage # -# \param elf_img ELF binary to build uImage from -# -proc run_image {elf_img} { +proc run_image { } { + + set elf_img [file join [run_dir] boot image.elf] # parse ELF entrypoint and load address set entrypoint [exec [cross_dev_prefix]readelf -h $elf_img | \ diff --git a/tool/run/image/uefi b/tool/run/image/uefi index 7b50883558..827a386e52 100644 --- a/tool/run/image/uefi +++ b/tool/run/image/uefi @@ -12,7 +12,7 @@ proc image_uefi_size { } { return [get_cmd_arg --image-uefi_size 0] } ## # Create uefi image # -proc run_image { {unused ""} } { +proc run_image { } { set run_size [expr [regsub {\s.*} [exec du -smL [run_dir]] {}]] diff --git a/tool/run/run b/tool/run/run index 93a4e81690..897eac74fb 100755 --- a/tool/run/run +++ b/tool/run/run @@ -834,9 +834,13 @@ proc run_boot_dir { binaries } { ## -# Dummy image build module +# Bring the boot-directory content into a form that can actually be booted # -proc run_image { {image "" } } { return true; } +# The form suitable for booting depends on the platform and the used boot +# loader. By convention, this function can expect the presence of the boot +# image in the form of an [run_dir]/boot/image.elf file. +# +proc run_image { } { return true; } ##