mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-09-19 21:20:31 +02:00
Compare commits
49 Commits
7cb4cdf0f2
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 489a81eb6d | |||
| 272e306ba2 | |||
| f1f7fa2925 | |||
| 9e189bbd06 | |||
| 688e541c58 | |||
| 387e6dd771 | |||
| a0951d1127 | |||
| f59e5d8e2b | |||
| 4530c6f2e3 | |||
| e0714ad929 | |||
| 058a70a16e | |||
| e1c2525783 | |||
| 69875b8e10 | |||
| 1722964f66 | |||
| 63596046d1 | |||
| 40b120c26b | |||
| bf654d4c19 | |||
| 94ff1ec49a | |||
| 08021d71c2 | |||
| 856551a36d | |||
| 7c025e1036 | |||
| 60a2f5cbff | |||
| 3b565ce056 | |||
| 089875ac1f | |||
| 2dc01a93b9 | |||
| cebae0ed80 | |||
| d165f14a4d | |||
| 5afd77433d | |||
| 08ec187842 | |||
| 2dc4a4d16b | |||
| ca55077032 | |||
| 113dac006f | |||
| 88887c0163 | |||
| 0c41ea82dd | |||
| bbc56b714b | |||
| 6a5b4c98d6 | |||
| 50eec6d485 | |||
| 40b1a3e0bb | |||
| 59cbc1784c | |||
| 6725b616f3 | |||
| 7507655d34 | |||
| 2aad50cd59 | |||
| f7b9c9e410 | |||
| 4878cec84d | |||
| 04be963383 | |||
| 5043b6dc97 | |||
| a65d804f1e | |||
| cf079dbd17 | |||
| 828578cc57 |
@@ -150,7 +150,7 @@ CONFIG_MEMLAYOUT_LD_FILE="src/arch/x86/memlayout.ld"
|
||||
# CONFIG_FATAL_ASSERTS is not set
|
||||
CONFIG_INTEL_GMA_VBT_FILE="src/mainboard/$(MAINBOARDDIR)/data.vbt"
|
||||
CONFIG_PRERAM_CBMEM_CONSOLE_SIZE=0xc00
|
||||
CONFIG_MAINBOARD_SMBIOS_PRODUCT_NAME="OptiPlex 7020/9020 SFF"
|
||||
CONFIG_MAINBOARD_SMBIOS_PRODUCT_NAME="Precision T1700 MT"
|
||||
# CONFIG_CONSOLE_POST is not set
|
||||
CONFIG_MAX_SOCKET=1
|
||||
CONFIG_CMOS_DEFAULT_FILE="src/mainboard/$(MAINBOARDDIR)/cmos.default"
|
||||
|
||||
@@ -148,7 +148,7 @@ CONFIG_MEMLAYOUT_LD_FILE="src/arch/x86/memlayout.ld"
|
||||
# CONFIG_FATAL_ASSERTS is not set
|
||||
CONFIG_INTEL_GMA_VBT_FILE="src/mainboard/$(MAINBOARDDIR)/data.vbt"
|
||||
CONFIG_PRERAM_CBMEM_CONSOLE_SIZE=0xc00
|
||||
CONFIG_MAINBOARD_SMBIOS_PRODUCT_NAME="OptiPlex 7020/9020 SFF"
|
||||
CONFIG_MAINBOARD_SMBIOS_PRODUCT_NAME="Precision T1700 MT"
|
||||
# CONFIG_CONSOLE_POST is not set
|
||||
CONFIG_MAX_SOCKET=1
|
||||
CONFIG_CMOS_DEFAULT_FILE="src/mainboard/$(MAINBOARDDIR)/cmos.default"
|
||||
|
||||
@@ -150,7 +150,7 @@ CONFIG_MEMLAYOUT_LD_FILE="src/arch/x86/memlayout.ld"
|
||||
# CONFIG_FATAL_ASSERTS is not set
|
||||
CONFIG_INTEL_GMA_VBT_FILE="src/mainboard/$(MAINBOARDDIR)/data.vbt"
|
||||
CONFIG_PRERAM_CBMEM_CONSOLE_SIZE=0xc00
|
||||
CONFIG_MAINBOARD_SMBIOS_PRODUCT_NAME="OptiPlex 7020/9020 SFF"
|
||||
CONFIG_MAINBOARD_SMBIOS_PRODUCT_NAME="Precision T1700 SFF"
|
||||
# CONFIG_CONSOLE_POST is not set
|
||||
CONFIG_MAX_SOCKET=1
|
||||
CONFIG_CMOS_DEFAULT_FILE="src/mainboard/$(MAINBOARDDIR)/cmos.default"
|
||||
|
||||
@@ -148,7 +148,7 @@ CONFIG_MEMLAYOUT_LD_FILE="src/arch/x86/memlayout.ld"
|
||||
# CONFIG_FATAL_ASSERTS is not set
|
||||
CONFIG_INTEL_GMA_VBT_FILE="src/mainboard/$(MAINBOARDDIR)/data.vbt"
|
||||
CONFIG_PRERAM_CBMEM_CONSOLE_SIZE=0xc00
|
||||
CONFIG_MAINBOARD_SMBIOS_PRODUCT_NAME="OptiPlex 7020/9020 SFF"
|
||||
CONFIG_MAINBOARD_SMBIOS_PRODUCT_NAME="Precision T1700 SFF"
|
||||
# CONFIG_CONSOLE_POST is not set
|
||||
CONFIG_MAX_SOCKET=1
|
||||
CONFIG_CMOS_DEFAULT_FILE="src/mainboard/$(MAINBOARDDIR)/cmos.default"
|
||||
|
||||
@@ -24,13 +24,5 @@ payload_uboot=""
|
||||
cbfscfg=""
|
||||
|
||||
premake="corebootpremake"
|
||||
mkhelper="coreboot_pad_one_byte"
|
||||
postmake="mkcorebootbin"
|
||||
|
||||
# must confirm, but i think git-clean
|
||||
# will also delete crossgcc builds in
|
||||
# coreboot.git, which we do not currently
|
||||
# rely on out-of-tree
|
||||
gitclean="n"
|
||||
|
||||
# so, TODO: support out-of-tree xgcc builds
|
||||
mkhelper="$if_not_dry_build coreboot_pad_one_byte"
|
||||
postmake="$if_not_dry_build mkcorebootbin"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
bootstrapargs="--gnulib-srcdir=gnulib/ --no-git"
|
||||
autoconfargs="--with-platform=coreboot --disable-werror"
|
||||
configureargs="--with-platform=coreboot --disable-werror"
|
||||
makeargs="FS_PAYLOAD_MODULES=\"\""
|
||||
buildtype="autohell"
|
||||
mkhelper="mkpayload_grub"
|
||||
mkhelper="$if_not_dry_build mkpayload_grub"
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
postmake="copyps1bios"
|
||||
mkhelper="$if_not_dry_build copyps1bios"
|
||||
postmake="$if_not_dry_build copyps1bios"
|
||||
|
||||
@@ -6,7 +6,7 @@ acpica arm-none-eabi-binutils arm-none-eabi-gcc arm-none-eabi-newlib \
|
||||
autogen base-devel bison cdrtools cmake curl device-mapper doxygen \
|
||||
dtc e2fsprogs flex freetype2 fuse2 gawk gcc-ada gdb gettext git \
|
||||
help2man innoextract libftdi libgpiod libjaylink libpciaccess libusb nasm \
|
||||
ncurses openssl 7zip ccache less libx86 \
|
||||
ncurses openssl 7zip less libx86 \
|
||||
pandoc parted pciutils perl perl-libwww python python-setuptools rsync \
|
||||
sharutils subversion swig texinfo ttf-dejavu unarchiver unzip wget xz zlib mtools \
|
||||
"
|
||||
|
||||
@@ -13,6 +13,6 @@ libsdl2-dev libselinux1-dev libssl-dev libtool libusb-1.0-0 libusb-1.0-0-dev \
|
||||
libusb-dev lz4 lzma lzma-alone m4 nasm openssl 7zip parted pciutils \
|
||||
perl pkg-config python3 python3-distutils-extra python3-pkg-resources python3-pycryptodome \
|
||||
python3-pyelftools python3-setuptools python-is-python3 sharutils swig unar \
|
||||
unifont unifont-bin unzip uuid-dev wget xfonts-unifont zlib1g-dev ccache \
|
||||
unifont unifont-bin unzip uuid-dev wget xfonts-unifont zlib1g-dev \
|
||||
g++-mipsel-linux-gnu make genisoimage mtools libx86-1 libx86-dev libstdc++-arm-none-eabi-newlib autoconf-archive \
|
||||
"
|
||||
|
||||
@@ -10,5 +10,5 @@ innoextract intltool libftdi-devel libselinux-devel libusb1 libusb1-devel \
|
||||
nasm ncurses-devel openssl-devel p7zip p7zip-plugins pandoc parted \
|
||||
pciutils-devel perl perl-libwww-perl python-unversioned-command python3 \
|
||||
python3-setuptools rsync sharutils subversion texinfo unar unifont \
|
||||
unifont-fonts unifont-ttf-fonts unzip wget xz zlib-devel ccache swig \
|
||||
unifont-fonts unifont-ttf-fonts unzip wget xz zlib-devel swig \
|
||||
"
|
||||
|
||||
@@ -11,5 +11,5 @@ libselinux-devel libusb1 libusb1-devel nasm ncurses-devel openssl-devel \
|
||||
p7zip p7zip-plugins pandoc parted pciutils-devel perl perl-libwww-perl \
|
||||
python-unversioned-command python3 python3-setuptools rsync sharutils \
|
||||
subversion systemd-devel texinfo unar unifont unifont-fonts \
|
||||
unifont-ttf-fonts unzip wget xz zlib-devel ccache swig python3-devel \
|
||||
unifont-ttf-fonts unzip wget xz zlib-devel swig python3-devel \
|
||||
"
|
||||
|
||||
@@ -11,6 +11,6 @@ libselinux-devel libusb1 libusb1-devel nasm ncurses-devel openssl-devel openssl-
|
||||
p7zip p7zip-plugins pandoc parted pciutils-devel perl perl-libwww-perl \
|
||||
python-unversioned-command python3 python3-setuptools rsync sharutils \
|
||||
subversion systemd-devel texinfo unar unifont unifont-fonts uuid-devel \
|
||||
unifont-ttf-fonts unzip wget xz zlib-devel ccache swig python3-devel \
|
||||
unifont-ttf-fonts unzip wget xz zlib-devel swig python3-devel \
|
||||
libuuid-devel gnutls-devel \
|
||||
"
|
||||
|
||||
@@ -11,6 +11,6 @@ libselinux-devel libusb1 libusb1-devel nasm ncurses-devel openssl-devel openssl-
|
||||
p7zip p7zip-plugins pandoc parted pciutils-devel perl perl-libwww-perl \
|
||||
python-unversioned-command python3 python3-setuptools rsync sharutils \
|
||||
subversion systemd-devel texinfo unifont unifont-fonts uuid-devel \
|
||||
unifont-ttf-fonts unzip wget xz zlib-devel ccache swig python3-devel \
|
||||
unifont-ttf-fonts unzip wget xz zlib-devel swig python3-devel \
|
||||
libuuid-devel gnutls-devel tar unar libtool \
|
||||
"
|
||||
|
||||
@@ -11,6 +11,6 @@ libselinux-devel libusb1 libusb1-devel nasm ncurses-devel openssl-devel openssl-
|
||||
p7zip p7zip-plugins pandoc parted pciutils-devel perl perl-libwww-perl \
|
||||
python-unversioned-command python3 python3-setuptools rsync sharutils \
|
||||
subversion systemd-devel texinfo unifont unifont-fonts uuid-devel \
|
||||
unifont-ttf-fonts unzip wget xz zlib-devel ccache swig python3-devel \
|
||||
unifont-ttf-fonts unzip wget xz zlib-devel swig python3-devel \
|
||||
libuuid-devel gnutls-devel tar unar libtool \
|
||||
"
|
||||
|
||||
@@ -11,7 +11,7 @@ dev-libs/libgpiod app-arch/sharutils dev-libs/libtomcrypt sys-devel/autogen \
|
||||
media-libs/freetype sys-fs/e2fsprogs sys-fs/lvm2 dev-libs/libusb \
|
||||
sys-block/parted sys-fs/mtools app-arch/lz4 dev-libs/leancrypto sys-fs/fuse \
|
||||
sys-apps/dtc net-libs/gnutls net-misc/curl dev-build/cmake dev-vcs/git \
|
||||
dev-util/ccache dev-embedded/libftdi app-arch/innoextract sys-devel/gcc \
|
||||
dev-embedded/libftdi app-arch/innoextract sys-devel/gcc \
|
||||
sys-apps/pciutils app-crypt/efitools gnustep-base/gnustep-make gnustep-base/gnustep-base \
|
||||
app-arch/unar app-arch/7zip dev-lang/python dev-python/setuptools dev-python/ply \
|
||||
sys-libs/libselinux dev-python/pyelftools dev-python/pycparser dev-python/cffi \
|
||||
|
||||
@@ -12,6 +12,6 @@ libpython3-dev libsdl2-dev libselinux1-dev libssl-dev libtool libusb-1.0-0 \
|
||||
libusb-1.0-0-dev lz4 lzma lzma-alone m4 nasm openssl p7zip p7zip-full parted \
|
||||
pciutils perl pkg-config python3 python3-pkg-resources python3-pycryptodome \
|
||||
python3-pyelftools python3-setuptools python-is-python3 sharutils swig \
|
||||
fonts-unifont unar unifont unzip uuid-dev wget zlib1g-dev ccache \
|
||||
fonts-unifont unar unifont unzip uuid-dev wget zlib1g-dev \
|
||||
g++-mipsel-linux-gnu make genisoimage mtools \
|
||||
"
|
||||
|
||||
@@ -8,5 +8,5 @@ freetype freetype-devel fuse gawk gcc-ada gdb gettext gettext-devel git \
|
||||
gnutls-devel help2man innoextract libftdi1 libpciaccess libusb libuuid-devel \
|
||||
nasm ncurses ncurses-devel openssl openssl-devel 7zip parted pciutils perl \
|
||||
perl-LWP python python3 python3-devel python3-setuptools rsync sharutils \
|
||||
subversion swig texinfo unar unzip wget xz zlib ccache \
|
||||
subversion swig texinfo unar unzip wget xz zlib \
|
||||
"
|
||||
|
||||
@@ -2,4 +2,3 @@
|
||||
|
||||
makeargs="-f lbmkbofhmakefile"
|
||||
cleanargs="-f lbmkbofhmakefile"
|
||||
mkhelper="copyps1bios"
|
||||
|
||||
Vendored
+20
-37
@@ -9,47 +9,43 @@ eval "`newvar url bkup_url depend loc subcurl subcurl_bkup subgit subgit_bkup \
|
||||
tmpgit="$xbtmp/gitclone"
|
||||
tmpgitcache="$xbtmp/tmpgit"
|
||||
|
||||
fetch_targets()
|
||||
multi_tree_fetch()
|
||||
{
|
||||
[ -d "src/$project/$tree" ] && \
|
||||
return 0
|
||||
[ -d "src/$project/$tree" ] && return 0
|
||||
|
||||
git_prep "$url" "$bkup_url" "$xbmkpwd/$configdir/$tree/patches" \
|
||||
"src/$project/$tree" "submod"
|
||||
}
|
||||
|
||||
fetch_project()
|
||||
single_tree_fetch()
|
||||
{
|
||||
xgcctree=""
|
||||
|
||||
. "config/git/$project/pkg.cfg" || \
|
||||
err "Can't read config 'config/git/$project/pkg.cfg'" \
|
||||
"fetch_project" "@"
|
||||
"single_tree_fetch" "@"
|
||||
|
||||
if [ -z "$url" ] || [ -z "$bkup_url" ]; then
|
||||
err "url/bkup_url not both set 'config/git/$project/pkg.cfg'" \
|
||||
"fetch_project" "$@"
|
||||
"single_tree_fetch" "$@"
|
||||
fi
|
||||
|
||||
[ -n "$xgcctree" ] && \
|
||||
x_ ./mk -f coreboot "$xgcctree"
|
||||
x_ "$mk" -f coreboot "$xgcctree"
|
||||
|
||||
[ -n "$depend" ] && \
|
||||
for d in $depend ; do
|
||||
x_ ./mk -f $d
|
||||
x_ "$mk" -f $d
|
||||
done
|
||||
|
||||
clone_project
|
||||
$if_single_tree \
|
||||
clone_project; :
|
||||
}
|
||||
|
||||
clone_project()
|
||||
{
|
||||
singletree "$project" || \
|
||||
return 0
|
||||
|
||||
loc="src/$project"
|
||||
[ -d "$loc" ] && \
|
||||
return 0
|
||||
[ -d "$loc" ] && return 0
|
||||
|
||||
remkdir "${tmpgit%/*}"
|
||||
git_prep "$url" "$bkup_url" "$xbmkpwd/config/$project/patches" "$loc"
|
||||
@@ -81,9 +77,7 @@ fetch_submodule()
|
||||
mcfgdir="$mdir/${1##*/}"
|
||||
eval "`newvar st subcurl subcurl_bkup subgit subgit_bkup subhash`"
|
||||
|
||||
if e "$mcfgdir/module.cfg" f missing; then
|
||||
return 0
|
||||
fi
|
||||
e "$mcfgdir/module.cfg" f missing && return 0
|
||||
. "$mcfgdir/module.cfg" || \
|
||||
err "Can't read '$mcfgdir/module.cfg'" "fetch_submodules" "$@"
|
||||
|
||||
@@ -119,8 +113,7 @@ xbget()
|
||||
err "empty URL given in" "xbget" "$@"
|
||||
try_fetch_$1 "$url" "$@" || \
|
||||
continue
|
||||
[ -e "$4" ] && \
|
||||
return 0; : # successful download/copy
|
||||
[ -e "$4" ] && return 0; : # successful download/copy
|
||||
done
|
||||
|
||||
err "failed to download file/repository" "xbget" "$@"; :
|
||||
@@ -174,10 +167,8 @@ try_fetch_curl()
|
||||
try_$2 "$cached" "$@" || \
|
||||
return 1
|
||||
|
||||
[ -f "$5" ] && \
|
||||
if bad_checksum "$6" "$5" 2>/dev/null; then
|
||||
x_ cp "$cached" "$5"
|
||||
fi
|
||||
[ -f "$5" ] && bad_checksum "$6" "$5" 2>/dev/null && \
|
||||
x_ cp "$cached" "$5"
|
||||
|
||||
if [ ! -f "$cached" ]; then
|
||||
return 1
|
||||
@@ -202,8 +193,7 @@ try_curl()
|
||||
ua="Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/91.0"
|
||||
|
||||
( x_ curl --location --retry 3 -A "$ua" "$2" -o "$1" ) \
|
||||
|| ( x_ wget --tries 3 -U "$ua" "$2" -O "$1" ) \
|
||||
|| return 1; :
|
||||
|| ( x_ wget --tries 3 -U "$ua" "$2" -O "$1" ) || return 1; :
|
||||
}
|
||||
|
||||
try_copy()
|
||||
@@ -230,15 +220,9 @@ try_git()
|
||||
x_ mv "$tmpgitcache" "$gitdest"
|
||||
fi
|
||||
|
||||
if git -C "$gitdest" show "$7" 1>/dev/null 2>/dev/null && \
|
||||
[ "$forcepull" != "y" ]; then
|
||||
# don't try to pull the latest changes if the given target
|
||||
# revision already exists locally. this saves a lot of time
|
||||
# during release builds, and reduces the chance that we will
|
||||
# interact with grub.git or gnulib.git overall during runtime
|
||||
|
||||
return 0
|
||||
fi
|
||||
git -C "$gitdest" show "$7" 1>/dev/null 2>/dev/null && \
|
||||
[ "$forcepull" != "y" ] && \
|
||||
return 0 # don't pull changes if target rev exists locally
|
||||
|
||||
if [ "$XBMK_CACHE_MIRROR" = "y" ]; then
|
||||
( x_ git -C "$gitdest" fetch ) || :; :
|
||||
@@ -250,11 +234,10 @@ try_git()
|
||||
|
||||
bad_checksum()
|
||||
{
|
||||
if e "$2" f missing; then
|
||||
e "$2" f missing && \
|
||||
return 0
|
||||
fi
|
||||
|
||||
build_sbase
|
||||
eval "$build_sbase"
|
||||
csum="$(x_ "$sha512sum" "$2" | awk '{print $1}')" || \
|
||||
err "!sha512 '$2' $1" bad_checksum "$@"
|
||||
|
||||
|
||||
Vendored
+4
-6
@@ -165,13 +165,11 @@ xbmk_parent_set_env()
|
||||
|
||||
x_ chmod -w "$xbmklock"
|
||||
|
||||
xbmk_parent_set_export
|
||||
xbmk_set_version
|
||||
forx 'xbmk_%s' parent_set_export set_version
|
||||
|
||||
remkdir "$xbtmp" "$xbtmp/xbmkpath"
|
||||
|
||||
xbmk_set_pyver
|
||||
xbmk_set_mirror
|
||||
forx 'xbmk_set_%s' pyver mirror
|
||||
}
|
||||
|
||||
xbmk_parent_check_tmp()
|
||||
@@ -348,7 +346,7 @@ xbmk_set_mirror()
|
||||
|
||||
git_init()
|
||||
{
|
||||
# the git identity check is only needed for: ./mk -b coreboot [args]
|
||||
# the git identity check is only needed for: "$mk" -b coreboot [args]
|
||||
[ "${2-}" = "-b" ] && [ "${3-}" = "coreboot" ] && \
|
||||
for gitarg in "user.name" "user.email"; do
|
||||
git config --includes $gitarg 1>/dev/null 2>/dev/null || \
|
||||
@@ -381,7 +379,7 @@ xchild()
|
||||
{
|
||||
xbmk_rval=0
|
||||
|
||||
( x_ ./mk "$@" ) || xbmk_rval=1
|
||||
( x_ "$mk" "$@" ) || xbmk_rval=1
|
||||
|
||||
( x_ rm -Rf "$xbtmp" ) || xbmk_rval=1
|
||||
( x_ rm -f "$xbmklock" ) || xbmk_rval=1
|
||||
|
||||
+15
-36
@@ -12,21 +12,17 @@ ifdtool="elf/coreboot/default/ifdtool"
|
||||
checkvars="CONFIG_GBE_BIN_PATH ${checkvarsxbmk-} ${checkvarschk-}"
|
||||
|
||||
eval "`newvar archive board boarddir IFD_platform ifdprefix \
|
||||
new_mac tmpromdir tree xchanged $checkvars`"
|
||||
new_mac nuke tmpromdir tree xchanged $checkvars`"
|
||||
|
||||
inject()
|
||||
{
|
||||
remkdir "$tmpromdel"
|
||||
|
||||
[ $# -lt 1 ] && \
|
||||
err "No options specified" "inject" "$@"
|
||||
[ $# -lt 1 ] && err "No options specified" "inject" "$@"
|
||||
|
||||
archive="$1";
|
||||
new_mac="xx:xx:xx:xx:xx:xx"
|
||||
|
||||
nuke=""
|
||||
xchanged=""
|
||||
|
||||
[ $# -gt 1 ] && case "$2" in
|
||||
nuke)
|
||||
new_mac=""
|
||||
@@ -48,18 +44,11 @@ inject()
|
||||
|
||||
check_release
|
||||
if check_target; then
|
||||
patch_release || \
|
||||
return 0; :
|
||||
patch_release || return 0
|
||||
fi
|
||||
[ "$xchanged" = "y" ] && \
|
||||
remktar
|
||||
|
||||
if [ "$xchanged" = "y" ]; then
|
||||
printf "\n'%s' was modified\n" "$archive" 1>&2
|
||||
else
|
||||
printf "\n'%s' was NOT modified\n" "$archive" 1>&2
|
||||
fi
|
||||
|
||||
x_ rm -Rf "$tmpromdel"
|
||||
}
|
||||
|
||||
@@ -67,9 +56,8 @@ check_release()
|
||||
{
|
||||
[ -L "$archive" ] && \
|
||||
err "'$archive' is a symlink" "check_release" "$@"
|
||||
if e "$archive" f missing; then
|
||||
e "$archive" f missing && \
|
||||
err "'$archive' missing" "check_release" "$@"
|
||||
fi
|
||||
|
||||
archivename="`basename "$archive" || err "Can't get '$archive' name"`" \
|
||||
|| err "can't get '$archive' name" "check_release" "$@"
|
||||
@@ -95,8 +83,7 @@ check_release()
|
||||
|
||||
check_target()
|
||||
{
|
||||
[ "$board" != "${board#serprog_}" ] && \
|
||||
return 1
|
||||
[ "$board" = "${board#serprog_}" ] || return 1
|
||||
|
||||
boarddir="$cbcfgsdir/$board"
|
||||
|
||||
@@ -106,10 +93,9 @@ check_target()
|
||||
[ -z "$tree" ] && \
|
||||
err "tree unset in '$boarddir/target.cfg'" "check_target" "$@"
|
||||
|
||||
x_ ./mk -d coreboot "$tree"
|
||||
x_ "$mk" -d coreboot "$tree"
|
||||
|
||||
ifdtool="elf/coreboot/$tree/ifdtool"
|
||||
|
||||
[ -n "$IFD_platform" ] && \
|
||||
ifdprefix="-p $IFD_platform"; :
|
||||
}
|
||||
@@ -117,7 +103,7 @@ check_target()
|
||||
patch_release()
|
||||
{
|
||||
[ "$nuke" != "nuke" ] && \
|
||||
x_ ./mk download "$board"
|
||||
x_ "$mk" download "$board"
|
||||
|
||||
has_hashes="n"
|
||||
tmpromdir="$tmpromdel/bin/$board"
|
||||
@@ -134,8 +120,7 @@ patch_release()
|
||||
fi
|
||||
done
|
||||
|
||||
readkconfig || \
|
||||
return 1
|
||||
readkconfig || return 1
|
||||
|
||||
[ -n "$new_mac" ] && [ -n "$CONFIG_GBE_BIN_PATH" ] && \
|
||||
modify_mac; :
|
||||
@@ -146,15 +131,13 @@ readkconfig()
|
||||
x_ rm -f "$xbtmp/cbcfg"
|
||||
fx_ scankconfig x_ find "$boarddir/config" -type f
|
||||
|
||||
if e "$xbtmp/cbcfg" f missing; then
|
||||
e "$xbtmp/cbcfg" f missing && \
|
||||
return 1
|
||||
fi
|
||||
|
||||
. "$xbtmp/cbcfg" || \
|
||||
err "Can't read '$xbtmp/cbcfg'" "readkconfig" "$@"
|
||||
|
||||
setvfile "$@" || \
|
||||
return 1; :
|
||||
setvfile "$@" || return 1; :
|
||||
}
|
||||
|
||||
scankconfig()
|
||||
@@ -169,9 +152,7 @@ modify_mac()
|
||||
x_ cp "${CONFIG_GBE_BIN_PATH##*../}" "$xbtmp/gbe"
|
||||
|
||||
if [ -n "$new_mac" ] && [ "$new_mac" != "restore" ]; then
|
||||
x_ make -C util/nvmutil clean
|
||||
x_ make -C util/nvmutil
|
||||
|
||||
forx 'x_ make -C util/nvmutil %s' clean nvmutil
|
||||
x_ "$nvmutil" "$xbtmp/gbe" setmac "$new_mac"
|
||||
fi
|
||||
|
||||
@@ -184,10 +165,9 @@ modify_mac()
|
||||
|
||||
newmac()
|
||||
{
|
||||
if e "$1" f; then
|
||||
xchanged="y"
|
||||
x_ "$ifdtool" $ifdprefix -i GbE:"$xbtmp/gbe" "$1" -O "$1"
|
||||
fi
|
||||
e "$1" f || return 0
|
||||
xchanged="y"
|
||||
x_ "$ifdtool" $ifdprefix -i GbE:"$xbtmp/gbe" "$1" -O "$1"
|
||||
}
|
||||
|
||||
remktar()
|
||||
@@ -201,6 +181,5 @@ remktar()
|
||||
) || err "Cannot re-generate '$archive'" "remktar" "$@"
|
||||
|
||||
mv "${tmpromdir%"/bin/$board"}/bin/${relname}_${board}.tar.xz" \
|
||||
"$archive" || \
|
||||
err "'$archive' -> Can't overwrite" "remktar" "$@"; :
|
||||
"$archive" || err "'$archive' -> Can't overwrite" "remktar" "$@"; :
|
||||
}
|
||||
|
||||
+28
-93
@@ -25,9 +25,6 @@ buildser()
|
||||
|
||||
copyps1bios()
|
||||
{
|
||||
$if_dry_build \
|
||||
return 0
|
||||
|
||||
remkdir "bin/playstation"
|
||||
x_ cp src/pcsx-redux/src/mips/openbios/openbios.bin bin/playstation
|
||||
|
||||
@@ -43,9 +40,6 @@ mkpayload_grub()
|
||||
{
|
||||
eval "`newvar grub_modules grub_install_modules`"
|
||||
|
||||
$if_dry_build \
|
||||
return 0
|
||||
|
||||
. "$grubdata/module/$tree" || \
|
||||
err "Can't read '$grubdata/module/$tree'" "mkpayload_grub" "$@"
|
||||
|
||||
@@ -65,33 +59,21 @@ corebootpremake()
|
||||
[ "$XBMK_RELEASE" = "y" ] && [ "$release" = "n" ] && \
|
||||
return 0
|
||||
|
||||
$if_not_dry_build \
|
||||
cook_coreboot_config
|
||||
|
||||
fx_ check_coreboot_util printf "cbfstool\nifdtool\n"
|
||||
|
||||
printf "%s\n" "${version%%-*}" > "$srcdir/.coreboot-version" || \
|
||||
err "!mk $srcdir .coreboot-version" "corebootpremake" "$@"
|
||||
|
||||
[ -z "$mode" ] && [ "$target" != "$tree" ] && \
|
||||
x_ ./mk download "$target"; :
|
||||
}
|
||||
|
||||
cook_coreboot_config()
|
||||
{
|
||||
if [ -z "$mode" ] && [ -f "$srcdir/.config" ]; then
|
||||
printf "CONFIG_CCACHE=y\n" >> "$srcdir/.config" || \
|
||||
err "can't cook '$srcdir'" "cook_coreboot_config" "$@"
|
||||
fi
|
||||
[ "$target" != "$tree" ] && \
|
||||
x_ "$mk" download "$target"; :
|
||||
}
|
||||
|
||||
check_coreboot_util()
|
||||
{
|
||||
[ "$badhash" = "y" ] && \
|
||||
x_ rm -f "elf/coreboot/$tree/$1"
|
||||
if e "elf/coreboot/$tree/$1" f; then
|
||||
e "elf/coreboot/$tree/$1" f && \
|
||||
return 0
|
||||
fi
|
||||
|
||||
utilelfdir="elf/coreboot/$tree"
|
||||
utilsrcdir="src/coreboot/$tree/util/$1"
|
||||
@@ -121,8 +103,7 @@ coreboot_pad_one_byte()
|
||||
[ "$XBMK_RELEASE" = "y" ] && [ "$release" = "n" ] && \
|
||||
return 0
|
||||
|
||||
$if_not_dry_build \
|
||||
pad_one_byte "$srcdir/build/coreboot.rom"
|
||||
pad_one_byte "$srcdir/build/coreboot.rom"
|
||||
}
|
||||
|
||||
mkcorebootbin()
|
||||
@@ -130,11 +111,7 @@ mkcorebootbin()
|
||||
[ "$XBMK_RELEASE" = "y" ] && [ "$release" = "n" ] && \
|
||||
return 0
|
||||
|
||||
$if_not_dry_build \
|
||||
check_coreboot_util cbfstool
|
||||
|
||||
$if_not_dry_build \
|
||||
check_coreboot_util ifdtool
|
||||
forx 'check_coreboot_util %s' cbfstool ifdtool
|
||||
|
||||
for y in "$target_dir/config"/*; do
|
||||
defconfig="$y"
|
||||
@@ -146,8 +123,7 @@ mkcorebootbin()
|
||||
|
||||
mkcorebootbin_real()
|
||||
{
|
||||
[ "$target" = "$tree" ] && \
|
||||
return 0
|
||||
[ "$target" = "$tree" ] && return 0
|
||||
|
||||
tmprom="$xbtmp/coreboot.rom"
|
||||
|
||||
@@ -169,11 +145,8 @@ mkcorebootbin_real()
|
||||
elfrom="${elfrom}_$displaymode"
|
||||
elfrom="$elfrom/coreboot.rom"
|
||||
|
||||
$if_not_dry_build \
|
||||
x_ cp "$elfrom" "$tmprom"
|
||||
|
||||
$if_not_dry_build \
|
||||
unpad_one_byte "$tmprom"
|
||||
x_ cp "$elfrom" "$tmprom"
|
||||
unpad_one_byte "$tmprom"
|
||||
|
||||
[ -n "$payload_uboot" ] && [ "$payload_uboot" != "amd64" ] && \
|
||||
[ "$payload_uboot" != "i386" ] && [ "$payload_uboot" != "arm64" ] \
|
||||
@@ -188,9 +161,8 @@ mkcorebootbin_real()
|
||||
[ "$payload_grub" = "y" ] && \
|
||||
payload_seabios="y"
|
||||
[ "$payload_seabios" = "y" ] && [ "$payload_uboot" = "arm64" ] && \
|
||||
$if_not_dry_build \
|
||||
err "$target: U-Boot arm / SeaBIOS/GRUB both enabled" \
|
||||
"mkcorebootbin_real" "$@"
|
||||
err "$target: U-Boot arm / SeaBIOS/GRUB both enabled" \
|
||||
"mkcorebootbin_real" "$@"
|
||||
|
||||
[ -z "$grub_scan_disk" ] && \
|
||||
grub_scan_disk="nvme ahci ata"
|
||||
@@ -208,9 +180,6 @@ mkcorebootbin_real()
|
||||
[ "$payload_grub" != "y" ] && \
|
||||
payload_grubsea="n"
|
||||
|
||||
$if_dry_build \
|
||||
return 0
|
||||
|
||||
[ -f "$cbfscfg" ] && \
|
||||
dx_ add_cbfs_option "$cbfscfg"
|
||||
|
||||
@@ -221,7 +190,8 @@ mkcorebootbin_real()
|
||||
fi
|
||||
if [ "$payload_uboot" = "arm64" ]; then
|
||||
pname="uboot"
|
||||
add_uboot
|
||||
add_uboot "" fallback/payload default \
|
||||
"$target" u-boot.elf
|
||||
fi
|
||||
else
|
||||
pname="custom"
|
||||
@@ -256,8 +226,8 @@ add_cbfs_option()
|
||||
add_seabios()
|
||||
{
|
||||
[ -n "$payload_uboot" ] && [ "$payload_uboot" != "arm64" ] && \
|
||||
$if_not_dry_build \
|
||||
add_uboot # add u-boot first, due to fixed cbfs offset
|
||||
[ "$displaymode" != "txtmode" ] && [ "$initmode" != "normal" ] && \
|
||||
add_uboot_x86 # u-boot first, due to fixed cbfs offset
|
||||
|
||||
_seabioself="elf/seabios/default/default/$initmode/bios.bin.elf"
|
||||
[ "$initmode" = "fspgop" ] && \
|
||||
@@ -337,60 +307,28 @@ mkseagrub()
|
||||
fx_ cprom x_ find "$grubdata/keymap" -type f -name "*.gkb"
|
||||
}
|
||||
|
||||
add_uboot_x86()
|
||||
{
|
||||
[ "$payload_uboot" = "amd64" ] && \
|
||||
add_uboot "-l 0x1110000 -e 0x1110000" "img/u-boot" \
|
||||
"x86_64" "amd64coreboot" "u-boot-x86-with-spl.bin"
|
||||
[ "$payload_uboot" = "i386" ] && \
|
||||
add_uboot "-l 0x1110000 -e 0x1110000" "u-boot" "x86" \
|
||||
"i386coreboot" "u-boot-dtb.bin"; :
|
||||
}
|
||||
|
||||
add_uboot()
|
||||
{
|
||||
if [ "$displaymode" = "txtmode" ]; then
|
||||
printf "cb/%s: Can't use U-Boot in text mode\n" "$target" 1>&2
|
||||
return 0
|
||||
elif [ "$initmode" = "normal" ]; then
|
||||
printf "cb/%s: Can't use U-Boot in normal initmode\n" \
|
||||
"$target" 1>&2
|
||||
return 0
|
||||
fi
|
||||
|
||||
# TODO: re-work to allow each coreboot target to say which ub tree
|
||||
# instead of hardcoding as in the current logic below:
|
||||
|
||||
# aarch64 targets:
|
||||
ubcbfsargs=""
|
||||
ubpath="fallback/payload"
|
||||
ubtree="default"
|
||||
ubtarget="$target"
|
||||
|
||||
# override for x86/x86_64 targets:
|
||||
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
|
||||
|
||||
ubpath="img/u-boot" # 64-bit
|
||||
ubtree="x86_64"
|
||||
ubtarget="amd64coreboot"
|
||||
|
||||
if [ "$payload_uboot" = "i386" ]; then
|
||||
ubpath="u-boot" # 32-bit
|
||||
ubtree="x86"
|
||||
ubtarget="i386coreboot"; :
|
||||
fi
|
||||
fi
|
||||
|
||||
ubdir="elf/u-boot/$ubtree/$ubtarget/$uboot_config"
|
||||
|
||||
ubootelf="$ubdir/u-boot.elf" # aarch64
|
||||
ubootelf="elf/u-boot/$3/$4/$uboot_config/$5"
|
||||
[ ! -f "$ubootelf" ] && \
|
||||
ubootelf="$ubdir/u-boot" # aarch64 (fallback)
|
||||
[ "$payload_uboot" = "i386" ] && \
|
||||
ubootelf="$ubdir/u-boot-dtb.bin" # x86 override
|
||||
[ "$payload_uboot" = "amd64" ] && \
|
||||
ubootelf="$ubdir/u-boot-x86-with-spl.bin" # x86_64 override
|
||||
ubootelf="${ubootelf%.elf}" # hack (fix arm64 build)
|
||||
|
||||
cbfs "$tmprom" "$ubootelf" "$ubpath" $ubcbfsargs
|
||||
cbfs "$tmprom" "$ubootelf" "$2" $1
|
||||
[ "$payload_seabios" != "y" ] && \
|
||||
cprom; :
|
||||
}
|
||||
|
||||
# prepare the final image in bin/ for user installation:
|
||||
|
||||
cprom()
|
||||
{
|
||||
cpcmd="cp"
|
||||
@@ -446,14 +384,11 @@ cbfs()
|
||||
|
||||
mkcoreboottar()
|
||||
{
|
||||
$if_dry_build \
|
||||
return 0
|
||||
|
||||
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
|
||||
x_ "$mk" inject "bin/${relname}_${target}.tar.xz" nuke
|
||||
}
|
||||
|
||||
+35
-80
@@ -51,14 +51,12 @@ eval "`newvar DL_hash DL_url DL_url_bkup E6400_VGA_bin_hash E6400_VGA_DL_hash \
|
||||
|
||||
download()
|
||||
{
|
||||
[ $# -lt 1 ] && \
|
||||
err "No argument given" "download" "$@"
|
||||
[ $# -lt 1 ] && err "No argument given" "download" "$@"
|
||||
|
||||
export PATH="$PATH:/sbin"
|
||||
board="$1"
|
||||
|
||||
check_target || return 0
|
||||
readkconfig download
|
||||
check_target && readkconfig download; :
|
||||
}
|
||||
|
||||
getfiles()
|
||||
@@ -108,56 +106,43 @@ fetch()
|
||||
dlop="$6"
|
||||
binsum="$7"
|
||||
|
||||
[ -z "$binsum" ] && \
|
||||
err "binsum is empty (no checksum)" "fetch" "$@"
|
||||
[ -z "$binsum" ] && err "binsum is empty (no checksum)" "fetch" "$@"
|
||||
|
||||
_dl="$XBMK_CACHE/file/$dlsum" # internet file to extract from e.g. .exe
|
||||
_dl_bin="$XBMK_CACHE/file/$binsum" # extracted file e.g. me.bin
|
||||
|
||||
[ "$5" = "/dev/null" ] && \
|
||||
return 0
|
||||
[ "$5" = "/dev/null" ] && return 0 # fetch/extract disabled
|
||||
|
||||
# an extracted vendor file will be placed in pre_dest first, for
|
||||
# verifying its checksum. if it matches, it is later moved to _dest
|
||||
remkdir "${_pre_dest%/*}" "$appdir"
|
||||
|
||||
# HACK: if grabbing fsp from coreboot, fix the path for lbmk
|
||||
if [ "$dl_type" = "fsp" ]; then
|
||||
dl="${dl##*../}"
|
||||
_cdp="$dl"
|
||||
[ "$dl_type" = "fsp" ] && for bkup in "" "_bkup"; do
|
||||
eval "dl$bkup=\"\${dl$bkup##*../}\""
|
||||
eval "_cdp=\"\$dl$bkup\""
|
||||
|
||||
[ ! -f "$_cdp" ] && \
|
||||
_cdp="$cbdir/$_cdp"
|
||||
[ -f "$_cdp" ] && \
|
||||
dl="$_cdp"
|
||||
|
||||
dl_bkup="${dl_bkup##*../}"
|
||||
_cdp="$dl_bkup"
|
||||
|
||||
[ ! -f "$_cdp" ] && \
|
||||
_cdp="$cbdir/$_cdp"
|
||||
[ -f "$_cdp" ] && \
|
||||
dl_bkup="$_cdp"; :
|
||||
fi
|
||||
eval "dl$bkup=\"\$_cdp\""; :
|
||||
done; :
|
||||
|
||||
# download the file (from the internet) to extract from:
|
||||
|
||||
xbget "$dlop" "$dl" "$dl_bkup" "$_dl" "$dlsum"
|
||||
x_ rm -Rf "${_dl}_extracted"
|
||||
|
||||
# skip extraction if a cached extracted file exists:
|
||||
|
||||
( xbget copy "$_dl_bin" "$_dl_bin" "$_dest" "$binsum" 2>/dev/null ) || :
|
||||
[ -f "$_dest" ] && \
|
||||
return 0
|
||||
|
||||
x_ mkdir -p "${_dest%/*}"
|
||||
|
||||
if [ "$dl_type" != "fsp" ]; then
|
||||
[ "$dl_type" = "fsp" ] || \
|
||||
extract_archive "$_dl" "$appdir" || \
|
||||
[ "$dl_type" = "e6400vga" ] || \
|
||||
err "$_dest $dl_type: !extract" "fetch" "$@"
|
||||
fi
|
||||
|
||||
x_ extract_$dl_type "$_dl" "$appdir"
|
||||
set -u -e
|
||||
@@ -168,39 +153,26 @@ fetch()
|
||||
( fx_ "mkdst $binsum" x_ find "${_pre_dest%/*}" -type f ) || :
|
||||
|
||||
bad_checksum "$binsum" "$_dest" || \
|
||||
[ ! -f "$_dest" ] || \
|
||||
return 0; :
|
||||
[ ! -f "$_dest" ] || return 0; :
|
||||
|
||||
[ -z "$binsum" ] && \
|
||||
printf "'%s': checksum undefined\n" "$_dest" 1>&2
|
||||
|
||||
if [ -L "$_dest" ]; then
|
||||
printf "WARNING: '%s' is a link!\n" "$_dest" 1>&2
|
||||
else
|
||||
x_ rm -f "$_dest"
|
||||
fi
|
||||
x_ rm -f "$_dest"
|
||||
|
||||
[ -z "$binsum" ] && printf "WARNING: %s: no checksum\n" "$_dest" 1>&2
|
||||
err "Can't safely extract '$_dest', for board '$board'" "fetch" "$@"
|
||||
}
|
||||
|
||||
mkdst()
|
||||
{
|
||||
if bad_checksum "$1" "$2" 2>/dev/null; then
|
||||
x_ rm -f "$2"
|
||||
else
|
||||
if ! bad_checksum "$1" "$2" 2>/dev/null; then
|
||||
x_ mv "$2" "$_dl_bin"
|
||||
x_ cp "$_dl_bin" "$_dest"
|
||||
|
||||
exit 1
|
||||
fi
|
||||
x_ rm -f "$2"
|
||||
}
|
||||
|
||||
extract_intel_me()
|
||||
{
|
||||
if e "$mecleaner" f missing; then
|
||||
err "$cbdir: me_cleaner missing" "extract_intel_me" "$@"
|
||||
fi
|
||||
|
||||
mfs=""
|
||||
_7ztest="$xbtmp/metmp/a"
|
||||
_metmp="$xbtmp/me.bin"
|
||||
@@ -222,7 +194,7 @@ extract_intel_me()
|
||||
"extract_intel_me" "$@"
|
||||
fi
|
||||
|
||||
x_ ./mk -f deguard
|
||||
x_ "$mk" -f deguard
|
||||
fi
|
||||
|
||||
set +u +e
|
||||
@@ -243,10 +215,8 @@ extract_intel_me()
|
||||
# must be called inside a subshell.
|
||||
find_me()
|
||||
{
|
||||
[ -f "$_metmp" ] && \
|
||||
exit 1 # me.bin found
|
||||
[ -L "$1" ] && \
|
||||
return 0 # symlinks disabled for security reasons
|
||||
[ -f "$_metmp" ] && exit 1 # me.bin found
|
||||
[ -L "$1" ] && return 0 # symlinks disabled for security reasons
|
||||
|
||||
_7ztest="${_7ztest}a"
|
||||
|
||||
@@ -283,8 +253,7 @@ find_me()
|
||||
return 0 # can't extract, so try the next file
|
||||
fi
|
||||
|
||||
[ -f "$_metmp" ] && \
|
||||
exit 1 # me.bin found
|
||||
[ -f "$_metmp" ] && exit 1 # me.bin found
|
||||
|
||||
( fx_ find_me x_ find "$_7ztest" -type f ) || exit 1; : # 1==me found
|
||||
}
|
||||
@@ -333,8 +302,7 @@ extract_kbc1126ec_dump()
|
||||
unar -D 68*.CAB Rom.bin || \
|
||||
err "!kbc1126 unar" "extract_kbc1126ec" "$@"
|
||||
|
||||
[ ! -f "ec.bin" ] && \
|
||||
x_ mv Rom.bin ec.bin
|
||||
[ -f "ec.bin" ] || x_ mv Rom.bin ec.bin
|
||||
|
||||
x_ e ec.bin f
|
||||
x_ "$kbc1126_ec_dump" ec.bin
|
||||
@@ -380,8 +348,7 @@ extract_sch5545ec()
|
||||
# https://pcsupport.lenovo.com/us/en/products/laptops-and-netbooks/thinkpad-t-series-laptops/thinkpad-t480-type-20l5-20l6/20l5/solutions/ht508988
|
||||
extract_tbfw()
|
||||
{
|
||||
[ -z "$TBFW_size" ] && \
|
||||
err "$board: TBFW_size unset" "extract_tbfw" "$@"
|
||||
[ -z "$TBFW_size" ] && err "$board: TBFW_size unset" extract_tbfw "$@"
|
||||
|
||||
fx_ copytb x_ find "$appdir" -type f -name "TBT.bin"
|
||||
}
|
||||
@@ -412,17 +379,15 @@ setvfile()
|
||||
eval "$vcmd && do_getvfile=\"y\""
|
||||
|
||||
[ "$do_getvfile" = "y" ] && \
|
||||
if getvfile "$@"; then
|
||||
return 0
|
||||
fi; :
|
||||
getvfile "$@" && \
|
||||
return 0; :
|
||||
done && return 1; :
|
||||
}
|
||||
|
||||
getvfile()
|
||||
{
|
||||
if e "config/vendor/$vcfg/pkg.cfg" f missing; then
|
||||
e "config/vendor/$vcfg/pkg.cfg" f missing && \
|
||||
return 1
|
||||
fi
|
||||
|
||||
. "config/vendor/$vcfg/pkg.cfg" || \
|
||||
err "Can't read 'config/vendor/$vcfg/pkg.cfg'" "getvfile" "$@"
|
||||
@@ -430,12 +395,8 @@ getvfile()
|
||||
bootstrap
|
||||
|
||||
if [ $# -gt 0 ]; then
|
||||
# download vendor files
|
||||
|
||||
getfiles
|
||||
else
|
||||
# inject vendor files
|
||||
|
||||
getfiles # ./mk download
|
||||
else # ./mk inject
|
||||
fx_ prep x_ find "$tmpromdir" -mindepth 1 -maxdepth 1 \
|
||||
-type f -name "*.rom"
|
||||
( check_vendor_hashes ) || \
|
||||
@@ -455,20 +416,17 @@ bootstrap()
|
||||
[ "$XBMKmecleaner" = "y" ] && \
|
||||
mecleaner="$xbmkpwd/src/me_cleaner/me_cleaner.py"
|
||||
|
||||
x_ ./mk -f coreboot "${cbdir##*/}"
|
||||
x_ ./mk -f me_cleaner
|
||||
x_ "$mk" -f coreboot "${cbdir##*/}"
|
||||
x_ "$mk" -f me_cleaner
|
||||
|
||||
x_ ./mk -b bios_extract
|
||||
x_ ./mk -b biosutilities
|
||||
x_ ./mk -b uefitool
|
||||
x_ ./mk -b libarchive # for bsdtar and bsdunzip
|
||||
forx 'x_ \"$mk\" -b %s' bios_extract biosutilities uefitool libarchive
|
||||
|
||||
[ -d "${kbc1126_ec_dump%/*}" ] && \
|
||||
x_ make -C "$cbdir/util/kbc1126"
|
||||
|
||||
if [ -n "$MRC_refcode_cbtree" ]; then
|
||||
cbfstoolref="elf/coreboot/$MRC_refcode_cbtree/cbfstool"
|
||||
x_ ./mk -d coreboot "$MRC_refcode_cbtree"; :
|
||||
x_ "$mk" -d coreboot "$MRC_refcode_cbtree"; :
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -481,9 +439,8 @@ prep()
|
||||
[ "$nuke" = "nuke" ] && \
|
||||
_xromnew="${_xrom%/*}/$vfix${_xrom##*/}"
|
||||
|
||||
if e "$_xrom" f missing; then
|
||||
e "$_xrom" f missing && \
|
||||
return 0
|
||||
fi
|
||||
|
||||
[ -z "${_xromname#"$vfix"}" ] && \
|
||||
err "$_xromname / $vfix: name match" "prep" "$@"
|
||||
@@ -502,8 +459,7 @@ prep()
|
||||
( mksha512 "$_xrom" "vendorhashes" ) || err; :
|
||||
fi
|
||||
|
||||
add_vfiles "$_xrom" || \
|
||||
return 1 # no need to insert files
|
||||
add_vfiles "$_xrom" || return 1 # no need to insert files
|
||||
|
||||
if [ "$nuke" = "nuke" ]; then
|
||||
pad_one_byte "$_xrom"
|
||||
@@ -513,7 +469,7 @@ prep()
|
||||
|
||||
mksha512()
|
||||
{
|
||||
build_sbase
|
||||
eval "$build_sbase"
|
||||
|
||||
[ "${1%/*}" != "$1" ] && \
|
||||
x_ cd "${1%/*}"
|
||||
@@ -566,8 +522,7 @@ add_vfiles()
|
||||
|
||||
vfile()
|
||||
{
|
||||
[ "$2" = "/dev/null" ] && \
|
||||
return 0
|
||||
[ "$2" = "/dev/null" ] && return 0
|
||||
|
||||
cbfsname="$1"
|
||||
_dest="${2##*../}"
|
||||
@@ -612,7 +567,7 @@ vfile()
|
||||
# must be called from a subshell
|
||||
check_vendor_hashes()
|
||||
{
|
||||
build_sbase
|
||||
eval "$build_sbase"
|
||||
|
||||
x_ cd "$tmpromdir"
|
||||
|
||||
|
||||
+6
-17
@@ -8,6 +8,8 @@
|
||||
cbfstool="elf/coreboot/default/cbfstool"
|
||||
rmodtool="elf/coreboot/default/rmodtool"
|
||||
|
||||
build_sbase="[ ! -f \"\$sha512sum\" ] && x_ make -C util/sbase"
|
||||
|
||||
newvar()
|
||||
{
|
||||
printf "%s\n" "$*" | \
|
||||
@@ -44,13 +46,9 @@ version()
|
||||
|
||||
xbmk_sanitize_version()
|
||||
{
|
||||
[ -z "$version" ] && \
|
||||
return 0
|
||||
|
||||
version="`printf '%s\n' "$version" | sed \
|
||||
's/[[:space:]]//g; s/\.\.//g; s/\.\///g; s/\//-/g; s/^-//'`"
|
||||
|
||||
[ -z "$version" ] && \
|
||||
[ -n "$version" ] && version="`printf '%s\n' "$version" | sed \
|
||||
's/[[:space:]]//g; s/\.\.//g; s/\.\///g; s/\//-/g; s/^-//'`" \
|
||||
&& [ -z "$version" ] && \
|
||||
err "'version' empty after sanitization" \
|
||||
"xbmk_sanitize_version" "$@"; :
|
||||
}
|
||||
@@ -84,8 +82,6 @@ e()
|
||||
printf "%s %s\n" "$1" "$es2" 1>&2
|
||||
}
|
||||
|
||||
# return 0 if project is single-tree, otherwise 1
|
||||
# e.g. coreboot is multi-tree, so 1
|
||||
singletree()
|
||||
{
|
||||
( fx_ "eval exit 1 && err" find "config/$1/"*/ -type f \
|
||||
@@ -118,12 +114,6 @@ unpad_one_byte()
|
||||
x_ mv "$unpaddedfile" "$1"
|
||||
}
|
||||
|
||||
build_sbase()
|
||||
{
|
||||
[ ! -f "$sha512sum" ] && \
|
||||
x_ make -C "$xbmkpwd/util/sbase"; :
|
||||
}
|
||||
|
||||
remkdir()
|
||||
{
|
||||
x_ rm -Rf "$@"
|
||||
@@ -154,8 +144,7 @@ dx_()
|
||||
{
|
||||
xchk dx_ "$@"
|
||||
|
||||
[ ! -f "$2" ] && \
|
||||
return 0
|
||||
[ ! -f "$2" ] && return 0
|
||||
|
||||
while read -r fx; do
|
||||
$1 "$fx" || return 1; :
|
||||
|
||||
+4
-21
@@ -2,23 +2,13 @@
|
||||
|
||||
# Copyright (c) 2023-2026 Leah Rowe <leah@libreboot.org>
|
||||
|
||||
eval "`newvar reldest reldir relmode rsrc vdir`"
|
||||
eval "`newvar reldest reldir rsrc vdir`"
|
||||
|
||||
release()
|
||||
{
|
||||
export XBMK_RELEASE="y"
|
||||
reldir="release"
|
||||
|
||||
while getopts m: option
|
||||
do
|
||||
[ -z "$OPTARG" ] && \
|
||||
err "empty argument not allowed" "release" "$@"
|
||||
[ "$option" != "m" ] && \
|
||||
err "invalid option '-$option'" "release" "$@"
|
||||
|
||||
relmode="$OPTARG"
|
||||
done
|
||||
|
||||
reldest="$reldir/$version"
|
||||
[ -e "$reldest" ] && \
|
||||
err "already exists: \"$reldest\"" "release" "$@"
|
||||
@@ -32,10 +22,7 @@ release()
|
||||
x_ git clone . "$rsrc"
|
||||
update_xbmkver "$rsrc"
|
||||
|
||||
prep_release src
|
||||
prep_release tarball
|
||||
[ "$relmode" != "src" ] && \
|
||||
prep_release bin
|
||||
forx 'prep_release %s' src tarball bin
|
||||
|
||||
x_ rm -Rf "$rsrc"
|
||||
|
||||
@@ -66,8 +53,7 @@ prep_release_src()
|
||||
|
||||
x_ ./mk -f
|
||||
|
||||
fx_ "x_ rm -Rf" x_ find . -name ".git"
|
||||
fx_ "x_ rm -Rf" x_ find . -name ".gitmodules"
|
||||
forx 'fx_ \"x_ rm -Rf\" x_ find . -name \".%s\"' git gitmodules
|
||||
|
||||
( fx_ nuke x_ find config -type f -name "nuke.list" ) || \
|
||||
err "can't prune project files" "prep_release_src" "$@"; :
|
||||
@@ -104,10 +90,7 @@ prep_release_bin()
|
||||
{
|
||||
x_ ./mk -d coreboot
|
||||
|
||||
x_ ./mk -b coreboot
|
||||
x_ ./mk -b pico-serprog
|
||||
x_ ./mk -b stm32-vserprog
|
||||
x_ ./mk -b pcsx-redux
|
||||
forx 'x_ ./mk -b' coreboot pico-serprog stm32-vserprog pcsx-redux
|
||||
|
||||
fx_ mkrom_tarball x_ find bin -mindepth 1 -maxdepth 1 \
|
||||
-type d -name "serprog_*"
|
||||
|
||||
@@ -9,15 +9,28 @@
|
||||
|
||||
set -u -e
|
||||
|
||||
eval "`printf "LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE \
|
||||
LC_MONETARY LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE \
|
||||
LC_MEASUREMENT LC_IDENTIFICATION LC_ALL\n" | \
|
||||
awk '{ for (i=1; i<=NF; i++) $i = "export " $i "=C.UTF-8;"; print }'`"
|
||||
|
||||
findpath()
|
||||
{
|
||||
eval "$(printf '%s\n' "$@" | awk '{printf "readlink -f \"%s\" \
|
||||
2>/dev/null || realpath \"%s\" 2>/dev/null || return 1;",$0,$0}')"
|
||||
forx 'readlink -f \"%s\" 2>/dev/null || \
|
||||
x_ realpath \"%s\" 2>/dev/null' "$@"
|
||||
}
|
||||
|
||||
printf "%s\n" "%s" | grep -o "%s" 1>/dev/null || exit 1 # safety (-o check)
|
||||
forx()
|
||||
{
|
||||
awkarg="{printf \"${1-};\""
|
||||
shift 1 2>/dev/null || :
|
||||
|
||||
scount="$(printf "%s\n" "$awkarg" | grep -o "%s" | wc -l)"
|
||||
while [ $scount -gt 0 ]; do
|
||||
awkarg="$awkarg,\$0"
|
||||
scount="$(expr $scount - 1 || :)"
|
||||
done
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
eval "$(printf '%s\n' "$1" | awk "$awkarg}")"
|
||||
shift 1
|
||||
done
|
||||
}
|
||||
|
||||
x_()
|
||||
@@ -33,12 +46,17 @@ err()
|
||||
exit 1
|
||||
}
|
||||
|
||||
(
|
||||
xbarg0="$0"
|
||||
[ "${xbarg0##*/}" = "$xbarg0" ] && \
|
||||
xbarg0="`command -v "$xbarg0"`"
|
||||
forx 'export %s=\"C.UTF-8\"' LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME \
|
||||
LC_COLLATE LC_MONETARY LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS \
|
||||
LC_TELEPHONE LC_MEASUREMENT LC_IDENTIFICATION LC_ALL
|
||||
|
||||
xbmkpwd="$(x_ dirname "$(x_ findpath "$xbarg0")")" || exit 1
|
||||
(
|
||||
mk="$0"
|
||||
[ "${mk##*/}" != "$mk" ] || \
|
||||
mk="$(x_ command -v "$mk")" || exit 1
|
||||
|
||||
mk="$(x_ findpath "$mk")" || exit 1
|
||||
xbmkpwd="$(x_ dirname "$mk")" || exit 1
|
||||
|
||||
x_ cd "$xbmkpwd"
|
||||
|
||||
@@ -61,28 +79,23 @@ shift 1 2>/dev/null || :
|
||||
eval "$(printf "version release download inject\n" | awk '{ for (i=1; i<=NF; \
|
||||
i++) $i = "[ \""$i"\" = \"$_f\" ] && x_ "$i" \"$@\" && exit 0;"; print }')"
|
||||
|
||||
# flag e.g. ./mk -b <-- mkflag would be "b"
|
||||
flag=""
|
||||
|
||||
# macros, overridden depending on the flag
|
||||
if_do_make=""
|
||||
if_not_do_make=":" # : means false
|
||||
if_make_config=":"
|
||||
if_build=":" # can be false even if make is true
|
||||
if_dry_build=":"
|
||||
if_not_do_make=":"
|
||||
if_not_dry_build=""
|
||||
if_single_tree=":"
|
||||
eval "`newvar if_do_make if_not_make_config if_not_build if_not_dry_build`"
|
||||
|
||||
eval "`newvar autoconfargs autogenargs badhash badtghash bootstrapargs \
|
||||
eval "`newvar configureargs autogenargs badhash badtghash bootstrapargs \
|
||||
build_depend buildtype cleanargs cmakedir cmd defconfig dest_dir elfdir \
|
||||
forcepull listfile makeargs mdir mkhelper mkhelpercfg mode postmake \
|
||||
flag forcepull listfile makeargs mdir mkhelper mkhelpercfg mode postmake \
|
||||
premake project release rev srcdir target target_dir tree xarch xgcctree \
|
||||
xlang`"
|
||||
|
||||
# can be overridden in project mkhelper.cfg
|
||||
gitclean="y"
|
||||
gitcleanargs="-fdx"
|
||||
|
||||
main()
|
||||
{
|
||||
flags="f:F:b:m:u:c:x:s:l:n:d:"
|
||||
flags="f:F:b:m:u:s:l:n:d:"
|
||||
|
||||
while getopts $flags option
|
||||
do
|
||||
@@ -92,39 +105,38 @@ main()
|
||||
flag="$1"
|
||||
|
||||
# the "mode" variable is affixed to a make command, example:
|
||||
# ./mk -m coreboot does: make menuconfig -C src/coreboot/tree
|
||||
# "$mk" -m coreboot does: make menuconfig -C src/coreboot/tree
|
||||
|
||||
case "$flag" in
|
||||
-d)
|
||||
# -d is similar to -b, except that
|
||||
# a large number of operations will be
|
||||
# skipped. these are "if_not_dry_build build" scenarios
|
||||
# where only a subset of build tasks are done,
|
||||
# and $if_not_dry_build is prefixed to skipped commands
|
||||
|
||||
-b) : ;; # build a source tree
|
||||
-d) # dry builds. -d is like -b but skips many build steps
|
||||
if_dry_build=""
|
||||
if_not_dry_build=":"
|
||||
;;
|
||||
-b) : ;;
|
||||
-u) mode="oldconfig" ;;
|
||||
-m) mode="menuconfig" ;;
|
||||
-c) mode="distclean" ;;
|
||||
-x) mode="crossgcc-clean" ;;
|
||||
-f|-F) # download source code for a project
|
||||
# macros. colon means false.
|
||||
eval "`newvar if_not_do_make if_dry_build`"
|
||||
if_do_make=":"
|
||||
if_dry_build=""
|
||||
if_not_do_make=""
|
||||
if_not_dry_build=":"
|
||||
[ "$flag" = "-F" ] && \
|
||||
forcepull="y"; : # never skip git fetch/pull
|
||||
;;
|
||||
-u) mode="oldconfig" ;;
|
||||
-m) mode="menuconfig" ;;
|
||||
-s) mode="savedefconfig" ;;
|
||||
-l) mode="olddefconfig" ;;
|
||||
-n) mode="nconfig" ;;
|
||||
*) err "invalid option '-$option'" "trees" "$@" ;;
|
||||
esac
|
||||
|
||||
if [ -z "$mode" ]; then
|
||||
if_build=""
|
||||
if_not_build=":"
|
||||
fi
|
||||
if [ "${mode%config}" != "$mode" ]; then
|
||||
if_make_config=""
|
||||
if_not_make_config=":"
|
||||
fi
|
||||
|
||||
if [ -z "${OPTARG+x}" ]; then
|
||||
shift 1
|
||||
break
|
||||
@@ -139,7 +151,7 @@ main()
|
||||
if [ -z "$flag" ]; then
|
||||
err "missing flag ($flags)" "trees" "$@"
|
||||
elif [ -z "$project" ]; then
|
||||
fx_ "x_ ./mk $flag" x_ ls -1 config/git
|
||||
fx_ "x_ "$mk" $flag" x_ ls -1 config/git
|
||||
return 0
|
||||
elif [ ! -f "config/git/$project/pkg.cfg" ]; then
|
||||
err "config/git/$project/pkg.cfg missing" "trees" "$@"
|
||||
@@ -161,9 +173,12 @@ main()
|
||||
x_ touch "$mkhelpercfg"
|
||||
fi
|
||||
|
||||
cmd="build_project"
|
||||
singletree "$project" || \
|
||||
cmd="build_targets"
|
||||
if singletree "$project"; then
|
||||
cmd="mk_single_tree"
|
||||
if_single_tree=""
|
||||
else
|
||||
cmd="mk_multi_tree"
|
||||
fi
|
||||
|
||||
remkdir "${tmpgit%/*}"
|
||||
x_ touch "$mkhelpercfg"
|
||||
@@ -172,33 +187,24 @@ main()
|
||||
$cmd "$@"
|
||||
}
|
||||
|
||||
build_project()
|
||||
mk_single_tree()
|
||||
{
|
||||
configure_project "$configdir" || \
|
||||
return 0
|
||||
|
||||
[ ! -f "$listfile" ] || \
|
||||
$if_not_dry_build elfcheck || \
|
||||
return 0
|
||||
[ ! -f "$listfile" ] || $if_not_dry_build \
|
||||
elfcheck || return 0
|
||||
|
||||
[ "$mode" = "distclean" ] && \
|
||||
mode="clean"
|
||||
|
||||
run_make_command || \
|
||||
return 0
|
||||
|
||||
[ -z "$mode" ] && \
|
||||
$if_not_dry_build \
|
||||
copy_elf; :
|
||||
run_make_command && $if_build $if_not_dry_build \
|
||||
copy_elf; :
|
||||
}
|
||||
|
||||
build_targets()
|
||||
mk_multi_tree()
|
||||
{
|
||||
[ ! -d "$configdir" ] && \
|
||||
err "directory '$configdir' doesn't exist" "build_targets" "$@"
|
||||
[ $# -lt 1 ] && \
|
||||
fx_ build_targets find "$configdir" \
|
||||
[ ! -d "$configdir" ] && err "missing '$configdir'" mk_multi_tree "$@"
|
||||
[ $# -lt 1 ] && fx_ mk_multi_tree find "$configdir" \
|
||||
-mindepth 1 -maxdepth 1 -type d
|
||||
|
||||
[ $# -gt 0 ] && for x in "$@"
|
||||
do
|
||||
unset CROSS_COMPILE
|
||||
@@ -215,8 +221,7 @@ build_targets()
|
||||
target="${x##*/}"
|
||||
|
||||
x_ handle_defconfig
|
||||
|
||||
[ -z "$mode" ] && \
|
||||
$if_build \
|
||||
x_ $postmake; :
|
||||
done; :
|
||||
}
|
||||
@@ -226,43 +231,31 @@ handle_defconfig()
|
||||
target_dir="$configdir/$target"
|
||||
|
||||
[ ! -f "CHANGELOG" ] && \
|
||||
fetch_project "$project"
|
||||
single_tree_fetch "$project"
|
||||
|
||||
configure_project "$target_dir" || \
|
||||
return 0
|
||||
|
||||
[ -z "$tree" ] && \
|
||||
err "$configdir: 'tree' not set" "handle_defconfig" "$@"
|
||||
[ -z "$tree" ] && err "$configdir: 'tree' unset" handle_defconfig "$@"
|
||||
|
||||
srcdir="src/$project/$tree"
|
||||
|
||||
[ "$mode" = "${mode%clean}" ] && [ ! -d "$srcdir" ] && \
|
||||
return 0
|
||||
|
||||
for y in "$target_dir/config"/*
|
||||
[ -d "$srcdir" ] && for y in "$target_dir/config"/*
|
||||
do
|
||||
[ "$flag" != "-d" ] && [ ! -f "$y" ] && \
|
||||
continue
|
||||
[ "$flag" != "-d" ] && \
|
||||
[ ! -f "$y" ] && \
|
||||
$if_not_dry_build \
|
||||
continue
|
||||
|
||||
$if_not_dry_build eval \
|
||||
defconfig="$y"
|
||||
|
||||
if [ -z "$mode" ]; then
|
||||
check_defconfig || continue; :
|
||||
fi
|
||||
|
||||
[ -z "$mode" ] && \
|
||||
for _xarch in $xarch; do
|
||||
$if_dry_build \
|
||||
break
|
||||
[ -n "$_xarch" ] && \
|
||||
check_cross_compiler "$_xarch"; :
|
||||
done; :
|
||||
$if_build \
|
||||
prep_mk_multi_tree || continue
|
||||
|
||||
handle_makefile
|
||||
|
||||
[ -z "$mode" ] && \
|
||||
$if_not_dry_build \
|
||||
copy_elf; :
|
||||
$if_build $if_not_dry_build \
|
||||
copy_elf; :
|
||||
done; :
|
||||
}
|
||||
|
||||
@@ -270,13 +263,11 @@ configure_project()
|
||||
{
|
||||
_tcfg="$1/target.cfg"
|
||||
|
||||
eval "`newvar autoconfargs badhash badtghash bootstrapargs \
|
||||
eval "`newvar configureargs badhash badtghash bootstrapargs \
|
||||
build_depend buildtype cleanargs makeargs mkhelper postmake \
|
||||
premake release xarch xgcctree xlang`"
|
||||
gitclean="y"
|
||||
|
||||
[ ! -f "$_tcfg" ] && \
|
||||
buildtype="auto"
|
||||
[ ! -f "$_tcfg" ] && buildtype="auto"
|
||||
|
||||
# globally initialise all variables for a source tree / target:
|
||||
if e "$datadir/mkhelper.cfg" f; then
|
||||
@@ -286,19 +277,18 @@ configure_project()
|
||||
fi
|
||||
|
||||
# override target/tree specific variables from per-target config:
|
||||
while e "$_tcfg" f || [ "$cmd" != "build_project" ]
|
||||
while e "$_tcfg" f || [ "$cmd" != "mk_single_tree" ]
|
||||
do
|
||||
printf "Loading %s config: %s\n" "$project" "$_tcfg"
|
||||
eval "`newvar rev tree`"
|
||||
|
||||
. "$_tcfg" || \
|
||||
err "Can't read '$_tcfg'" "configure_project" "$@"
|
||||
. "$_tcfg" || err "Can't read '$_tcfg'" configure_project "$@"
|
||||
|
||||
[ "$flag" = "-d" ] && \
|
||||
build_depend="" # dry run
|
||||
$if_dry_build eval \
|
||||
build_depend=""
|
||||
|
||||
[ "$cmd" = "build_project" ] && \
|
||||
break # single-tree, so targeting is unnecessary
|
||||
$if_single_tree \
|
||||
break
|
||||
$if_do_make \
|
||||
break
|
||||
[ "${_tcfg%/*/target.cfg}" = "${_tcfg%"/$tree/target.cfg"}" ] \
|
||||
@@ -309,26 +299,24 @@ configure_project()
|
||||
|
||||
[ "$XBMK_RELEASE" = "y" ] && [ "$release" = "n" ] && \
|
||||
return 1
|
||||
[ -n "$buildtype" ] && [ "${mode%config}" != "$mode" ] && \
|
||||
[ -n "$buildtype" ] && $if_make_config \
|
||||
return 1
|
||||
|
||||
[ -z "$mode" ] && \
|
||||
$if_not_dry_build \
|
||||
build_dependencies
|
||||
$if_build $if_not_dry_build \
|
||||
build_dependencies
|
||||
|
||||
mdir="$xbmkpwd/config/submodule/$project"
|
||||
[ -n "$tree" ] && \
|
||||
mdir="$mdir/$tree"
|
||||
[ -n "$tree" ] && mdir="$mdir/$tree"
|
||||
|
||||
if [ ! -f "CHANGELOG" ]; then
|
||||
delete_old_project_files
|
||||
$if_not_do_make \
|
||||
fetch_${cmd#build_}
|
||||
${cmd#mk_}_fetch
|
||||
fi
|
||||
$if_not_do_make \
|
||||
return 1
|
||||
|
||||
x_ ./mk -f "$project" "$target"
|
||||
x_ "$mk" -f "$project" "$target"
|
||||
}
|
||||
|
||||
# projects can specify which other projects
|
||||
@@ -345,11 +333,13 @@ build_dependencies()
|
||||
$if_not_dry_build \
|
||||
err "$project/$tree: !bd '$bd'" \
|
||||
"build_dependencies" "$@"
|
||||
|
||||
[ "${bd##*/}" = "$bd" ] && \
|
||||
bd_tree=""
|
||||
|
||||
[ -n "$bd_project" ] && \
|
||||
$if_not_dry_build \
|
||||
x_ ./mk -b $bd_project $bd_tree; :
|
||||
x_ "$mk" -b $bd_project $bd_tree; :
|
||||
done; :
|
||||
}
|
||||
|
||||
@@ -405,7 +395,7 @@ project_up_to_date()
|
||||
"$@"
|
||||
fi
|
||||
|
||||
build_sbase
|
||||
eval "$build_sbase"
|
||||
fx_ "x_ util/sbase/sha512sum" find "$@" -type f -not -path \
|
||||
"*/.git*/*" | awk '{print $1}' > "$xbtmp/tmp.hash" || \
|
||||
err "!h $project $hashdir" \
|
||||
@@ -427,7 +417,16 @@ project_up_to_date()
|
||||
eval "[ \"\$$badhashvar\" = \"y\" ] && return 1"; :
|
||||
}
|
||||
|
||||
check_cross_compiler()
|
||||
prep_mk_multi_tree()
|
||||
{
|
||||
dest_dir="$elfdir/$tree/$target/${defconfig#"$target_dir/config/"}"
|
||||
|
||||
$if_not_dry_build elfcheck || return 1 # skip if a build exists
|
||||
$if_not_dry_build eval "$(printf '%s\n' "$xarch" | awk \
|
||||
'{ for (i=1; i<=NF; i++) $i = "check_xgcc \""$i"\";"; print }')"
|
||||
}
|
||||
|
||||
check_xgcc()
|
||||
{
|
||||
cbdir="src/coreboot/$tree"
|
||||
|
||||
@@ -436,15 +435,16 @@ check_cross_compiler()
|
||||
[ -n "$xgcctree" ] && \
|
||||
cbdir="src/coreboot/$xgcctree"
|
||||
|
||||
xfix="${1%-*}"
|
||||
[ "$xfix" = "x86_64" ] && \
|
||||
xfix="x64"
|
||||
cbelfdir="elf${cbdir#src}"
|
||||
|
||||
xgccfile="elf/coreboot/$tree/xgcc_${xfix}_was_compiled"
|
||||
xfix="${1%-*}"
|
||||
[ "$xfix" = "x86_64" ] && xfix="x64"
|
||||
|
||||
xgccfile="$cbelfdir/xgcc_${xfix}_was_compiled"
|
||||
xgccargs="crossgcc-$xfix UPDATED_SUBMODULES=1 CPUS=$XBMK_THREADS"
|
||||
|
||||
x_ ./mk -f coreboot "${cbdir#src/coreboot/}"
|
||||
x_ mkdir -p "elf/coreboot/$tree" # TODO: is this needed?
|
||||
x_ "$mk" -f coreboot "${cbdir#src/coreboot/}"
|
||||
x_ mkdir -p "$cbelfdir"
|
||||
|
||||
# tell build systems what cross-compiler to use
|
||||
export PATH="$xbmkpwd/$cbdir/util/crossgcc/xgcc/bin:$PATH"
|
||||
@@ -454,110 +454,56 @@ check_cross_compiler()
|
||||
[ -n "$xlang" ] && \
|
||||
export BUILD_LANGUAGES="$xlang"
|
||||
|
||||
[ -f "$xgccfile" ] && \
|
||||
return 0 # build exists already, so skip building
|
||||
[ -f "$xgccfile" ] && return 0 # skip (build already exists)
|
||||
|
||||
# it sometimes fails for like, no reason
|
||||
make -C "$cbdir" $xgccargs || x_ make -C "$cbdir" $xgccargs
|
||||
|
||||
x_ touch "$xgccfile" # prevent unnecessary re-build operations
|
||||
}
|
||||
|
||||
check_defconfig()
|
||||
{
|
||||
[ ! -f "$defconfig" ] && \
|
||||
$if_not_dry_build \
|
||||
err "$project/$target: no config" check_defconfig "$@"
|
||||
|
||||
dest_dir="$elfdir/$tree/$target/${defconfig#"$target_dir/config/"}"
|
||||
|
||||
# skip build if a previous one exists:
|
||||
|
||||
$if_dry_build \
|
||||
return 0
|
||||
elfcheck || \
|
||||
return 1; :
|
||||
}
|
||||
|
||||
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; :
|
||||
}
|
||||
|
||||
handle_makefile()
|
||||
{
|
||||
if $if_not_dry_build check_makefile "$srcdir"; then
|
||||
$if_not_dry_build \
|
||||
x_ make -C "$srcdir" $cleanargs clean
|
||||
fi
|
||||
check_makefile "$srcdir" && $if_not_dry_build \
|
||||
x_ make -C "$srcdir" clean $cleanargs
|
||||
|
||||
[ -f "$defconfig" ] && \
|
||||
x_ cp "$defconfig" "$srcdir/.config"
|
||||
|
||||
run_make_command || \
|
||||
err "no makefile!" "handle_makefile" "$@"
|
||||
run_make_command || err "no makefile!" "handle_makefile" "$@"
|
||||
|
||||
_copy=".config"
|
||||
|
||||
[ "$mode" = "savedefconfig" ] && \
|
||||
_copy="defconfig"
|
||||
|
||||
[ "${mode%config}" != "$mode" ] && \
|
||||
$if_not_dry_build \
|
||||
x_ cp "$srcdir/$_copy" "$defconfig"; :
|
||||
|
||||
[ -e "$srcdir/.git" ] && [ "$gitclean" = "y" ] && \
|
||||
if [ "$mode" = "distclean" ] || [ "$mode" = "clean" ]; then
|
||||
$if_not_dry_build \
|
||||
x_ git -C "$srcdir" clean $gitcleanargs; :
|
||||
fi; :
|
||||
$if_make_config \
|
||||
x_ cp "$srcdir/$_copy" "$defconfig"; :
|
||||
}
|
||||
|
||||
run_make_command()
|
||||
{
|
||||
[ -z "$mode" ] && \
|
||||
$if_build \
|
||||
x_ $premake
|
||||
|
||||
$if_not_dry_build check_cmake "$srcdir" && \
|
||||
[ -z "$mode" ] && \
|
||||
$if_not_dry_build \
|
||||
check_autoconf "$srcdir"
|
||||
|
||||
$if_not_dry_build check_makefile "$srcdir" || \
|
||||
return 1
|
||||
|
||||
$if_not_dry_build \
|
||||
x_ make -C "$srcdir" $mode -j$XBMK_THREADS $makeargs
|
||||
|
||||
[ -z "$mode" ] && \
|
||||
x_ $mkhelper
|
||||
|
||||
check_makefile "$srcdir" || \
|
||||
return 0
|
||||
|
||||
[ "$mode" = "clean" ] || \
|
||||
return 0
|
||||
$if_dry_build \
|
||||
return 0
|
||||
|
||||
make -C "$srcdir" $cleanargs distclean || \
|
||||
x_ make -C "$srcdir" $cleanargs clean; :
|
||||
run_make_command_real || return 1
|
||||
$if_build \
|
||||
x_ $mkhelper; :
|
||||
}
|
||||
|
||||
check_cmake()
|
||||
run_make_command_real()
|
||||
{
|
||||
$if_dry_build \
|
||||
return 0
|
||||
[ ! -n "$cmakedir" ] && \
|
||||
return 0
|
||||
[ -z "$cmakedir" ] || \
|
||||
x_ cmake -B "$srcdir" "$srcdir/$cmakedir"
|
||||
$if_build \
|
||||
check_autoconf "$srcdir"
|
||||
|
||||
check_makefile "$1" || \
|
||||
cmake -B "$1" "$1/$cmakedir" || \
|
||||
x_ check_makefile "$1"
|
||||
|
||||
x_ check_makefile "$1"; :
|
||||
check_makefile "$srcdir" || return 1
|
||||
x_ make -C "$srcdir" $mode -j$XBMK_THREADS $makeargs
|
||||
}
|
||||
|
||||
check_autoconf()
|
||||
@@ -570,16 +516,15 @@ check_autoconf()
|
||||
[ -f "autogen.sh" ] && \
|
||||
x_ ./autogen.sh $autogenargs
|
||||
[ -f "configure" ] && \
|
||||
x_ ./configure $autoconfargs; :
|
||||
x_ ./configure $configureargs; :
|
||||
|
||||
) || err "can't bootstrap project: $1" "check_autoconf" "$@"; :
|
||||
) || err "can't bootstrap project: $1" check_autoconf "$@"; :
|
||||
}
|
||||
|
||||
check_makefile()
|
||||
{
|
||||
[ ! -f "$1/Makefile" ] && [ ! -f "$1/makefile" ] && \
|
||||
[ ! -f "$1/GNUmakefile" ] && \
|
||||
return 1; :
|
||||
[ ! -f "$1/GNUmakefile" ] && return 1; :
|
||||
}
|
||||
|
||||
copy_elf()
|
||||
@@ -596,7 +541,7 @@ copy_elf()
|
||||
"cannot read '$listfile'" "copy_elf" "$@"; :
|
||||
fi
|
||||
|
||||
( x_ make clean -C "$srcdir" $cleanargs ) || \
|
||||
( x_ make -C "$srcdir" clean $cleanargs ) || \
|
||||
err "can't make-clean '$srcdir'" "copy_elf" "$@"; :
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user