From eb354be20d4e12e0532daa191f19e3f07217b371 Mon Sep 17 00:00:00 2001 From: Alexander Boettcher Date: Fri, 27 Jan 2023 07:57:52 +0100 Subject: [PATCH] image/uefi: factor out common boot parts to avoid divergence. Issue #4741 --- tool/run/boot_dir/hw | 9 +-------- tool/run/boot_dir/nova | 10 +--------- tool/run/boot_dir/sel4 | 9 +-------- tool/run/image/uefi | 12 ++++++++++++ 4 files changed, 15 insertions(+), 25 deletions(-) diff --git a/tool/run/boot_dir/hw b/tool/run/boot_dir/hw index 52bf937eaf..1ac2d3582a 100644 --- a/tool/run/boot_dir/hw +++ b/tool/run/boot_dir/hw @@ -117,14 +117,7 @@ proc run_boot_dir {binaries} { } if {[have_include image/uefi]} { - set grub2_path [get_grub2_dir] - - exec mkdir -p [run_dir]/efi/boot - exec cp $grub2_path/boot/grub2/grub2_32.efi [run_dir]/efi/boot/bootia32.efi - exec cp $grub2_path/boot/grub2/grub2_64.efi [run_dir]/efi/boot/bootx64.efi - exec mkdir -p [run_dir]/boot/grub - exec cp [genode_dir]/tool/boot/bender [run_dir]/boot/bender - + install_uefi_bootloader_to_run_dir set serial_bender_opt "serial_fallback" } diff --git a/tool/run/boot_dir/nova b/tool/run/boot_dir/nova index 32d446e6f9..14bb5e99c8 100644 --- a/tool/run/boot_dir/nova +++ b/tool/run/boot_dir/nova @@ -120,15 +120,7 @@ proc run_boot_dir {binaries} { } if {[have_include image/uefi]} { - exec mkdir -p [run_dir]/efi/boot - exec cp [get_grub2_dir]/boot/grub2/grub2_32.efi [run_dir]/efi/boot/bootia32.efi - exec cp [get_grub2_dir]/boot/grub2/grub2_64.efi [run_dir]/efi/boot/bootx64.efi - exec mkdir -p [run_dir]/boot/grub - exec cp [genode_dir]/tool/boot/bender [run_dir]/boot/bender - - exec cp [genode_dir]/tool/boot/boot.png [run_dir]/boot/boot.png - exec cp [get_grub2_dir]/boot/font.pf2 [run_dir]/boot/font.pf2 - + install_uefi_bootloader_to_run_dir append options_bender " serial_fallback" } diff --git a/tool/run/boot_dir/sel4 b/tool/run/boot_dir/sel4 index f30e3f0c4e..617fac8d66 100644 --- a/tool/run/boot_dir/sel4 +++ b/tool/run/boot_dir/sel4 @@ -67,14 +67,7 @@ proc run_boot_dir {binaries} { } if {[have_include image/uefi]} { - set grub2_path [get_grub2_dir] - - exec mkdir -p [run_dir]/efi/boot - exec cp $grub2_path/boot/grub2/grub2_32.efi [run_dir]/efi/boot/bootia32.efi - exec cp $grub2_path/boot/grub2/grub2_64.efi [run_dir]/efi/boot/bootx64.efi - exec mkdir -p [run_dir]/boot/grub - exec cp [genode_dir]/tool/boot/bender [run_dir]/boot/bender - + install_uefi_bootloader_to_run_dir set serial_bender_opt "serial_fallback" } diff --git a/tool/run/image/uefi b/tool/run/image/uefi index 827a386e52..62d0864226 100644 --- a/tool/run/image/uefi +++ b/tool/run/image/uefi @@ -39,3 +39,15 @@ proc run_image { } { exec rm -f [run_dir].header [run_dir].partition } + + +proc install_uefi_bootloader_to_run_dir { } { + exec mkdir -p [run_dir]/efi/boot + exec cp [get_grub2_dir]/boot/grub2/grub2_32.efi [run_dir]/efi/boot/bootia32.efi + exec cp [get_grub2_dir]/boot/grub2/grub2_64.efi [run_dir]/efi/boot/bootx64.efi + exec mkdir -p [run_dir]/boot/grub + exec cp [genode_dir]/tool/boot/bender [run_dir]/boot/bender + + exec cp [genode_dir]/tool/boot/boot.png [run_dir]/boot/boot.png + exec cp [get_grub2_dir]/boot/font.pf2 [run_dir]/boot/font.pf2 +}