summaryrefslogtreecommitdiff
path: root/script/roms
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2024-06-20 02:58:59 +0100
committerLeah Rowe <leah@libreboot.org>2024-06-20 02:58:59 +0100
commit47112968411558bc832a867c1b7bc90884eded75 (patch)
treeea3f47935118d9d91a0356c13906de21a3024f4a /script/roms
parent5a4fc97c63956f5069f5687f6b72c41bf0a3c4c0 (diff)
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.
Diffstat (limited to 'script/roms')
-rwxr-xr-xscript/roms37
1 files changed, 22 insertions, 15 deletions
diff --git a/script/roms b/script/roms
index 2f90653f..c992b447 100755
--- a/script/roms
+++ b/script/roms
@@ -53,7 +53,7 @@ main()
for x in $boards; do
[ -n "$ser" ] && mkserprogfw "$ser" "$x"
[ -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
done
@@ -120,6 +120,12 @@ configure_target()
[ "$payload_uboot" = "y" ] || payload_uboot="n"
[ -n "$uboot_config" ] || uboot_config="default"
+ [ "$xbmk_release" = "y" ] && [ "$release" = "n" ] && return 1
+ [ "$board" = "$tree" ] && return 1; return 0
+}
+
+build_payloads()
+{
romdir="bin/$board"
cbdir="src/coreboot/$board"
[ "$board" = "$tree" ] || cbdir="src/coreboot/$tree"
@@ -127,9 +133,20 @@ configure_target()
cbrom="$cbdir/build/coreboot.rom"
[ -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
- [ "$board" = "$tree" ] && return 1; return 0
+ if [ "$payload_grub" = "y" ] || [ "$payload_seabios_withgrub" = "y" ] \
+ || [ "$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()
@@ -162,8 +179,8 @@ build_roms()
cbrom="$(mktemp -t coreboot_rom.XXXXXXXXXX)"
x_ cp "$_cbrom" "$cbrom"
- [ "$payload_memtest" = "y" ] && x_ ./update trees -b memtest86plus && \
- cbfs "$cbrom" "elf/memtest86plus/memtest.bin" img/memtest
+ [ "$payload_memtest" != "y" ] || cbfs "$cbrom"
+ "elf/memtest86plus/memtest.bin" img/memtest
[ "$payload_seabios" = "y" ] && build_seabios_roms
[ "$payload_grub" != "y" ] || build_grub_roms "$cbrom" "grub"
[ "$payload_uboot" = "y" ] && x_ cp "$_cbrom" "$cbrom" && \
@@ -193,8 +210,6 @@ build_grub_roms()
tmprom="$1"
payload1="$2" # allow values: grub, seabios, seabios_withgrub
- x_ ./update trees -b grub $grubtree
-
grub_cbfs="fallback/payload"
if [ "$payload1" = "grub" ] && [ "$payload_grub_withseabios" = "y" ]
then
@@ -233,8 +248,6 @@ mkSeabiosRom() {
tmprom="$(mktemp -t coreboot_rom.XXXXXXXXXX)" # 1=cbrom, 2=cbfs path
_seabioself="elf/seabios/default/$initmode/bios.bin.elf"
- x_ ./update trees -b seabios
-
x_ cp "$1" "$tmprom"
cbfs "$tmprom" "$_seabioself" "$2"
x_ "$cbfstool" "$tmprom" add-int -i 3000 -n etc/ps2-keyboard-spinup
@@ -250,12 +263,6 @@ mkSeabiosRom() {
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)"
newrom="$romdir/uboot_payload_${board}_${initmode}_$displaymode.rom"
x_ cp "$cbrom" "$tmprom"