roms: remove build_payloads() and split it up

payloads are compiled before coreboot, but it doesn't matter
to the build speed whether this is done first.

reduce the lines of code by checking payload builds *while*
adding them to the coreboot images. this means that coreboot
is now compiled first, before the payloads.

Signed-off-by: Leah Rowe <leah@libreboot.org>
audit2
Leah Rowe 2024-06-19 00:39:15 +01:00 committed by Leah Rowe
parent da3d7c7101
commit 14a05f72fb
1 changed files with 15 additions and 22 deletions

View File

@ -41,7 +41,7 @@ main()
$err "Cannot generate list of boards for building" $err "Cannot generate list of boards for building"
for x in $boards; do for x in $boards; do
[ -d "config/coreboot/$x/config" ] && configure_target "$x" \ [ -d "config/coreboot/$x/config" ] && configure_target "$x" \
&& build_payloads && build_board && [ -d "bin/$board" ] \ && build_board && [ -d "bin/$board" ] \
&& targets="$targets, $x"; continue && targets="$targets, $x"; continue
done done
@ -125,12 +125,6 @@ configure_target()
[ "$payload_uboot" = "y" ] || payload_uboot="n" [ "$payload_uboot" = "y" ] || payload_uboot="n"
[ -n "$uboot_config" ] || uboot_config="default" [ -n "$uboot_config" ] || uboot_config="default"
[ "$xbmk_release" = "y" ] && [ "$release" = "n" ] && return 1
[ "$board" = "$tree" ] && return 1; return 0
}
build_payloads()
{
romdir="bin/$board" romdir="bin/$board"
cbdir="src/coreboot/$board" cbdir="src/coreboot/$board"
[ "$board" = "$tree" ] || cbdir="src/coreboot/$tree" [ "$board" = "$tree" ] || cbdir="src/coreboot/$tree"
@ -138,20 +132,9 @@ build_payloads()
cbrom="$cbdir/build/coreboot.rom" cbrom="$cbdir/build/coreboot.rom"
[ -f "$cbfstool" ] || x_ ./update trees -b coreboot utils $tree [ -f "$cbfstool" ] || x_ ./update trees -b coreboot utils $tree
[ "$payload_memtest" = "y" ] && x_ ./update trees -b memtest86plus
[ "$payload_seabios" = "y" ] && x_ ./update trees -b seabios
if [ "$payload_grub" = "y" ] || [ "$payload_seabios_withgrub" = "y" ] \ [ "$xbmk_release" = "y" ] && [ "$release" = "n" ] && return 1
|| [ "$payload_seabios_grubonly" = "y" ]; then [ "$board" = "$tree" ] && return 1; return 0
[ -f "$grubelf" ] || x_ ./update trees -b grub $grubtree
fi
[ "$payload_uboot" = "y" ] || return 0
x_ ./update trees -b u-boot $board
ubdir="elf/u-boot/$board/$uboot_config"
ubootelf="$ubdir/u-boot.elf" && [ ! -f "$ubootelf" ] && \
ubootelf="$ubdir/u-boot"
[ -f "$ubootelf" ] || $err "$board: Can't find u-boot"; return 0
} }
build_board() build_board()
@ -184,8 +167,8 @@ build_roms()
cbrom="$(mktemp -t coreboot_rom.XXXXXXXXXX)" cbrom="$(mktemp -t coreboot_rom.XXXXXXXXXX)"
x_ cp "$_cbrom" "$cbrom" x_ cp "$_cbrom" "$cbrom"
[ "$payload_memtest" != "y" ] || cbfs "$cbrom" [ "$payload_memtest" = "y" ] && x_ ./update trees -b memtest86plus && \
"elf/memtest86plus/memtest.bin" img/memtest cbfs "$cbrom" "elf/memtest86plus/memtest.bin" img/memtest
[ "$payload_seabios" = "y" ] && build_seabios_roms [ "$payload_seabios" = "y" ] && build_seabios_roms
[ "$payload_grub" != "y" ] || build_grub_roms "$cbrom" "grub" [ "$payload_grub" != "y" ] || build_grub_roms "$cbrom" "grub"
[ "$payload_uboot" = "y" ] || return 0 [ "$payload_uboot" = "y" ] || return 0
@ -216,6 +199,8 @@ build_grub_roms()
tmprom="$1" tmprom="$1"
payload1="$2" # allow values: grub, seabios, seabios_withgrub payload1="$2" # allow values: grub, seabios, seabios_withgrub
x_ ./update trees -b grub $grubtree
grub_cbfs="fallback/payload" grub_cbfs="fallback/payload"
if [ "$payload1" = "grub" ] && [ "$payload_grub_withseabios" = "y" ] if [ "$payload1" = "grub" ] && [ "$payload_grub_withseabios" = "y" ]
then then
@ -260,6 +245,8 @@ mkSeabiosRom() {
tmprom="$(mktemp -t coreboot_rom.XXXXXXXXXX)" # 1=cbrom, 2=cbfs path tmprom="$(mktemp -t coreboot_rom.XXXXXXXXXX)" # 1=cbrom, 2=cbfs path
_seabioself="elf/seabios/default/$initmode/bios.bin.elf" _seabioself="elf/seabios/default/$initmode/bios.bin.elf"
x_ ./update trees -b seabios
x_ cp "$1" "$tmprom" x_ cp "$1" "$tmprom"
cbfs "$tmprom" "$_seabioself" "$2" cbfs "$tmprom" "$_seabioself" "$2"
x_ "$cbfstool" "$tmprom" add-int -i 3000 -n etc/ps2-keyboard-spinup x_ "$cbfstool" "$tmprom" add-int -i 3000 -n etc/ps2-keyboard-spinup
@ -275,6 +262,12 @@ mkSeabiosRom() {
build_uboot_roms() build_uboot_roms()
{ {
x_ ./update trees -b u-boot $board
ubdir="elf/u-boot/$board/$uboot_config"
ubootelf="$ubdir/u-boot.elf" && [ ! -f "$ubootelf" ] && \
ubootelf="$ubdir/u-boot"
[ -f "$ubootelf" ] || $err "$board: Can't find u-boot"
tmprom="$(mktemp -t coreboot_rom.XXXXXXXXXX)" tmprom="$(mktemp -t coreboot_rom.XXXXXXXXXX)"
newrom="$romdir/uboot_payload_${board}_${initmode}_$displaymode.rom" newrom="$romdir/uboot_payload_${board}_${initmode}_$displaymode.rom"
x_ cp "$cbrom" "$tmprom" x_ cp "$cbrom" "$tmprom"