summaryrefslogtreecommitdiff
path: root/include/rom.sh
diff options
context:
space:
mode:
Diffstat (limited to 'include/rom.sh')
-rw-r--r--include/rom.sh61
1 files changed, 43 insertions, 18 deletions
diff --git a/include/rom.sh b/include/rom.sh
index 2efe4919..8cb0f318 100644
--- a/include/rom.sh
+++ b/include/rom.sh
@@ -25,9 +25,8 @@ buildser()
copyps1bios()
{
- if [ "$if_not_dry_build" = ":" ]; then
+ $if_dry_build \
return 0
- fi
remkdir "bin/playstation"
x_ cp src/pcsx-redux/src/mips/openbios/openbios.bin bin/playstation
@@ -45,9 +44,8 @@ mkpayload_grub()
grub_modules=""
grub_install_modules=""
- if [ "$if_not_dry_build" = ":" ]; then
+ $if_dry_build \
return 0
- fi
. "$grubdata/module/$tree" || \
err "Can't read '$grubdata/module/$tree'" "mkpayload_grub" "$@"
@@ -175,6 +173,9 @@ mkcorebootbin_real()
initmode="${initmode%%_*}"
cbfstool="elf/coreboot/$tree/cbfstool"
+ # cbfstool option backends, if they exist
+ cbfscfg="config/coreboot/$target/cbfs.cfg"
+
elfrom="elf/coreboot/$tree/$target/$initmode"
if [ -n "$displaymode" ]; then
elfrom="${elfrom}_$displaymode"
@@ -232,24 +233,47 @@ mkcorebootbin_real()
payload_grubsea="n"
fi
- if $if_not_dry_build grep "CONFIG_PAYLOAD_NONE=y" "$defconfig"; then
+ $if_dry_build \
+ return 0
+
+ if [ -f "$cbfscfg" ]; then
+ dx_ add_cbfs_option "$cbfscfg"
+ fi
+
+ if grep "CONFIG_PAYLOAD_NONE=y" "$defconfig"; then
if [ "$payload_seabios" = "y" ]; then
pname="seabios"
- $if_not_dry_build \
- add_seabios
+ add_seabios
fi
if [ "$payload_uboot" = "arm64" ]; then
pname="uboot"
- $if_not_dry_build \
- add_uboot
+ add_uboot
fi
else
pname="custom"
- $if_not_dry_build \
- cprom
+ cprom
fi; :
}
+# options for cbfs backend (as opposed to nvram/smmstore):
+
+add_cbfs_option()
+{
+ # TODO: input sanitization (currently mitigated by careful config)
+
+ op_name="`printf "%s\n" "$1" | awk '{print $1}'`"
+ op_arg="`printf "%s\n" "$1" | awk '{print $2}'`"
+
+ if [ -z "$op_name" ] || [ -z "$op_arg" ]; then
+ return 0
+ fi
+
+ ( x_ "$cbfstool" "$tmprom" remove -n "option/$op_name" 1>/dev/null \
+ 2>/dev/null ) || :
+
+ x_ "$cbfstool" "$tmprom" add-int -i "$op_arg" -n "option/$op_name"
+}
+
# in our design, SeaBIOS is also responsible for starting either
# a GRUB or U-Boot payload. this is because SeaBIOS is generally
# a more reliable codebase, so it's less likely to cause a brick
@@ -477,13 +501,14 @@ cbfs()
mkcoreboottar()
{
- if [ "$target" != "$tree" ] && [ "$XBMK_RELEASE" = "y" ] && \
- [ "$release" != "n" ]; then
-
- $if_not_dry_build \
- mkrom_tarball "bin/$target"
+ $if_dry_build \
+ return 0
- $if_not_dry_build \
- x_ ./mk inject "bin/${relname}_${target}.tar.xz" nuke
+ if [ "$target" = "$tree" ] || [ "$XBMK_RELEASE" != "y" ] || \
+ [ "$release" = "n" ]; then
+ return 0
fi
+
+ mkrom_tarball "bin/$target"
+ x_ ./mk inject "bin/${relname}_${target}.tar.xz" nuke
}