xbmk: cleanup of recent code refactoring

be a bit less pedantic about if else clauses. leave the
big ones still with then on separate lines, where else
is specified.

also unroll a few condensed code lines where i missed
a few.

sloccount 2303 in lbmk. that's still only slightly bigger
than libreboot 20260907 which was 2180, and still much
smaller than libreboot 20230625 which was 3322.

this is *without* the condensed codelines, so now the only
thing that's reduced is the overall amount of logic present
in the build system.

and i should clarify that lbmk is presently much more powerful
than both of those two versions (20160907/20230625).

the 2016 one is useful for comparison historically, since that
was the last major version of libreboot prior to the great
second coming of leah in 2021; and the 2023 june release was
basically the last one before the great audits of 2023 to
2025 began.

not to brag (not much anyway), but all of this means that lbmk
is an insanely efficient build system, considering all the
features it has and what it does.

i unrolled the condensed code style in lbmk, making the scripts
a lot easier to read, because i received complainst about the
condensed style previously used; nicholas chin and alper nebi
yasak both told me that it sucked, and riku viitanen had hinted
at that same fact several months prior.

so hopefully now, lbmk is a bit nicer. those and other people
often find it challenging to challenge me because for reason
they assume i'll get upset and fly off the handle, but it's the
opposite. i want constant criticism, so that i know to improve!

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2025-09-24 13:19:23 +01:00
parent 03bf6c185b
commit 8347e2c85d
7 changed files with 195 additions and 313 deletions
+6 -2
View File
@@ -375,8 +375,12 @@ pybin()
pypath="$(findpath \ pypath="$(findpath \
"$(command -v "$1" 2>/dev/null)" 2>/dev/null || :)" "$(command -v "$1" 2>/dev/null)" 2>/dev/null || :)"
[ -e "$pypath" ] && [ ! -d "$pypath" ] && \
[ -x "$pypath" ] && printf "%s\n" "$pypath" && return 0; : if [ -e "$pypath" ] && [ ! -d "$pypath" ] && \
[ -x "$pypath" ]; then
printf "%s\n" "$pypath"
return 0
fi
fi fi
# if python venv: fall back to common PATH directories for checking # if python venv: fall back to common PATH directories for checking
+2 -3
View File
@@ -94,8 +94,7 @@ setvars()
fi fi
val="$1" val="$1"
shift 1 shift 1
while [ $# -gt 0 ] while [ $# -gt 0 ]; do
do
printf "%s=\"%s\"\n" "$1" "$val" printf "%s=\"%s\"\n" "$1" "$val"
shift 1 shift 1
done done
@@ -165,7 +164,7 @@ unpad_one_byte()
err "can't increment file size" "unpad_one_byte" "$@" err "can't increment file size" "unpad_one_byte" "$@"
if [ $xromsize -lt 524288 ]; then if [ $xromsize -lt 524288 ]; then
err "too small, $xromsize: $1" "unpad_one_byte" "$@" err "too small, $xromsize: $1" "unpad_one_byte" "$@"
fi fi
unpaddedfile="`mktemp || err "mktemp unpad_one_byte"`" || \ unpaddedfile="`mktemp || err "mktemp unpad_one_byte"`" || \
+1 -3
View File
@@ -21,8 +21,7 @@ extract_refcode()
-m x86 -n fallback/refcode -f "$appdir/ref" -r RO_SECTION -m x86 -n fallback/refcode -f "$appdir/ref" -r RO_SECTION
# enable the Intel GbE device, if told by offset MRC_refcode_gbe # enable the Intel GbE device, if told by offset MRC_refcode_gbe
if [ -n "$MRC_refcode_gbe" ] if [ -n "$MRC_refcode_gbe" ]; then
then
x_ dd if="config/ifd/hp820g2/1.bin" of="$appdir/ref" bs=1 \ x_ dd if="config/ifd/hp820g2/1.bin" of="$appdir/ref" bs=1 \
seek=$MRC_refcode_gbe count=1 conv=notrunc; : seek=$MRC_refcode_gbe count=1 conv=notrunc; :
fi fi
@@ -36,7 +35,6 @@ extract_mrc()
SHELLBALL="chromeos-firmwareupdate-$MRC_board" SHELLBALL="chromeos-firmwareupdate-$MRC_board"
( (
x_ cd "$appdir" x_ cd "$appdir"
extract_partition "${MRC_url##*/}" extract_partition "${MRC_url##*/}"
extract_archive "$SHELLBALL" . extract_archive "$SHELLBALL" .
+18 -23
View File
@@ -9,22 +9,23 @@ release()
reldir="release" reldir="release"
while getopts m: option while getopts m: option; do
do if [ -z "$OPTARG" ]; then
if [ -z "$OPTARG" ]
then
err "empty argument not allowed" "release" "$@" err "empty argument not allowed" "release" "$@"
fi fi
case "$option" in case "$option" in
m) relmode="$OPTARG" ;; m)
*) err "invalid option '-$option'" "release" "$@" ;; relmode="$OPTARG"
;;
*)
err "invalid option '-$option'" "release" "$@"
;;
esac esac
done done
reldest="$reldir/$version" reldest="$reldir/$version"
if [ -e "$reldest" ] if [ -e "$reldest" ]; then
then
err "already exists: \"$reldest\"" "release" "$@" err "already exists: \"$reldest\"" "release" "$@"
fi fi
@@ -40,8 +41,7 @@ release()
prep_release src prep_release src
prep_release tarball prep_release tarball
if [ "$relmode" != "src" ] if [ "$relmode" != "src" ]; then
then
prep_release bin prep_release bin
fi fi
x_ rm -Rf "$rsrc" x_ rm -Rf "$rsrc"
@@ -56,9 +56,7 @@ release()
prep_release() prep_release()
{ {
( (
if [ "$1" != "tarball" ]; then
if [ "$1" != "tarball" ]
then
x_ cd "$rsrc" x_ cd "$rsrc"
fi fi
@@ -74,19 +72,15 @@ prep_release_src()
fx_ "x_ rm -Rf" x_ find . -name ".git" fx_ "x_ rm -Rf" x_ find . -name ".git"
fx_ "x_ rm -Rf" x_ find . -name ".gitmodules" fx_ "x_ rm -Rf" x_ find . -name ".gitmodules"
( ( fx_ nuke x_ find config -type f -name "nuke.list" ) || \
err "can't prune project files" "prep_release_src" "$@"; :
fx_ nuke x_ find config -type f -name "nuke.list"
) || err "can't prune project files" "prep_release_src" "$@"; :
} }
nuke() nuke()
{ {
r="$rsrc/src/${1#config/}" r="$rsrc/src/${1#config/}"
if [ -d "${r%/*}" ] if [ -d "${r%/*}" ]; then
then
x_ cd "${r%/*}" x_ cd "${r%/*}"
dx_ "eval [ -L \"\$fx\" ] || x_ rm -Rf" "$rsrc/$1" dx_ "eval [ -L \"\$fx\" ] || x_ rm -Rf" "$rsrc/$1"
@@ -103,7 +97,6 @@ prep_release_tarball()
x_ rm -Rf "$rsrc/cache" "$rsrc/xbmkwd" x_ rm -Rf "$rsrc/cache" "$rsrc/xbmkwd"
( (
x_ cd "${rsrc%/*}" x_ cd "${rsrc%/*}"
x_ mktarball "${rsrc##*/}" "${rsrc##*/}.tar.xz" x_ mktarball "${rsrc##*/}" "${rsrc##*/}.tar.xz"
@@ -114,8 +107,10 @@ prep_release_bin()
{ {
x_ ./mk -d coreboot x_ ./mk -d coreboot
fx_ "x_ ./mk -b" printf \ x_ ./mk -b coreboot
"coreboot\npico-serprog\nstm32-vserprog\npcsx-redux\n" x_ ./mk -b pico-serprog
x_ ./mx -b stm32-vserprog
x_ ./mk -b pcsx-redux
fx_ mkrom_tarball x_ find bin -maxdepth 1 -type d -name "serprog_*" fx_ mkrom_tarball x_ find bin -maxdepth 1 -type d -name "serprog_*"
+65 -121
View File
@@ -9,13 +9,11 @@ grubdata="config/data/grub"
buildser() buildser()
{ {
if [ "$1" = "pico" ] if [ "$1" = "pico" ]; then
then
x_ cmake -DPICO_BOARD="$2" \ x_ cmake -DPICO_BOARD="$2" \
-DPICO_SDK_PATH="$picosdk" -B "$sersrc/build" "$sersrc" && \ -DPICO_SDK_PATH="$picosdk" -B "$sersrc/build" "$sersrc" && \
x_ cmake --build "$sersrc/build" x_ cmake --build "$sersrc/build"
elif [ "$1" = "stm32" ] elif [ "$1" = "stm32" ]; then
then
x_ make -C "$sersrc" libopencm3-just-make \ x_ make -C "$sersrc" libopencm3-just-make \
BOARD=$2 && x_ make -C "$sersrc" BOARD=$2 BOARD=$2 && x_ make -C "$sersrc" BOARD=$2
fi fi
@@ -26,8 +24,7 @@ buildser()
copyps1bios() copyps1bios()
{ {
if [ "$dry" = ":" ] if [ "$dry" = ":" ]; then
then
return 0 return 0
fi fi
@@ -61,8 +58,7 @@ mkpayload_grub()
corebootpremake() corebootpremake()
{ {
if [ "$XBMK_RELEASE" = "y" ] && [ "$release" = "n" ] if [ "$XBMK_RELEASE" = "y" ] && [ "$release" = "n" ]; then
then
return 0 return 0
fi fi
@@ -72,16 +68,14 @@ corebootpremake()
printf "%s\n" "${version%%-*}" > "$srcdir/.coreboot-version" || \ printf "%s\n" "${version%%-*}" > "$srcdir/.coreboot-version" || \
err "!mk $srcdir .coreboot-version" "corebootpremake" "$@" err "!mk $srcdir .coreboot-version" "corebootpremake" "$@"
if [ -z "$mode" ] && [ "$target" != "$tree" ] if [ -z "$mode" ] && [ "$target" != "$tree" ]; then
then
x_ ./mk download "$target" x_ ./mk download "$target"
fi fi
} }
cook_coreboot_config() cook_coreboot_config()
{ {
if [ -z "$mode" ] && [ -f "$srcdir/.config" ] if [ -z "$mode" ] && [ -f "$srcdir/.config" ]; then
then
printf "CONFIG_CCACHE=y\n" >> "$srcdir/.config" || \ printf "CONFIG_CCACHE=y\n" >> "$srcdir/.config" || \
err "can't cook '$srcdir'" "cook_coreboot_config" "$@" err "can't cook '$srcdir'" "cook_coreboot_config" "$@"
fi fi
@@ -89,12 +83,10 @@ cook_coreboot_config()
check_coreboot_util() check_coreboot_util()
{ {
if [ "$badhash" = "y" ] if [ "$badhash" = "y" ]; then
then
x_ rm -f "elf/coreboot/$tree/$1" x_ rm -f "elf/coreboot/$tree/$1"
fi fi
if e "elf/coreboot/$tree/$1" f if e "elf/coreboot/$tree/$1" f; then
then
return 0 return 0
fi fi
@@ -102,28 +94,25 @@ check_coreboot_util()
utilsrcdir="src/coreboot/$tree/util/$1" utilsrcdir="src/coreboot/$tree/util/$1"
utilmode="" utilmode=""
if [ -n "$mode" ] if [ -n "$mode" ]; then
then
utilmode="clean" utilmode="clean"
fi fi
x_ make -C "$utilsrcdir" $utilmode -j$XBMK_THREADS $makeargs x_ make -C "$utilsrcdir" $utilmode -j$XBMK_THREADS $makeargs
if [ -n "$mode" ] if [ -n "$mode" ]; then
then # TODO: is this rm command needed?
x_ rm -Rf "$utilelfdir" # TODO: is this needed?
x_ rm -Rf "$utilelfdir"
return 0 return 0
fi elif [ -n "$mode" ] || [ -f "$utilelfdir/$1" ]; then
if [ -n "$mode" ] || [ -f "$utilelfdir/$1" ]
then
return 0 return 0
fi fi
x_ mkdir -p "$utilelfdir" x_ mkdir -p "$utilelfdir"
x_ cp "$utilsrcdir/$1" "$utilelfdir" x_ cp "$utilsrcdir/$1" "$utilelfdir"
if [ "$1" = "cbfstool" ] if [ "$1" = "cbfstool" ]; then
then
x_ cp "$utilsrcdir/rmodtool" "$utilelfdir" x_ cp "$utilsrcdir/rmodtool" "$utilelfdir"
fi fi
} }
@@ -131,8 +120,7 @@ check_coreboot_util()
coreboot_pad_one_byte() coreboot_pad_one_byte()
{ {
# TODO: why is this if block here? can i remove it? # TODO: why is this if block here? can i remove it?
if [ "$XBMK_RELEASE" = "y" ] && [ "$release" = "n" ] if [ "$XBMK_RELEASE" = "y" ] && [ "$release" = "n" ]; then
then
return 0 return 0
fi fi
@@ -141,16 +129,14 @@ coreboot_pad_one_byte()
mkcorebootbin() mkcorebootbin()
{ {
if [ "$XBMK_RELEASE" = "y" ] && [ "$release" = "n" ] if [ "$XBMK_RELEASE" = "y" ] && [ "$release" = "n" ]; then
then
return 0 return 0
fi fi
$dry check_coreboot_util cbfstool $dry check_coreboot_util cbfstool
$dry check_coreboot_util ifdtool $dry check_coreboot_util ifdtool
for y in "$target_dir/config"/* for y in "$target_dir/config"/*; do
do
defconfig="$y" defconfig="$y"
mkcorebootbin_real mkcorebootbin_real
done done
@@ -160,8 +146,7 @@ mkcorebootbin()
mkcorebootbin_real() mkcorebootbin_real()
{ {
if [ "$target" = "$tree" ] if [ "$target" = "$tree" ]; then
then
return 0 return 0
fi fi
@@ -169,16 +154,16 @@ mkcorebootbin_real()
initmode="${defconfig##*/}" initmode="${defconfig##*/}"
displaymode="${initmode##*_}" displaymode="${initmode##*_}"
if [ "$displaymode" = "$initmode" ] if [ "$displaymode" = "$initmode" ]; then
then # blank it for "normal" configs:
displaymode="" # blank it for "normal" configs
displaymode=""
fi fi
initmode="${initmode%%_*}" initmode="${initmode%%_*}"
cbfstool="elf/coreboot/$tree/cbfstool" cbfstool="elf/coreboot/$tree/cbfstool"
elfrom="elf/coreboot/$tree/$target/$initmode" elfrom="elf/coreboot/$tree/$target/$initmode"
if [ -n "$displaymode" ] if [ -n "$displaymode" ]; then
then
elfrom="${elfrom}_$displaymode" elfrom="${elfrom}_$displaymode"
fi fi
elfrom="$elfrom/coreboot.rom" elfrom="$elfrom/coreboot.rom"
@@ -193,63 +178,50 @@ mkcorebootbin_real()
"mkcorebootbin_real" "$@" "mkcorebootbin_real" "$@"
fi fi
if [ -n "$payload_uboot" ] && [ "$payload_uboot" != "arm64" ] if [ -n "$payload_uboot" ] && [ "$payload_uboot" != "arm64" ]; then
then
payload_seabios="y" payload_seabios="y"
fi fi
if [ -z "$uboot_config" ] if [ -z "$uboot_config" ]; then
then
uboot_config="default" uboot_config="default"
fi fi
if [ "$payload_grub" = "y" ] if [ "$payload_grub" = "y" ]; then
then
payload_seabios="y" payload_seabios="y"
fi fi
if [ "$payload_seabios" = "y" ] && [ "$payload_uboot" = "arm64" ] if [ "$payload_seabios" = "y" ] && [ "$payload_uboot" = "arm64" ]; then
then
$dry err "$target: U-Boot(arm) and SeaBIOS/GRUB both enabled" \ $dry err "$target: U-Boot(arm) and SeaBIOS/GRUB both enabled" \
"mkcorebootbin_real" "$@" "mkcorebootbin_real" "$@"
fi fi
if [ -z "$grub_scan_disk" ] if [ -z "$grub_scan_disk" ]; then
then
grub_scan_disk="nvme ahci ata" grub_scan_disk="nvme ahci ata"
fi fi
if [ -z "$grubtree" ] if [ -z "$grubtree" ]; then
then
grubtree="default" grubtree="default"
fi fi
grubelf="elf/grub/$grubtree/$grubtree/payload/grub.elf" grubelf="elf/grub/$grubtree/$grubtree/payload/grub.elf"
if [ "$payload_memtest" != "y" ] if [ "$payload_memtest" != "y" ]; then
then
payload_memtest="n" payload_memtest="n"
fi fi
if [ "$(uname -m)" != "x86_64" ] if [ "$(uname -m)" != "x86_64" ]; then
then
payload_memtest="n" payload_memtest="n"
fi fi
if [ "$payload_grubsea" = "y" ] && [ "$initmode" = "normal" ] if [ "$payload_grubsea" = "y" ] && [ "$initmode" = "normal" ]; then
then
payload_grubsea="n" payload_grubsea="n"
fi fi
if [ "$payload_grub" != "y" ] if [ "$payload_grub" != "y" ]; then
then
payload_grubsea="n" payload_grubsea="n"
fi fi
if $dry grep "CONFIG_PAYLOAD_NONE=y" "$defconfig" if $dry grep "CONFIG_PAYLOAD_NONE=y" "$defconfig"; then
then if [ "$payload_seabios" = "y" ]; then
if [ "$payload_seabios" = "y" ]
then
pname="seabios" pname="seabios"
$dry add_seabios $dry add_seabios
fi fi
if [ "$payload_uboot" = "arm64" ] if [ "$payload_uboot" = "arm64" ]; then
then
pname="uboot" pname="uboot"
$dry add_uboot $dry add_uboot
fi fi
@@ -268,8 +240,7 @@ mkcorebootbin_real()
add_seabios() add_seabios()
{ {
if [ -n "$payload_uboot" ] && [ "$payload_uboot" != "arm64" ] if [ -n "$payload_uboot" ] && [ "$payload_uboot" != "arm64" ]; then
then
# we must add u-boot first, because it's added as a flat # we must add u-boot first, because it's added as a flat
# binary at a specific offset for secondary program loader # binary at a specific offset for secondary program loader
@@ -278,8 +249,7 @@ add_seabios()
_seabioself="elf/seabios/default/default/$initmode/bios.bin.elf" _seabioself="elf/seabios/default/default/$initmode/bios.bin.elf"
_seaname="fallback/payload" _seaname="fallback/payload"
if [ "$payload_grubsea" = "y" ] if [ "$payload_grubsea" = "y" ]; then
then
_seaname="seabios.elf" _seaname="seabios.elf"
fi fi
@@ -288,33 +258,27 @@ add_seabios()
x_ "$cbfstool" "$tmprom" add-int -i 3000 -n etc/ps2-keyboard-spinup x_ "$cbfstool" "$tmprom" add-int -i 3000 -n etc/ps2-keyboard-spinup
opexec="2" opexec="2"
if [ "$initmode" = "vgarom" ] if [ "$initmode" = "vgarom" ]; then
then
opexec="0" opexec="0"
fi fi
x_ "$cbfstool" "$tmprom" add-int -i $opexec -n etc/pci-optionrom-exec x_ "$cbfstool" "$tmprom" add-int -i $opexec -n etc/pci-optionrom-exec
x_ "$cbfstool" "$tmprom" add-int -i 0 -n etc/optionroms-checksum x_ "$cbfstool" "$tmprom" add-int -i 0 -n etc/optionroms-checksum
if [ "$initmode" = "libgfxinit" ] if [ "$initmode" = "libgfxinit" ]; then
then
cbfs "$tmprom" "$seavgabiosrom" vgaroms/seavgabios.bin raw cbfs "$tmprom" "$seavgabiosrom" vgaroms/seavgabios.bin raw
fi fi
if [ "$payload_memtest" = "y" ] if [ "$payload_memtest" = "y" ]; then
then
# because why not have memtest? # because why not have memtest?
cbfs "$tmprom" \ cbfs "$tmprom" "elf/memtest86plus/memtest.bin" img/memtest
"elf/memtest86plus/memtest.bin" img/memtest
fi fi
if [ "$payload_grub" = "y" ] if [ "$payload_grub" = "y" ]; then
then
add_grub add_grub
fi fi
if [ "$payload_grubsea" != "y" ] if [ "$payload_grubsea" != "y" ]; then
then
# ROM image where SeaBIOS doesn't load grub/u-boot first. # ROM image where SeaBIOS doesn't load grub/u-boot first.
# U-Boot/GRUB available in ESC menu if enabled for the board # U-Boot/GRUB available in ESC menu if enabled for the board
@@ -327,14 +291,12 @@ add_seabios()
if [ "$payload_uboot" = "amd64" ] && \ if [ "$payload_uboot" = "amd64" ] && \
[ "$displaymode" != "txtmode" ] && \ [ "$displaymode" != "txtmode" ] && \
[ "$initmode" != "normal" ] && [ "$payload_grubsea" != "y" ] [ "$initmode" != "normal" ] && [ "$payload_grubsea" != "y" ]; then
then
pname="seauboot" pname="seauboot"
cprom "seauboot" cprom "seauboot"
fi fi
if [ "$payload_grub" = "y" ] if [ "$payload_grub" = "y" ]; then
then
pname="seagrub" pname="seagrub"
mkseagrub mkseagrub
fi fi
@@ -344,8 +306,7 @@ add_grub()
{ {
# path in CBFS for the GRUB payload # path in CBFS for the GRUB payload
_grubname="img/grub2" _grubname="img/grub2"
if [ "$payload_grubsea" = "y" ] if [ "$payload_grubsea" = "y" ]; then
then
_grubname="fallback/payload" _grubname="fallback/payload"
fi fi
@@ -357,8 +318,7 @@ add_grub()
cbfs "$tmprom" "$xbtmp/tmpcfg" scan.cfg raw cbfs "$tmprom" "$xbtmp/tmpcfg" scan.cfg raw
if [ "$initmode" != "normal" ] && [ "$displaymode" != "txtmode" ] if [ "$initmode" != "normal" ] && [ "$displaymode" != "txtmode" ]; then
then
cbfs "$tmprom" "$grubdata/background/background1280x800.png" \ cbfs "$tmprom" "$grubdata/background/background1280x800.png" \
"background.png" raw "background.png" raw
fi fi
@@ -366,8 +326,7 @@ add_grub()
mkseagrub() mkseagrub()
{ {
if [ "$payload_grubsea" = "y" ] if [ "$payload_grubsea" = "y" ]; then
then
pname="grub" pname="grub"
else else
cbfs "$tmprom" "$grubdata/bootorder" bootorder raw cbfs "$tmprom" "$grubdata/bootorder" bootorder raw
@@ -378,13 +337,11 @@ mkseagrub()
add_uboot() add_uboot()
{ {
if [ "$displaymode" = "txtmode" ] if [ "$displaymode" = "txtmode" ]; then
then
printf "cb/%s: Cannot use U-Boot in text mode\n" \ printf "cb/%s: Cannot use U-Boot in text mode\n" \
"$target" 1>&2 "$target" 1>&2
return 0 return 0
elif [ "$initmode" = "normal" ] elif [ "$initmode" = "normal" ]; then
then
printf "cb/%s: Cannot use U-Boot in normal initmode\n" \ printf "cb/%s: Cannot use U-Boot in normal initmode\n" \
"$target" 1>&2 "$target" 1>&2
return 0 return 0
@@ -400,8 +357,7 @@ add_uboot()
ubtarget="$target" ubtarget="$target"
# override for x86/x86_64 targets: # override for x86/x86_64 targets:
if [ -n "$payload_uboot" ] && [ "$payload_uboot" != "arm64" ] if [ -n "$payload_uboot" ] && [ "$payload_uboot" != "arm64" ]; then
then
ubcbfsargs="-l 0x1110000 -e 0x1110000" # 64-bit and 32-bit ubcbfsargs="-l 0x1110000 -e 0x1110000" # 64-bit and 32-bit
# on 64-bit, 0x1120000 is the SPL, with a stub that # on 64-bit, 0x1120000 is the SPL, with a stub that
# loads it, located at 0x1110000 # loads it, located at 0x1110000
@@ -422,23 +378,19 @@ add_uboot()
# aarch64 targets: # aarch64 targets:
ubootelf="$ubdir/u-boot.elf" ubootelf="$ubdir/u-boot.elf"
if [ ! -f "$ubootelf" ] if [ ! -f "$ubootelf" ]; then
then
ubootelf="$ubdir/u-boot" ubootelf="$ubdir/u-boot"
fi fi
# override for x86/x86_64 targets: # override for x86/x86_64 targets:
if [ "$payload_uboot" = "i386" ] if [ "$payload_uboot" = "i386" ]; then
then
ubootelf="$ubdir/u-boot-dtb.bin" ubootelf="$ubdir/u-boot-dtb.bin"
elif [ "$payload_uboot" = "amd64" ] elif [ "$payload_uboot" = "amd64" ]; then
then
ubootelf="$ubdir/u-boot-x86-with-spl.bin" # EFI-compatible ubootelf="$ubdir/u-boot-x86-with-spl.bin" # EFI-compatible
fi fi
cbfs "$tmprom" "$ubootelf" "$ubpath" $ubcbfsargs cbfs "$tmprom" "$ubootelf" "$ubpath" $ubcbfsargs
if [ "$payload_seabios" != "y" ] if [ "$payload_seabios" != "y" ]; then
then
cprom cprom
fi fi
} }
@@ -452,31 +404,26 @@ cprom()
tmpnew="" tmpnew=""
newrom="bin/$target/${pname}_${target}_$initmode.rom" newrom="bin/$target/${pname}_${target}_$initmode.rom"
if [ -n "$displaymode" ] if [ -n "$displaymode" ]; then
then
newrom="${newrom%.rom}_$displaymode.rom" newrom="${newrom%.rom}_$displaymode.rom"
fi fi
if [ $# -gt 0 ] && [ "${1%.gkb}" != "$1" ] if [ $# -gt 0 ] && [ "${1%.gkb}" != "$1" ]; then
then
tmpnew="${1##*/}" tmpnew="${1##*/}"
newrom="${newrom%.rom}_${tmpnew%.gkb}.rom" newrom="${newrom%.rom}_${tmpnew%.gkb}.rom"
fi fi
irom="$tmprom" irom="$tmprom"
if [ $# -gt 0 ] if [ $# -gt 0 ]; then
then
irom="$(mktemp || err "!mk irom, $(echo "$@")")" || \ irom="$(mktemp || err "!mk irom, $(echo "$@")")" || \
err "can't copy rom" "cprom" "$@" err "can't copy rom" "cprom" "$@"
x_ cp "$tmprom" "$irom" && cpcmd="mv" x_ cp "$tmprom" "$irom" && cpcmd="mv"
if [ "${1%.gkb}" != "$1" ] if [ "${1%.gkb}" != "$1" ]; then
then
cbfs "$irom" "$grubdata/keymap/$tmpnew" keymap.gkb raw cbfs "$irom" "$grubdata/keymap/$tmpnew" keymap.gkb raw
elif [ "$1" = "seauboot" ] elif [ "$1" = "seauboot" ]; then
then
cbfs "$irom" "$grubdata/bootorder_uboot" bootorder raw cbfs "$irom" "$grubdata/bootorder_uboot" bootorder raw
fi fi
fi fi
@@ -492,12 +439,10 @@ cbfs()
ccmd="add-payload" ccmd="add-payload"
lzma="-c lzma" lzma="-c lzma"
if [ $# -gt 3 ] && [ $# -lt 5 ] if [ $# -gt 3 ] && [ $# -lt 5 ]; then
then
ccmd="add" ccmd="add"
lzma="-t $4" lzma="-t $4"
elif [ $# -gt 4 ] && [ "$5" = "0x1110000" ] elif [ $# -gt 4 ] && [ "$5" = "0x1110000" ]; then
then
ccmd="add-flat-binary" && \ ccmd="add-flat-binary" && \
lzma="-c lzma -l 0x1110000 -e 0x1110000" lzma="-c lzma -l 0x1110000 -e 0x1110000"
fi fi
@@ -510,8 +455,7 @@ cbfs()
mkcoreboottar() mkcoreboottar()
{ {
if [ "$target" != "$tree" ] && [ "$XBMK_RELEASE" = "y" ] && \ if [ "$target" != "$tree" ] && [ "$XBMK_RELEASE" = "y" ] && \
[ "$release" != "n" ] [ "$release" != "n" ]; then
then
$dry mkrom_tarball "bin/$target" && \ $dry mkrom_tarball "bin/$target" && \
$dry x_ ./mk inject "bin/${relname}_${target}.tar.xz" nuke; : $dry x_ ./mk inject "bin/${relname}_${target}.tar.xz" nuke; :
fi fi
+69 -139
View File
@@ -15,8 +15,7 @@ trees()
while getopts $flags option while getopts $flags option
do do
if [ -n "$_f" ] if [ -n "$_f" ]; then
then
err "only one flag is permitted" "trees" "$@" err "only one flag is permitted" "trees" "$@"
fi fi
@@ -61,19 +60,16 @@ trees()
shift 2 shift 2
done done
if [ -z "$_f" ] if [ -z "$_f" ]; then
then
err "missing flag ($flags)" "trees" "$@" err "missing flag ($flags)" "trees" "$@"
fi fi
if [ -z "$project" ] if [ -z "$project" ]; then
then
fx_ "x_ ./mk $_f" x_ ls -1 config/git fx_ "x_ ./mk $_f" x_ ls -1 config/git
return 1 return 1
fi fi
if [ ! -f "config/git/$project/pkg.cfg" ] if [ ! -f "config/git/$project/pkg.cfg" ]; then
then
err "config/git/$project/pkg.cfg missing" "trees" "$@" err "config/git/$project/pkg.cfg missing" "trees" "$@"
fi fi
@@ -84,14 +80,12 @@ trees()
dest_dir="$elfdir" dest_dir="$elfdir"
listfile="$datadir/build.list" listfile="$datadir/build.list"
if [ ! -f "$listfile" ] if [ ! -f "$listfile" ]; then
then
listfile="" # build.list is optional on all projects listfile="" # build.list is optional on all projects
fi fi
mkhelpercfg="$datadir/mkhelper.cfg" mkhelpercfg="$datadir/mkhelper.cfg"
if e "$mkhelpercfg" f missing if e "$mkhelpercfg" f missing; then
then
mkhelpercfg="$xbtmp/mkhelper.cfg" mkhelpercfg="$xbtmp/mkhelper.cfg"
x_ touch "$mkhelpercfg" x_ touch "$mkhelpercfg"
fi fi
@@ -105,34 +99,28 @@ trees()
build_project() build_project()
{ {
if ! configure_project "$configdir" if ! configure_project "$configdir"; then
then
return 0 return 0
elif [ -f "$listfile" ] elif [ -f "$listfile" ]; then
then
$dry elfcheck || return 0; : $dry elfcheck || return 0; :
fi fi
if [ "$mode" = "distclean" ] if [ "$mode" = "distclean" ]; then
then
mode="clean" mode="clean"
fi fi
run_make_command || return 0 run_make_command || return 0
if [ -z "$mode" ] if [ -z "$mode" ]; then
then
$dry copy_elf; : $dry copy_elf; :
fi fi
} }
build_targets() build_targets()
{ {
if [ ! -d "$configdir" ] if [ ! -d "$configdir" ]; then
then
err "directory '$configdir' doesn't exist" "build_targets" "$@" err "directory '$configdir' doesn't exist" "build_targets" "$@"
elif [ $# -lt 1 ] elif [ $# -lt 1 ]; then
then
targets="$(ls -1 "$configdir")" || \ targets="$(ls -1 "$configdir")" || \
err "'$configdir': can't list targets" "build_targets" "$@" err "'$configdir': can't list targets" "build_targets" "$@"
fi fi
@@ -142,8 +130,7 @@ build_targets()
unset CROSS_COMPILE unset CROSS_COMPILE
export PATH="$xbmkpath" export PATH="$xbmkpath"
if [ "$x" = "list" ] if [ "$x" = "list" ]; then
then
x_ ls -1 "config/$project" x_ ls -1 "config/$project"
listfile="" listfile=""
break break
@@ -155,8 +142,7 @@ build_targets()
x_ handle_defconfig x_ handle_defconfig
if [ -z "$mode" ] if [ -z "$mode" ]; then
then
x_ $postmake x_ $postmake
fi fi
done; : done; :
@@ -166,41 +152,34 @@ handle_defconfig()
{ {
target_dir="$configdir/$target" target_dir="$configdir/$target"
if [ ! -f "CHANGELOG" ] if [ ! -f "CHANGELOG" ]; then
then
fetch_project "$project" fetch_project "$project"
fi fi
if ! configure_project "$target_dir" if ! configure_project "$target_dir"; then
then
return 0 return 0
fi fi
chkvars tree chkvars tree
srcdir="src/$project/$tree" srcdir="src/$project/$tree"
if [ "$mode" = "${mode%clean}" ] && [ ! -d "$srcdir" ] if [ "$mode" = "${mode%clean}" ] && [ ! -d "$srcdir" ]; then
then
return 0 return 0
fi fi
for y in "$target_dir/config"/* for y in "$target_dir/config"/*
do do
if [ "$_f" != "-d" ] && [ ! -f "$y" ] if [ "$_f" != "-d" ] && [ ! -f "$y" ]; then
then
continue continue
elif [ "$_f" != "-d" ] elif [ "$_f" != "-d" ]; then
then
defconfig="$y" defconfig="$y"
fi fi
if [ -z "$mode" ] if [ -z "$mode" ]; then
then
check_defconfig || continue; : check_defconfig || continue; :
fi fi
if [ -z "$mode" ] if [ -z "$mode" ]; then
then
for _xarch in $xarch; do for _xarch in $xarch; do
if [ -n "$_xarch" ] if [ -n "$_xarch" ]
then then
@@ -211,8 +190,7 @@ handle_defconfig()
handle_makefile handle_makefile
if [ -z "$mode" ] if [ -z "$mode" ]; then
then
$dry copy_elf $dry copy_elf
fi fi
done; : done; :
@@ -226,15 +204,13 @@ configure_project()
_tcfg="$1/target.cfg" _tcfg="$1/target.cfg"
if [ ! -f "$_tcfg" ] if [ ! -f "$_tcfg" ]; then
then
btype="auto" btype="auto"
fi fi
# globally initialise all variables for a source tree / target: # globally initialise all variables for a source tree / target:
if e "$datadir/mkhelper.cfg" f if e "$datadir/mkhelper.cfg" f; then
then
eval "`setcfg "$datadir/mkhelper.cfg"`" eval "`setcfg "$datadir/mkhelper.cfg"`"
fi fi
@@ -254,21 +230,18 @@ configure_project()
eval "`setvars "" rev tree`" eval "`setvars "" rev tree`"
eval "`setcfg "$_tcfg"`" eval "`setcfg "$_tcfg"`"
if [ "$_f" = "-d" ] if [ "$_f" = "-d" ]; then
then
build_depend="" # dry run build_depend="" # dry run
fi fi
if [ "$cmd" = "build_project" ] if [ "$cmd" = "build_project" ]; then
then
# single-tree, so it can't be a target pointing # single-tree, so it can't be a target pointing
# to a main source tree # to a main source tree
break break
fi fi
if [ "$do_make" != "n" ] if [ "$do_make" != "n" ]; then
then
# if we're *downloading* a project, then # if we're *downloading* a project, then
# we don't need to to change the target.cfg # we don't need to to change the target.cfg
@@ -287,34 +260,28 @@ configure_project()
done done
if [ "$XBMK_RELEASE" = "y" ] && [ "$release" = "n" ] if [ "$XBMK_RELEASE" = "y" ] && [ "$release" = "n" ]; then
then
return 1 return 1
fi fi
if [ -n "$btype" ] && [ "${mode%config}" != "$mode" ] if [ -n "$btype" ] && [ "${mode%config}" != "$mode" ]; then
then
return 1 return 1
fi fi
if [ -z "$mode" ] if [ -z "$mode" ]; then
then
$dry build_dependencies; : $dry build_dependencies; :
fi fi
mdir="$xbmkpwd/config/submodule/$project" mdir="$xbmkpwd/config/submodule/$project"
if [ -n "$tree" ] if [ -n "$tree" ]; then
then
mdir="$mdir/$tree" mdir="$mdir/$tree"
fi fi
if [ ! -f "CHANGELOG" ] if [ ! -f "CHANGELOG" ]; then
then
delete_old_project_files delete_old_project_files
fi fi
if [ "$do_make" = "n" ] if [ "$do_make" = "n" ]; then
then
if [ ! -f "CHANGELOG" ] if [ ! -f "CHANGELOG" ]
then then
fetch_${cmd#build_} fetch_${cmd#build_}
@@ -336,19 +303,16 @@ build_dependencies()
bd_project="${bd%%/*}" bd_project="${bd%%/*}"
bd_tree="${bd##*/}" bd_tree="${bd##*/}"
if [ -z "$bd_project" ] if [ -z "$bd_project" ]; then
then
$dry err "$project/$tree: !bd '$bd'" \ $dry err "$project/$tree: !bd '$bd'" \
"build_dependencies" "$@" "build_dependencies" "$@"
fi fi
if [ "${bd##*/}" = "$bd" ] if [ "${bd##*/}" = "$bd" ]; then
then
bd_tree="" bd_tree=""
fi fi
if [ -n "$bd_project" ] if [ -n "$bd_project" ]; then
then
$dry x_ ./mk -b $bd_project $bd_tree; : $dry x_ ./mk -b $bd_project $bd_tree; :
fi fi
done; : done; :
@@ -366,8 +330,7 @@ delete_old_project_files()
{ {
# delete an entire source tree along with its builds: # delete an entire source tree along with its builds:
if ! project_up_to_date hash "$tree" badhash "$datadir" \ if ! project_up_to_date hash "$tree" badhash "$datadir" \
"$configdir/$tree" "$mdir" "$configdir/$tree" "$mdir"; then
then
x_ rm -Rf "src/$project/$tree" "elf/$project/$tree" x_ rm -Rf "src/$project/$tree" "elf/$project/$tree"
fi fi
@@ -402,8 +365,7 @@ project_up_to_date()
x_ mkdir -p "$XBMK_CACHE/$hashdir" x_ mkdir -p "$XBMK_CACHE/$hashdir"
if [ -f "$XBMK_CACHE/$hashdir/$project$hashname" ] if [ -f "$XBMK_CACHE/$hashdir/$project$hashname" ]; then
then
read -r old_hash < \ read -r old_hash < \
"$XBMK_CACHE/$hashdir/$project$hashname" \ "$XBMK_CACHE/$hashdir/$project$hashname" \
|| err \ || err \
@@ -421,8 +383,7 @@ project_up_to_date()
"project_up_to_date" "$hashdir" "$hashname" "$badhashvar" "$@" "project_up_to_date" "$hashdir" "$hashname" "$badhashvar" "$@"
if [ "$hash" != "$old_hash" ] || \ if [ "$hash" != "$old_hash" ] || \
[ ! -f "$XBMK_CACHE/$hashdir/$project$hashname" ] [ ! -f "$XBMK_CACHE/$hashdir/$project$hashname" ]; then
then
eval "$badhashvar=\"y\"" eval "$badhashvar=\"y\""
fi fi
@@ -437,19 +398,16 @@ check_cross_compiler()
{ {
cbdir="src/coreboot/$tree" cbdir="src/coreboot/$tree"
if [ "$project" != "coreboot" ] if [ "$project" != "coreboot" ]; then
then
cbdir="src/coreboot/default" cbdir="src/coreboot/default"
fi fi
if [ -n "$xtree" ] if [ -n "$xtree" ]; then
then
cbdir="src/coreboot/$xtree" cbdir="src/coreboot/$xtree"
fi fi
xfix="${1%-*}" xfix="${1%-*}"
if [ "$xfix" = "x86_64" ] if [ "$xfix" = "x86_64" ]; then
then
xfix="x64" xfix="x64"
fi fi
@@ -462,13 +420,11 @@ check_cross_compiler()
export PATH="$xbmkpwd/$cbdir/util/crossgcc/xgcc/bin:$PATH" export PATH="$xbmkpwd/$cbdir/util/crossgcc/xgcc/bin:$PATH"
export CROSS_COMPILE="${xarch% *}-" export CROSS_COMPILE="${xarch% *}-"
if [ -n "$xlang" ] if [ -n "$xlang" ]; then
then
export BUILD_LANGUAGES="$xlang" export BUILD_LANGUAGES="$xlang"
fi fi
if [ -f "$xgccfile" ] if [ -f "$xgccfile" ]; then
then
return 0 # a build already exists return 0 # a build already exists
fi fi
@@ -485,23 +441,22 @@ check_cross_compiler()
# gnat in PATH never resolves to gnat-14, because gnat-14 was "experimental" # gnat in PATH never resolves to gnat-14, because gnat-14 was "experimental"
check_gnu_path() check_gnu_path()
{ {
if ! command -v "$1" 1>/dev/null if ! command -v "$1" 1>/dev/null; then
then
err "Host '$1' unavailable" "check_gnu_path" "$@" err "Host '$1' unavailable" "check_gnu_path" "$@"
fi fi
eval "`setvars "" gccver gccfull gnatver gnatfull gccdir gnatdir`" eval "`setvars "" gccver gccfull gnatver gnatfull gccdir gnatdir`"
if ! gnu_setver "$1" "$1" if ! gnu_setver "$1" "$1"; then
then
err "Command '$1' unavailable." "check_gnu_path" "$@" err "Command '$1' unavailable." "check_gnu_path" "$@"
fi fi
gnu_setver "$2" "$2" || : gnu_setver "$2" "$2" || :
eval "[ -z \"\$$1ver\" ] && err \"Cannot detect host '$1' version\"" eval "[ -z \"\$$1ver\" ] && err \"Cannot detect host '$1' version\""
if [ "$gnatfull" = "$gccfull" ] if [ "$gnatfull" = "$gccfull" ]; then
then # matching gcc/gnat versions
return 0 # matching gcc/gnat versions
return 0
fi fi
eval "$1dir=\"$(dirname "$(command -v "$1")")\"" eval "$1dir=\"$(dirname "$(command -v "$1")")\""
@@ -517,16 +472,13 @@ check_gnu_path()
fi fi
done done
if ! gnu_setver "$2" "$_gnudir/$2-$_gnuver" if ! gnu_setver "$2" "$_gnudir/$2-$_gnuver"; then
then
return 1 return 1
elif [ "$gnatfull" != "$gccfull" ] elif [ "$gnatfull" != "$gccfull" ]; then
then
return 1 return 1
fi fi
( (
remkdir "$xbtmp/gnupath" remkdir "$xbtmp/gnupath"
x_ cd "$xbtmp/gnupath" x_ cd "$xbtmp/gnupath"
@@ -534,8 +486,7 @@ check_gnu_path()
for _gnubin in "$_gnudir/$2"*"-$_gnuver" for _gnubin in "$_gnudir/$2"*"-$_gnuver"
do do
_gnuutil="${_gnubin##*/}" _gnuutil="${_gnubin##*/}"
if [ -e "$_gnubin" ] if [ -e "$_gnubin" ]; then
then
x_ ln -s "$_gnubin" "${_gnuutil%"-$_gnuver"}" x_ ln -s "$_gnubin" "${_gnuutil%"-$_gnuver"}"
fi fi
done done
@@ -556,8 +507,7 @@ gnu_setver()
check_defconfig() check_defconfig()
{ {
if [ ! -f "$defconfig" ] if [ ! -f "$defconfig" ]; then
then
$dry err "$project/$target: missing defconfig" \ $dry err "$project/$target: missing defconfig" \
"check_defconfig" "$@" "check_defconfig" "$@"
fi fi
@@ -571,11 +521,7 @@ elfcheck()
{ {
# TODO: *STILL* very hacky check. do it properly (based on build.list) # TODO: *STILL* very hacky check. do it properly (based on build.list)
( ( fx_ "eval exit 1 && err" find "$dest_dir" -type f ) || return 1; :
fx_ "eval exit 1 && err" find "$dest_dir" -type f
) || return 1; :
} }
handle_makefile() handle_makefile()
@@ -583,8 +529,7 @@ handle_makefile()
$dry check_makefile "$srcdir" && \ $dry check_makefile "$srcdir" && \
$dry x_ make -C "$srcdir" $cleanargs clean $dry x_ make -C "$srcdir" $cleanargs clean
if [ -f "$defconfig" ] if [ -f "$defconfig" ]; then
then
x_ cp "$defconfig" "$srcdir/.config" x_ cp "$defconfig" "$srcdir/.config"
fi fi
@@ -593,27 +538,23 @@ handle_makefile()
_copy=".config" _copy=".config"
if [ "$mode" = "savedefconfig" ] if [ "$mode" = "savedefconfig" ]; then
then
_copy="defconfig" _copy="defconfig"
fi fi
if [ "${mode%config}" != "$mode" ] if [ "${mode%config}" != "$mode" ]; then
then
$dry x_ cp "$srcdir/$_copy" "$defconfig"; : $dry x_ cp "$srcdir/$_copy" "$defconfig"; :
fi fi
if [ -e "$srcdir/.git" ] && [ "$project" = "u-boot" ] && \ if [ -e "$srcdir/.git" ] && [ "$project" = "u-boot" ] && \
[ "$mode" = "distclean" ] [ "$mode" = "distclean" ]; then
then
$dry x_ git -C "$srcdir" $cleanargs clean -fdx; : $dry x_ git -C "$srcdir" $cleanargs clean -fdx; :
fi fi
} }
run_make_command() run_make_command()
{ {
if [ -z "$mode" ] if [ -z "$mode" ]; then
then
x_ $premake x_ $premake
fi fi
@@ -623,15 +564,13 @@ run_make_command()
$dry x_ make -C "$srcdir" $mode -j$XBMK_THREADS $makeargs $dry x_ make -C "$srcdir" $mode -j$XBMK_THREADS $makeargs
if [ -z "$mode" ] if [ -z "$mode" ]; then
then
x_ $mkhelper x_ $mkhelper
fi fi
check_makefile "$srcdir" || return 0 check_makefile "$srcdir" || return 0
if [ "$mode" = "clean" ] if [ "$mode" = "clean" ]; then
then
$dry make -C "$srcdir" $cleanargs distclean || \ $dry make -C "$srcdir" $cleanargs distclean || \
$dry x_ make -C "$srcdir" $cleanargs clean; : $dry x_ make -C "$srcdir" $cleanargs clean; :
fi fi
@@ -639,8 +578,7 @@ run_make_command()
check_cmake() check_cmake()
{ {
if [ -n "$cmakedir" ] if [ -n "$cmakedir" ]; then
then
$dry check_makefile "$1" || cmake -B "$1" \ $dry check_makefile "$1" || cmake -B "$1" \
"$1/$cmakedir" || $dry x_ check_makefile "$1" "$1/$cmakedir" || $dry x_ check_makefile "$1"
$dry x_ check_makefile "$1"; : $dry x_ check_makefile "$1"; :
@@ -650,7 +588,6 @@ check_cmake()
check_autoconf() check_autoconf()
{ {
( (
x_ cd "$1" x_ cd "$1"
if [ -f "bootstrap" ] if [ -f "bootstrap" ]
@@ -674,25 +611,21 @@ check_autoconf()
check_makefile() check_makefile()
{ {
if [ ! -f "$1/Makefile" ] && [ ! -f "$1/makefile" ] && \ if [ ! -f "$1/Makefile" ] && [ ! -f "$1/makefile" ] && \
[ ! -f "$1/GNUmakefile" ] [ ! -f "$1/GNUmakefile" ]; then
then
return 1 return 1
fi fi
} }
copy_elf() copy_elf()
{ {
if [ -f "$listfile" ] if [ -f "$listfile" ]; then
then
x_ mkdir -p "$dest_dir" x_ mkdir -p "$dest_dir"
fi fi
if [ -f "$listfile" ] if [ -f "$listfile" ]; then
then
while read -r f while read -r f
do do
if [ -f "$srcdir/$f" ] if [ -f "$srcdir/$f" ]; then
then
x_ cp "$srcdir/$f" "$dest_dir" x_ cp "$srcdir/$f" "$dest_dir"
fi fi
@@ -700,9 +633,6 @@ copy_elf()
"cannot read '$listfile'" "copy_elf" "$@"; : "cannot read '$listfile'" "copy_elf" "$@"; :
fi fi
( ( x_ make clean -C "$srcdir" $cleanargs ) || \
err "can't make-clean '$srcdir'" "copy_elf" "$@"; :
x_ make clean -C "$srcdir" $cleanargs
) || err "can't make-clean '$srcdir'" "copy_elf" "$@"; :
} }
+34 -22
View File
@@ -277,37 +277,49 @@ apply_deguard_hack()
extract_archive() extract_archive()
{ {
innoextract "$1" -d "$2" || python "$pfs_extract" "$1" -e || 7z x \ if innoextract "$1" -d "$2"; then
"$1" -o"$2" || unar "$1" -o "$2" || unzip "$1" -d "$2" || return 1 :
elif python "$pfs_extract" "$1" -e; then
:
elif 7z x "$1" -o"$2"; then
:
elif unar "$1" -o "$2"; then
:
elif unzip "$1" -d "$2"; then
:
else
return 1
fi
[ ! -d "${_dl}_extracted" ] || x_ cp -R "${_dl}_extracted" "$2"; : if [ -d "${_dl}_extracted" ]; then
x_ cp -R "${_dl}_extracted" "$2"
fi
} }
extract_kbc1126ec() extract_kbc1126ec()
{ {
( (
x_ cd "$appdir/"
x_ cd "$appdir/" if mv Rompaq/68*.BIN ec.bin; then
:
elif unar -D ROM.CAB Rom.bin; then
:
elif unar -D Rom.CAB Rom.bin; then
:
elif unar -D 68*.CAB Rom.bin; then
:
else
err "!kbc1126 unar" "extract_kbc1126ec" "$@"
fi
if mv Rompaq/68*.BIN ec.bin; then if [ ! -f "ec.bin" ]; then
: x_ mv Rom.bin ec.bin
elif unar -D ROM.CAB Rom.bin; then fi
:
elif unar -D Rom.CAB Rom.bin; then
:
elif unar -D 68*.CAB Rom.bin; then
:
else
err "!kbc1126 unar" "extract_kbc1126ec" "$@"
fi
if [ ! -f "ec.bin" ]; then if x_ e ec.bin f; then
x_ mv Rom.bin ec.bin x_ "$kbc1126_ec_dump" ec.bin
fi fi
if x_ e ec.bin f; then
x_ "$kbc1126_ec_dump" ec.bin
fi
) || err "$board: can't extract kbc1126 fw" "extract_kbc1126ec" "$@" ) || err "$board: can't extract kbc1126 fw" "extract_kbc1126ec" "$@"