From 4e3097b5e7b6b80dff3f76046f28e5816e877578 Mon Sep 17 00:00:00 2001 From: Alper Nebi Yasak Date: Tue, 6 Dec 2022 19:52:00 +0300 Subject: build/roms: Disable U-Boot when not in payloads specified by cmdline When overriding which payloads will be built with the -p command line argument, the roms_helper script doesn't disable the U-Boot payload. Disable it in this case. Signed-off-by: Alper Nebi Yasak --- resources/scripts/build/boot/roms_helper | 1 + 1 file changed, 1 insertion(+) (limited to 'resources/scripts/build/boot/roms_helper') diff --git a/resources/scripts/build/boot/roms_helper b/resources/scripts/build/boot/roms_helper index bd1f3860..e2b152d9 100755 --- a/resources/scripts/build/boot/roms_helper +++ b/resources/scripts/build/boot/roms_helper @@ -159,6 +159,7 @@ if [ ! -z ${payloads} ]; then payload_grub_withseabios="n" # seabios chainloaded from grub payload_seabios="n" payload_seabios_withgrub="n" # i386-coreboot grub accessible from SeaBIOS boot menu + payload_uboot="n" seabios_opromloadonly="0" payload_memtest="n" -- cgit v1.2.1 From 9fb4ecec62b0430fa8e405d2133a4579020e522b Mon Sep 17 00:00:00 2001 From: Alper Nebi Yasak Date: Wed, 7 Dec 2022 21:41:33 +0300 Subject: build/roms: Don't build Memtest86+ when not specified by cmdline When overriding which payloads will be built with the -p command line argument, the roms_helper script builds the Memtest86+ payload before checking if it should be disabled. Move the build command after the command line override. Signed-off-by: Alper Nebi Yasak --- resources/scripts/build/boot/roms_helper | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'resources/scripts/build/boot/roms_helper') diff --git a/resources/scripts/build/boot/roms_helper b/resources/scripts/build/boot/roms_helper index e2b152d9..a59c4285 100755 --- a/resources/scripts/build/boot/roms_helper +++ b/resources/scripts/build/boot/roms_helper @@ -146,12 +146,6 @@ if [ "${payload_uboot}" = "y" ] && \ uboot_config="default" fi -if [ "${payload_memtest}" = "y" ]; then - if [ ! -f "memtest86plus/memtest" ]; then - ./build module memtest86plus - fi -fi - # Override all payload directives with cmdline args if [ ! -z ${payloads} ]; then echo "setting payloads $payloads" @@ -219,6 +213,12 @@ if [ ! -f "${seavgabiosrom}" ] \ fi fi +if [ "${payload_memtest}" = "y" ]; then + if [ ! -f "memtest86plus/memtest" ]; then + ./build module memtest86plus + fi +fi + [ -d "${romdir}/" ] || mkdir -p "${romdir}/" rm -f "${romdir}"/* -- cgit v1.2.1 From a586356164491f5895713fca713967218211219e Mon Sep 17 00:00:00 2001 From: Alper Nebi Yasak Date: Wed, 7 Dec 2022 19:31:36 +0300 Subject: build/roms: Build 32-bit crossgcc for AArch64 as well This re-applies commit a69855f7e448 ("Build 32-bit crossgcc for AArch64 as well") which was inexplicably reverted along with unrelated changes. Mention in a comment that building crossgcc-arm is necessary for AArch64. Signed-off-by: Alper Nebi Yasak --- resources/scripts/build/boot/roms_helper | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'resources/scripts/build/boot/roms_helper') diff --git a/resources/scripts/build/boot/roms_helper b/resources/scripts/build/boot/roms_helper index a59c4285..ff0681f3 100755 --- a/resources/scripts/build/boot/roms_helper +++ b/resources/scripts/build/boot/roms_helper @@ -194,7 +194,8 @@ elif [ "${arch}" = "AArch64" ]; then ( cat version > "${cbdir}/.coreboot-version" cd "${cbdir}" - make crossgcc-aarch64 CPUS=$(nproc) # This is for aarch64, doesn't apply to armv7 + # aarch64 needs armv7 toolchain for arm-trusted-firmware + make crossgcc-arm crossgcc-aarch64 CPUS=$(nproc) ) fi -- cgit v1.2.1 From bee5054077e8e178cb5dfe1b4ecd1b20d67ee93f Mon Sep 17 00:00:00 2001 From: Alper Nebi Yasak Date: Wed, 7 Dec 2022 20:53:18 +0300 Subject: build/roms: Make coreboot crossgcc usable for payloads and modules Add the coreboot-built cross-architecture toolchains to the PATH so that modules and payloads can use them. When building for a foreign-arch board, also export CROSS_COMPILE pointing to the appropriate prefix. Signed-off-by: Alper Nebi Yasak --- resources/scripts/build/boot/roms_helper | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'resources/scripts/build/boot/roms_helper') diff --git a/resources/scripts/build/boot/roms_helper b/resources/scripts/build/boot/roms_helper index ff0681f3..abec7402 100755 --- a/resources/scripts/build/boot/roms_helper +++ b/resources/scripts/build/boot/roms_helper @@ -184,12 +184,20 @@ if [ "${arch}" = "x86_32" ] || [ "${arch}" = "x86_64" ]; then # 32-bit ROM images, so we only need to worry about i386-elf ) fi + case "$(uname -m)" in + x86*|i*86|amd64) : ;; + *) export CROSS_COMPILE=i386-elf- ;; + esac elif [ "${arch}" = "ARMv7" ]; then ( cat version > "${cbdir}/.coreboot-version" cd "${cbdir}" make crossgcc-arm CPUS=$(nproc) # This is for armv7, doesn't apply to aarch64 ) + case "$(uname -m)" in + arm|arm32|armv6*|armv7*) : ;; + *) export CROSS_COMPILE=arm-eabi- ;; + esac elif [ "${arch}" = "AArch64" ]; then ( cat version > "${cbdir}/.coreboot-version" @@ -197,8 +205,14 @@ elif [ "${arch}" = "AArch64" ]; then # aarch64 needs armv7 toolchain for arm-trusted-firmware make crossgcc-arm crossgcc-aarch64 CPUS=$(nproc) ) + case "$(uname -m)" in + arm64|aarch64) : ;; + *) export CROSS_COMPILE=aarch64-elf- ;; + esac fi +export PATH="$(pwd)/${cbdir}/util/crossgcc/xgcc/bin:$PATH" + if [ ! -f "${cbfstool}" ]; then ./build module cbutils ${cbtree} fi -- cgit v1.2.1 From 5b6bf2a82631f15ad8d3923520e678b9b0065302 Mon Sep 17 00:00:00 2001 From: Alper Nebi Yasak Date: Wed, 7 Dec 2022 21:55:05 +0300 Subject: build/roms: Don't rebuild crossgcc if it was already built The roms_helper script skips building crossgcc-i386 if its target directory exists. Skip it for other architectures as well. Signed-off-by: Alper Nebi Yasak --- resources/scripts/build/boot/roms_helper | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) (limited to 'resources/scripts/build/boot/roms_helper') diff --git a/resources/scripts/build/boot/roms_helper b/resources/scripts/build/boot/roms_helper index abec7402..f533e6ab 100755 --- a/resources/scripts/build/boot/roms_helper +++ b/resources/scripts/build/boot/roms_helper @@ -175,36 +175,34 @@ if [ ! -d "${cbdir}" ]; then ./download coreboot ${cbtree} fi +cat version > "${cbdir}/.coreboot-version" + if [ "${arch}" = "x86_32" ] || [ "${arch}" = "x86_64" ]; then if [ ! -d "${cbdir}/util/crossgcc/xgcc/i386-elf/" ]; then - ( - cat version > "${cbdir}/.coreboot-version" - cd "${cbdir}" - make crossgcc-i386 CPUS=$(nproc) # even for 64-bit machines, coreboot builds - # 32-bit ROM images, so we only need to worry about i386-elf - ) + # Even for 64-bit machines, coreboot builds 32-bit ROM + # images, so we only need to worry about i386-elf + make -C "${cbdir}" crossgcc-i386 CPUS=$(nproc) fi case "$(uname -m)" in x86*|i*86|amd64) : ;; *) export CROSS_COMPILE=i386-elf- ;; esac elif [ "${arch}" = "ARMv7" ]; then - ( - cat version > "${cbdir}/.coreboot-version" - cd "${cbdir}" - make crossgcc-arm CPUS=$(nproc) # This is for armv7, doesn't apply to aarch64 - ) + if [ ! -d "${cbdir}/util/crossgcc/xgcc/arm-eabi/" ]; then + make -C "${cbdir}" crossgcc-arm CPUS=$(nproc) + fi case "$(uname -m)" in arm|arm32|armv6*|armv7*) : ;; *) export CROSS_COMPILE=arm-eabi- ;; esac elif [ "${arch}" = "AArch64" ]; then - ( - cat version > "${cbdir}/.coreboot-version" - cd "${cbdir}" - # aarch64 needs armv7 toolchain for arm-trusted-firmware - make crossgcc-arm crossgcc-aarch64 CPUS=$(nproc) - ) + if [ ! -d "${cbdir}/util/crossgcc/xgcc/aarch64-elf/" ]; then + make -C "${cbdir}" crossgcc-aarch64 CPUS=$(nproc) + fi + # aarch64 also needs armv7 toolchain for arm-trusted-firmware + if [ ! -d "${cbdir}/util/crossgcc/xgcc/arm-eabi/" ]; then + make -C "${cbdir}" crossgcc-arm CPUS=$(nproc) + fi case "$(uname -m)" in arm64|aarch64) : ;; *) export CROSS_COMPILE=aarch64-elf- ;; -- cgit v1.2.1 From 1c62b003ad6014288114300de65844496dffaf72 Mon Sep 17 00:00:00 2001 From: Alper Nebi Yasak Date: Fri, 9 Dec 2022 14:50:03 +0300 Subject: build/roms: Support using "u-boot" ELF file as U-Boot payload U-Boot runtime configuration is done with a device-tree file, which is built alongside the executable in the upstream build system, and must be available to U-Boot at runtime. This device-tree is normally not linked into the default "u-boot" ELF file. So far we have been handling it by re-creating a "u-boot.elf" from the raw binary parts by setting REMAKE_ELF, and using that as the coreboot payload. Unfortunately, that fails to build for x86 boards, more specificly the "coreboot" boards upstream. It's also possible (but discouraged) to set OF_EMBED to embed the device-tree file into the U-Boot itself, in which case we could use the "u-boot" file as the payload on the "coreboot" boards. Add support for using the "u-boot" file as the payload if "u-boot.elf" doesn't exist. Signed-off-by: Alper Nebi Yasak --- resources/scripts/build/boot/roms_helper | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'resources/scripts/build/boot/roms_helper') diff --git a/resources/scripts/build/boot/roms_helper b/resources/scripts/build/boot/roms_helper index f533e6ab..66a7be8f 100755 --- a/resources/scripts/build/boot/roms_helper +++ b/resources/scripts/build/boot/roms_helper @@ -268,14 +268,17 @@ if [ "${payload_grub}" = "y" ] || [ "${payload_seabios_withgrub}" = "y" ]; then fi if [ "${payload_uboot}" = "y" ]; then - if [ "${uboot_config}" = "default" ] && \ - [ -f "payload/u-boot/${board}/u-boot.elf" ]; then - ubootelf="payload/u-boot/${board}/u-boot.elf" + if [ "${uboot_config}" = "default" ]; then + ubdir="payload/u-boot/${board}" else - ubootelf="payload/u-boot/${board}/${uboot_config}/u-boot.elf" + ubdir="payload/u-boot/${board}/${uboot_config}" fi - if [ ! -f "${ubootelf}" ]; then + if [ -f "${ubdir}/u-boot.elf" ]; then + ubootelf="${ubdir}/u-boot.elf" + elif [ -f "${ubdir}/u-boot" ]; then + ubootelf="${ubdir}/u-boot" + else printf "Required U-Boot payloads not yet built. Building now:\n" rm -Rf "payload/u-boot/${board}" # just in case ./build payload u-boot "${board}" @@ -397,9 +400,15 @@ make_uboot_payload_rom() { cbfstool_path="${4}" if [ "${target_uboot_config}" = "default" ]; then - target_ubootelf="payload/u-boot/${board}/u-boot.elf" + target_ubdir="payload/u-boot/${board}" else - target_ubootelf="payload/u-boot/${board}/${target_uboot_config}/u-boot.elf" + target_ubdir="payload/u-boot/${board}/${target_uboot_config}" + fi + + if [ -f "${target_ubdir}/u-boot.elf" ]; then + target_ubootelf="${target_ubdir}/u-boot.elf" + elif [ -f "${target_ubdir}/u-boot" ]; then + target_ubootelf="${target_ubdir}/u-boot" fi tmprom=$(mktemp -t coreboot_rom.XXXXXXXXXX) -- cgit v1.2.1