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