packages: seabios: fix payload not being added to the GNU Boot image

A bug has been introduced in

    a202dce646
    ("images: remove 'libgfxinit' from the image names.")

where we simplified images names without taking care of renaming the filename
used as the SeaBIOS build target.

This error was visible during the generation of the images:

    Creating new ROM image: bin/[...]/seabios_kgpe-d16-[...].rom
    payload/seabios/seabios.elf: No such file or directory
    E: Could not load file 'payload/seabios/seabios.elf'.
    E: Failed while operating on 'COREBOOT' region!
    E: The image will be left unmodified.

The resulting image was then missing a payload entry and was then
non-functional (people would then just get a black screen without any OS loaded
from the disk).

GNUtoo confirmed by bisecting that the commit cited above was indeed responsible
of the bug and also that the error message above was specific to this issue.

This commit fixes this bug by setting variables to hold the actual payload
location (making future changes easier), in the relevant files.

Tested-by: Adrien 'neox' Bourmault <neox@gnu.org>
Signed-off-by: Adrien 'neox' Bourmault <neox@gnu.org>
GNUtoo: Added "Created new ROM image" log, made it fit,
        improved source code comment.
Acked-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
This commit is contained in:
Adrien Bourmault 2024-11-28 23:40:16 +01:00 committed by Denis 'GNUtoo' Carikli
parent d80a69e47c
commit b7e7b5a257
Signed by: GNUtoo
GPG Key ID: 5F5DFCC14177E263
2 changed files with 20 additions and 5 deletions

View File

@ -134,6 +134,13 @@ if [ "${board}" != "${cbtree}" ]; then
fi
cbfstool="${cbdir}/util/cbfstool/cbfstool"
corebootrom="${cbdir}/build/coreboot.rom"
# seabios.elf and seavgabios.bin are produced by
# resources/packages/seabios/payload, which also hardcode their paths
# in the same way and in the same variable names, so the variable
# below need to be kept in sync with
# the ones in resources/packages/seabios/payload.
seabiosrom="payload/seabios/seabios.elf"
seavgabiosrom="payload/seabios/seavgabios.bin"
if [ ! -d "${cbdir}" ]; then
@ -164,7 +171,7 @@ if [ ! -f "${cbfstool}" ]; then
fi
if [ ! -f "${seavgabiosrom}" ] \
|| [ ! -f payload/seabios/seabios_libgfxinit.elf ]; then
|| [ ! -f ${seabiosrom} ]; then
if [ "${payload_seabios}" = "y" ]; then
./build payload seabios
elif [ "${payload_grub}" = "y" ] \
@ -284,8 +291,8 @@ make_seabios_rom() {
# etc/pci-optionrom-exec will be set to 2
# etc/pci-optionrom-exec will be set to 0
target_seabioself="payload/seabios/seabios.elf"
target_seavgabios_rom="payload/seabios/seavgabios.bin"
target_seabioself="${seabiosrom}"
target_seavgabios_rom="${seavgabiosrom}"
tmprom=$(mktemp -t coreboot_rom.XXXXXXXXXX)

View File

@ -24,6 +24,14 @@ set -u -e
# Build SeaBIOS
# ---------------------------------------------------------------------
# seabios.elf and seavgabios.bin are reused by
# resources/packages/roms_helper/boot, and their path is also
# hardcoded, in the same way, in the same variable names, so if you
# modify the variables below also keep
# resources/packages/roms_helper/boot in sync.
seabiosrom="../payload/seabios/seabios.elf"
seavgabiosrom="../payload/seabios/seavgabios.bin"
printf "Building SeaBIOS payloads and SeaVGABIOS\n"
[ ! -d "payload/" ] && mkdir -p payload/
@ -42,8 +50,8 @@ cd seabios/
cp ../resources/seabios/config/libgfxinit .config
make silentoldconfig -j$(nproc)
make -j$(nproc)
mv out/bios.bin.elf ../payload/seabios/seabios_libgfxinit.elf
mv out/vgabios.bin ../payload/seabios/seavgabios.bin
mv out/bios.bin.elf ${seabiosrom}
mv out/vgabios.bin ${seavgabiosrom}
rm .config
# clean it again. gotta keep it clean!