build/fw/coreboot: Fix misuse of raw u-boot.bin as payload

The "u-boot.bin" file generated by U-Boot builds is a raw binary. When
adding payloads to a CBFS, we need to use ELF files with add-payload
or manually pass the entry point and load address of the payload binary
with add-flat-binary.

We primarily use the "u-boot.elf" which gets build with the REMAKE_ELF
option, as it also has the necessary device-tree binary that U-Boot
usually needs to work. When the option is not set (e.g. for QEMU), we
need to use the "u-boot" file which is an ELF.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
btrfsvols
Alper Nebi Yasak 2023-10-13 22:41:15 +03:00
parent 65af756fc3
commit eb267733fa
2 changed files with 5 additions and 4 deletions

View File

@ -1,3 +1,4 @@
u-boot
u-boot.bin u-boot.bin
u-boot.dtb u-boot.dtb
u-boot.img u-boot.img

View File

@ -3,7 +3,7 @@
# SPDX-FileCopyrightText: 2014-2016,2020,2021,2023 Leah Rowe <leah@libreboot.org> # SPDX-FileCopyrightText: 2014-2016,2020,2021,2023 Leah Rowe <leah@libreboot.org>
# SPDX-FileCopyrightText: 2021,2022 Ferass El Hafidi <vitali64pmemail@protonmail.com> # SPDX-FileCopyrightText: 2021,2022 Ferass El Hafidi <vitali64pmemail@protonmail.com>
# SPDX-FileCopyrightText: 2022 Caleb La Grange <thonkpeasant@protonmail.com> # SPDX-FileCopyrightText: 2022 Caleb La Grange <thonkpeasant@protonmail.com>
# SPDX-FileCopyrightText: 2022 Alper Nebi Yasak <alpernebiyasak@gmail.com> # SPDX-FileCopyrightText: 2022-2023 Alper Nebi Yasak <alpernebiyasak@gmail.com>
# SPDX-FileCopyrightText: 2023 Riku Viitanen <riku.viitanen@protonmail.com> # SPDX-FileCopyrightText: 2023 Riku Viitanen <riku.viitanen@protonmail.com>
[ "x${DEBUG+set}" = 'xset' ] && set -v [ "x${DEBUG+set}" = 'xset' ] && set -v
@ -187,8 +187,8 @@ build_dependency_uboot()
x_ ./update project trees -b u-boot ${board} x_ ./update project trees -b u-boot ${board}
ubdir="elf/u-boot/${board}/${uboot_config}" ubdir="elf/u-boot/${board}/${uboot_config}"
ubootelf="${ubdir}/u-boot.elf" ubootelf="${ubdir}/u-boot.elf"
[ ! -f "${ubootelf}" ] && [ -f "${ubdir}/u-boot.bin" ] && \ [ ! -f "${ubootelf}" ] && [ -f "${ubdir}/u-boot" ] && \
ubootelf="${ubdir}/u-boot.bin" ubootelf="${ubdir}/u-boot"
[ -f "${ubootelf}" ] && return 0 [ -f "${ubootelf}" ] && return 0
err "Could not find u-boot build for board, ${board}" err "Could not find u-boot build for board, ${board}"
} }
@ -369,7 +369,7 @@ mkUbootRom() {
_ubdir="elf/u-boot/${board}/${uboot_config}" _ubdir="elf/u-boot/${board}/${uboot_config}"
_ubootelf="${_ubdir}/u-boot.elf" _ubootelf="${_ubdir}/u-boot.elf"
[ -f "${_ubootelf}" ] || _ubootelf="${_ubdir}/u-boot.bin" [ -f "${_ubootelf}" ] || _ubootelf="${_ubdir}/u-boot"
[ -f "${_ubootelf}" ] || err "mkUbootRom: ${board}: cant find u-boot" [ -f "${_ubootelf}" ] || err "mkUbootRom: ${board}: cant find u-boot"
tmprom=$(mktemp -t coreboot_rom.XXXXXXXXXX) tmprom=$(mktemp -t coreboot_rom.XXXXXXXXXX)