From 60f2a6d5af3a36dcb28768a18f61ade70cbf21b5 Mon Sep 17 00:00:00 2001 From: Stefano Stabellini Date: Tue, 22 Mar 2022 13:15:13 -0700 Subject: If bootm, generate a u-boot Legacy uImage to boot If BOOT_CMD is specified as "bootm" it requires a uImage to boot. Automatically generate a $XEN.ub binary using mkimage and specifying the right loading address. Also remove "u-boot legacy uImage" from the allowed Xen binary types because we cannot easily check that the uImage was built with the right address. Note that "ARM OpenFirmware" is the type returned by certain versions of "file" utility for a Xen arm32 binary. Signed-off-by: Stefano Stabellini Reviewed-by: Ayan Kumar Halder --- scripts/uboot-script-gen | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'scripts/uboot-script-gen') diff --git a/scripts/uboot-script-gen b/scripts/uboot-script-gen index 6705184..aee45ec 100755 --- a/scripts/uboot-script-gen +++ b/scripts/uboot-script-gen @@ -237,7 +237,7 @@ function check_file_type() # since some executables aren't recongnized if [ "$type" = "executable" ] then - type="executable\|data\|u-boot legacy uImage" + type="executable\|data\|ARM OpenFirmware" # file in older distros (ex: RHEL 7.4) just output data for device # tree blobs elif [ "$type" = "Device Tree Blob" ] @@ -387,6 +387,21 @@ function linux_config() fi } +generate_uboot_images() +{ + local arch=$(file -L $XEN | grep "ARM") + + if test "$arch" + then + arch=arm + else + arch=arm64 + fi + + mkimage -A $arch -T kernel -C none -a $memaddr -e $memaddr -d $XEN "$XEN".ub + XEN="$XEN".ub +} + xen_file_loading() { check_compressed_file_type $DOM0_KERNEL "executable" @@ -448,6 +463,12 @@ xen_file_loading() # secure boot on uboot expects the last PE image loaded to be the # signed secureboot image used check_compressed_file_type $XEN "executable" + + if test "$BOOT_CMD" = "bootm" + then + generate_uboot_images + fi + kernel_addr=$memaddr kernel_path=$XEN load_file "$XEN" "host_kernel" -- cgit v1.2.3