summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/rom.sh61
-rw-r--r--include/tree.sh38
2 files changed, 66 insertions, 33 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
}
diff --git a/include/tree.sh b/include/tree.sh
index 19060110..cb406233 100644
--- a/include/tree.sh
+++ b/include/tree.sh
@@ -35,6 +35,7 @@ cmakedir=""
defconfig=""
postmake=""
mkhelpercfg=""
+if_dry_build=":"
if_not_dry_build=""
dest_dir=""
mdir=""
@@ -73,6 +74,7 @@ trees()
# and $if_not_dry_build is prefixed to skipped commands
if_not_dry_build=":"
+ if_dry_build=""
;;
-b) : ;;
-u) mode="oldconfig" ;;
@@ -82,10 +84,12 @@ trees()
-f) # download source code for a project
do_make="n" # lets us know not to build anything
if_not_dry_build=":"
+ if_dry_build=""
;;
-F) # same as -F, but don't skip git fetch/pull on cache
do_make="n" # lets us know not to build anything
if_not_dry_build=":"
+ if_dry_build=""
forcepull="y"
;;
-s) mode="savedefconfig" ;;
@@ -236,9 +240,10 @@ handle_defconfig()
if [ -z "$mode" ]; then
for _xarch in $xarch; do
+ $if_dry_build \
+ break
if [ -n "$_xarch" ]; then
- $if_not_dry_build \
- check_cross_compiler "$_xarch"
+ check_cross_compiler "$_xarch"
fi
done; :
fi
@@ -625,7 +630,9 @@ check_defconfig()
# skip build if a previous one exists:
- if ! $if_not_dry_build elfcheck; then
+ $if_dry_build \
+ return 0
+ if ! elfcheck; then
return 1
fi
}
@@ -697,25 +704,26 @@ run_make_command()
fi
if [ "$mode" = "clean" ]; then
- $if_not_dry_build \
- make -C "$srcdir" $cleanargs distclean || \
- $if_not_dry_build \
- x_ make -C "$srcdir" $cleanargs clean; :
+ $if_dry_build \
+ return 0
+ if ! make -C "$srcdir" $cleanargs distclean; then
+ x_ make -C "$srcdir" $cleanargs clean
+ fi
fi
}
check_cmake()
{
- if [ -n "$cmakedir" ]; then
- if ! $if_not_dry_build check_makefile "$1"; then
- if ! cmake -B "$1" "$1/$cmakedir"; then
- $if_not_dry_build \
- x_ check_makefile "$1"
- fi
+ $if_dry_build \
+ return 0
+ if [ ! -n "$cmakedir" ]; then
+ return 0
+ elif ! check_makefile "$1"; then
+ if ! cmake -B "$1" "$1/$cmakedir"; then
+ x_ check_makefile "$1"
fi
- $if_not_dry_build \
- x_ check_makefile "$1"; :
fi
+ x_ check_makefile "$1"; :
}
check_autoconf()