mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-09-19 21:20:31 +02:00
Compare commits
4 Commits
04c3bc53b6
...
15204cda63
| Author | SHA1 | Date | |
|---|---|---|---|
| 15204cda63 | |||
| 8173aea83b | |||
| aad748c5ca | |||
| 8db320799b |
+26
-53
@@ -3,25 +3,16 @@
|
|||||||
# Copyright (c) 2020-2021,2023-2026 Leah Rowe <leah@libreboot.org>
|
# Copyright (c) 2020-2021,2023-2026 Leah Rowe <leah@libreboot.org>
|
||||||
# Copyright (c) 2022 Caleb La Grange <thonkpeasant@protonmail.com>
|
# Copyright (c) 2022 Caleb La Grange <thonkpeasant@protonmail.com>
|
||||||
|
|
||||||
url=""
|
eval "`newvar url bkup_url depend loc subcurl subcurl_bkup subgit subgit_bkup \
|
||||||
bkup_url=""
|
subhash`"
|
||||||
|
|
||||||
depend=""
|
|
||||||
loc=""
|
|
||||||
subcurl=""
|
|
||||||
subcurl_bkup=""
|
|
||||||
subgit=""
|
|
||||||
subgit_bkup=""
|
|
||||||
subhash=""
|
|
||||||
|
|
||||||
tmpgit="$xbtmp/gitclone"
|
tmpgit="$xbtmp/gitclone"
|
||||||
tmpgitcache="$xbtmp/tmpgit"
|
tmpgitcache="$xbtmp/tmpgit"
|
||||||
|
|
||||||
fetch_targets()
|
fetch_targets()
|
||||||
{
|
{
|
||||||
if [ -d "src/$project/$tree" ]; then
|
[ -d "src/$project/$tree" ] && \
|
||||||
return 0
|
return 0
|
||||||
fi
|
|
||||||
|
|
||||||
git_prep "$url" "$bkup_url" "$xbmkpwd/$configdir/$tree/patches" \
|
git_prep "$url" "$bkup_url" "$xbmkpwd/$configdir/$tree/patches" \
|
||||||
"src/$project/$tree" "submod"
|
"src/$project/$tree" "submod"
|
||||||
@@ -40,14 +31,13 @@ fetch_project()
|
|||||||
"fetch_project" "$@"
|
"fetch_project" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$xgcctree" ]; then
|
[ -n "$xgcctree" ] && \
|
||||||
x_ ./mk -f coreboot "$xgcctree"
|
x_ ./mk -f coreboot "$xgcctree"
|
||||||
fi
|
|
||||||
if [ -n "$depend" ]; then
|
[ -n "$depend" ] && \
|
||||||
for d in $depend ; do
|
for d in $depend ; do
|
||||||
x_ ./mk -f $d
|
x_ ./mk -f $d
|
||||||
done
|
done
|
||||||
fi
|
|
||||||
|
|
||||||
clone_project
|
clone_project
|
||||||
}
|
}
|
||||||
@@ -60,9 +50,8 @@ clone_project()
|
|||||||
|
|
||||||
loc="src/$project"
|
loc="src/$project"
|
||||||
|
|
||||||
if [ -d "$loc" ]; then
|
[ -d "$loc" ] && \
|
||||||
return 0
|
return 0
|
||||||
fi
|
|
||||||
|
|
||||||
remkdir "${tmpgit%/*}"
|
remkdir "${tmpgit%/*}"
|
||||||
git_prep "$url" "$bkup_url" "$xbmkpwd/config/$project/patches" "$loc"
|
git_prep "$url" "$bkup_url" "$xbmkpwd/config/$project/patches" "$loc"
|
||||||
@@ -75,18 +64,16 @@ git_prep()
|
|||||||
_patchdir="$3"
|
_patchdir="$3"
|
||||||
_loc="$4" # $1 and $2 are gitrepo and gitrepo_backup
|
_loc="$4" # $1 and $2 are gitrepo and gitrepo_backup
|
||||||
|
|
||||||
if [ -z "$rev" ]; then
|
[ -z "$rev" ] && \
|
||||||
err "$project/$tree: rev not set" "git_prep" "$@"
|
err "$project/$tree: rev not set" "git_prep" "$@"
|
||||||
fi
|
|
||||||
|
|
||||||
xbget git "$1" "$2" "$tmpgit" "$rev" "$_patchdir"
|
xbget git "$1" "$2" "$tmpgit" "$rev" "$_patchdir"
|
||||||
if singletree "$project" || [ $# -gt 4 ]; then
|
if singletree "$project" || [ $# -gt 4 ]; then
|
||||||
dx_ fetch_submodule "$mdir/module.list"
|
dx_ fetch_submodule "$mdir/module.list"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$_loc" != "${_loc%/*}" ]; then
|
[ "$_loc" != "${_loc%/*}" ] && \
|
||||||
x_ xbmkdir "${_loc%/*}"
|
x_ xbmkdir "${_loc%/*}"
|
||||||
fi
|
|
||||||
|
|
||||||
x_ mv "$tmpgit" "$_loc"
|
x_ mv "$tmpgit" "$_loc"
|
||||||
}
|
}
|
||||||
@@ -116,13 +103,11 @@ fetch_submodule()
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
st="${st# }"
|
st="${st# }"
|
||||||
if [ "$st" = "git curl" ]; then
|
[ "$st" = "git curl" ] && \
|
||||||
err "$mdir: git+curl defined" "fetch_submodule" "$@"
|
err "$mdir: git+curl defined" "fetch_submodule" "$@"
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$st" ]; then
|
[ -z "$st" ] && \
|
||||||
return 0
|
return 0
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$st" = "curl" ]; then
|
if [ "$st" = "curl" ]; then
|
||||||
if [ -z "$subcurl" ] || [ -z "$subcurl_bkup" ]; then
|
if [ -z "$subcurl" ] || [ -z "$subcurl_bkup" ]; then
|
||||||
@@ -151,9 +136,8 @@ fetch_submodule()
|
|||||||
|
|
||||||
xbget()
|
xbget()
|
||||||
{
|
{
|
||||||
if [ "$1" != "curl" ] && [ "$1" != "copy" ] && [ "$1" != "git" ]; then
|
[ "$1" != "curl" ] && [ "$1" != "copy" ] && [ "$1" != "git" ] && \
|
||||||
err "Bad dlop (arg 1)" "xbget" "$@"
|
err "Bad dlop (arg 1)" "xbget" "$@"
|
||||||
fi
|
|
||||||
|
|
||||||
for url in "$2" "$3"
|
for url in "$2" "$3"
|
||||||
do
|
do
|
||||||
@@ -165,14 +149,12 @@ xbget()
|
|||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
git)
|
git)
|
||||||
if [ ! -d "$4" ]; then
|
[ ! -d "$4" ] && \
|
||||||
continue
|
continue
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
if [ ! -f "$4" ]; then
|
[ ! -f "$4" ] && \
|
||||||
continue
|
continue
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
return 0 # successful download/copy
|
return 0 # successful download/copy
|
||||||
@@ -200,11 +182,9 @@ try_fetch_git()
|
|||||||
# let's say it was https://foo.example.com/repo, then cached
|
# let's say it was https://foo.example.com/repo, then cached
|
||||||
# directories becomes cache/mirror/foo.example.com/repo
|
# directories becomes cache/mirror/foo.example.com/repo
|
||||||
|
|
||||||
if [ "$XBMK_CACHE_MIRROR" = "y" ]; then
|
cached="clone"
|
||||||
|
[ "$XBMK_CACHE_MIRROR" = "y" ] && \
|
||||||
cached="mirror"
|
cached="mirror"
|
||||||
else
|
|
||||||
cached="clone"
|
|
||||||
fi
|
|
||||||
cached="$cached/${1#*://}"
|
cached="$cached/${1#*://}"
|
||||||
cached="$XBMK_CACHE/$cached"
|
cached="$XBMK_CACHE/$cached"
|
||||||
|
|
||||||
@@ -221,9 +201,8 @@ try_fetch_git()
|
|||||||
err "Can't clone final repo" "try_fetch" "$@"; :
|
err "Can't clone final repo" "try_fetch" "$@"; :
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -d "$5" ]; then
|
[ ! -d "$5" ] && \
|
||||||
return 1
|
return 1; :
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try_fetch_file()
|
try_fetch_file()
|
||||||
@@ -237,17 +216,15 @@ try_fetch_file()
|
|||||||
x_ rm -f "$cached"
|
x_ rm -f "$cached"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f "$cached" ]; then
|
[ ! -f "$cached" ] && \
|
||||||
if ! try_$2 "$cached" "$@"; then
|
if ! try_$2 "$cached" "$@"; then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -f "$5" ]; then
|
[ -f "$5" ] && \
|
||||||
if bad_checksum "$6" "$5" 2>/dev/null; then
|
if bad_checksum "$6" "$5" 2>/dev/null; then
|
||||||
x_ cp "$cached" "$5"
|
x_ cp "$cached" "$5"
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -f "$cached" ]; then
|
if [ ! -f "$cached" ]; then
|
||||||
return 1
|
return 1
|
||||||
@@ -257,13 +234,11 @@ try_fetch_file()
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$cached" != "$5" ]; then
|
[ "$cached" != "$5" ] && \
|
||||||
x_ cp "$cached" "$5"
|
x_ cp "$cached" "$5"
|
||||||
fi
|
|
||||||
|
|
||||||
if bad_checksum "$6" "$5"; then
|
if bad_checksum "$6" "$5"; then
|
||||||
x_ rm -f "$5"
|
x_ rm -f "$5"
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
elif [ ! -f "$5" ]; then
|
elif [ ! -f "$5" ]; then
|
||||||
return 1
|
return 1
|
||||||
@@ -338,12 +313,11 @@ bad_checksum()
|
|||||||
csum="$(x_ "$sha512sum" "$2" | awk '{print $1}')" || \
|
csum="$(x_ "$sha512sum" "$2" | awk '{print $1}')" || \
|
||||||
err "!sha512 '$2' $1" bad_checksum "$@"
|
err "!sha512 '$2' $1" bad_checksum "$@"
|
||||||
|
|
||||||
if [ "$csum" = "$1" ]; then
|
[ "$csum" = "$1" ] && \
|
||||||
return 1
|
return 1
|
||||||
else
|
|
||||||
x_ rm -f "$2"
|
x_ rm -f "$2"
|
||||||
printf "BAD SHA512 %s, '%s'; need %s\n" "$csum" "$2" "$1" 1>&2
|
printf "BAD SHA512 %s, '%s'; need %s\n" "$csum" "$2" "$1" 1>&2
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tmpclone()
|
tmpclone()
|
||||||
@@ -351,9 +325,8 @@ tmpclone()
|
|||||||
( x_ git clone "$1" "$2" ) || return 1
|
( x_ git clone "$1" "$2" ) || return 1
|
||||||
( x_ git -C "$2" reset --hard "$3" ) || return 1
|
( x_ git -C "$2" reset --hard "$3" ) || return 1
|
||||||
|
|
||||||
if [ ! -d "$4" ]; then
|
[ ! -d "$4" ] && \
|
||||||
return 0
|
return 0
|
||||||
fi
|
|
||||||
|
|
||||||
tmpclone_patchlist="`mktemp || err "Can't create tmp patch list"`" || \
|
tmpclone_patchlist="`mktemp || err "Can't create tmp patch list"`" || \
|
||||||
err "Can't create tmp patch list" "tmpclone" "$@"
|
err "Can't create tmp patch list" "tmpclone" "$@"
|
||||||
|
|||||||
+47
-101
@@ -27,31 +27,14 @@ projectname="libreboot"
|
|||||||
projectsite="https://libreboot.org/"
|
projectsite="https://libreboot.org/"
|
||||||
|
|
||||||
# TODO: consider just erroring here instead of hardcoding a default
|
# TODO: consider just erroring here instead of hardcoding a default
|
||||||
if [ -z "${PATH+x}" ]; then
|
[ -z "${PATH+x}" ] && \
|
||||||
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
|
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
|
||||||
fi
|
|
||||||
|
|
||||||
sha512sum="util/sbase/sha512sum"
|
sha512sum="util/sbase/sha512sum"
|
||||||
|
|
||||||
aur_notice=""
|
eval "`newvar aur_notice basetmp board checkvarschk checkvarsxbmk configdir \
|
||||||
basetmp=""
|
datadir is_child python pyver reinstall relname version versiondate \
|
||||||
board=""
|
xbmklock xbmkpath xbmkpwd xbmkpwd xbtmp`"
|
||||||
checkvarschk=""
|
|
||||||
checkvarsxbmk=""
|
|
||||||
configdir=""
|
|
||||||
datadir=""
|
|
||||||
is_child=""
|
|
||||||
python=""
|
|
||||||
pyver=""
|
|
||||||
reinstall=""
|
|
||||||
relname=""
|
|
||||||
version=""
|
|
||||||
versiondate=""
|
|
||||||
xbmklock=""
|
|
||||||
xbmkpath=""
|
|
||||||
xbmkpwd=""
|
|
||||||
xbmkpwd=""
|
|
||||||
xbtmp=""
|
|
||||||
|
|
||||||
xbmk_init()
|
xbmk_init()
|
||||||
{
|
{
|
||||||
@@ -62,23 +45,20 @@ xbmk_init()
|
|||||||
|
|
||||||
if [ $# -gt 0 ] && [ "$1" = "dependencies" ]; then
|
if [ $# -gt 0 ] && [ "$1" = "dependencies" ]; then
|
||||||
x_ xbmkpkg "$@"
|
x_ xbmkpkg "$@"
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
id -u 1>/dev/null 2>/dev/null || \
|
id -u 1>/dev/null 2>/dev/null || \
|
||||||
err "suid check failed" "xbmk_init" "$@"
|
err "suid check failed" "xbmk_init" "$@"
|
||||||
|
|
||||||
if [ "$(id -u)" = "0" ]; then
|
[ "$(id -u)" = "0" ] && \
|
||||||
err "this command as root is not permitted" "xbmk_init" "$@"
|
err "this command as root is not permitted" "xbmk_init" "$@"
|
||||||
fi
|
|
||||||
|
|
||||||
export PWD="$xbmkpwd"
|
export PWD="$xbmkpwd"
|
||||||
x_ xbmkdir "$basetmp"
|
x_ xbmkdir "$basetmp"
|
||||||
|
|
||||||
if [ ! -e "cache" ]; then
|
[ ! -e "cache" ] && \
|
||||||
x_ xbmkdir "cache"
|
x_ xbmkdir "cache"
|
||||||
fi
|
|
||||||
|
|
||||||
for init_cmd in get_version set_env set_threads git_init child_exec; do
|
for init_cmd in get_version set_env set_threads git_init child_exec; do
|
||||||
if ! xbmk_$init_cmd "$@"; then
|
if ! xbmk_$init_cmd "$@"; then
|
||||||
@@ -91,9 +71,8 @@ xbmkpkg()
|
|||||||
{
|
{
|
||||||
xchk xbmkpkg "$@"
|
xchk xbmkpkg "$@"
|
||||||
|
|
||||||
if [ $# -gt 2 ]; then
|
[ $# -gt 2 ] && \
|
||||||
reinstall="$3"
|
reinstall="$3"
|
||||||
fi
|
|
||||||
|
|
||||||
. "config/dependencies/$2" || \
|
. "config/dependencies/$2" || \
|
||||||
err "Can't read 'config/dependencies/$2'" "xbmkpkg" "$@"
|
err "Can't read 'config/dependencies/$2'" "xbmkpkg" "$@"
|
||||||
@@ -111,50 +90,41 @@ xbmkpkg()
|
|||||||
printf "Updating package use...\n"
|
printf "Updating package use...\n"
|
||||||
printf "Writing into %s" "$pkg_use_file..."
|
printf "Writing into %s" "$pkg_use_file..."
|
||||||
|
|
||||||
if [ ! -d "`dirname $pkg_use_file`" ]; then
|
[ ! -d "`dirname $pkg_use_file`" ] && \
|
||||||
x_ mkdir -p "`dirname $pkg_use_file`"
|
x_ mkdir -p "`dirname $pkg_use_file`"
|
||||||
fi
|
|
||||||
|
|
||||||
printf "%s\n" "$pkg_use" >> "$pkg_use_file"
|
printf "%s\n" "$pkg_use" >> "$pkg_use_file"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
x_ $pkg_add $pkglist
|
x_ $pkg_add $pkglist
|
||||||
|
|
||||||
if [ -n "$aur_notice" ]; then
|
[ -n "$aur_notice" ] && \
|
||||||
printf "You need AUR packages: %s\n" "$aur_notice" 1>&2
|
printf "You need AUR packages: %s\n" "$aur_notice" 1>&2; :
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
xbmk_get_version()
|
xbmk_get_version()
|
||||||
{
|
{
|
||||||
if [ -f ".version" ]; then
|
[ ! -f ".version" ] || \
|
||||||
read -r version < ".version" || \
|
read -r version < ".version" || \
|
||||||
err "can't read version file" "xbmk_get_version" "$@"
|
err "can't read version file" "xbmk_get_version" "$@"
|
||||||
fi
|
[ ! -f ".versiondate" ] || \
|
||||||
if [ -f ".versiondate" ]; then
|
|
||||||
read -r versiondate < ".versiondate" || \
|
read -r versiondate < ".versiondate" || \
|
||||||
err "can't read versiondate" xbmk_get_version "$@"
|
err "can't read versiondate" xbmk_get_version "$@"
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -f ".version" ] && [ -z "$version" ]; then
|
[ -f ".version" ] && [ -z "$version" ] && \
|
||||||
err "version not set" "xbmk_get_version" "$@"
|
err "version not set" "xbmk_get_version" "$@"
|
||||||
fi
|
[ -f ".versiondate" ] && [ -z "$versiondate" ] && \
|
||||||
if [ -f ".versiondate" ] && [ -z "$versiondate" ]; then
|
|
||||||
err "versiondate not set" "xbmk_get_version" "$@"
|
err "versiondate not set" "xbmk_get_version" "$@"
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -e ".git" ] && [ ! -f ".version" ]; then
|
[ ! -e ".git" ] && [ ! -f ".version" ] && \
|
||||||
version="unknown"
|
version="unknown"
|
||||||
fi
|
[ ! -e ".git" ] && [ ! -f ".versiondate" ] && \
|
||||||
if [ ! -e ".git" ] && [ ! -f ".versiondate" ]; then
|
|
||||||
versiondate="1716415872"
|
versiondate="1716415872"
|
||||||
fi
|
|
||||||
|
|
||||||
xbmk_sanitize_version
|
xbmk_sanitize_version
|
||||||
|
|
||||||
if [ -n "$version" ]; then
|
[ -n "$version" ] && \
|
||||||
relname="$projectname-$version"
|
relname="$projectname-$version"; :
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# a parent instance will cause this function to return 0.
|
# a parent instance will cause this function to return 0.
|
||||||
@@ -167,16 +137,14 @@ xbmk_set_env()
|
|||||||
xbmkpath="$PATH"
|
xbmkpath="$PATH"
|
||||||
|
|
||||||
# unify all temporary files/directories in a single TMPDIR
|
# unify all temporary files/directories in a single TMPDIR
|
||||||
if [ -n "${TMPDIR+x}" ] && [ "${TMPDIR%_*}" != "$basetmp/xbmk" ]; then
|
[ -n "${TMPDIR+x}" ] && [ "${TMPDIR%_*}" != "$basetmp/xbmk" ] && \
|
||||||
unset TMPDIR
|
unset TMPDIR
|
||||||
fi
|
|
||||||
if [ -n "${TMPDIR+x}" ]; then
|
if [ -n "${TMPDIR+x}" ]; then
|
||||||
export TMPDIR="$TMPDIR"
|
export TMPDIR="$TMPDIR"
|
||||||
xbtmp="$TMPDIR"
|
xbtmp="$TMPDIR"
|
||||||
fi
|
fi
|
||||||
if [ -n "${TMPDIR+x}" ]; then
|
[ -n "${TMPDIR+x}" ] && \
|
||||||
is_child="y"
|
is_child="y"
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$is_child" = "y" ]
|
if [ "$is_child" = "y" ]
|
||||||
then
|
then
|
||||||
@@ -202,15 +170,12 @@ xbmk_child_set_env()
|
|||||||
{
|
{
|
||||||
xbmk_child_set_tmp
|
xbmk_child_set_tmp
|
||||||
|
|
||||||
if [ -z "${XBMK_CACHE+x}" ]; then
|
[ -z "${XBMK_CACHE+x}" ] && \
|
||||||
err "XBMK_CACHE unset on child" "xbmk_set_env" "$@"
|
err "XBMK_CACHE unset on child" "xbmk_set_env" "$@"
|
||||||
fi
|
[ -z "${XBMK_THREADS+x}" ] && \
|
||||||
if [ -z "${XBMK_THREADS+x}" ]; then
|
xbmk_set_threads
|
||||||
xbmk_set_threads; :
|
[ -z "${XBMK_CACHE_MIRROR+x}" ] && \
|
||||||
fi
|
xbmk_set_mirror; :
|
||||||
if [ -z "${XBMK_CACHE_MIRROR+x}" ]; then
|
|
||||||
xbmk_set_mirror
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
xbmk_child_set_tmp()
|
xbmk_child_set_tmp()
|
||||||
@@ -282,9 +247,8 @@ xbmk_parent_check_tmp()
|
|||||||
xbtmp="$TMPDIR"
|
xbtmp="$TMPDIR"
|
||||||
|
|
||||||
while read -r xtmpdir; do
|
while read -r xtmpdir; do
|
||||||
if [ "$xtmpdir" = "$xbtmp" ]; then
|
[ "$xtmpdir" = "$xbtmp" ] && \
|
||||||
err "pre-existing '$xbtmp'" "xbmk_parent_check_tmp" "$@"
|
err "pre-existing $xbtmp" xbmk_parent_check_tmp "$@"; :
|
||||||
fi
|
|
||||||
done < "$xbmklist" || \
|
done < "$xbmklist" || \
|
||||||
err "Can't read xbmklist: '$xbmklist'" "xbmk_parent_check_tmp" "$@"
|
err "Can't read xbmklist: '$xbmklist'" "xbmk_parent_check_tmp" "$@"
|
||||||
|
|
||||||
@@ -295,10 +259,9 @@ xbmk_parent_set_export()
|
|||||||
{
|
{
|
||||||
export XBMK_CACHE="$xbmkpwd/cache"
|
export XBMK_CACHE="$xbmkpwd/cache"
|
||||||
|
|
||||||
if [ -e "$XBMK_CACHE" ] && [ ! -d "$XBMK_CACHE" ]; then
|
[ -e "$XBMK_CACHE" ] && [ ! -d "$XBMK_CACHE" ] && \
|
||||||
err "cachedir '$XBMK_CACHE' is a file" \
|
err "cachedir '$XBMK_CACHE' is a file" \
|
||||||
"xbmk_parent_set_export" "$@"
|
"xbmk_parent_set_export" "$@"
|
||||||
fi
|
|
||||||
|
|
||||||
export PATH="$xbtmp/xbmkpath:$xbtmp/gnupath:$PATH"
|
export PATH="$xbtmp/xbmkpath:$xbtmp/gnupath:$PATH"
|
||||||
xbmkpath="$PATH"
|
xbmkpath="$PATH"
|
||||||
@@ -306,42 +269,35 @@ xbmk_parent_set_export()
|
|||||||
# if "y": a coreboot target won't be built if target.cfg says release=n
|
# if "y": a coreboot target won't be built if target.cfg says release=n
|
||||||
# (this is used to exclude certain build targets from releases)
|
# (this is used to exclude certain build targets from releases)
|
||||||
|
|
||||||
if [ -z "${XBMK_RELEASE+x}" ]; then
|
[ -z "${XBMK_RELEASE+x}" ] && \
|
||||||
export XBMK_RELEASE="n"
|
export XBMK_RELEASE="n"
|
||||||
fi
|
[ "$XBMK_RELEASE" = "Y" ] && \
|
||||||
if [ "$XBMK_RELEASE" = "Y" ]; then
|
|
||||||
export XBMK_RELEASE="y"
|
export XBMK_RELEASE="y"
|
||||||
fi
|
[ "$XBMK_RELEASE" != "y" ] && \
|
||||||
if [ "$XBMK_RELEASE" != "y" ]; then
|
export XBMK_RELEASE="n"; :
|
||||||
export XBMK_RELEASE="n"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
xbmk_set_threads()
|
xbmk_set_threads()
|
||||||
{
|
{
|
||||||
if [ -z "${XBMK_THREADS+x}" ]; then
|
[ -z "${XBMK_THREADS+x}" ] && \
|
||||||
export XBMK_THREADS=1
|
export XBMK_THREADS=1
|
||||||
fi
|
expr "X$XBMK_THREADS" : "X-\{0,1\}[0123456789][0123456789]*$" \
|
||||||
if ! expr "X$XBMK_THREADS" : "X-\{0,1\}[0123456789][0123456789]*$" \
|
1>/dev/null 2>/dev/null || \
|
||||||
1>/dev/null 2>/dev/null; then
|
export XBMK_THREADS=1; :
|
||||||
export XBMK_THREADS=1
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
xbmk_set_version()
|
xbmk_set_version()
|
||||||
{
|
{
|
||||||
version_="$version"
|
version_="$version"
|
||||||
if [ -e ".git" ]; then
|
[ ! -e ".git" ] || \
|
||||||
version="$(git describe --tags HEAD 2>&1)" || \
|
version="$(git describe --tags HEAD 2>&1)" || \
|
||||||
version="git-$(git rev-parse HEAD 2>&1)" || \
|
version="git-$(git rev-parse HEAD 2>&1)" || \
|
||||||
version="$version_"
|
version="$version_"
|
||||||
fi
|
|
||||||
|
|
||||||
versiondate_="$versiondate"
|
versiondate_="$versiondate"
|
||||||
if [ -e ".git" ]; then
|
[ ! -e ".git" ] || \
|
||||||
versiondate="$(git show --no-patch --no-notes \
|
versiondate="$(git show --no-patch --no-notes \
|
||||||
--pretty='%ct' HEAD)" || versiondate="$versiondate_"
|
--pretty='%ct' HEAD)" || versiondate="$versiondate_"
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$version" ] || [ -z "$versiondate" ]; then
|
if [ -z "$version" ] || [ -z "$versiondate" ]; then
|
||||||
err "version and/or versiondate unset" "xbmk_set_version" "$@"
|
err "version and/or versiondate unset" "xbmk_set_version" "$@"
|
||||||
@@ -362,25 +318,22 @@ xbmk_set_pyver()
|
|||||||
if ! pybin python3 1>/dev/null; then
|
if ! pybin python3 1>/dev/null; then
|
||||||
python="python"
|
python="python"
|
||||||
fi
|
fi
|
||||||
if [ "$python" = "python3" ]; then
|
[ "$python" = "python3" ] && \
|
||||||
pyver="3"
|
pyver="3"
|
||||||
fi
|
|
||||||
if ! pybin "$python" 1>/dev/null; then
|
if ! pybin "$python" 1>/dev/null; then
|
||||||
pyver=""
|
pyver=""
|
||||||
fi
|
fi
|
||||||
if [ -n "$pyver" ]; then
|
[ -z "$pyver" ] || \
|
||||||
"`x_ pybin "$python"`" -c "$pyv" 1>/dev/null \
|
"`x_ pybin "$python"`" -c "$pyv" 1>/dev/null \
|
||||||
2>/dev/null || \
|
2>/dev/null || \
|
||||||
err "Can't detect Python version." "xbmk_set_pyver" "$@"
|
err "Can't detect Python version." "xbmk_set_pyver" "$@"
|
||||||
fi
|
|
||||||
if [ -n "$pyver" ]; then
|
if [ -n "$pyver" ]; then
|
||||||
pyver="$("$(pybin "$python")" -c "$pyv" | awk '{print $1}')"
|
pyver="$("$(pybin "$python")" -c "$pyv" | awk '{print $1}')"
|
||||||
pyver="${pyver#(}"
|
pyver="${pyver#(}"
|
||||||
pyver="${pyver%,}"
|
pyver="${pyver%,}"
|
||||||
fi
|
fi
|
||||||
if [ "${pyver%%.*}" != "3" ]; then
|
[ "${pyver%%.*}" != "3" ] && \
|
||||||
err "Bad python version (must by 3.x)" "xbmk_set_pyver" "$@"
|
err "Bad python version (must by 3.x)" "xbmk_set_pyver" "$@"
|
||||||
fi
|
|
||||||
|
|
||||||
# set up python in PATH (environmental variable):
|
# set up python in PATH (environmental variable):
|
||||||
|
|
||||||
@@ -405,11 +358,10 @@ pybin()
|
|||||||
if ! command -v "$1" 1>/dev/null 2>/dev/null; then
|
if ! command -v "$1" 1>/dev/null 2>/dev/null; then
|
||||||
venv=0
|
venv=0
|
||||||
fi
|
fi
|
||||||
if [ $venv -gt 0 ]; then
|
[ $venv -gt 0 ] && \
|
||||||
if ! "$1" -c "$py" 1>/dev/null 2>/dev/null; then
|
if ! "$1" -c "$py" 1>/dev/null 2>/dev/null; then
|
||||||
venv=0
|
venv=0
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
# ideally, don't rely on PATH or hardcoded paths if python venv.
|
# ideally, don't rely on PATH or hardcoded paths if python venv.
|
||||||
# use the *real*, direct executable linked to by the venv symlink:
|
# use the *real*, direct executable linked to by the venv symlink:
|
||||||
@@ -422,7 +374,6 @@ pybin()
|
|||||||
[ -x "$pypath" ]; then
|
[ -x "$pypath" ]; then
|
||||||
|
|
||||||
printf "%s\n" "$pypath"
|
printf "%s\n" "$pypath"
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -434,7 +385,6 @@ pybin()
|
|||||||
[ -x "$pypath/$1" ]; then
|
[ -x "$pypath/$1" ]; then
|
||||||
|
|
||||||
printf "%s/%s\n" "$pypath" "$1"
|
printf "%s/%s\n" "$pypath" "$1"
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
done && return 1
|
done && return 1
|
||||||
@@ -455,12 +405,10 @@ xbmk_set_mirror()
|
|||||||
# it's slower, and uses more disk space, and some upstreams might not
|
# it's slower, and uses more disk space, and some upstreams might not
|
||||||
# appreciate it, so it should only be used for development or archival
|
# appreciate it, so it should only be used for development or archival
|
||||||
|
|
||||||
if [ -z "${XBMK_CACHE_MIRROR+x}" ]; then
|
[ -z "${XBMK_CACHE_MIRROR+x}" ] && \
|
||||||
export XBMK_CACHE_MIRROR="n"
|
export XBMK_CACHE_MIRROR="n"
|
||||||
fi
|
[ "$XBMK_CACHE_MIRROR" != "y" ] && \
|
||||||
if [ "$XBMK_CACHE_MIRROR" != "y" ]; then
|
export XBMK_CACHE_MIRROR="n"; :
|
||||||
export XBMK_CACHE_MIRROR="n"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
xbmk_git_init()
|
xbmk_git_init()
|
||||||
@@ -475,12 +423,10 @@ xbmk_git_init()
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ -L ".git" ]; then
|
[ -L ".git" ] && \
|
||||||
err "'$xbmkpwd/.git' is a symlink" "xbmk_git_init" "$@"
|
err "'$xbmkpwd/.git' is a symlink" "xbmk_git_init" "$@"
|
||||||
fi
|
[ -e ".git" ] && \
|
||||||
if [ -e ".git" ]; then
|
|
||||||
return 0
|
return 0
|
||||||
fi
|
|
||||||
|
|
||||||
# GNU-specific extensions of date are used.
|
# GNU-specific extensions of date are used.
|
||||||
# TODO: that is a bug. fix it!
|
# TODO: that is a bug. fix it!
|
||||||
|
|||||||
+14
-39
@@ -9,34 +9,17 @@ tmpromdel="$XBMK_CACHE/DO_NOT_FLASH"
|
|||||||
nvmutil="util/nvmutil/nvmutil"
|
nvmutil="util/nvmutil/nvmutil"
|
||||||
ifdtool="elf/coreboot/default/ifdtool"
|
ifdtool="elf/coreboot/default/ifdtool"
|
||||||
|
|
||||||
checkvars="CONFIG_GBE_BIN_PATH"
|
checkvars="CONFIG_GBE_BIN_PATH ${checkvarsxbmk-} ${checkvarschk-}"
|
||||||
if [ -n "$checkvarsxbmk" ]; then
|
|
||||||
checkvars="$checkvars $checkvarsxbmk"
|
|
||||||
fi
|
|
||||||
if [ -n "$checkvarschk" ]; then
|
|
||||||
checkvars="$checkvars $checkvarschk"
|
|
||||||
fi
|
|
||||||
|
|
||||||
archive=""
|
eval "`newvar archive board boarddir IFD_platform ifdprefix \
|
||||||
board=""
|
new_mac tmpromdir tree xchanged $checkvars`"
|
||||||
boarddir=""
|
|
||||||
IFD_platform=""
|
|
||||||
ifdprefix=""
|
|
||||||
new_mac=""
|
|
||||||
tmpromdir=""
|
|
||||||
tree=""
|
|
||||||
xchanged=""
|
|
||||||
|
|
||||||
eval "`printf "%s\n" "$checkvars" | \
|
|
||||||
awk '{ for (i=1; i<=NF; i++) $i = $i "=;"; print }'`"
|
|
||||||
|
|
||||||
inject()
|
inject()
|
||||||
{
|
{
|
||||||
remkdir "$tmpromdel"
|
remkdir "$tmpromdel"
|
||||||
|
|
||||||
if [ $# -lt 1 ]; then
|
[ $# -lt 1 ] && \
|
||||||
err "No options specified" "inject" "$@"
|
err "No options specified" "inject" "$@"
|
||||||
fi
|
|
||||||
|
|
||||||
archive="$1";
|
archive="$1";
|
||||||
new_mac="xx:xx:xx:xx:xx:xx"
|
new_mac="xx:xx:xx:xx:xx:xx"
|
||||||
@@ -52,18 +35,16 @@ inject()
|
|||||||
setmac)
|
setmac)
|
||||||
if [ $# -gt 2 ]; then
|
if [ $# -gt 2 ]; then
|
||||||
new_mac="$3" && \
|
new_mac="$3" && \
|
||||||
if [ -z "$new_mac" ]; then
|
[ -z "$new_mac" ] && \
|
||||||
err "Empty MAC address specified" "inject" "$@"
|
err "Empty MAC address" "inject" "$@"; :
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
err "Unrecognised inject mode: '$2'" "inject" "$@" ;;
|
err "Unrecognised inject mode: '$2'" "inject" "$@" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [ "$new_mac" = "keep" ]; then
|
[ "$new_mac" = "keep" ] && \
|
||||||
new_mac=""
|
new_mac=""
|
||||||
fi
|
|
||||||
|
|
||||||
check_release
|
check_release
|
||||||
if check_target; then
|
if check_target; then
|
||||||
@@ -71,9 +52,8 @@ inject()
|
|||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ "$xchanged" = "y" ]; then
|
[ "$xchanged" = "y" ] && \
|
||||||
remktar
|
remktar
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$xchanged" = "y" ]; then
|
if [ "$xchanged" = "y" ]; then
|
||||||
printf "\n'%s' was modified\n" "$archive" 1>&2
|
printf "\n'%s' was modified\n" "$archive" 1>&2
|
||||||
@@ -86,9 +66,8 @@ inject()
|
|||||||
|
|
||||||
check_release()
|
check_release()
|
||||||
{
|
{
|
||||||
if [ -L "$archive" ]; then
|
[ -L "$archive" ] && \
|
||||||
err "'$archive' is a symlink" "check_release" "$@"
|
err "'$archive' is a symlink" "check_release" "$@"
|
||||||
fi
|
|
||||||
if e "$archive" f missing; then
|
if e "$archive" f missing; then
|
||||||
err "'$archive' missing" "check_release" "$@"
|
err "'$archive' missing" "check_release" "$@"
|
||||||
fi
|
fi
|
||||||
@@ -96,9 +75,8 @@ check_release()
|
|||||||
archivename="`basename "$archive" || err "Can't get '$archive' name"`" \
|
archivename="`basename "$archive" || err "Can't get '$archive' name"`" \
|
||||||
|| err "can't get '$archive' name" "check_release" "$@"
|
|| err "can't get '$archive' name" "check_release" "$@"
|
||||||
|
|
||||||
if [ -z "$archivename" ]; then
|
[ -z "$archivename" ] && \
|
||||||
err "Can't determine archive name" "check_release" "$@"
|
err "Can't determine archive name" "check_release" "$@"
|
||||||
fi
|
|
||||||
|
|
||||||
case "$archivename" in
|
case "$archivename" in
|
||||||
*_src.tar.xz)
|
*_src.tar.xz)
|
||||||
@@ -118,9 +96,8 @@ check_release()
|
|||||||
|
|
||||||
check_target()
|
check_target()
|
||||||
{
|
{
|
||||||
if [ "$board" != "${board#serprog_}" ]; then
|
[ "$board" != "${board#serprog_}" ] && \
|
||||||
return 1
|
return 1
|
||||||
fi
|
|
||||||
|
|
||||||
boarddir="$cbcfgsdir/$board"
|
boarddir="$cbcfgsdir/$board"
|
||||||
|
|
||||||
@@ -135,16 +112,14 @@ check_target()
|
|||||||
|
|
||||||
ifdtool="elf/coreboot/$tree/ifdtool"
|
ifdtool="elf/coreboot/$tree/ifdtool"
|
||||||
|
|
||||||
if [ -n "$IFD_platform" ]; then
|
[ -n "$IFD_platform" ] && \
|
||||||
ifdprefix="-p $IFD_platform"
|
ifdprefix="-p $IFD_platform"; :
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
patch_release()
|
patch_release()
|
||||||
{
|
{
|
||||||
if [ "$nuke" != "nuke" ]; then
|
[ "$nuke" != "nuke" ] && \
|
||||||
x_ ./mk download "$board"
|
x_ ./mk download "$board"
|
||||||
fi
|
|
||||||
|
|
||||||
has_hashes="n"
|
has_hashes="n"
|
||||||
tmpromdir="$tmpromdel/bin/$board"
|
tmpromdir="$tmpromdel/bin/$board"
|
||||||
|
|||||||
+29
-38
@@ -8,6 +8,12 @@
|
|||||||
cbfstool="elf/coreboot/default/cbfstool"
|
cbfstool="elf/coreboot/default/cbfstool"
|
||||||
rmodtool="elf/coreboot/default/rmodtool"
|
rmodtool="elf/coreboot/default/rmodtool"
|
||||||
|
|
||||||
|
newvar()
|
||||||
|
{
|
||||||
|
printf "%s\n" "$*" | \
|
||||||
|
awk '{ for (i=1; i<=NF; i++) $i = $i "=;"; print }'; :
|
||||||
|
}
|
||||||
|
|
||||||
mkrom_tarball()
|
mkrom_tarball()
|
||||||
{
|
{
|
||||||
update_xbmkver "$1"
|
update_xbmkver "$1"
|
||||||
@@ -34,9 +40,8 @@ version()
|
|||||||
|
|
||||||
xbmk_sanitize_version()
|
xbmk_sanitize_version()
|
||||||
{
|
{
|
||||||
if [ -z "$version" ]; then
|
[ -z "$version" ] && \
|
||||||
return 0
|
return 0
|
||||||
fi
|
|
||||||
|
|
||||||
version="`printf "%s\n" "$version" | sed -e 's/\t//g'`"
|
version="`printf "%s\n" "$version" | sed -e 's/\t//g'`"
|
||||||
version="`printf "%s\n" "$version" | sed -e 's/\ //g'`"
|
version="`printf "%s\n" "$version" | sed -e 's/\ //g'`"
|
||||||
@@ -46,19 +51,17 @@ xbmk_sanitize_version()
|
|||||||
|
|
||||||
version="${version#-}"
|
version="${version#-}"
|
||||||
|
|
||||||
if [ -z "$version" ]; then
|
[ -z "$version" ] && \
|
||||||
err "'version' empty after sanitization" \
|
err "'version' empty after sanitization" \
|
||||||
"xbmk_sanitize_version" "$@"
|
"xbmk_sanitize_version" "$@"; :
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mktarball()
|
mktarball()
|
||||||
{
|
{
|
||||||
printf "Creating tar archive '%s' from directory '%s'\n" "$2" "$1"
|
printf "Creating tar archive '%s' from directory '%s'\n" "$2" "$1"
|
||||||
|
|
||||||
if [ "${2%/*}" != "$2" ]; then
|
[ "${2%/*}" != "$2" ] && \
|
||||||
x_ xbmkdir "${2%/*}"
|
x_ xbmkdir "${2%/*}"
|
||||||
fi
|
|
||||||
|
|
||||||
x_ tar -c "$1" | xz -T$XBMK_THREADS -9e > "$2" || \
|
x_ tar -c "$1" | xz -T$XBMK_THREADS -9e > "$2" || \
|
||||||
err "can't make tarball '$1'" "mktarball" "$@"
|
err "can't make tarball '$1'" "mktarball" "$@"
|
||||||
@@ -67,10 +70,8 @@ mktarball()
|
|||||||
e()
|
e()
|
||||||
{
|
{
|
||||||
es_t="e"
|
es_t="e"
|
||||||
|
[ $# -gt 1 ] && \
|
||||||
if [ $# -gt 1 ]; then
|
|
||||||
es_t="$2"
|
es_t="$2"
|
||||||
fi
|
|
||||||
|
|
||||||
es2="already exists"
|
es2="already exists"
|
||||||
estr="[ -$es_t \"\$1\" ] || return 1"
|
estr="[ -$es_t \"\$1\" ] || return 1"
|
||||||
@@ -95,9 +96,8 @@ singletree()
|
|||||||
|
|
||||||
findpath()
|
findpath()
|
||||||
{
|
{
|
||||||
if [ $# -lt 1 ]; then
|
[ $# -lt 1 ] && \
|
||||||
err "findpath: No arguments provided" "findpath" "$@"
|
err "findpath: No arguments provided" "findpath" "$@"
|
||||||
fi
|
|
||||||
|
|
||||||
while [ $# -gt 0 ]
|
while [ $# -gt 0 ]
|
||||||
do
|
do
|
||||||
@@ -130,9 +130,8 @@ unpad_one_byte()
|
|||||||
xromsize="$(expr $(stat -c '%s' "$1") - 1)" || \
|
xromsize="$(expr $(stat -c '%s' "$1") - 1)" || \
|
||||||
err "can't increment file size" "unpad_one_byte" "$@"
|
err "can't increment file size" "unpad_one_byte" "$@"
|
||||||
|
|
||||||
if [ $xromsize -lt 524288 ]; then
|
[ $xromsize -lt 524288 ] && \
|
||||||
err "too small, $xromsize: $1" "unpad_one_byte" "$@"
|
err "too small, $xromsize: $1" "unpad_one_byte" "$@"
|
||||||
fi
|
|
||||||
|
|
||||||
unpaddedfile="`mktemp || err "mktemp unpad_one_byte"`" || \
|
unpaddedfile="`mktemp || err "mktemp unpad_one_byte"`" || \
|
||||||
err "can't make tmp file" "unpad_one_byte" "$@"
|
err "can't make tmp file" "unpad_one_byte" "$@"
|
||||||
@@ -143,9 +142,8 @@ unpad_one_byte()
|
|||||||
|
|
||||||
build_sbase()
|
build_sbase()
|
||||||
{
|
{
|
||||||
if [ ! -f "$sha512sum" ]; then
|
[ ! -f "$sha512sum" ] && \
|
||||||
x_ make -C "$xbmkpwd/util/sbase"
|
x_ make -C "$xbmkpwd/util/sbase"; :
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
remkdir()
|
remkdir()
|
||||||
@@ -156,11 +154,9 @@ remkdir()
|
|||||||
|
|
||||||
xbmkdir()
|
xbmkdir()
|
||||||
{
|
{
|
||||||
while [ $# -gt 0 ]
|
while [ $# -gt 0 ]; do
|
||||||
do
|
[ ! -d "$1" ] && \
|
||||||
if [ ! -d "$1" ]; then
|
|
||||||
x_ mkdir -p "$1"
|
x_ mkdir -p "$1"
|
||||||
fi
|
|
||||||
|
|
||||||
shift 1
|
shift 1
|
||||||
done
|
done
|
||||||
@@ -190,9 +186,8 @@ dx_()
|
|||||||
{
|
{
|
||||||
xchk dx_ "$@"
|
xchk dx_ "$@"
|
||||||
|
|
||||||
if [ ! -f "$2" ]; then
|
[ ! -f "$2" ] && \
|
||||||
return 0
|
return 0
|
||||||
fi
|
|
||||||
|
|
||||||
while read -r fx; do
|
while read -r fx; do
|
||||||
$1 "$fx" || return 1; :
|
$1 "$fx" || return 1; :
|
||||||
@@ -201,20 +196,19 @@ dx_()
|
|||||||
|
|
||||||
x_()
|
x_()
|
||||||
{
|
{
|
||||||
if [ $# -lt 1 ]; then
|
[ $# -lt 1 ] && \
|
||||||
return 0
|
return 0
|
||||||
elif [ -z "$1" ]; then
|
[ -z "$1" ] && \
|
||||||
err "Empty first arg" "x_" "$@"
|
err "Empty first arg" "x_" "$@"
|
||||||
else
|
|
||||||
"$@" || err "Unhandled error" "x_" "$@"
|
"$@" || err "Unhandled error" "x_" "$@"
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
xeq()
|
xeq()
|
||||||
{
|
{
|
||||||
if [ $# -lt 2 ]; then
|
[ $# -lt 2 ] && \
|
||||||
err "no args" xeq
|
err "no args" xeq
|
||||||
fi
|
|
||||||
xbcmd="$1"
|
xbcmd="$1"
|
||||||
chk="$2"
|
chk="$2"
|
||||||
shift 2
|
shift 2
|
||||||
@@ -225,9 +219,8 @@ xeq()
|
|||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
for eq in "$@"; do
|
for eq in "$@"; do
|
||||||
if [ "$chk" = "$eq" ]; then
|
[ "$chk" = "$eq" ] && \
|
||||||
return 0
|
return 0; :
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@@ -264,14 +257,12 @@ xprintf()
|
|||||||
xprintfargs=0
|
xprintfargs=0
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]; do
|
||||||
printf "\"%s\"" "$1"
|
printf "\"%s\"" "$1"
|
||||||
if [ $# -gt 1 ]; then
|
[ $# -gt 1 ] && \
|
||||||
printf " "
|
printf " "
|
||||||
fi
|
|
||||||
|
|
||||||
xprintfargs=1
|
xprintfargs=1
|
||||||
shift 1
|
shift 1
|
||||||
done
|
done
|
||||||
if [ $xprintfargs -gt 0 ]; then
|
[ $xprintfargs -gt 0 ] && \
|
||||||
printf "\n"
|
printf "\n"; :
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-7
@@ -18,9 +18,8 @@ extract_refcode()
|
|||||||
# and refcode is extracted from an image using the old scheme. we use
|
# and refcode is extracted from an image using the old scheme. we use
|
||||||
# cbfstool from coreboot 4.11_branch, the tree used by ASUS KGPE-D16:
|
# cbfstool from coreboot 4.11_branch, the tree used by ASUS KGPE-D16:
|
||||||
|
|
||||||
if [ -z "$cbfstoolref" ]; then
|
[ -z "$cbfstoolref" ] && \
|
||||||
err "cbfstoolref not set" "extract_refcode" "$@"
|
err "cbfstoolref not set" "extract_refcode" "$@"
|
||||||
fi
|
|
||||||
|
|
||||||
x_ xbmkdir "${_pre_dest%/*}"
|
x_ xbmkdir "${_pre_dest%/*}"
|
||||||
|
|
||||||
@@ -28,21 +27,19 @@ 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" ]; then
|
[ -n "$MRC_refcode_gbe" ] && \
|
||||||
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
|
|
||||||
|
|
||||||
x_ mv "$appdir/ref" "$_pre_dest"
|
x_ mv "$appdir/ref" "$_pre_dest"
|
||||||
}
|
}
|
||||||
|
|
||||||
extract_mrc()
|
extract_mrc()
|
||||||
{
|
{
|
||||||
if [ -z "$MRC_board" ]; then
|
[ -z "$MRC_board" ] && \
|
||||||
err "MRC_board unset" "extract_mrc" "$@"
|
err "MRC_board unset" "extract_mrc" "$@"
|
||||||
elif [ -z "$CONFIG_MRC_FILE" ]; then
|
[ -z "$CONFIG_MRC_FILE" ] && \
|
||||||
err "CONFIG_MRC_FILE unset" "extract_mrc" "$@"
|
err "CONFIG_MRC_FILE unset" "extract_mrc" "$@"
|
||||||
fi
|
|
||||||
|
|
||||||
SHELLBALL="chromeos-firmwareupdate-$MRC_board"
|
SHELLBALL="chromeos-firmwareupdate-$MRC_board"
|
||||||
|
|
||||||
|
|||||||
+6
-10
@@ -16,9 +16,8 @@ release()
|
|||||||
|
|
||||||
while getopts m: option
|
while getopts m: option
|
||||||
do
|
do
|
||||||
if [ -z "$OPTARG" ]; then
|
[ -z "$OPTARG" ] && \
|
||||||
err "empty argument not allowed" "release" "$@"
|
err "empty argument not allowed" "release" "$@"
|
||||||
fi
|
|
||||||
|
|
||||||
case "$option" in
|
case "$option" in
|
||||||
m)
|
m)
|
||||||
@@ -31,9 +30,8 @@ release()
|
|||||||
done
|
done
|
||||||
|
|
||||||
reldest="$reldir/$version"
|
reldest="$reldir/$version"
|
||||||
if [ -e "$reldest" ]; then
|
[ -e "$reldest" ] && \
|
||||||
err "already exists: \"$reldest\"" "release" "$@"
|
err "already exists: \"$reldest\"" "release" "$@"
|
||||||
fi
|
|
||||||
|
|
||||||
vdir="`mktemp -d || err "can't make vdir"`" || \
|
vdir="`mktemp -d || err "can't make vdir"`" || \
|
||||||
err "can't make tmp vdir" "release" "$@"
|
err "can't make tmp vdir" "release" "$@"
|
||||||
@@ -47,9 +45,9 @@ release()
|
|||||||
|
|
||||||
prep_release src
|
prep_release src
|
||||||
prep_release tarball
|
prep_release tarball
|
||||||
if [ "$relmode" != "src" ]; then
|
[ "$relmode" != "src" ] && \
|
||||||
prep_release bin
|
prep_release bin
|
||||||
fi
|
|
||||||
x_ rm -Rf "$rsrc"
|
x_ rm -Rf "$rsrc"
|
||||||
|
|
||||||
x_ xbmkdir "$reldir"
|
x_ xbmkdir "$reldir"
|
||||||
@@ -64,9 +62,8 @@ prep_release()
|
|||||||
(
|
(
|
||||||
if [ "$1" != "tarball" ]; then
|
if [ "$1" != "tarball" ]; then
|
||||||
x_ cd "$rsrc"
|
x_ cd "$rsrc"
|
||||||
if [ ! -e "cache" ]; then
|
[ ! -e "cache" ] && \
|
||||||
x_ ln -s "$XBMK_CACHE" "cache"
|
x_ ln -s "$XBMK_CACHE" "cache"; :
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
prep_release_$1
|
prep_release_$1
|
||||||
@@ -93,7 +90,6 @@ nuke()
|
|||||||
|
|
||||||
if [ -d "${r%/*}" ]; then
|
if [ -d "${r%/*}" ]; then
|
||||||
x_ cd "${r%/*}"
|
x_ cd "${r%/*}"
|
||||||
|
|
||||||
dx_ "x_ rm -Rf" "$rsrc/$1"
|
dx_ "x_ rm -Rf" "$rsrc/$1"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
+41
-84
@@ -63,9 +63,8 @@ mkpayload_grub()
|
|||||||
|
|
||||||
corebootpremake()
|
corebootpremake()
|
||||||
{
|
{
|
||||||
if [ "$XBMK_RELEASE" = "y" ] && [ "$release" = "n" ]; then
|
[ "$XBMK_RELEASE" = "y" ] && [ "$release" = "n" ] && \
|
||||||
return 0
|
return 0
|
||||||
fi
|
|
||||||
|
|
||||||
$if_not_dry_build \
|
$if_not_dry_build \
|
||||||
cook_coreboot_config
|
cook_coreboot_config
|
||||||
@@ -75,9 +74,8 @@ 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" ]; then
|
[ -z "$mode" ] && [ "$target" != "$tree" ] && \
|
||||||
x_ ./mk download "$target"
|
x_ ./mk download "$target"; :
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cook_coreboot_config()
|
cook_coreboot_config()
|
||||||
@@ -90,9 +88,8 @@ cook_coreboot_config()
|
|||||||
|
|
||||||
check_coreboot_util()
|
check_coreboot_util()
|
||||||
{
|
{
|
||||||
if [ "$badhash" = "y" ]; then
|
[ "$badhash" = "y" ] && \
|
||||||
x_ rm -f "elf/coreboot/$tree/$1"
|
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
|
return 0
|
||||||
fi
|
fi
|
||||||
@@ -101,9 +98,8 @@ check_coreboot_util()
|
|||||||
utilsrcdir="src/coreboot/$tree/util/$1"
|
utilsrcdir="src/coreboot/$tree/util/$1"
|
||||||
|
|
||||||
utilmode=""
|
utilmode=""
|
||||||
if [ -n "$mode" ]; then
|
[ -n "$mode" ] && \
|
||||||
utilmode="clean"
|
utilmode="clean"
|
||||||
fi
|
|
||||||
|
|
||||||
x_ make -C "$utilsrcdir" $utilmode -j$XBMK_THREADS $makeargs
|
x_ make -C "$utilsrcdir" $utilmode -j$XBMK_THREADS $makeargs
|
||||||
|
|
||||||
@@ -120,16 +116,14 @@ check_coreboot_util()
|
|||||||
x_ xbmkdir "$utilelfdir"
|
x_ xbmkdir "$utilelfdir"
|
||||||
x_ cp "$utilsrcdir/$1" "$utilelfdir"
|
x_ cp "$utilsrcdir/$1" "$utilelfdir"
|
||||||
|
|
||||||
if [ "$1" = "cbfstool" ]; then
|
[ "$1" = "cbfstool" ] && \
|
||||||
x_ cp "$utilsrcdir/rmodtool" "$utilelfdir"
|
x_ cp "$utilsrcdir/rmodtool" "$utilelfdir"; :
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
coreboot_pad_one_byte()
|
coreboot_pad_one_byte()
|
||||||
{
|
{
|
||||||
if [ "$XBMK_RELEASE" = "y" ] && [ "$release" = "n" ]; then
|
[ "$XBMK_RELEASE" = "y" ] && [ "$release" = "n" ] && \
|
||||||
return 0
|
return 0
|
||||||
fi
|
|
||||||
|
|
||||||
$if_not_dry_build \
|
$if_not_dry_build \
|
||||||
pad_one_byte "$srcdir/build/coreboot.rom"
|
pad_one_byte "$srcdir/build/coreboot.rom"
|
||||||
@@ -137,9 +131,8 @@ coreboot_pad_one_byte()
|
|||||||
|
|
||||||
mkcorebootbin()
|
mkcorebootbin()
|
||||||
{
|
{
|
||||||
if [ "$XBMK_RELEASE" = "y" ] && [ "$release" = "n" ]; then
|
[ "$XBMK_RELEASE" = "y" ] && [ "$release" = "n" ] && \
|
||||||
return 0
|
return 0
|
||||||
fi
|
|
||||||
|
|
||||||
$if_not_dry_build \
|
$if_not_dry_build \
|
||||||
check_coreboot_util cbfstool
|
check_coreboot_util cbfstool
|
||||||
@@ -157,9 +150,8 @@ mkcorebootbin()
|
|||||||
|
|
||||||
mkcorebootbin_real()
|
mkcorebootbin_real()
|
||||||
{
|
{
|
||||||
if [ "$target" = "$tree" ]; then
|
[ "$target" = "$tree" ] && \
|
||||||
return 0
|
return 0
|
||||||
fi
|
|
||||||
|
|
||||||
tmprom="$xbtmp/coreboot.rom"
|
tmprom="$xbtmp/coreboot.rom"
|
||||||
|
|
||||||
@@ -177,9 +169,8 @@ mkcorebootbin_real()
|
|||||||
cbfscfg="config/coreboot/$target/cbfs.cfg"
|
cbfscfg="config/coreboot/$target/cbfs.cfg"
|
||||||
|
|
||||||
elfrom="elf/coreboot/$tree/$target/$initmode"
|
elfrom="elf/coreboot/$tree/$target/$initmode"
|
||||||
if [ -n "$displaymode" ]; then
|
[ -n "$displaymode" ] && \
|
||||||
elfrom="${elfrom}_$displaymode"
|
elfrom="${elfrom}_$displaymode"
|
||||||
fi
|
|
||||||
elfrom="$elfrom/coreboot.rom"
|
elfrom="$elfrom/coreboot.rom"
|
||||||
|
|
||||||
$if_not_dry_build \
|
$if_not_dry_build \
|
||||||
@@ -188,57 +179,44 @@ mkcorebootbin_real()
|
|||||||
$if_not_dry_build \
|
$if_not_dry_build \
|
||||||
unpad_one_byte "$tmprom"
|
unpad_one_byte "$tmprom"
|
||||||
|
|
||||||
if [ -n "$payload_uboot" ] && [ "$payload_uboot" != "amd64" ] && \
|
[ -n "$payload_uboot" ] && [ "$payload_uboot" != "amd64" ] && \
|
||||||
[ "$payload_uboot" != "i386" ] && [ "$payload_uboot" != "arm64" ]
|
[ "$payload_uboot" != "i386" ] && [ "$payload_uboot" != "arm64" ] \
|
||||||
then
|
&& err "'$target' defines bad u-boot type '$payload_uboot'" \
|
||||||
err "'$target' defines bad u-boot type '$payload_uboot'" \
|
|
||||||
"mkcorebootbin_real" "$@"
|
"mkcorebootbin_real" "$@"
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "$payload_uboot" ] && [ "$payload_uboot" != "arm64" ]; then
|
[ -n "$payload_uboot" ] && [ "$payload_uboot" != "arm64" ] && \
|
||||||
payload_seabios="y"
|
payload_seabios="y"
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$uboot_config" ]; then
|
[ -z "$uboot_config" ] && \
|
||||||
uboot_config="default"
|
uboot_config="default"
|
||||||
fi
|
[ "$payload_grub" = "y" ] && \
|
||||||
if [ "$payload_grub" = "y" ]; then
|
|
||||||
payload_seabios="y"
|
payload_seabios="y"
|
||||||
fi
|
[ "$payload_seabios" = "y" ] && [ "$payload_uboot" = "arm64" ] && \
|
||||||
if [ "$payload_seabios" = "y" ] && [ "$payload_uboot" = "arm64" ]; then
|
|
||||||
$if_not_dry_build \
|
$if_not_dry_build \
|
||||||
err "$target: U-Boot arm / SeaBIOS/GRUB both enabled" \
|
err "$target: U-Boot arm / SeaBIOS/GRUB both enabled" \
|
||||||
"mkcorebootbin_real" "$@"
|
"mkcorebootbin_real" "$@"
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$grub_scan_disk" ]; then
|
[ -z "$grub_scan_disk" ] && \
|
||||||
grub_scan_disk="nvme ahci ata"
|
grub_scan_disk="nvme ahci ata"
|
||||||
fi
|
[ -z "$grubtree" ] && \
|
||||||
if [ -z "$grubtree" ]; then
|
|
||||||
grubtree="default"
|
grubtree="default"
|
||||||
fi
|
|
||||||
grubelf="elf/grub/$grubtree/$grubtree/payload/grub.elf"
|
grubelf="elf/grub/$grubtree/$grubtree/payload/grub.elf"
|
||||||
|
|
||||||
if [ "$payload_memtest" != "y" ]; then
|
[ "$payload_memtest" != "y" ] && \
|
||||||
payload_memtest="n"
|
payload_memtest="n"
|
||||||
fi
|
[ "$(uname -m)" != "x86_64" ] && \
|
||||||
if [ "$(uname -m)" != "x86_64" ]; then
|
|
||||||
payload_memtest="n"
|
payload_memtest="n"
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$payload_grubsea" = "y" ] && [ "$initmode" = "normal" ]; then
|
[ "$payload_grubsea" = "y" ] && [ "$initmode" = "normal" ] && \
|
||||||
payload_grubsea="n"
|
payload_grubsea="n"
|
||||||
fi
|
[ "$payload_grub" != "y" ] && \
|
||||||
if [ "$payload_grub" != "y" ]; then
|
|
||||||
payload_grubsea="n"
|
payload_grubsea="n"
|
||||||
fi
|
|
||||||
|
|
||||||
$if_dry_build \
|
$if_dry_build \
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
if [ -f "$cbfscfg" ]; then
|
[ -f "$cbfscfg" ] && \
|
||||||
dx_ add_cbfs_option "$cbfscfg"
|
dx_ add_cbfs_option "$cbfscfg"
|
||||||
fi
|
|
||||||
|
|
||||||
if grep "CONFIG_PAYLOAD_NONE=y" "$defconfig"; then
|
if grep "CONFIG_PAYLOAD_NONE=y" "$defconfig"; then
|
||||||
if [ "$payload_seabios" = "y" ]; then
|
if [ "$payload_seabios" = "y" ]; then
|
||||||
@@ -283,31 +261,25 @@ add_cbfs_option()
|
|||||||
|
|
||||||
add_seabios()
|
add_seabios()
|
||||||
{
|
{
|
||||||
if [ -n "$payload_uboot" ] && [ "$payload_uboot" != "arm64" ]; then
|
[ -n "$payload_uboot" ] && [ "$payload_uboot" != "arm64" ] && \
|
||||||
# we must add u-boot first, because it's added as a flat
|
|
||||||
# binary at a specific offset for secondary program loader
|
|
||||||
|
|
||||||
$if_not_dry_build \
|
$if_not_dry_build \
|
||||||
add_uboot
|
add_uboot # add u-boot first, due to fixed cbfs offset
|
||||||
fi
|
|
||||||
|
|
||||||
_seabioself="elf/seabios/default/default/$initmode/bios.bin.elf"
|
_seabioself="elf/seabios/default/default/$initmode/bios.bin.elf"
|
||||||
[ "$initmode" = "fspgop" ] && \
|
[ "$initmode" = "fspgop" ] && \
|
||||||
_seabioself="elf/seabios/default/default/libgfxinit/bios.bin.elf"
|
_seabioself="elf/seabios/default/default/libgfxinit/bios.bin.elf"
|
||||||
|
|
||||||
_seaname="fallback/payload"
|
_seaname="fallback/payload"
|
||||||
if [ "$payload_grubsea" = "y" ]; then
|
[ "$payload_grubsea" = "y" ] && \
|
||||||
_seaname="seabios.elf"
|
_seaname="seabios.elf"
|
||||||
fi
|
|
||||||
|
|
||||||
cbfs "$tmprom" "$_seabioself" "$_seaname"
|
cbfs "$tmprom" "$_seabioself" "$_seaname"
|
||||||
|
|
||||||
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" ]; then
|
[ "$initmode" = "vgarom" ] && \
|
||||||
opexec="0"
|
opexec="0"
|
||||||
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
|
||||||
@@ -315,26 +287,17 @@ add_seabios()
|
|||||||
cbfs "$tmprom" "$seavgabiosrom" vgaroms/seavgabios.bin raw
|
cbfs "$tmprom" "$seavgabiosrom" vgaroms/seavgabios.bin raw
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$payload_memtest" = "y" ]; then
|
[ "$payload_memtest" = "y" ] && \
|
||||||
# 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
|
[ "$payload_grub" = "y" ] && \
|
||||||
add_grub
|
add_grub
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$payload_grubsea" != "y" ]; then
|
[ "$payload_grubsea" != "y" ] && \
|
||||||
# ROM image where SeaBIOS doesn't load grub/u-boot first.
|
cprom # seabios, but don't load grub/u-boot first
|
||||||
# U-Boot/GRUB available in ESC menu if enabled for the board
|
|
||||||
|
|
||||||
cprom
|
# now make seauboot(u-boot loaded by seabios) and SeaGRUB (GRUB loaded
|
||||||
fi
|
# by SeaBIOS) images; users can bypass via ESC to boot from SeaBIOS
|
||||||
|
|
||||||
# now make "SeaUBoot" and "SeaGRUB" images, where SeaBIOS auto-loads
|
|
||||||
# SeaBIOS or U-Boot first; users can bypass this by pressing ESC
|
|
||||||
# in the SeaBIOS menu, to boot devices using SeaBIOS itself instead
|
|
||||||
|
|
||||||
if [ "$payload_uboot" = "amd64" ] && \
|
if [ "$payload_uboot" = "amd64" ] && \
|
||||||
[ "$displaymode" != "txtmode" ] && \
|
[ "$displaymode" != "txtmode" ] && \
|
||||||
@@ -353,9 +316,8 @@ 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" ]; then
|
[ "$payload_grubsea" = "y" ] && \
|
||||||
_grubname="fallback/payload"
|
_grubname="fallback/payload"
|
||||||
fi
|
|
||||||
|
|
||||||
cbfs "$tmprom" "$grubelf" "$_grubname"
|
cbfs "$tmprom" "$grubelf" "$_grubname"
|
||||||
|
|
||||||
@@ -365,10 +327,9 @@ add_grub()
|
|||||||
|
|
||||||
cbfs "$tmprom" "$xbtmp/tmpcfg" scan.cfg raw
|
cbfs "$tmprom" "$xbtmp/tmpcfg" scan.cfg raw
|
||||||
|
|
||||||
if [ "$initmode" != "normal" ] && [ "$displaymode" != "txtmode" ]; then
|
[ "$initmode" != "normal" ] && [ "$displaymode" != "txtmode" ] && \
|
||||||
cbfs "$tmprom" "$grubdata/background/background1280x800.png" \
|
cbfs "$tmprom" "$grubdata/background/background1280x800.png" \
|
||||||
"background.png" raw
|
"background.png" raw; :
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mkseagrub()
|
mkseagrub()
|
||||||
@@ -386,12 +347,10 @@ add_uboot()
|
|||||||
{
|
{
|
||||||
if [ "$displaymode" = "txtmode" ]; then
|
if [ "$displaymode" = "txtmode" ]; then
|
||||||
printf "cb/%s: Can't use U-Boot in text mode\n" "$target" 1>&2
|
printf "cb/%s: Can't use U-Boot in text mode\n" "$target" 1>&2
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
elif [ "$initmode" = "normal" ]; then
|
elif [ "$initmode" = "normal" ]; then
|
||||||
printf "cb/%s: Can't use U-Boot in normal initmode\n" \
|
printf "cb/%s: Can't use U-Boot in normal initmode\n" \
|
||||||
"$target" 1>&2
|
"$target" 1>&2
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -438,9 +397,8 @@ add_uboot()
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
cbfs "$tmprom" "$ubootelf" "$ubpath" $ubcbfsargs
|
cbfs "$tmprom" "$ubootelf" "$ubpath" $ubcbfsargs
|
||||||
if [ "$payload_seabios" != "y" ]; then
|
[ "$payload_seabios" != "y" ] && \
|
||||||
cprom
|
cprom; :
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# prepare the final image in bin/ for user installation:
|
# prepare the final image in bin/ for user installation:
|
||||||
@@ -452,9 +410,8 @@ cprom()
|
|||||||
tmpnew=""
|
tmpnew=""
|
||||||
newrom="bin/$target/${pname}_${target}_$initmode.rom"
|
newrom="bin/$target/${pname}_${target}_$initmode.rom"
|
||||||
|
|
||||||
if [ -n "$displaymode" ]; then
|
[ -n "$displaymode" ] && \
|
||||||
newrom="${newrom%.rom}_$displaymode.rom"
|
newrom="${newrom%.rom}_$displaymode.rom"
|
||||||
fi
|
|
||||||
if [ $# -gt 0 ] && [ "${1%.gkb}" != "$1" ]; then
|
if [ $# -gt 0 ] && [ "${1%.gkb}" != "$1" ]; then
|
||||||
tmpnew="${1##*/}"
|
tmpnew="${1##*/}"
|
||||||
newrom="${newrom%.rom}_${tmpnew%.gkb}.rom"
|
newrom="${newrom%.rom}_${tmpnew%.gkb}.rom"
|
||||||
|
|||||||
+87
-213
@@ -13,45 +13,11 @@ if_dry_build=":"
|
|||||||
if_not_do_make=":"
|
if_not_do_make=":"
|
||||||
if_not_dry_build=""
|
if_not_dry_build=""
|
||||||
|
|
||||||
autoconfargs=""
|
eval "`newvar autoconfargs autogenargs badhash badtghash bootstrapargs \
|
||||||
autogenargs=""
|
build_depend buildtype cleanargs cmakedir cmd defconfig dest_dir elfdir \
|
||||||
badhash=""
|
forcepull gccdir gccfull gccver gnatdir gnatfull gnatver listfile \
|
||||||
badtghash=""
|
makeargs mdir mkhelper mkhelpercfg mode postmake premake project release \
|
||||||
bootstrapargs=""
|
rev srcdir target target_dir targets tree xarch xgcctree xlang`"
|
||||||
build_depend=""
|
|
||||||
buildtype=""
|
|
||||||
cleanargs=""
|
|
||||||
cmakedir=""
|
|
||||||
cmd=""
|
|
||||||
defconfig=""
|
|
||||||
dest_dir=""
|
|
||||||
elfdir=""
|
|
||||||
forcepull=""
|
|
||||||
gccdir=""
|
|
||||||
gccfull=""
|
|
||||||
gccver=""
|
|
||||||
gnatdir=""
|
|
||||||
gnatfull=""
|
|
||||||
gnatver=""
|
|
||||||
listfile=""
|
|
||||||
makeargs=""
|
|
||||||
mdir=""
|
|
||||||
mkhelper=""
|
|
||||||
mkhelpercfg=""
|
|
||||||
mode=""
|
|
||||||
postmake=""
|
|
||||||
premake=""
|
|
||||||
project=""
|
|
||||||
release=""
|
|
||||||
rev=""
|
|
||||||
srcdir=""
|
|
||||||
target=""
|
|
||||||
target_dir=""
|
|
||||||
targets=""
|
|
||||||
tree=""
|
|
||||||
xarch=""
|
|
||||||
xgcctree=""
|
|
||||||
xlang=""
|
|
||||||
|
|
||||||
trees()
|
trees()
|
||||||
{
|
{
|
||||||
@@ -59,9 +25,8 @@ trees()
|
|||||||
|
|
||||||
while getopts $flags option
|
while getopts $flags option
|
||||||
do
|
do
|
||||||
if [ -n "$flag" ]; then
|
[ -n "$flag" ] && \
|
||||||
err "only one flag is permitted" "trees" "$@"
|
err "only one flag is permitted" "trees" "$@"
|
||||||
fi
|
|
||||||
|
|
||||||
flag="$1"
|
flag="$1"
|
||||||
|
|
||||||
@@ -74,7 +39,7 @@ trees()
|
|||||||
# a large number of operations will be
|
# a large number of operations will be
|
||||||
# skipped. these are "if_not_dry_build build" scenarios
|
# skipped. these are "if_not_dry_build build" scenarios
|
||||||
# where only a subset of build tasks are done,
|
# where only a subset of build tasks are done,
|
||||||
# and $if_not_dry_build is prefixed to skipped commands
|
# and $if_not_dry_build is prefixed to skipped commands
|
||||||
|
|
||||||
if_dry_build=""
|
if_dry_build=""
|
||||||
if_not_dry_build=":"
|
if_not_dry_build=":"
|
||||||
@@ -104,7 +69,6 @@ trees()
|
|||||||
|
|
||||||
if [ -z "${OPTARG+x}" ]; then
|
if [ -z "${OPTARG+x}" ]; then
|
||||||
shift 1
|
shift 1
|
||||||
|
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -118,9 +82,7 @@ trees()
|
|||||||
err "missing flag ($flags)" "trees" "$@"
|
err "missing flag ($flags)" "trees" "$@"
|
||||||
elif [ -z "$project" ]; then
|
elif [ -z "$project" ]; then
|
||||||
fx_ "x_ ./mk $flag" x_ ls -1 config/git
|
fx_ "x_ ./mk $flag" x_ ls -1 config/git
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
elif [ ! -f "config/git/$project/pkg.cfg" ]; then
|
elif [ ! -f "config/git/$project/pkg.cfg" ]; then
|
||||||
err "config/git/$project/pkg.cfg missing" "trees" "$@"
|
err "config/git/$project/pkg.cfg missing" "trees" "$@"
|
||||||
fi
|
fi
|
||||||
@@ -132,9 +94,8 @@ trees()
|
|||||||
dest_dir="$elfdir"
|
dest_dir="$elfdir"
|
||||||
|
|
||||||
listfile="$datadir/build.list"
|
listfile="$datadir/build.list"
|
||||||
if [ ! -f "$listfile" ]; then
|
[ ! -f "$listfile" ] && \
|
||||||
listfile="" # build.list is optional on all projects
|
listfile="" # build.list is optional on all projects
|
||||||
fi
|
|
||||||
|
|
||||||
mkhelpercfg="$datadir/mkhelper.cfg"
|
mkhelpercfg="$datadir/mkhelper.cfg"
|
||||||
if e "$mkhelpercfg" f missing; then
|
if e "$mkhelpercfg" f missing; then
|
||||||
@@ -161,18 +122,16 @@ build_project()
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$mode" = "distclean" ]; then
|
[ "$mode" = "distclean" ] && \
|
||||||
mode="clean"
|
mode="clean"
|
||||||
fi
|
|
||||||
|
|
||||||
if ! run_make_command; then
|
if ! run_make_command; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$mode" ]; then
|
[ -z "$mode" ] && \
|
||||||
$if_not_dry_build \
|
$if_not_dry_build \
|
||||||
copy_elf; :
|
copy_elf; :
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
build_targets()
|
build_targets()
|
||||||
@@ -191,9 +150,7 @@ build_targets()
|
|||||||
|
|
||||||
if [ "$x" = "list" ]; then
|
if [ "$x" = "list" ]; then
|
||||||
x_ ls -1 "config/$project"
|
x_ ls -1 "config/$project"
|
||||||
|
|
||||||
listfile=""
|
listfile=""
|
||||||
|
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -203,9 +160,8 @@ build_targets()
|
|||||||
|
|
||||||
x_ handle_defconfig
|
x_ handle_defconfig
|
||||||
|
|
||||||
if [ -z "$mode" ]; then
|
[ -z "$mode" ] && \
|
||||||
x_ $postmake
|
x_ $postmake; :
|
||||||
fi
|
|
||||||
done; :
|
done; :
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -213,51 +169,44 @@ handle_defconfig()
|
|||||||
{
|
{
|
||||||
target_dir="$configdir/$target"
|
target_dir="$configdir/$target"
|
||||||
|
|
||||||
if [ ! -f "CHANGELOG" ]; then
|
[ ! -f "CHANGELOG" ] && \
|
||||||
fetch_project "$project"
|
fetch_project "$project"
|
||||||
fi
|
|
||||||
if ! configure_project "$target_dir"; then
|
if ! configure_project "$target_dir"; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$tree" ]; then
|
[ -z "$tree" ] && \
|
||||||
err "$configdir: 'tree' not set" "handle_defconfig" "$@"
|
err "$configdir: 'tree' not set" "handle_defconfig" "$@"
|
||||||
fi
|
|
||||||
|
|
||||||
srcdir="src/$project/$tree"
|
srcdir="src/$project/$tree"
|
||||||
|
|
||||||
if [ "$mode" = "${mode%clean}" ] && [ ! -d "$srcdir" ]; then
|
[ "$mode" = "${mode%clean}" ] && [ ! -d "$srcdir" ] && \
|
||||||
return 0
|
return 0
|
||||||
fi
|
|
||||||
|
|
||||||
for y in "$target_dir/config"/*
|
for y in "$target_dir/config"/*
|
||||||
do
|
do
|
||||||
if [ "$flag" != "-d" ] && [ ! -f "$y" ]; then
|
[ "$flag" != "-d" ] && [ ! -f "$y" ] && \
|
||||||
continue
|
continue
|
||||||
elif [ "$flag" != "-d" ]; then
|
[ "$flag" != "-d" ] && \
|
||||||
defconfig="$y"
|
defconfig="$y"
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$mode" ]; then
|
if [ -z "$mode" ]; then
|
||||||
check_defconfig || continue; :
|
check_defconfig || continue; :
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$mode" ]; then
|
[ -z "$mode" ] && \
|
||||||
for _xarch in $xarch; do
|
for _xarch in $xarch; do
|
||||||
$if_dry_build \
|
$if_dry_build \
|
||||||
break
|
break
|
||||||
if [ -n "$_xarch" ]; then
|
[ -n "$_xarch" ] && \
|
||||||
check_cross_compiler "$_xarch"
|
check_cross_compiler "$_xarch"; :
|
||||||
fi
|
|
||||||
done; :
|
done; :
|
||||||
fi
|
|
||||||
|
|
||||||
handle_makefile
|
handle_makefile
|
||||||
|
|
||||||
if [ -z "$mode" ]; then
|
[ -z "$mode" ] && \
|
||||||
$if_not_dry_build \
|
$if_not_dry_build \
|
||||||
copy_elf
|
copy_elf; :
|
||||||
fi
|
|
||||||
done; :
|
done; :
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -265,28 +214,14 @@ configure_project()
|
|||||||
{
|
{
|
||||||
_tcfg="$1/target.cfg"
|
_tcfg="$1/target.cfg"
|
||||||
|
|
||||||
autoconfargs=""
|
eval "`newvar autoconfargs badhash badtghash bootstrapargs \
|
||||||
badhash=""
|
build_depend buildtype cleanargs makeargs mkhelper postmake \
|
||||||
badtghash=""
|
premake release xarch xgcctree xlang`"
|
||||||
bootstrapargs=""
|
|
||||||
build_depend=""
|
|
||||||
buildtype=""
|
|
||||||
cleanargs=""
|
|
||||||
makeargs=""
|
|
||||||
mkhelper=""
|
|
||||||
postmake=""
|
|
||||||
premake=""
|
|
||||||
release=""
|
|
||||||
xarch=""
|
|
||||||
xgcctree=""
|
|
||||||
xlang=""
|
|
||||||
|
|
||||||
if [ ! -f "$_tcfg" ]; then
|
[ ! -f "$_tcfg" ] && \
|
||||||
buildtype="auto"
|
buildtype="auto"
|
||||||
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; then
|
if e "$datadir/mkhelper.cfg" f; then
|
||||||
. "$datadir/mkhelper.cfg" || \
|
. "$datadir/mkhelper.cfg" || \
|
||||||
err "Can't read '$datadir/mkhelper.cfg'" \
|
err "Can't read '$datadir/mkhelper.cfg'" \
|
||||||
@@ -294,63 +229,42 @@ configure_project()
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# override target/tree specific variables from per-target config:
|
# override target/tree specific variables from per-target config:
|
||||||
|
|
||||||
while e "$_tcfg" f || [ "$cmd" != "build_project" ]
|
while e "$_tcfg" f || [ "$cmd" != "build_project" ]
|
||||||
do
|
do
|
||||||
# TODO: implement infinite loop detection here, caused
|
# TODO: detect infinine loops and throw err.
|
||||||
# by project targets pointing to other targets/trees
|
# (currently mitigated by virtue of configuration)
|
||||||
# when then ultimate point back repeatedly; this is
|
|
||||||
# currently avoided simply by careful configuration.
|
|
||||||
# temporary files per tree/target name could be created
|
|
||||||
# per iteration, and then checked the next time
|
|
||||||
|
|
||||||
printf "Loading %s config: %s\n" "$project" "$_tcfg"
|
printf "Loading %s config: %s\n" "$project" "$_tcfg"
|
||||||
|
eval "`newvar rev tree`"
|
||||||
rev=""
|
|
||||||
tree=""
|
|
||||||
|
|
||||||
. "$_tcfg" || \
|
. "$_tcfg" || \
|
||||||
err "Can't read '$_tcfg'" "configure_project" "$@"
|
err "Can't read '$_tcfg'" "configure_project" "$@"
|
||||||
|
|
||||||
if [ "$flag" = "-d" ]; then
|
[ "$flag" = "-d" ] && \
|
||||||
build_depend="" # dry run
|
build_depend="" # dry run
|
||||||
fi
|
|
||||||
if [ "$cmd" = "build_project" ]; then
|
|
||||||
# single-tree, so it can't be a target pointing
|
|
||||||
# to a main source tree
|
|
||||||
|
|
||||||
break
|
[ "$cmd" = "build_project" ] && \
|
||||||
fi
|
break # single-tree, so targeting is unnecessary
|
||||||
$if_do_make \
|
$if_do_make \
|
||||||
break
|
break
|
||||||
if [ "${_tcfg%/*/target.cfg}" = "${_tcfg%"/$tree/target.cfg"}" ]
|
[ "${_tcfg%/*/target.cfg}" = "${_tcfg%"/$tree/target.cfg"}" ] \
|
||||||
then
|
&& break # target and tree matching was successful
|
||||||
# we have found the main source tree that
|
|
||||||
# a given target uses; no need to continue
|
|
||||||
|
|
||||||
break
|
|
||||||
else
|
|
||||||
_tcfg="${_tcfg%/*/target.cfg}/$tree/target.cfg"
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
_tcfg="${_tcfg%/*/target.cfg}/$tree/target.cfg" # try next
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ "$XBMK_RELEASE" = "y" ] && [ "$release" = "n" ]; then
|
[ "$XBMK_RELEASE" = "y" ] && [ "$release" = "n" ] && \
|
||||||
return 1
|
return 1
|
||||||
fi
|
[ -n "$buildtype" ] && [ "${mode%config}" != "$mode" ] && \
|
||||||
if [ -n "$buildtype" ] && [ "${mode%config}" != "$mode" ]; then
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$mode" ]; then
|
[ -z "$mode" ] && \
|
||||||
$if_not_dry_build \
|
$if_not_dry_build \
|
||||||
build_dependencies
|
build_dependencies
|
||||||
fi
|
|
||||||
|
|
||||||
mdir="$xbmkpwd/config/submodule/$project"
|
mdir="$xbmkpwd/config/submodule/$project"
|
||||||
if [ -n "$tree" ]; then
|
[ -n "$tree" ] && \
|
||||||
mdir="$mdir/$tree"
|
mdir="$mdir/$tree"
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -f "CHANGELOG" ]; then
|
if [ ! -f "CHANGELOG" ]; then
|
||||||
delete_old_project_files
|
delete_old_project_files
|
||||||
@@ -373,18 +287,15 @@ build_dependencies()
|
|||||||
bd_project="${bd%%/*}"
|
bd_project="${bd%%/*}"
|
||||||
bd_tree="${bd##*/}"
|
bd_tree="${bd##*/}"
|
||||||
|
|
||||||
if [ -z "$bd_project" ]; then
|
[ -z "$bd_project" ] && \
|
||||||
$if_not_dry_build \
|
$if_not_dry_build \
|
||||||
err "$project/$tree: !bd '$bd'" \
|
err "$project/$tree: !bd '$bd'" \
|
||||||
"build_dependencies" "$@"
|
"build_dependencies" "$@"
|
||||||
fi
|
[ "${bd##*/}" = "$bd" ] && \
|
||||||
if [ "${bd##*/}" = "$bd" ]; then
|
|
||||||
bd_tree=""
|
bd_tree=""
|
||||||
fi
|
[ -n "$bd_project" ] && \
|
||||||
if [ -n "$bd_project" ]; then
|
|
||||||
$if_not_dry_build \
|
$if_not_dry_build \
|
||||||
x_ ./mk -b $bd_project $bd_tree; :
|
x_ ./mk -b $bd_project $bd_tree; :
|
||||||
fi
|
|
||||||
done; :
|
done; :
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -425,8 +336,7 @@ delete_old_project_files()
|
|||||||
|
|
||||||
project_up_to_date()
|
project_up_to_date()
|
||||||
{
|
{
|
||||||
old_hash=""
|
eval "`newvar hash old_hash`"
|
||||||
hash=""
|
|
||||||
|
|
||||||
hashdir="$1"
|
hashdir="$1"
|
||||||
hashname="$2"
|
hashname="$2"
|
||||||
@@ -470,18 +380,14 @@ check_cross_compiler()
|
|||||||
{
|
{
|
||||||
cbdir="src/coreboot/$tree"
|
cbdir="src/coreboot/$tree"
|
||||||
|
|
||||||
if [ "$project" != "coreboot" ]; then
|
[ "$project" != "coreboot" ] && \
|
||||||
cbdir="src/coreboot/default"
|
cbdir="src/coreboot/default"
|
||||||
fi
|
[ -n "$xgcctree" ] && \
|
||||||
if [ -n "$xgcctree" ]; then
|
|
||||||
cbdir="src/coreboot/$xgcctree"
|
cbdir="src/coreboot/$xgcctree"
|
||||||
fi
|
|
||||||
|
|
||||||
xfix="${1%-*}"
|
xfix="${1%-*}"
|
||||||
|
[ "$xfix" = "x86_64" ] && \
|
||||||
if [ "$xfix" = "x86_64" ]; then
|
|
||||||
xfix="x64"
|
xfix="x64"
|
||||||
fi
|
|
||||||
|
|
||||||
xgccfile="elf/coreboot/$tree/xgcc_${xfix}_was_compiled"
|
xgccfile="elf/coreboot/$tree/xgcc_${xfix}_was_compiled"
|
||||||
xgccargs="crossgcc-$xfix UPDATED_SUBMODULES=1 CPUS=$XBMK_THREADS"
|
xgccargs="crossgcc-$xfix UPDATED_SUBMODULES=1 CPUS=$XBMK_THREADS"
|
||||||
@@ -489,27 +395,22 @@ check_cross_compiler()
|
|||||||
x_ ./mk -f coreboot "${cbdir#src/coreboot/}"
|
x_ ./mk -f coreboot "${cbdir#src/coreboot/}"
|
||||||
x_ xbmkdir "elf/coreboot/$tree" # TODO: is this needed?
|
x_ xbmkdir "elf/coreboot/$tree" # TODO: is this needed?
|
||||||
|
|
||||||
|
# tell build systems what cross-compiler to use
|
||||||
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% *}-" # used by e.g. u-boot
|
||||||
|
|
||||||
if [ -n "$xlang" ]; then
|
# coreboot-specific (we disable gnat on some trees)
|
||||||
|
[ -n "$xlang" ] && \
|
||||||
export BUILD_LANGUAGES="$xlang"
|
export BUILD_LANGUAGES="$xlang"
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -f "$xgccfile" ]; then
|
[ -f "$xgccfile" ] && \
|
||||||
# skip the build, because a build already exists:
|
return 0 # build exists already, so skip building
|
||||||
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
check_gnu_path gcc gnat || x_ check_gnu_path gnat gcc
|
check_gnu_path gcc gnat || x_ check_gnu_path gnat gcc
|
||||||
make -C "$cbdir" $xgccargs || x_ make -C "$cbdir" $xgccargs
|
make -C "$cbdir" $xgccargs || x_ make -C "$cbdir" $xgccargs
|
||||||
|
|
||||||
# this tells subsequent runs that the build was already done:
|
x_ touch "$xgccfile" # prevent unnecessary re-build operations
|
||||||
x_ touch "$xgccfile"
|
remkdir "$xbtmp/gnupath" # reset hostcc
|
||||||
|
|
||||||
# reset hostcc in PATH:
|
|
||||||
remkdir "$xbtmp/gnupath"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# fix mismatching gcc/gnat versions on debian trixie/sid. as of december 2024,
|
# fix mismatching gcc/gnat versions on debian trixie/sid. as of december 2024,
|
||||||
@@ -523,12 +424,7 @@ check_gnu_path()
|
|||||||
err "Host '$1' unavailable" "check_gnu_path" "$@"
|
err "Host '$1' unavailable" "check_gnu_path" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
gccdir=""
|
eval "`newvar gccdir gccfull gccver gnatdir gnatfull gnatver`"
|
||||||
gccfull=""
|
|
||||||
gccver=""
|
|
||||||
gnatdir=""
|
|
||||||
gnatfull=""
|
|
||||||
gnatver=""
|
|
||||||
|
|
||||||
if host_gcc_gnat_match "$@"; then
|
if host_gcc_gnat_match "$@"; then
|
||||||
return 0
|
return 0
|
||||||
@@ -548,11 +444,8 @@ host_gcc_gnat_match()
|
|||||||
|
|
||||||
eval "[ -z \"\$$1ver\" ] && err \"Cannot detect host '$1' version\""
|
eval "[ -z \"\$$1ver\" ] && err \"Cannot detect host '$1' version\""
|
||||||
|
|
||||||
if [ "$gnatfull" != "$gccfull" ]; then
|
[ "$gnatfull" != "$gccfull" ] && \
|
||||||
# non-matching gcc/gnat versions
|
return 1; : # mismatched gcc/gnat versions
|
||||||
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# find all gcc/gnat versions, matching them up in PATH:
|
# find all gcc/gnat versions, matching them up in PATH:
|
||||||
@@ -563,8 +456,7 @@ match_gcc_gnat_versions()
|
|||||||
eval "_gnudir=\"\$$1dir\""
|
eval "_gnudir=\"\$$1dir\""
|
||||||
eval "_gnuver=\"\$$1ver\""
|
eval "_gnuver=\"\$$1ver\""
|
||||||
|
|
||||||
for _bin in "$_gnudir/$2-"*
|
for _bin in "$_gnudir/$2-"*; do
|
||||||
do
|
|
||||||
if [ "${_bin#"$_gnudir/$2-"}" = "$_gnuver" ] && [ -x "$_bin" ]
|
if [ "${_bin#"$_gnudir/$2-"}" = "$_gnuver" ] && [ -x "$_bin" ]
|
||||||
then
|
then
|
||||||
_gnuver="${_bin#"$_gnudir/$2-"}"
|
_gnuver="${_bin#"$_gnudir/$2-"}"
|
||||||
@@ -596,9 +488,8 @@ link_gcc_gnat_versions()
|
|||||||
for _gnubin in "$_gnudir/$2"*"-$_gnuver"
|
for _gnubin in "$_gnudir/$2"*"-$_gnuver"
|
||||||
do
|
do
|
||||||
_gnuutil="${_gnubin##*/}"
|
_gnuutil="${_gnubin##*/}"
|
||||||
if [ -e "$_gnubin" ]; then
|
[ -e "$_gnubin" ] && \
|
||||||
x_ ln -s "$_gnubin" "${_gnuutil%"-$_gnuver"}"
|
x_ ln -s "$_gnubin" "${_gnuutil%"-$_gnuver"}"; :
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -616,10 +507,9 @@ gnu_setver()
|
|||||||
|
|
||||||
check_defconfig()
|
check_defconfig()
|
||||||
{
|
{
|
||||||
if [ ! -f "$defconfig" ]; then
|
[ ! -f "$defconfig" ] && \
|
||||||
$if_not_dry_build \
|
$if_not_dry_build \
|
||||||
err "$project/$target: no config" "check_defconfig" "$@"
|
err "$project/$target: no config" check_defconfig "$@"
|
||||||
fi
|
|
||||||
|
|
||||||
dest_dir="$elfdir/$tree/$target/${defconfig#"$target_dir/config/"}"
|
dest_dir="$elfdir/$tree/$target/${defconfig#"$target_dir/config/"}"
|
||||||
|
|
||||||
@@ -627,9 +517,8 @@ check_defconfig()
|
|||||||
|
|
||||||
$if_dry_build \
|
$if_dry_build \
|
||||||
return 0
|
return 0
|
||||||
if ! elfcheck; then
|
elfcheck || \
|
||||||
return 1
|
return 1; :
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
elfcheck()
|
elfcheck()
|
||||||
@@ -646,42 +535,36 @@ handle_makefile()
|
|||||||
x_ make -C "$srcdir" $cleanargs clean
|
x_ make -C "$srcdir" $cleanargs clean
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "$defconfig" ]; then
|
[ -f "$defconfig" ] && \
|
||||||
x_ cp "$defconfig" "$srcdir/.config"
|
x_ cp "$defconfig" "$srcdir/.config"
|
||||||
fi
|
|
||||||
|
|
||||||
run_make_command || \
|
run_make_command || \
|
||||||
err "no makefile!" "handle_makefile" "$@"
|
err "no makefile!" "handle_makefile" "$@"
|
||||||
|
|
||||||
_copy=".config"
|
_copy=".config"
|
||||||
|
|
||||||
if [ "$mode" = "savedefconfig" ]; then
|
[ "$mode" = "savedefconfig" ] && \
|
||||||
_copy="defconfig"
|
_copy="defconfig"
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "${mode%config}" != "$mode" ]; then
|
[ "${mode%config}" != "$mode" ] && \
|
||||||
$if_not_dry_build \
|
$if_not_dry_build \
|
||||||
x_ cp "$srcdir/$_copy" "$defconfig"; :
|
x_ cp "$srcdir/$_copy" "$defconfig"; :
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -e "$srcdir/.git" ] && [ "$project" = "u-boot" ] && \
|
[ -e "$srcdir/.git" ] && [ "$project" = "u-boot" ] && \
|
||||||
[ "$mode" = "distclean" ]; then
|
[ "$mode" = "distclean" ] && \
|
||||||
$if_not_dry_build \
|
$if_not_dry_build \
|
||||||
x_ git -C "$srcdir" $cleanargs clean -fdx; :
|
x_ git -C "$srcdir" $cleanargs clean -fdx; :
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
run_make_command()
|
run_make_command()
|
||||||
{
|
{
|
||||||
if [ -z "$mode" ]; then
|
[ -z "$mode" ] && \
|
||||||
x_ $premake
|
x_ $premake
|
||||||
fi
|
|
||||||
|
|
||||||
if $if_not_dry_build check_cmake "$srcdir"; then
|
if $if_not_dry_build check_cmake "$srcdir"; then
|
||||||
if [ -z "$mode" ]; then
|
[ -z "$mode" ] && \
|
||||||
$if_not_dry_build \
|
$if_not_dry_build \
|
||||||
check_autoconf "$srcdir"
|
check_autoconf "$srcdir"; :
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
if ! $if_not_dry_build check_makefile "$srcdir"; then
|
if ! $if_not_dry_build check_makefile "$srcdir"; then
|
||||||
return 1
|
return 1
|
||||||
@@ -690,9 +573,8 @@ run_make_command()
|
|||||||
$if_not_dry_build \
|
$if_not_dry_build \
|
||||||
x_ make -C "$srcdir" $mode -j$XBMK_THREADS $makeargs
|
x_ make -C "$srcdir" $mode -j$XBMK_THREADS $makeargs
|
||||||
|
|
||||||
if [ -z "$mode" ]; then
|
[ -z "$mode" ] && \
|
||||||
x_ $mkhelper
|
x_ $mkhelper
|
||||||
fi
|
|
||||||
|
|
||||||
if ! check_makefile "$srcdir"; then
|
if ! check_makefile "$srcdir"; then
|
||||||
return 0
|
return 0
|
||||||
@@ -724,42 +606,34 @@ check_cmake()
|
|||||||
check_autoconf()
|
check_autoconf()
|
||||||
{
|
{
|
||||||
(
|
(
|
||||||
x_ cd "$1"
|
x_ cd "$1"
|
||||||
|
|
||||||
if [ -f "bootstrap" ]; then
|
[ -f "bootstrap" ] && \
|
||||||
x_ ./bootstrap $bootstrapargs
|
x_ ./bootstrap $bootstrapargs
|
||||||
fi
|
[ -f "autogen.sh" ] && \
|
||||||
if [ -f "autogen.sh" ]; then
|
x_ ./autogen.sh $autogenargs
|
||||||
x_ ./autogen.sh $autogenargs
|
[ -f "configure" ] && \
|
||||||
fi
|
x_ ./configure $autoconfargs; :
|
||||||
if [ -f "configure" ]; then
|
|
||||||
x_ ./configure $autoconfargs; :
|
|
||||||
fi
|
|
||||||
|
|
||||||
) || err "can't bootstrap project: $1" "check_autoconf" "$@"; :
|
) || err "can't bootstrap project: $1" "check_autoconf" "$@"; :
|
||||||
}
|
}
|
||||||
|
|
||||||
check_makefile()
|
check_makefile()
|
||||||
{
|
{
|
||||||
if [ ! -f "$1/Makefile" ] && [ ! -f "$1/makefile" ] && \
|
[ ! -f "$1/Makefile" ] && [ ! -f "$1/makefile" ] && \
|
||||||
[ ! -f "$1/GNUmakefile" ]; then
|
[ ! -f "$1/GNUmakefile" ] && \
|
||||||
|
return 1; :
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
copy_elf()
|
copy_elf()
|
||||||
{
|
{
|
||||||
if [ -f "$listfile" ]; then
|
[ -f "$listfile" ] && \
|
||||||
x_ xbmkdir "$dest_dir"
|
x_ xbmkdir "$dest_dir"
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -f "$listfile" ]; then
|
if [ -f "$listfile" ]; then
|
||||||
while read -r f
|
while read -r f; do
|
||||||
do
|
[ -f "$srcdir/$f" ] && \
|
||||||
if [ -f "$srcdir/$f" ]; then
|
x_ cp "$srcdir/$f" "$dest_dir"; :
|
||||||
x_ cp "$srcdir/$f" "$dest_dir"
|
|
||||||
fi
|
|
||||||
|
|
||||||
done < "$listfile" || err \
|
done < "$listfile" || err \
|
||||||
"cannot read '$listfile'" "copy_elf" "$@"; :
|
"cannot read '$listfile'" "copy_elf" "$@"; :
|
||||||
|
|||||||
+75
-185
@@ -36,73 +36,23 @@ checkvarsxbmk="CONFIG_ME_BIN_PATH CONFIG_SMSC_SCH5545_EC_FW_FILE \
|
|||||||
CONFIG_FSP_FD_PATH CONFIG_IFD_BIN_PATH CONFIG_MRC_FILE CONFIG_FSP_M_CBFS"
|
CONFIG_FSP_FD_PATH CONFIG_IFD_BIN_PATH CONFIG_MRC_FILE CONFIG_FSP_M_CBFS"
|
||||||
|
|
||||||
# lbmk-specific extensions; general variables
|
# lbmk-specific extensions; general variables
|
||||||
cbdir=""
|
eval "`newvar cbdir cbfstoolref has_hashes hashfile kbc1126_ec_dump mecleaner \
|
||||||
cbfstoolref=""
|
mfs nuke rom vcfg xromsize _7ztest _dest _dl _dl_bin _me _metmp _pre_dest`"
|
||||||
has_hashes=""
|
|
||||||
hashfile=""
|
|
||||||
kbc1126_ec_dump=""
|
|
||||||
mecleaner=""
|
|
||||||
mfs=""
|
|
||||||
nuke=""
|
|
||||||
rom=""
|
|
||||||
vcfg=""
|
|
||||||
xromsize=""
|
|
||||||
|
|
||||||
_7ztest=""
|
# lbmk-specific extensions; declared by pkg.cfg files in config/vendor/
|
||||||
_dest=""
|
eval "`newvar DL_hash DL_url DL_url_bkup E6400_VGA_bin_hash E6400_VGA_DL_hash \
|
||||||
_dl=""
|
E6400_VGA_DL_url E6400_VGA_DL_url_bkup E6400_VGA_offset E6400_VGA_romname \
|
||||||
_dl_bin=""
|
EC_FW1_hash EC_FW2_hash EC_hash EC_url EC_url_bkup FSPFD_hash \
|
||||||
_me=""
|
FSPM_bin_hash FSPS_bin_hash ME11bootguard ME11delta ME11pch ME11sku \
|
||||||
_metmp=""
|
ME11version ME_bin_hash MEcheck MEclean MEshrink MRC_bin_hash \
|
||||||
_pre_dest=""
|
MRC_refcode_cbtree MRC_refcode_gbe REF_bin_hash SCH5545EC_bin_hash \
|
||||||
|
SCH5545EC_DL_hash SCH5545EC_DL_url SCH5545EC_DL_url_bkup TBFW_bin_hash \
|
||||||
# lbmk-specific extensions; declared in pkg.cfg files in config/vendor/
|
TBFW_hash TBFW_size TBFW_url TBFW_url_bkup XBMKmecleaner`"
|
||||||
DL_hash=""
|
|
||||||
DL_url=""
|
|
||||||
DL_url_bkup=""
|
|
||||||
E6400_VGA_bin_hash=""
|
|
||||||
E6400_VGA_DL_hash=""
|
|
||||||
E6400_VGA_DL_url=""
|
|
||||||
E6400_VGA_DL_url_bkup=""
|
|
||||||
E6400_VGA_offset=""
|
|
||||||
E6400_VGA_romname=""
|
|
||||||
EC_FW1_hash=""
|
|
||||||
EC_FW2_hash=""
|
|
||||||
EC_hash=""
|
|
||||||
EC_url=""
|
|
||||||
EC_url_bkup=""
|
|
||||||
FSPFD_hash=""
|
|
||||||
FSPM_bin_hash=""
|
|
||||||
FSPS_bin_hash=""
|
|
||||||
ME11bootguard=""
|
|
||||||
ME11delta=""
|
|
||||||
ME11pch=""
|
|
||||||
ME11sku=""
|
|
||||||
ME11version=""
|
|
||||||
ME_bin_hash=""
|
|
||||||
MEcheck=""
|
|
||||||
MEclean=""
|
|
||||||
MEshrink=""
|
|
||||||
MRC_bin_hash=""
|
|
||||||
MRC_refcode_cbtree=""
|
|
||||||
MRC_refcode_gbe=""
|
|
||||||
REF_bin_hash=""
|
|
||||||
SCH5545EC_bin_hash=""
|
|
||||||
SCH5545EC_DL_hash=""
|
|
||||||
SCH5545EC_DL_url=""
|
|
||||||
SCH5545EC_DL_url_bkup=""
|
|
||||||
TBFW_bin_hash=""
|
|
||||||
TBFW_hash=""
|
|
||||||
TBFW_size=""
|
|
||||||
TBFW_url=""
|
|
||||||
TBFW_url_bkup=""
|
|
||||||
XBMKmecleaner=""
|
|
||||||
|
|
||||||
download()
|
download()
|
||||||
{
|
{
|
||||||
if [ $# -lt 1 ]; then
|
[ $# -lt 1 ] && \
|
||||||
err "No argument given" "download" "$@"
|
err "No argument given" "download" "$@"
|
||||||
fi
|
|
||||||
|
|
||||||
export PATH="$PATH:/sbin"
|
export PATH="$PATH:/sbin"
|
||||||
board="$1"
|
board="$1"
|
||||||
@@ -114,48 +64,38 @@ download()
|
|||||||
|
|
||||||
getfiles()
|
getfiles()
|
||||||
{
|
{
|
||||||
if [ -n "$CONFIG_HAVE_ME_BIN" ];then
|
[ -n "$CONFIG_HAVE_ME_BIN" ] && \
|
||||||
fetch intel_me "$DL_url" "$DL_url_bkup" "$DL_hash" \
|
fetch intel_me "$DL_url" "$DL_url_bkup" "$DL_hash" \
|
||||||
"$CONFIG_ME_BIN_PATH" curl "$ME_bin_hash"
|
"$CONFIG_ME_BIN_PATH" curl "$ME_bin_hash"
|
||||||
fi
|
[ -n "$CONFIG_INCLUDE_SMSC_SCH5545_EC_FW" ] && \
|
||||||
if [ -n "$CONFIG_INCLUDE_SMSC_SCH5545_EC_FW" ]; then
|
|
||||||
fetch sch5545ec "$SCH5545EC_DL_url" "$SCH5545EC_DL_url_bkup" \
|
fetch sch5545ec "$SCH5545EC_DL_url" "$SCH5545EC_DL_url_bkup" \
|
||||||
"$SCH5545EC_DL_hash" "$CONFIG_SMSC_SCH5545_EC_FW_FILE" \
|
"$SCH5545EC_DL_hash" "$CONFIG_SMSC_SCH5545_EC_FW_FILE" \
|
||||||
"curl" "$SCH5545EC_bin_hash"
|
"curl" "$SCH5545EC_bin_hash"
|
||||||
fi
|
[ -n "$CONFIG_KBC1126_FW1" ] && \
|
||||||
if [ -n "$CONFIG_KBC1126_FW1" ]; then
|
|
||||||
fetch kbc1126ec "$EC_url" "$EC_url_bkup" "$EC_hash" \
|
fetch kbc1126ec "$EC_url" "$EC_url_bkup" "$EC_hash" \
|
||||||
"$CONFIG_KBC1126_FW1" curl "$EC_FW1_hash"
|
"$CONFIG_KBC1126_FW1" curl "$EC_FW1_hash"
|
||||||
fi
|
[ -n "$CONFIG_KBC1126_FW2" ] && \
|
||||||
if [ -n "$CONFIG_KBC1126_FW2" ]; then
|
|
||||||
fetch kbc1126ec "$EC_url" "$EC_url_bkup" "$EC_hash" \
|
fetch kbc1126ec "$EC_url" "$EC_url_bkup" "$EC_hash" \
|
||||||
"$CONFIG_KBC1126_FW2" curl "$EC_FW2_hash"
|
"$CONFIG_KBC1126_FW2" curl "$EC_FW2_hash"
|
||||||
fi
|
[ -n "$CONFIG_VGA_BIOS_FILE" ] && \
|
||||||
if [ -n "$CONFIG_VGA_BIOS_FILE" ]; then
|
|
||||||
fetch e6400vga "$E6400_VGA_DL_url" "$E6400_VGA_DL_url_bkup" \
|
fetch e6400vga "$E6400_VGA_DL_url" "$E6400_VGA_DL_url_bkup" \
|
||||||
"$E6400_VGA_DL_hash" "$CONFIG_VGA_BIOS_FILE" "curl" \
|
"$E6400_VGA_DL_hash" "$CONFIG_VGA_BIOS_FILE" "curl" \
|
||||||
"$E6400_VGA_bin_hash"
|
"$E6400_VGA_bin_hash"
|
||||||
fi
|
[ -n "$CONFIG_HAVE_MRC" ] && \
|
||||||
if [ -n "$CONFIG_HAVE_MRC" ]; then
|
|
||||||
fetch "mrc" "$MRC_url" "$MRC_url_bkup" "$MRC_hash" \
|
fetch "mrc" "$MRC_url" "$MRC_url_bkup" "$MRC_hash" \
|
||||||
"$CONFIG_MRC_FILE" "curl" "$MRC_bin_hash"
|
"$CONFIG_MRC_FILE" "curl" "$MRC_bin_hash"
|
||||||
fi
|
[ -n "$CONFIG_REFCODE_BLOB_FILE" ] && \
|
||||||
if [ -n "$CONFIG_REFCODE_BLOB_FILE" ]; then
|
|
||||||
fetch "refcode" "$MRC_url" "$MRC_url_bkup" "$MRC_hash" \
|
fetch "refcode" "$MRC_url" "$MRC_url_bkup" "$MRC_hash" \
|
||||||
"$CONFIG_REFCODE_BLOB_FILE" "curl" "$REF_bin_hash"
|
"$CONFIG_REFCODE_BLOB_FILE" "curl" "$REF_bin_hash"
|
||||||
fi
|
[ -n "$CONFIG_LENOVO_TBFW_BIN" ] && \
|
||||||
if [ -n "$CONFIG_LENOVO_TBFW_BIN" ]; then
|
|
||||||
fetch "tbfw" "$TBFW_url" "$TBFW_url_bkup" "$TBFW_hash" \
|
fetch "tbfw" "$TBFW_url" "$TBFW_url_bkup" "$TBFW_hash" \
|
||||||
"$CONFIG_LENOVO_TBFW_BIN" "curl" "$TBFW_bin_hash"
|
"$CONFIG_LENOVO_TBFW_BIN" "curl" "$TBFW_bin_hash"
|
||||||
fi
|
[ -n "$CONFIG_FSP_M_FILE" ] && \
|
||||||
if [ -n "$CONFIG_FSP_M_FILE" ]; then
|
|
||||||
fetch "fsp" "$CONFIG_FSP_FD_PATH" "$CONFIG_FSP_FD_PATH" \
|
fetch "fsp" "$CONFIG_FSP_FD_PATH" "$CONFIG_FSP_FD_PATH" \
|
||||||
"$FSPFD_hash" "$CONFIG_FSP_M_FILE" "copy" "$FSPM_bin_hash"
|
"$FSPFD_hash" "$CONFIG_FSP_M_FILE" "copy" "$FSPM_bin_hash"
|
||||||
fi
|
[ -n "$CONFIG_FSP_S_FILE" ] && \
|
||||||
if [ -n "$CONFIG_FSP_S_FILE" ]; then
|
|
||||||
fetch "fsp" "$CONFIG_FSP_FD_PATH" "$CONFIG_FSP_FD_PATH" \
|
fetch "fsp" "$CONFIG_FSP_FD_PATH" "$CONFIG_FSP_FD_PATH" \
|
||||||
"$FSPFD_hash" "$CONFIG_FSP_S_FILE" "copy" "$FSPS_bin_hash"
|
"$FSPFD_hash" "$CONFIG_FSP_S_FILE" copy "$FSPS_bin_hash"; :
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fetch()
|
fetch()
|
||||||
@@ -169,16 +109,14 @@ fetch()
|
|||||||
dlop="$6"
|
dlop="$6"
|
||||||
binsum="$7"
|
binsum="$7"
|
||||||
|
|
||||||
if [ -z "$binsum" ]; then
|
[ -z "$binsum" ] && \
|
||||||
err "binsum is empty (no checksum)" "fetch" "$@"
|
err "binsum is empty (no checksum)" "fetch" "$@"
|
||||||
fi
|
|
||||||
|
|
||||||
_dl="$XBMK_CACHE/file/$dlsum" # internet file to extract from e.g. .exe
|
_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
|
_dl_bin="$XBMK_CACHE/file/$binsum" # extracted file e.g. me.bin
|
||||||
|
|
||||||
if [ "$5" = "/dev/null" ]; then
|
[ "$5" = "/dev/null" ] && \
|
||||||
return 0
|
return 0
|
||||||
fi
|
|
||||||
|
|
||||||
# an extracted vendor file will be placed in pre_dest first, for
|
# an extracted vendor file will be placed in pre_dest first, for
|
||||||
# verifying its checksum. if it matches, it is later moved to _dest
|
# verifying its checksum. if it matches, it is later moved to _dest
|
||||||
@@ -190,22 +128,18 @@ fetch()
|
|||||||
dl="${dl##*../}"
|
dl="${dl##*../}"
|
||||||
_cdp="$dl"
|
_cdp="$dl"
|
||||||
|
|
||||||
if [ ! -f "$_cdp" ]; then
|
[ ! -f "$_cdp" ] && \
|
||||||
_cdp="$cbdir/$_cdp"
|
_cdp="$cbdir/$_cdp"
|
||||||
fi
|
[ -f "$_cdp" ] && \
|
||||||
if [ -f "$_cdp" ]; then
|
|
||||||
dl="$_cdp"
|
dl="$_cdp"
|
||||||
fi
|
|
||||||
|
|
||||||
dl_bkup="${dl_bkup##*../}"
|
dl_bkup="${dl_bkup##*../}"
|
||||||
_cdp="$dl_bkup"
|
_cdp="$dl_bkup"
|
||||||
|
|
||||||
if [ ! -f "$_cdp" ]; then
|
[ ! -f "$_cdp" ] && \
|
||||||
_cdp="$cbdir/$_cdp"
|
_cdp="$cbdir/$_cdp"
|
||||||
fi
|
[ -f "$_cdp" ] && \
|
||||||
if [ -f "$_cdp" ]; then
|
|
||||||
dl_bkup="$_cdp"; :
|
dl_bkup="$_cdp"; :
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# download the file (from the internet) to extract from:
|
# download the file (from the internet) to extract from:
|
||||||
@@ -216,9 +150,8 @@ fetch()
|
|||||||
# skip extraction if a cached extracted file exists:
|
# skip extraction if a cached extracted file exists:
|
||||||
|
|
||||||
( xbget copy "$_dl_bin" "$_dl_bin" "$_dest" "$binsum" 2>/dev/null ) || :
|
( xbget copy "$_dl_bin" "$_dl_bin" "$_dest" "$binsum" 2>/dev/null ) || :
|
||||||
if [ -f "$_dest" ]; then
|
[ -f "$_dest" ] && \
|
||||||
return 0
|
return 0
|
||||||
fi
|
|
||||||
|
|
||||||
x_ xbmkdir "${_dest%/*}"
|
x_ xbmkdir "${_dest%/*}"
|
||||||
|
|
||||||
@@ -237,14 +170,12 @@ fetch()
|
|||||||
( fx_ "mkdst $binsum" x_ find "${_pre_dest%/*}" -type f ) || :
|
( fx_ "mkdst $binsum" x_ find "${_pre_dest%/*}" -type f ) || :
|
||||||
|
|
||||||
if ! bad_checksum "$binsum" "$_dest"; then
|
if ! bad_checksum "$binsum" "$_dest"; then
|
||||||
if [ -f "$_dest" ]; then
|
[ -f "$_dest" ] && \
|
||||||
return 0
|
return 0; :
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$binsum" ]; then
|
[ -z "$binsum" ] && \
|
||||||
printf "'%s': checksum undefined\n" "$_dest" 1>&2
|
printf "'%s': checksum undefined\n" "$_dest" 1>&2
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -L "$_dest" ]; then
|
if [ -L "$_dest" ]; then
|
||||||
printf "WARNING: '%s' is a link!\n" "$_dest" 1>&2
|
printf "WARNING: '%s' is a link!\n" "$_dest" 1>&2
|
||||||
@@ -282,12 +213,10 @@ extract_intel_me()
|
|||||||
|
|
||||||
# maintain compatibility with older configs
|
# maintain compatibility with older configs
|
||||||
# because in the past, shrink was assumed
|
# because in the past, shrink was assumed
|
||||||
if [ -z "$MEshrink" ]; then
|
[ -z "$MEshrink" ] && \
|
||||||
MEshrink="y"
|
MEshrink="y"
|
||||||
fi
|
[ "$MEshrink" != "y" ] && [ "$MEshrink" != "n" ] && \
|
||||||
if [ "$MEshrink" != "y" ] && [ "$MEshrink" != "n" ]; then
|
|
||||||
err "MEshrink set badly on '$board' vendor config"
|
err "MEshrink set badly on '$board' vendor config"
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$ME11bootguard" = "y" ]; then
|
if [ "$ME11bootguard" = "y" ]; then
|
||||||
if [ -z "$ME11delta" ] || [ -z "$ME11version" ] || \
|
if [ -z "$ME11delta" ] || [ -z "$ME11version" ] || \
|
||||||
@@ -317,13 +246,10 @@ extract_intel_me()
|
|||||||
# must be called inside a subshell.
|
# must be called inside a subshell.
|
||||||
find_me()
|
find_me()
|
||||||
{
|
{
|
||||||
if [ -f "$_metmp" ]; then
|
[ -f "$_metmp" ] && \
|
||||||
# we found me.bin, so we stop searching
|
exit 1 # me.bin found
|
||||||
|
[ -L "$1" ] && \
|
||||||
exit 1
|
return 0 # symlinks disabled for security reasons
|
||||||
elif [ -L "$1" ]; then
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
_7ztest="${_7ztest}a"
|
_7ztest="${_7ztest}a"
|
||||||
|
|
||||||
@@ -332,9 +258,8 @@ find_me()
|
|||||||
_r="-r" # re-locate modules
|
_r="-r" # re-locate modules
|
||||||
_trunc="-t" # -t: truncate the ME size
|
_trunc="-t" # -t: truncate the ME size
|
||||||
|
|
||||||
if [ "$ME11bootguard" = "y" ]; then
|
[ "$ME11bootguard" = "y" ] && \
|
||||||
mfs="--whitelist MFS"
|
mfs="--whitelist MFS"
|
||||||
fi
|
|
||||||
if [ "$MEclean" = "n" ]; then
|
if [ "$MEclean" = "n" ]; then
|
||||||
MEshrink="n"
|
MEshrink="n"
|
||||||
|
|
||||||
@@ -350,40 +275,29 @@ find_me()
|
|||||||
_r="" # don't re-locate ME modules
|
_r="" # don't re-locate ME modules
|
||||||
_trunc="" # don't shrink the me.bin file size
|
_trunc="" # don't shrink the me.bin file size
|
||||||
fi
|
fi
|
||||||
if [ "$MEcheck" = "n" ]; then
|
[ "$MEcheck" = "n" ] && \
|
||||||
_pass="-p" # skip fptr check
|
_pass="-p" # skip fptr check
|
||||||
fi
|
[ -n "$mfs" ] && \
|
||||||
if [ -n "$mfs" ]; then
|
|
||||||
_r="" # cannot re-locate modules if using --whitelist MFS
|
_r="" # cannot re-locate modules if using --whitelist MFS
|
||||||
fi
|
|
||||||
|
|
||||||
if "$mecleaner" $mfs $_r $_keep $_pass $_trunc -O "$xbtmp/a" \
|
if "$mecleaner" $mfs $_r $_keep $_pass $_trunc -O "$xbtmp/a" \
|
||||||
-M "$_metmp" "$1" || [ -f "$_metmp" ]; then
|
-M "$_metmp" "$1" || [ -f "$_metmp" ]; then
|
||||||
# me.bin extracted from a full image with ifd, then shrunk
|
: # me.bin extracted from a full image with ifd, then shrunk
|
||||||
:
|
|
||||||
elif "$mecleaner" $mfs $_r $_pass $_keep $_trunc -O "$_metmp" "$1" || \
|
elif "$mecleaner" $mfs $_r $_pass $_keep $_trunc -O "$_metmp" "$1" || \
|
||||||
[ -f "$_metmp" ]; then
|
[ -f "$_metmp" ]; then
|
||||||
# me.bin image already present, and we shrunk it
|
: # me.bin image already present, and we shrunk it
|
||||||
:
|
|
||||||
elif "$me7updateparser" $_keep -O "$_metmp" "$1"; then
|
elif "$me7updateparser" $_keep -O "$_metmp" "$1"; then
|
||||||
# thinkpad sandybridge me.bin image e.g. x220/t420
|
: # thinkpad sandybridge me.bin image e.g. x220/t420
|
||||||
:
|
|
||||||
elif extract_archive "$1" "$_7ztest"; then
|
elif extract_archive "$1" "$_7ztest"; then
|
||||||
# scan newly extracted archive within extracted archive
|
: # scan newly extracted archive within extracted archive
|
||||||
:
|
|
||||||
else
|
else
|
||||||
# could not extract anything, so we'll try the next file
|
return 0 # can't extract, so try the next file
|
||||||
return 0
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "$_metmp" ]; then
|
[ -f "$_metmp" ] && \
|
||||||
# we found me.bin, so we stop searching
|
exit 1 # me.bin found
|
||||||
|
|
||||||
exit 1
|
( fx_ find_me x_ find "$_7ztest" -type f ) || exit 1; : # 1==me found
|
||||||
else
|
|
||||||
# if the subshell does exit 1, we found me.bin, so exit 1
|
|
||||||
( fx_ find_me x_ find "$_7ztest" -type f ) || exit 1; :
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
apply_deguard_hack()
|
apply_deguard_hack()
|
||||||
@@ -411,9 +325,8 @@ extract_archive()
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -d "${_dl}_extracted" ]; then
|
[ -d "${_dl}_extracted" ] && \
|
||||||
x_ cp -R "${_dl}_extracted" "$2"
|
x_ cp -R "${_dl}_extracted" "$2"; :
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extract_kbc1126ec()
|
extract_kbc1126ec()
|
||||||
@@ -444,9 +357,8 @@ extract_kbc1126ec_dump()
|
|||||||
err "!kbc1126 unar" "extract_kbc1126ec" "$@"
|
err "!kbc1126 unar" "extract_kbc1126ec" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f "ec.bin" ]; then
|
[ ! -f "ec.bin" ] && \
|
||||||
x_ mv Rom.bin ec.bin
|
x_ mv Rom.bin ec.bin
|
||||||
fi
|
|
||||||
|
|
||||||
if x_ e ec.bin f; then
|
if x_ e ec.bin f; then
|
||||||
x_ "$kbc1126_ec_dump" ec.bin
|
x_ "$kbc1126_ec_dump" ec.bin
|
||||||
@@ -491,9 +403,8 @@ extract_sch5545ec()
|
|||||||
# https://pcsupport.lenovo.com/us/en/products/laptops-and-netbooks/thinkpad-t-series-laptops/thinkpad-t480-type-20l5-20l6/20l5/solutions/ht508988
|
# https://pcsupport.lenovo.com/us/en/products/laptops-and-netbooks/thinkpad-t-series-laptops/thinkpad-t480-type-20l5-20l6/20l5/solutions/ht508988
|
||||||
extract_tbfw()
|
extract_tbfw()
|
||||||
{
|
{
|
||||||
if [ -z "$TBFW_size" ]; then
|
[ -z "$TBFW_size" ] && \
|
||||||
err "$board: TBFW_size unset" "extract_tbfw" "$@"
|
err "$board: TBFW_size unset" "extract_tbfw" "$@"
|
||||||
fi
|
|
||||||
|
|
||||||
fx_ copytb x_ find "$appdir" -type f -name "TBT.bin"
|
fx_ copytb x_ find "$appdir" -type f -name "TBT.bin"
|
||||||
}
|
}
|
||||||
@@ -523,11 +434,10 @@ setvfile()
|
|||||||
|
|
||||||
eval "$vcmd && do_getvfile=\"y\""
|
eval "$vcmd && do_getvfile=\"y\""
|
||||||
|
|
||||||
if [ "$do_getvfile" = "y" ]; then
|
[ "$do_getvfile" = "y" ] && \
|
||||||
if getvfile "$@"; then
|
if getvfile "$@"; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi; :
|
||||||
fi
|
|
||||||
done && return 1; :
|
done && return 1; :
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -576,9 +486,8 @@ bootstrap()
|
|||||||
x_ ./mk -b uefitool
|
x_ ./mk -b uefitool
|
||||||
x_ ./mk -b libarchive # for bsdtar and bsdunzip
|
x_ ./mk -b libarchive # for bsdtar and bsdunzip
|
||||||
|
|
||||||
if [ -d "${kbc1126_ec_dump%/*}" ]; then
|
[ -d "${kbc1126_ec_dump%/*}" ] && \
|
||||||
x_ make -C "$cbdir/util/kbc1126"
|
x_ make -C "$cbdir/util/kbc1126"
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "$MRC_refcode_cbtree" ]; then
|
if [ -n "$MRC_refcode_cbtree" ]; then
|
||||||
cbfstoolref="elf/coreboot/$MRC_refcode_cbtree/cbfstool"
|
cbfstoolref="elf/coreboot/$MRC_refcode_cbtree/cbfstool"
|
||||||
@@ -592,17 +501,15 @@ prep()
|
|||||||
_xromname="${1##*/}"
|
_xromname="${1##*/}"
|
||||||
_xromnew="${_xrom%/*}/${_xromname#"$vfix"}"
|
_xromnew="${_xrom%/*}/${_xromname#"$vfix"}"
|
||||||
|
|
||||||
if [ "$nuke" = "nuke" ]; then
|
[ "$nuke" = "nuke" ] && \
|
||||||
_xromnew="${_xrom%/*}/$vfix${_xrom##*/}"
|
_xromnew="${_xrom%/*}/$vfix${_xrom##*/}"
|
||||||
fi
|
|
||||||
|
|
||||||
if e "$_xrom" f missing; then
|
if e "$_xrom" f missing; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "${_xromname#"$vfix"}" ]; then
|
[ -z "${_xromname#"$vfix"}" ] && \
|
||||||
err "$_xromname / $vfix: name match" "prep" "$@"
|
err "$_xromname / $vfix: name match" "prep" "$@"
|
||||||
fi
|
|
||||||
|
|
||||||
# Remove the prefix and 1-byte pad
|
# Remove the prefix and 1-byte pad
|
||||||
if [ "${_xromname#"$vfix"}" != "$_xromname" ] \
|
if [ "${_xromname#"$vfix"}" != "$_xromname" ] \
|
||||||
@@ -619,10 +526,7 @@ prep()
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if ! add_vfiles "$_xrom"; then
|
if ! add_vfiles "$_xrom"; then
|
||||||
# no need to insert files. we will later
|
return 1 # no need to insert files
|
||||||
# still process MAC addresses as required
|
|
||||||
|
|
||||||
return 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$nuke" = "nuke" ]; then
|
if [ "$nuke" = "nuke" ]; then
|
||||||
@@ -635,9 +539,8 @@ mksha512()
|
|||||||
{
|
{
|
||||||
build_sbase
|
build_sbase
|
||||||
|
|
||||||
if [ "${1%/*}" != "$1" ]; then
|
[ "${1%/*}" != "$1" ] && \
|
||||||
x_ cd "${1%/*}"
|
x_ cd "${1%/*}"
|
||||||
fi
|
|
||||||
|
|
||||||
x_ "$sha512sum" ./"${1##*/}" >> "$2" || \
|
x_ "$sha512sum" ./"${1##*/}" >> "$2" || \
|
||||||
err "!sha512sum \"$1\" > \"$2\"" "mksha512" "$@"
|
err "!sha512sum \"$1\" > \"$2\"" "mksha512" "$@"
|
||||||
@@ -649,47 +552,36 @@ add_vfiles()
|
|||||||
|
|
||||||
if [ "$has_hashes" != "y" ] && [ "$nuke" != "nuke" ]; then
|
if [ "$has_hashes" != "y" ] && [ "$nuke" != "nuke" ]; then
|
||||||
printf "'%s' has no hash file. Skipping.\n" "$archive" 1>&2
|
printf "'%s' has no hash file. Skipping.\n" "$archive" 1>&2
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
elif [ "$has_hashes" = "y" ] && [ "$nuke" = "nuke" ]; then
|
elif [ "$has_hashes" = "y" ] && [ "$nuke" = "nuke" ]; then
|
||||||
printf "'%s' has a hash file. Skipping nuke.\n" "$archive" 1>&2
|
printf "'%s' has a hash file. Skipping nuke.\n" "$archive" 1>&2
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$CONFIG_HAVE_REFCODE_BLOB" ]; then
|
[ -n "$CONFIG_HAVE_REFCODE_BLOB" ] && \
|
||||||
vfile "fallback/refcode" "$CONFIG_REFCODE_BLOB_FILE" "stage"
|
vfile "fallback/refcode" "$CONFIG_REFCODE_BLOB_FILE" "stage"
|
||||||
fi
|
[ "$CONFIG_HAVE_MRC" = "y" ] && \
|
||||||
if [ "$CONFIG_HAVE_MRC" = "y" ]; then
|
|
||||||
vfile "mrc.bin" "$CONFIG_MRC_FILE" "mrc" "0xfffa0000"
|
vfile "mrc.bin" "$CONFIG_MRC_FILE" "mrc" "0xfffa0000"
|
||||||
fi
|
[ "$CONFIG_HAVE_ME_BIN" = "y" ] && \
|
||||||
if [ "$CONFIG_HAVE_ME_BIN" = "y" ]; then
|
|
||||||
vfile IFD "$CONFIG_ME_BIN_PATH" me
|
vfile IFD "$CONFIG_ME_BIN_PATH" me
|
||||||
fi
|
[ -n "$CONFIG_KBC1126_FW1" ] && \
|
||||||
if [ -n "$CONFIG_KBC1126_FW1" ]; then
|
|
||||||
vfile ecfw1.bin "$CONFIG_KBC1126_FW1" raw \
|
vfile ecfw1.bin "$CONFIG_KBC1126_FW1" raw \
|
||||||
"$CONFIG_KBC1126_FW1_OFFSET"
|
"$CONFIG_KBC1126_FW1_OFFSET"
|
||||||
fi
|
[ -n "$CONFIG_KBC1126_FW2" ] && \
|
||||||
if [ -n "$CONFIG_KBC1126_FW2" ]; then
|
|
||||||
vfile ecfw2.bin "$CONFIG_KBC1126_FW2" raw \
|
vfile ecfw2.bin "$CONFIG_KBC1126_FW2" raw \
|
||||||
"$CONFIG_KBC1126_FW2_OFFSET"
|
"$CONFIG_KBC1126_FW2_OFFSET"
|
||||||
fi
|
[ -n "$CONFIG_VGA_BIOS_FILE" ] && [ -n "$CONFIG_VGA_BIOS_ID" ] && \
|
||||||
if [ -n "$CONFIG_VGA_BIOS_FILE" ] && [ -n "$CONFIG_VGA_BIOS_ID" ]; then
|
|
||||||
vfile "pci$CONFIG_VGA_BIOS_ID.rom" "$CONFIG_VGA_BIOS_FILE" \
|
vfile "pci$CONFIG_VGA_BIOS_ID.rom" "$CONFIG_VGA_BIOS_FILE" \
|
||||||
optionrom
|
optionrom
|
||||||
fi
|
[ "$CONFIG_INCLUDE_SMSC_SCH5545_EC_FW" = "y" ] && \
|
||||||
if [ "$CONFIG_INCLUDE_SMSC_SCH5545_EC_FW" = "y" ] && \
|
[ -n "$CONFIG_SMSC_SCH5545_EC_FW_FILE" ] && \
|
||||||
[ -n "$CONFIG_SMSC_SCH5545_EC_FW_FILE" ]; then
|
|
||||||
vfile sch5545_ecfw.bin "$CONFIG_SMSC_SCH5545_EC_FW_FILE" raw
|
vfile sch5545_ecfw.bin "$CONFIG_SMSC_SCH5545_EC_FW_FILE" raw
|
||||||
fi
|
[ -z "$CONFIG_FSP_USE_REPO" ] && [ -z "$CONFIG_FSP_FULL_FD" ] && \
|
||||||
if [ -z "$CONFIG_FSP_USE_REPO" ] && [ -z "$CONFIG_FSP_FULL_FD" ] && \
|
[ -n "$CONFIG_FSP_M_FILE" ] && \
|
||||||
[ -n "$CONFIG_FSP_M_FILE" ]; then
|
|
||||||
vfile "$CONFIG_FSP_M_CBFS" "$CONFIG_FSP_M_FILE" fsp --xip
|
vfile "$CONFIG_FSP_M_CBFS" "$CONFIG_FSP_M_FILE" fsp --xip
|
||||||
fi
|
[ -z "$CONFIG_FSP_USE_REPO" ] && [ -z "$CONFIG_FSP_FULL_FD" ] && \
|
||||||
if [ -z "$CONFIG_FSP_USE_REPO" ] && [ -z "$CONFIG_FSP_FULL_FD" ] && \
|
[ -n "$CONFIG_FSP_S_FILE" ] && \
|
||||||
[ -n "$CONFIG_FSP_S_FILE" ]; then
|
|
||||||
vfile "$CONFIG_FSP_S_CBFS" "$CONFIG_FSP_S_FILE" fsp
|
vfile "$CONFIG_FSP_S_CBFS" "$CONFIG_FSP_S_FILE" fsp
|
||||||
fi
|
|
||||||
|
|
||||||
xchanged="y"
|
xchanged="y"
|
||||||
|
|
||||||
@@ -698,9 +590,8 @@ add_vfiles()
|
|||||||
|
|
||||||
vfile()
|
vfile()
|
||||||
{
|
{
|
||||||
if [ "$2" = "/dev/null" ]; then
|
[ "$2" = "/dev/null" ] && \
|
||||||
return 0
|
return 0
|
||||||
fi
|
|
||||||
|
|
||||||
cbfsname="$1"
|
cbfsname="$1"
|
||||||
_dest="${2##*../}"
|
_dest="${2##*../}"
|
||||||
@@ -714,9 +605,8 @@ vfile()
|
|||||||
err "$rom: offset given but empty (undefined)" "vfile" "$@"
|
err "$rom: offset given but empty (undefined)" "vfile" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$nuke" != "nuke" ]; then
|
[ "$nuke" != "nuke" ] && \
|
||||||
x_ e "$_dest" f
|
x_ e "$_dest" f
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$cbfsname" = "IFD" ]; then
|
if [ "$cbfsname" = "IFD" ]; then
|
||||||
if [ "$nuke" = "nuke" ]; then
|
if [ "$nuke" = "nuke" ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user