Revert "roms: remove build_payloads() and split it up"

This reverts commit 3610667e3db08ff1db4f7784ff5a879d8aebce9d.

The output of some functions in the roms script are used as
an argument in cp and mv commands, also cbfstool. I overlooked
this fact in a previous code optimisation.

Revert it. The change only reduced sloccount by a few lines
anyway.
audit2
Leah Rowe 2024-06-20 02:58:59 +01:00 committed by Leah Rowe
parent 448d02babb
commit 253015f6a9
1 changed files with 22 additions and 15 deletions

View File

@ -53,7 +53,7 @@ main()
for x in $boards; do for x in $boards; do
[ -n "$ser" ] && mkserprogfw "$ser" "$x" [ -n "$ser" ] && mkserprogfw "$ser" "$x"
[ -z "$ser" ] && [ -d "config/coreboot/$x/config" ] && \ [ -z "$ser" ] && [ -d "config/coreboot/$x/config" ] && \
configure_target "$x" && build_board && \ configure_target "$x" && build_payloads && build_board && \
[ -d "bin/$board" ] && targets="$targets, $x"; continue [ -d "bin/$board" ] && targets="$targets, $x"; continue
done done
@ -120,6 +120,12 @@ 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"
@ -127,9 +133,20 @@ configure_target()
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
[ "$xbmk_release" = "y" ] && [ "$release" = "n" ] && return 1 if [ "$payload_grub" = "y" ] || [ "$payload_seabios_withgrub" = "y" ] \
[ "$board" = "$tree" ] && return 1; return 0 || [ "$payload_seabios_grubonly" = "y" ]; then
[ -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()
@ -162,8 +179,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" ] && x_ ./update trees -b memtest86plus && \ [ "$payload_memtest" != "y" ] || cbfs "$cbrom"
cbfs "$cbrom" "elf/memtest86plus/memtest.bin" img/memtest "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" ] && x_ cp "$_cbrom" "$cbrom" && \ [ "$payload_uboot" = "y" ] && x_ cp "$_cbrom" "$cbrom" && \
@ -193,8 +210,6 @@ 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
@ -233,8 +248,6 @@ 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
@ -250,12 +263,6 @@ 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"