mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-09-19 21:20:31 +02:00
Compare commits
5 Commits
123639e3db
...
bb4c038794
| Author | SHA1 | Date | |
|---|---|---|---|
| bb4c038794 | |||
| 786cf8cd9c | |||
| 189b61018f | |||
| e973584123 | |||
| afdf8c7733 |
+2
-10
@@ -32,13 +32,11 @@ mr_edk2tree="chromebook" # tree name in xbmk
|
|||||||
prep_mr_import()
|
prep_mr_import()
|
||||||
{
|
{
|
||||||
if [ -f "$xbmkpwd/CHANGELOG" ]; then
|
if [ -f "$xbmkpwd/CHANGELOG" ]; then
|
||||||
|
|
||||||
err "Project import disabled on releases" "prep_mr_import" "$@"
|
err "Project import disabled on releases" "prep_mr_import" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mr_tmpdir="`mktemp -d || err "can't make mrtmpdir"`" || \
|
mr_tmpdir="`mktemp -d || err "can't make mrtmpdir"`" || \
|
||||||
err "can't make mrtmpdir" "prep_mr_coreboot" "$@"
|
err "can't make mrtmpdir" "prep_mr_coreboot" "$@"
|
||||||
|
|
||||||
x_ remkdir "$mr_tmpdir"
|
x_ remkdir "$mr_tmpdir"
|
||||||
|
|
||||||
x_ prep_mx_edk2conf
|
x_ prep_mx_edk2conf
|
||||||
@@ -66,7 +64,6 @@ prep_mr_projects()
|
|||||||
{
|
{
|
||||||
x_ prep_mr "coreboot" "$mr_cbrepo" "$mr_cbbranch" "$mr_cbrev" \
|
x_ prep_mr "coreboot" "$mr_cbrepo" "$mr_cbbranch" "$mr_cbrev" \
|
||||||
"$mr_cbrevbase" "$mr_cbtree"
|
"$mr_cbrevbase" "$mr_cbtree"
|
||||||
|
|
||||||
x_ prep_mr "edk2" "$mr_edk2repo" "$mr_edk2branch" "$mr_edk2rev" \
|
x_ prep_mr "edk2" "$mr_edk2repo" "$mr_edk2branch" "$mr_edk2rev" \
|
||||||
"$mr_edk2revbase" "$mr_edk2tree"
|
"$mr_edk2revbase" "$mr_edk2tree"
|
||||||
}
|
}
|
||||||
@@ -84,7 +81,6 @@ prep_mr()
|
|||||||
|
|
||||||
x_ prep_mr_clone "$@"
|
x_ prep_mr_clone "$@"
|
||||||
x_ prep_mr_patch "$@"
|
x_ prep_mr_patch "$@"
|
||||||
|
|
||||||
x_ prep_mr_file "config/$1/$6/target.cfg" \
|
x_ prep_mr_file "config/$1/$6/target.cfg" \
|
||||||
"$spdx" \
|
"$spdx" \
|
||||||
"" \
|
"" \
|
||||||
@@ -108,13 +104,10 @@ prep_mr_patch()
|
|||||||
mx_patchdir="config/$1/$6/patches"
|
mx_patchdir="config/$1/$6/patches"
|
||||||
|
|
||||||
x_ remkdir "$mx_patchdir"
|
x_ remkdir "$mx_patchdir"
|
||||||
|
|
||||||
if [ "$4" != "$5" ]; then
|
if [ "$4" != "$5" ]; then
|
||||||
|
|
||||||
x_ git -C "$mr_tmpclone" format-patch $5..$4
|
x_ git -C "$mr_tmpclone" format-patch $5..$4
|
||||||
x_ mv "$mr_tmpclone"/*.patch "$mx_patchdir"
|
x_ mv "$mr_tmpclone"/*.patch "$mx_patchdir"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# if no patches were created, rmdir will succeed
|
# if no patches were created, rmdir will succeed
|
||||||
rmdir "$mx_patchdir" 1>/dev/null 2>/dev/null || :
|
rmdir "$mx_patchdir" 1>/dev/null 2>/dev/null || :
|
||||||
}
|
}
|
||||||
@@ -126,11 +119,10 @@ prep_mr_file()
|
|||||||
|
|
||||||
x_ rm -f "$mr_filename"
|
x_ rm -f "$mr_filename"
|
||||||
|
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]
|
||||||
|
do
|
||||||
printf "%s\n" "$1" >> "$mr_filename" || \
|
printf "%s\n" "$1" >> "$mr_filename" || \
|
||||||
err "Can't write '$1' to '$mr_filename'" prep_mr_file "$@"
|
err "Can't write '$1' to '$mr_filename'" prep_mr_file "$@"
|
||||||
|
|
||||||
shift 1
|
shift 1
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|||||||
+15
-94
@@ -20,7 +20,6 @@ tmpgitcache="$xbtmp/tmpgit"
|
|||||||
fetch_targets()
|
fetch_targets()
|
||||||
{
|
{
|
||||||
if [ -d "src/$project/$tree" ]; then
|
if [ -d "src/$project/$tree" ]; then
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -36,22 +35,16 @@ fetch_project()
|
|||||||
err "Can't read config 'config/git/$project/pkg.cfg'" \
|
err "Can't read config 'config/git/$project/pkg.cfg'" \
|
||||||
"fetch_project" "@"
|
"fetch_project" "@"
|
||||||
|
|
||||||
if [ -z "$url" ] || \
|
if [ -z "$url" ] || [ -z "$bkup_url" ]; then
|
||||||
[ -z "$bkup_url" ]; then
|
|
||||||
|
|
||||||
err "url/bkup_url not both set 'config/git/$project/pkg.cfg'" \
|
err "url/bkup_url not both set 'config/git/$project/pkg.cfg'" \
|
||||||
"fetch_project" "$@"
|
"fetch_project" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$xgcctree" ]; then
|
if [ -n "$xgcctree" ]; then
|
||||||
|
|
||||||
x_ ./mk -f coreboot "$xgcctree"
|
x_ ./mk -f coreboot "$xgcctree"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$depend" ]; then
|
if [ -n "$depend" ]; then
|
||||||
|
|
||||||
for d in $depend ; do
|
for d in $depend ; do
|
||||||
|
|
||||||
x_ ./mk -f $d
|
x_ ./mk -f $d
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
@@ -62,14 +55,12 @@ fetch_project()
|
|||||||
clone_project()
|
clone_project()
|
||||||
{
|
{
|
||||||
if ! singletree "$project"; then
|
if ! singletree "$project"; then
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
loc="src/$project"
|
loc="src/$project"
|
||||||
|
|
||||||
if [ -d "$loc" ]; then
|
if [ -d "$loc" ]; then
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -85,20 +76,15 @@ git_prep()
|
|||||||
_loc="$4" # $1 and $2 are gitrepo and gitrepo_backup
|
_loc="$4" # $1 and $2 are gitrepo and gitrepo_backup
|
||||||
|
|
||||||
if [ -z "$rev" ]; then
|
if [ -z "$rev" ]; then
|
||||||
|
|
||||||
err "$project/$tree: rev not set" "git_prep" "$@"
|
err "$project/$tree: rev not set" "git_prep" "$@"
|
||||||
fi
|
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
|
if [ "$_loc" != "${_loc%/*}" ]; then
|
||||||
|
|
||||||
x_ xbmkdir "${_loc%/*}"
|
x_ xbmkdir "${_loc%/*}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -119,59 +105,41 @@ fetch_submodule()
|
|||||||
if e "$mcfgdir/module.cfg" f missing; then
|
if e "$mcfgdir/module.cfg" f missing; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
. "$mcfgdir/module.cfg" || \
|
. "$mcfgdir/module.cfg" || \
|
||||||
err "Can't read '$mcfgdir/module.cfg'" "fetch_submodules" "$@"
|
err "Can't read '$mcfgdir/module.cfg'" "fetch_submodules" "$@"
|
||||||
|
|
||||||
if [ -n "$subgit" ] || \
|
if [ -n "$subgit" ] || [ -n "$subgit_bkup" ]; then
|
||||||
[ -n "$subgit_bkup" ]; then
|
|
||||||
|
|
||||||
st="$st git"
|
st="$st git"
|
||||||
fi
|
fi
|
||||||
|
if [ -n "$subcurl" ] || [ -n "$subcurl_bkup" ]; then
|
||||||
if [ -n "$subcurl" ] || \
|
|
||||||
[ -n "$subcurl_bkup" ]; then
|
|
||||||
|
|
||||||
st="$st curl"
|
st="$st curl"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
st="${st# }"
|
st="${st# }"
|
||||||
|
|
||||||
if [ "$st" = "git curl" ]; then
|
if [ "$st" = "git curl" ]; then
|
||||||
|
|
||||||
err "$mdir: git+curl defined" "fetch_submodule" "$@"
|
err "$mdir: git+curl defined" "fetch_submodule" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$st" ]; then
|
if [ -z "$st" ]; then
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$st" = "curl" ]; then
|
if [ "$st" = "curl" ]; then
|
||||||
|
|
||||||
if [ -z "$subcurl" ] || [ -z "$subcurl_bkup" ]; then
|
if [ -z "$subcurl" ] || [ -z "$subcurl_bkup" ]; then
|
||||||
err "subcurl/subcurl_bkup not both set" \
|
err "subcurl/subcurl_bkup not both set" \
|
||||||
"fetch_submodule" "$@"
|
"fetch_submodule" "$@"
|
||||||
fi
|
fi
|
||||||
|
elif [ -z "$subgit" ] || [ -z "$subgit_bkup" ]; then
|
||||||
elif [ -z "$subgit" ] || \
|
|
||||||
[ -z "$subgit_bkup" ]; then
|
|
||||||
|
|
||||||
err "subgit/subgit_bkup not both set" "fetch_submodule" "$@"
|
err "subgit/subgit_bkup not both set" "fetch_submodule" "$@"
|
||||||
|
|
||||||
elif [ -z "$subhash" ]; then
|
elif [ -z "$subhash" ]; then
|
||||||
|
|
||||||
err "subhash not set" "fetch_submodule" "$@"
|
err "subhash not set" "fetch_submodule" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$st" = "git" ]; then
|
if [ "$st" = "git" ]; then
|
||||||
|
|
||||||
x_ rm -Rf "$tmpgit/$1"
|
x_ rm -Rf "$tmpgit/$1"
|
||||||
|
|
||||||
xbget "$st" "$subgit" "$subgit_bkup" "$tmpgit/$1" \
|
xbget "$st" "$subgit" "$subgit_bkup" "$tmpgit/$1" \
|
||||||
"$subhash" "$mdir/${1##*/}/patches"
|
"$subhash" "$mdir/${1##*/}/patches"
|
||||||
else
|
else
|
||||||
|
|
||||||
xbget "$st" "$subcurl" "$subcurl_bkup" "$tmpgit/$1" \
|
xbget "$st" "$subcurl" "$subcurl_bkup" "$tmpgit/$1" \
|
||||||
"$subhash" "$mdir/${1##*/}/patches"
|
"$subhash" "$mdir/${1##*/}/patches"
|
||||||
fi
|
fi
|
||||||
@@ -183,41 +151,30 @@ fetch_submodule()
|
|||||||
|
|
||||||
xbget()
|
xbget()
|
||||||
{
|
{
|
||||||
if [ "$1" != "curl" ] && \
|
if [ "$1" != "curl" ] && [ "$1" != "copy" ] && [ "$1" != "git" ]; then
|
||||||
[ "$1" != "copy" ] && \
|
|
||||||
[ "$1" != "git" ]; then
|
|
||||||
|
|
||||||
err "Bad dlop (arg 1)" "xbget" "$@"
|
err "Bad dlop (arg 1)" "xbget" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for url in "$2" "$3"; do
|
for url in "$2" "$3"
|
||||||
|
do
|
||||||
if [ -z "$url" ]; then
|
if [ -z "$url" ]; then
|
||||||
|
|
||||||
err "empty URL given in" "xbget" "$@"
|
err "empty URL given in" "xbget" "$@"
|
||||||
|
|
||||||
elif ! try_fetch "$url" "$@"; then
|
elif ! try_fetch "$url" "$@"; then
|
||||||
|
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
|
||||||
git)
|
git)
|
||||||
|
|
||||||
if [ ! -d "$4" ]; then
|
if [ ! -d "$4" ]; then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
|
|
||||||
if [ ! -f "$4" ]; then
|
if [ ! -f "$4" ]; then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
return 0 # successful download/copy
|
return 0 # successful download/copy
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -227,15 +184,11 @@ xbget()
|
|||||||
try_fetch()
|
try_fetch()
|
||||||
{
|
{
|
||||||
if [ "$2" = "git" ]; then
|
if [ "$2" = "git" ]; then
|
||||||
|
|
||||||
if ! try_fetch_git "$@"; then
|
if ! try_fetch_git "$@"; then
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
|
||||||
if ! try_fetch_file "$@"; then
|
if ! try_fetch_file "$@"; then
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -248,34 +201,27 @@ try_fetch_git()
|
|||||||
# directories becomes cache/mirror/foo.example.com/repo
|
# directories becomes cache/mirror/foo.example.com/repo
|
||||||
|
|
||||||
if [ "$XBMK_CACHE_MIRROR" = "y" ]; then
|
if [ "$XBMK_CACHE_MIRROR" = "y" ]; then
|
||||||
|
|
||||||
cached="mirror"
|
cached="mirror"
|
||||||
else
|
else
|
||||||
|
|
||||||
cached="clone"
|
cached="clone"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cached="$cached/${1#*://}"
|
cached="$cached/${1#*://}"
|
||||||
cached="$XBMK_CACHE/$cached"
|
cached="$XBMK_CACHE/$cached"
|
||||||
|
|
||||||
x_ xbmkdir "${5%/*}" "${cached%/*}"
|
x_ xbmkdir "${5%/*}" "${cached%/*}"
|
||||||
|
|
||||||
if ! try_$2 "$cached" "$@"; then
|
if ! try_$2 "$cached" "$@"; then
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
elif [ ! -d "$cached" ]; then
|
elif [ ! -d "$cached" ]; then
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -d "$5" ]; then
|
if [ ! -d "$5" ]; then
|
||||||
|
|
||||||
tmpclone "$cached" "$5" "$6" "$7" || \
|
tmpclone "$cached" "$5" "$6" "$7" || \
|
||||||
err "Can't clone final repo" "try_fetch" "$@"; :
|
err "Can't clone final repo" "try_fetch" "$@"; :
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -d "$5" ]; then
|
if [ ! -d "$5" ]; then
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -288,14 +234,11 @@ try_fetch_file()
|
|||||||
x_ xbmkdir "${5%/*}" "${cached%/*}"
|
x_ xbmkdir "${5%/*}" "${cached%/*}"
|
||||||
|
|
||||||
if bad_checksum "$6" "$cached" 2>/dev/null; then
|
if bad_checksum "$6" "$cached" 2>/dev/null; then
|
||||||
|
|
||||||
x_ rm -f "$cached"
|
x_ rm -f "$cached"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f "$cached" ]; then
|
if [ ! -f "$cached" ]; then
|
||||||
|
|
||||||
if ! try_$2 "$cached" "$@"; then
|
if ! try_$2 "$cached" "$@"; then
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -307,50 +250,39 @@ try_fetch_file()
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f "$cached" ]; then
|
if [ ! -f "$cached" ]; then
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
elif bad_checksum "$6" "$cached"; then
|
elif bad_checksum "$6" "$cached"; then
|
||||||
|
|
||||||
x_ rm -f "$cached"
|
x_ rm -f "$cached"
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$cached" != "$5" ]; then
|
if [ "$cached" != "$5" ]; then
|
||||||
|
|
||||||
x_ cp "$cached" "$5"
|
x_ cp "$cached" "$5"
|
||||||
fi
|
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
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
try_curl()
|
try_curl()
|
||||||
{
|
{
|
||||||
ua="Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/91.0"
|
_ua=""
|
||||||
|
|
||||||
case "$2" in
|
case "$2" in
|
||||||
|
|
||||||
https://www.supermicro.com/*)
|
https://www.supermicro.com/*)
|
||||||
|
_ua="curl/8.6.0";;
|
||||||
ua="curl/8.6.0"
|
|
||||||
;;
|
|
||||||
|
|
||||||
*)
|
*)
|
||||||
:
|
_ua="Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/91.0";;
|
||||||
;;
|
|
||||||
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
( x_ curl --location --retry 3 -A "$ua" "$2" -o "$1" ) \
|
( x_ curl --location --retry 3 -A "$_ua" "$2" -o "$1" ) \
|
||||||
|| ( x_ wget --tries 3 -U "$ua" "$2" -O "$1" ) \
|
|| ( x_ wget --tries 3 -U "$_ua" "$2" -O "$1" ) \
|
||||||
|| return 1; :
|
|| return 1; :
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -367,13 +299,10 @@ try_git()
|
|||||||
x_ rm -Rf "$tmpgitcache"
|
x_ rm -Rf "$tmpgitcache"
|
||||||
|
|
||||||
if [ ! -d "$gitdest" ]; then
|
if [ ! -d "$gitdest" ]; then
|
||||||
|
|
||||||
if [ "$XBMK_CACHE_MIRROR" = "y" ]; then
|
if [ "$XBMK_CACHE_MIRROR" = "y" ]; then
|
||||||
|
|
||||||
( x_ git clone --mirror "$2" "$tmpgitcache" ) || \
|
( x_ git clone --mirror "$2" "$tmpgitcache" ) || \
|
||||||
return 1
|
return 1
|
||||||
else
|
else
|
||||||
|
|
||||||
( x_ git clone "$2" "$tmpgitcache" ) || return 1
|
( x_ git clone "$2" "$tmpgitcache" ) || return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -383,7 +312,6 @@ try_git()
|
|||||||
|
|
||||||
if git -C "$gitdest" show "$7" 1>/dev/null 2>/dev/null && \
|
if git -C "$gitdest" show "$7" 1>/dev/null 2>/dev/null && \
|
||||||
[ "$forcepull" != "y" ]; then
|
[ "$forcepull" != "y" ]; then
|
||||||
|
|
||||||
# don't try to pull the latest changes if the given target
|
# don't try to pull the latest changes if the given target
|
||||||
# revision already exists locally. this saves a lot of time
|
# revision already exists locally. this saves a lot of time
|
||||||
# during release builds, and reduces the chance that we will
|
# during release builds, and reduces the chance that we will
|
||||||
@@ -393,11 +321,9 @@ try_git()
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$XBMK_CACHE_MIRROR" = "y" ]; then
|
if [ "$XBMK_CACHE_MIRROR" = "y" ]; then
|
||||||
|
|
||||||
( x_ git -C "$gitdest" fetch ) || :; :
|
( x_ git -C "$gitdest" fetch ) || :; :
|
||||||
( x_ git -C "$gitdest" update-server-info ) || :; :
|
( x_ git -C "$gitdest" update-server-info ) || :; :
|
||||||
else
|
else
|
||||||
|
|
||||||
( x_ git -C "$gitdest" pull --all ) || :; :
|
( x_ git -C "$gitdest" pull --all ) || :; :
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -405,22 +331,17 @@ try_git()
|
|||||||
bad_checksum()
|
bad_checksum()
|
||||||
{
|
{
|
||||||
if e "$2" f missing; then
|
if e "$2" f missing; then
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
build_sbase
|
build_sbase
|
||||||
|
|
||||||
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
|
if [ "$csum" = "$1" ]; then
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
else
|
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
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
+20
-129
@@ -47,8 +47,8 @@ xbmk_init()
|
|||||||
sha512sum="$xbmkpwd/util/sbase/sha512sum"
|
sha512sum="$xbmkpwd/util/sbase/sha512sum"
|
||||||
|
|
||||||
if [ $# -gt 0 ] && [ "$1" = "dependencies" ]; then
|
if [ $# -gt 0 ] && [ "$1" = "dependencies" ]; then
|
||||||
|
|
||||||
x_ xbmkpkg "$@"
|
x_ xbmkpkg "$@"
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -56,7 +56,6 @@ xbmk_init()
|
|||||||
err "suid check failed" "xbmk_init" "$@"
|
err "suid check failed" "xbmk_init" "$@"
|
||||||
|
|
||||||
if [ "$(id -u)" = "0" ]; then
|
if [ "$(id -u)" = "0" ]; then
|
||||||
|
|
||||||
err "this command as root is not permitted" "xbmk_init" "$@"
|
err "this command as root is not permitted" "xbmk_init" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -64,14 +63,11 @@ xbmk_init()
|
|||||||
x_ xbmkdir "$basetmp"
|
x_ xbmkdir "$basetmp"
|
||||||
|
|
||||||
if [ ! -e "cache" ]; then
|
if [ ! -e "cache" ]; then
|
||||||
|
|
||||||
x_ xbmkdir "cache"
|
x_ xbmkdir "cache"
|
||||||
fi
|
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
|
||||||
|
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@@ -82,24 +78,19 @@ xbmkpkg()
|
|||||||
xchk xbmkpkg "$@"
|
xchk xbmkpkg "$@"
|
||||||
|
|
||||||
if [ $# -gt 2 ]; then
|
if [ $# -gt 2 ]; then
|
||||||
|
|
||||||
reinstall="$3"
|
reinstall="$3"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
. "config/dependencies/$2" || \
|
. "config/dependencies/$2" || \
|
||||||
err "Can't read 'config/dependencies/$2'" "xbmkpkg" "$@"
|
err "Can't read 'config/dependencies/$2'" "xbmkpkg" "$@"
|
||||||
|
|
||||||
if [ -z "$pkg_add" ] || \
|
if [ -z "$pkg_add" ] || [ -z "$pkglist" ]; then
|
||||||
[ -z "$pkglist" ]; then
|
|
||||||
|
|
||||||
err "pkg_add/pkglist not both set" "xbmkpkg" "$@"
|
err "pkg_add/pkglist not both set" "xbmkpkg" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$2" == "gentoo" ]; then
|
if [ "$2" == "gentoo" ]; then
|
||||||
|
|
||||||
if [ -z "$pkg_use" ] || \
|
if [ -z "$pkg_use" ] || [ -z "$pkg_use_file" ]; then
|
||||||
[ -z "$pkg_use_file" ]; then
|
|
||||||
|
|
||||||
err "pkg_use/pkg_use_file not both set" "xbmkpkg" "$@"
|
err "pkg_use/pkg_use_file not both set" "xbmkpkg" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -107,7 +98,6 @@ xbmkpkg()
|
|||||||
printf "Writing into %s" "$pkg_use_file..."
|
printf "Writing into %s" "$pkg_use_file..."
|
||||||
|
|
||||||
if [ ! -d "`dirname $pkg_use_file`" ]; then
|
if [ ! -d "`dirname $pkg_use_file`" ]; then
|
||||||
|
|
||||||
x_ mkdir -p "`dirname $pkg_use_file`"
|
x_ mkdir -p "`dirname $pkg_use_file`"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -117,7 +107,6 @@ xbmkpkg()
|
|||||||
x_ $pkg_add $pkglist
|
x_ $pkg_add $pkglist
|
||||||
|
|
||||||
if [ -n "$aur_notice" ]; then
|
if [ -n "$aur_notice" ]; then
|
||||||
|
|
||||||
printf "You need AUR packages: %s\n" "$aur_notice" 1>&2
|
printf "You need AUR packages: %s\n" "$aur_notice" 1>&2
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -125,45 +114,31 @@ xbmkpkg()
|
|||||||
xbmk_get_version()
|
xbmk_get_version()
|
||||||
{
|
{
|
||||||
if [ -f ".version" ]; then
|
if [ -f ".version" ]; then
|
||||||
|
|
||||||
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
|
fi
|
||||||
|
|
||||||
if [ -f ".versiondate" ]; then
|
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
|
fi
|
||||||
|
|
||||||
if [ -f ".version" ] && \
|
if [ -f ".version" ] && [ -z "$version" ]; then
|
||||||
[ -z "$version" ]; then
|
|
||||||
|
|
||||||
err "version not set" "xbmk_get_version" "$@"
|
err "version not set" "xbmk_get_version" "$@"
|
||||||
fi
|
fi
|
||||||
|
if [ -f ".versiondate" ] && [ -z "$versiondate" ]; then
|
||||||
if [ -f ".versiondate" ] && \
|
|
||||||
[ -z "$versiondate" ]; then
|
|
||||||
|
|
||||||
err "versiondate not set" "xbmk_get_version" "$@"
|
err "versiondate not set" "xbmk_get_version" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -e ".git" ] && \
|
if [ ! -e ".git" ] && [ ! -f ".version" ]; then
|
||||||
[ ! -f ".version" ]; then
|
|
||||||
|
|
||||||
version="unknown"
|
version="unknown"
|
||||||
fi
|
fi
|
||||||
|
if [ ! -e ".git" ] && [ ! -f ".versiondate" ]; then
|
||||||
if [ ! -e ".git" ] && \
|
|
||||||
[ ! -f ".versiondate" ]; then
|
|
||||||
|
|
||||||
versiondate="1716415872"
|
versiondate="1716415872"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
xbmk_sanitize_version
|
xbmk_sanitize_version
|
||||||
|
|
||||||
if [ -n "$version" ]; then
|
if [ -n "$version" ]; then
|
||||||
|
|
||||||
relname="$projectname-$version"
|
relname="$projectname-$version"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -178,26 +153,19 @@ 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
|
||||||
if [ -n "${TMPDIR+x}" ] && \
|
|
||||||
[ "${TMPDIR%_*}" != "$basetmp/xbmk" ]; then
|
|
||||||
|
|
||||||
unset TMPDIR
|
unset TMPDIR
|
||||||
fi
|
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
|
if [ -n "${TMPDIR+x}" ]; then
|
||||||
|
|
||||||
is_child="y"
|
is_child="y"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$is_child" = "y" ]; then
|
if [ "$is_child" = "y" ]
|
||||||
|
then
|
||||||
# child instance of xbmk, so we stop init after this point
|
# child instance of xbmk, so we stop init after this point
|
||||||
# and execute the given user command upon return:
|
# and execute the given user command upon return:
|
||||||
|
|
||||||
@@ -205,7 +173,6 @@ xbmk_set_env()
|
|||||||
|
|
||||||
return 1
|
return 1
|
||||||
else
|
else
|
||||||
|
|
||||||
# parent instance of xbmk, so we continue initialising.
|
# parent instance of xbmk, so we continue initialising.
|
||||||
# a parent instance of xbmk never processes its own
|
# a parent instance of xbmk never processes its own
|
||||||
# command directly; instead, it calls a child instance
|
# command directly; instead, it calls a child instance
|
||||||
@@ -222,17 +189,12 @@ xbmk_child_set_env()
|
|||||||
xbmk_child_set_tmp
|
xbmk_child_set_tmp
|
||||||
|
|
||||||
if [ -z "${XBMK_CACHE+x}" ]; then
|
if [ -z "${XBMK_CACHE+x}" ]; then
|
||||||
|
|
||||||
err "XBMK_CACHE unset on child" "xbmk_set_env" "$@"
|
err "XBMK_CACHE unset on child" "xbmk_set_env" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "${XBMK_THREADS+x}" ]; then
|
if [ -z "${XBMK_THREADS+x}" ]; then
|
||||||
|
|
||||||
xbmk_set_threads; :
|
xbmk_set_threads; :
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "${XBMK_CACHE_MIRROR+x}" ]; then
|
if [ -z "${XBMK_CACHE_MIRROR+x}" ]; then
|
||||||
|
|
||||||
xbmk_set_mirror
|
xbmk_set_mirror
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -250,7 +212,6 @@ xbmk_child_set_tmp()
|
|||||||
err "can't read '$xbmklock'" "xbmk_child_set_tmp" "$@"
|
err "can't read '$xbmklock'" "xbmk_child_set_tmp" "$@"
|
||||||
|
|
||||||
if [ "$locktmp" != "$xbtmpchk" ]; then
|
if [ "$locktmp" != "$xbtmpchk" ]; then
|
||||||
|
|
||||||
badtmp="TMPDIR '$xbtmpchk' changed; was '$locktmp'"
|
badtmp="TMPDIR '$xbtmpchk' changed; was '$locktmp'"
|
||||||
|
|
||||||
printf "bad TMPDIR init, '%s': %s\n" "$TMPDIR" "$badtmp" 1>&2
|
printf "bad TMPDIR init, '%s': %s\n" "$TMPDIR" "$badtmp" 1>&2
|
||||||
@@ -258,7 +219,6 @@ xbmk_child_set_tmp()
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
xbtmp="$xbtmpchk"
|
xbtmp="$xbtmpchk"
|
||||||
|
|
||||||
export TMPDIR="$xbtmpchk"
|
export TMPDIR="$xbtmpchk"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -276,13 +236,11 @@ xbmk_parent_set_env()
|
|||||||
x_ chmod -w "$xbmklock"
|
x_ chmod -w "$xbmklock"
|
||||||
|
|
||||||
xbmk_parent_set_export
|
xbmk_parent_set_export
|
||||||
|
|
||||||
xbmk_set_version
|
xbmk_set_version
|
||||||
|
|
||||||
remkdir "$xbtmp" "$xbtmp/gnupath" "$xbtmp/xbmkpath"
|
remkdir "$xbtmp" "$xbtmp/gnupath" "$xbtmp/xbmkpath"
|
||||||
|
|
||||||
xbmk_set_pyver
|
xbmk_set_pyver
|
||||||
|
|
||||||
xbmk_set_mirror
|
xbmk_set_mirror
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -297,9 +255,7 @@ xbmk_parent_check_tmp()
|
|||||||
x_ touch "$xbmklist"
|
x_ touch "$xbmklist"
|
||||||
|
|
||||||
for xtmpdir in "$basetmp"/xbmk_*; do
|
for xtmpdir in "$basetmp"/xbmk_*; do
|
||||||
|
|
||||||
if [ -e "$xtmpdir" ]; then
|
if [ -e "$xtmpdir" ]; then
|
||||||
|
|
||||||
printf "%s\n" "$xtmpdir" >> "$xbmklist" || \
|
printf "%s\n" "$xtmpdir" >> "$xbmklist" || \
|
||||||
err "can't write '$xtmpdir' to '$xbmklist'" \
|
err "can't write '$xtmpdir' to '$xbmklist'" \
|
||||||
"xbmk_parent_check_tmp" "$@"; :
|
"xbmk_parent_check_tmp" "$@"; :
|
||||||
@@ -307,19 +263,14 @@ xbmk_parent_check_tmp()
|
|||||||
done
|
done
|
||||||
|
|
||||||
# set up a unified temporary directory, for common deletion later:
|
# set up a unified temporary directory, for common deletion later:
|
||||||
|
|
||||||
export TMPDIR="`x_ mktemp -d -t xbmk_XXXXXXXX`" || \
|
export TMPDIR="`x_ mktemp -d -t xbmk_XXXXXXXX`" || \
|
||||||
err "can't export TMPDIR" "xbmk_parent_check_tmp" "$@"
|
err "can't export TMPDIR" "xbmk_parent_check_tmp" "$@"
|
||||||
|
|
||||||
xbtmp="$TMPDIR"
|
xbtmp="$TMPDIR"
|
||||||
|
|
||||||
while read -r xtmpdir; do
|
while read -r xtmpdir; do
|
||||||
|
|
||||||
if [ "$xtmpdir" = "$xbtmp" ]; then
|
if [ "$xtmpdir" = "$xbtmp" ]; then
|
||||||
|
|
||||||
err "pre-existing '$xbtmp'" "xbmk_parent_check_tmp" "$@"
|
err "pre-existing '$xbtmp'" "xbmk_parent_check_tmp" "$@"
|
||||||
fi
|
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" "$@"
|
||||||
|
|
||||||
@@ -330,9 +281,7 @@ xbmk_parent_set_export()
|
|||||||
{
|
{
|
||||||
export XBMK_CACHE="$xbmkpwd/cache"
|
export XBMK_CACHE="$xbmkpwd/cache"
|
||||||
|
|
||||||
if [ -e "$XBMK_CACHE" ] && \
|
if [ -e "$XBMK_CACHE" ] && [ ! -d "$XBMK_CACHE" ]; then
|
||||||
[ ! -d "$XBMK_CACHE" ]; then
|
|
||||||
|
|
||||||
err "cachedir '$XBMK_CACHE' is a file" \
|
err "cachedir '$XBMK_CACHE' is a file" \
|
||||||
"xbmk_parent_set_export" "$@"
|
"xbmk_parent_set_export" "$@"
|
||||||
fi
|
fi
|
||||||
@@ -344,17 +293,12 @@ xbmk_parent_set_export()
|
|||||||
# (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
|
if [ -z "${XBMK_RELEASE+x}" ]; then
|
||||||
|
|
||||||
export XBMK_RELEASE="n"
|
export XBMK_RELEASE="n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$XBMK_RELEASE" = "Y" ]; then
|
if [ "$XBMK_RELEASE" = "Y" ]; then
|
||||||
|
|
||||||
export XBMK_RELEASE="y"
|
export XBMK_RELEASE="y"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$XBMK_RELEASE" != "y" ]; then
|
if [ "$XBMK_RELEASE" != "y" ]; then
|
||||||
|
|
||||||
export XBMK_RELEASE="n"
|
export XBMK_RELEASE="n"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -362,13 +306,10 @@ xbmk_parent_set_export()
|
|||||||
xbmk_set_threads()
|
xbmk_set_threads()
|
||||||
{
|
{
|
||||||
if [ -z "${XBMK_THREADS+x}" ]; then
|
if [ -z "${XBMK_THREADS+x}" ]; then
|
||||||
|
|
||||||
export XBMK_THREADS=1
|
export XBMK_THREADS=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! 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; then
|
1>/dev/null 2>/dev/null; then
|
||||||
|
|
||||||
export XBMK_THREADS=1
|
export XBMK_THREADS=1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -376,74 +317,54 @@ xbmk_set_threads()
|
|||||||
xbmk_set_version()
|
xbmk_set_version()
|
||||||
{
|
{
|
||||||
version_="$version"
|
version_="$version"
|
||||||
|
|
||||||
if [ -e ".git" ]; then
|
if [ -e ".git" ]; then
|
||||||
|
|
||||||
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
|
fi
|
||||||
|
|
||||||
versiondate_="$versiondate"
|
versiondate_="$versiondate"
|
||||||
|
|
||||||
if [ -e ".git" ]; then
|
if [ -e ".git" ]; then
|
||||||
|
|
||||||
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
|
fi
|
||||||
|
|
||||||
if [ -z "$version" ] || \
|
if [ -z "$version" ] || [ -z "$versiondate" ]; then
|
||||||
[ -z "$versiondate" ]; then
|
|
||||||
|
|
||||||
err "version and/or versiondate unset" "xbmk_set_version" "$@"
|
err "version and/or versiondate unset" "xbmk_set_version" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
update_xbmkver "."
|
update_xbmkver "."
|
||||||
|
|
||||||
relname="$projectname-$version"
|
relname="$projectname-$version"
|
||||||
|
|
||||||
export LOCALVERSION="-$projectname-${version%%-*}"
|
export LOCALVERSION="-$projectname-${version%%-*}"
|
||||||
}
|
}
|
||||||
|
|
||||||
xbmk_set_pyver()
|
xbmk_set_pyver()
|
||||||
{
|
{
|
||||||
pyver="2"
|
|
||||||
python="python3"
|
python="python3"
|
||||||
|
pyver="2"
|
||||||
pyv="import sys; print(sys.version_info[:])"
|
pyv="import sys; print(sys.version_info[:])"
|
||||||
|
|
||||||
if ! pybin python3 1>/dev/null; then
|
if ! pybin python3 1>/dev/null; then
|
||||||
|
|
||||||
python="python"
|
python="python"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$python" = "python3" ]; then
|
if [ "$python" = "python3" ]; then
|
||||||
|
|
||||||
pyver="3"
|
pyver="3"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! pybin "$python" 1>/dev/null; then
|
if ! pybin "$python" 1>/dev/null; then
|
||||||
|
|
||||||
pyver=""
|
pyver=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$pyver" ]; then
|
if [ -n "$pyver" ]; then
|
||||||
|
|
||||||
"`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
|
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
|
if [ "${pyver%%.*}" != "3" ]; then
|
||||||
|
|
||||||
err "Bad python version (must by 3.x)" "xbmk_set_pyver" "$@"
|
err "Bad python version (must by 3.x)" "xbmk_set_pyver" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -467,16 +388,11 @@ pybin()
|
|||||||
py="import sys; quit(1) if sys.prefix == sys.base_prefix else quit(0)"
|
py="import sys; quit(1) if sys.prefix == sys.base_prefix else quit(0)"
|
||||||
|
|
||||||
venv=1
|
venv=1
|
||||||
|
|
||||||
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
|
if [ $venv -gt 0 ]; then
|
||||||
|
|
||||||
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
|
fi
|
||||||
@@ -484,14 +400,11 @@ pybin()
|
|||||||
# 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:
|
||||||
|
|
||||||
if [ $venv -gt 0 ] && \
|
if [ $venv -gt 0 ] && [ -L "`command -v "$1" 2>/dev/null`" ]; then
|
||||||
[ -L "`command -v "$1" 2>/dev/null`" ]; then
|
|
||||||
|
|
||||||
pypath="$(findpath \
|
pypath="$(findpath \
|
||||||
"$(command -v "$1" 2>/dev/null)" 2>/dev/null || :)"
|
"$(command -v "$1" 2>/dev/null)" 2>/dev/null || :)"
|
||||||
|
|
||||||
if [ -e "$pypath" ] && \
|
if [ -e "$pypath" ] && [ ! -d "$pypath" ] && \
|
||||||
[ ! -d "$pypath" ] && \
|
|
||||||
[ -x "$pypath" ]; then
|
[ -x "$pypath" ]; then
|
||||||
|
|
||||||
printf "%s\n" "$pypath"
|
printf "%s\n" "$pypath"
|
||||||
@@ -503,22 +416,17 @@ pybin()
|
|||||||
# if python venv: fall back to common PATH directories for checking:
|
# if python venv: fall back to common PATH directories for checking:
|
||||||
|
|
||||||
[ $venv -gt 0 ] && for pypath in "/usr/local/bin" "/usr/bin"; do
|
[ $venv -gt 0 ] && for pypath in "/usr/local/bin" "/usr/bin"; do
|
||||||
|
if [ -e "$pypath/$1" ] && [ ! -d "$pypath/$1" ] && \
|
||||||
if [ -e "$pypath/$1" ] && \
|
|
||||||
! -d "$pypath/$1" ] && \
|
|
||||||
[ -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
|
||||||
|
|
||||||
# Defer to normal command -v if not a venv:
|
# Defer to normal command -v if not a venv
|
||||||
|
|
||||||
if ! command -v "$1" 2>/dev/null; then
|
if ! command -v "$1" 2>/dev/null; then
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -534,12 +442,9 @@ xbmk_set_mirror()
|
|||||||
# 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
|
if [ -z "${XBMK_CACHE_MIRROR+x}" ]; then
|
||||||
|
|
||||||
export XBMK_CACHE_MIRROR="n"
|
export XBMK_CACHE_MIRROR="n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$XBMK_CACHE_MIRROR" != "y" ]; then
|
if [ "$XBMK_CACHE_MIRROR" != "y" ]; then
|
||||||
|
|
||||||
export XBMK_CACHE_MIRROR="n"
|
export XBMK_CACHE_MIRROR="n"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -547,26 +452,19 @@ xbmk_set_mirror()
|
|||||||
xbmk_git_init()
|
xbmk_git_init()
|
||||||
{
|
{
|
||||||
# the git identity check is only needed for: ./mk -b coreboot [args]
|
# the git identity check is only needed for: ./mk -b coreboot [args]
|
||||||
|
|
||||||
[ "${2-}" = "-b" ] && [ "${3-}" = "coreboot" ] && \
|
[ "${2-}" = "-b" ] && [ "${3-}" = "coreboot" ] && \
|
||||||
for gitarg in "user.name" "user.email"; do
|
for gitarg in "user.name" "user.email"; do
|
||||||
|
|
||||||
gitcmd="git config --includes $gitarg"
|
gitcmd="git config --includes $gitarg"
|
||||||
|
|
||||||
if ! $gitcmd 1>/dev/null 2>/dev/null; then
|
if ! $gitcmd 1>/dev/null 2>/dev/null; then
|
||||||
|
|
||||||
err "Run this first: $gitcmd \"your ${gitcmd##*.}\"" \
|
err "Run this first: $gitcmd \"your ${gitcmd##*.}\"" \
|
||||||
"xbmk_git_init" "$@"
|
"xbmk_git_init" "$@"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ -L ".git" ]; then
|
if [ -L ".git" ]; then
|
||||||
|
|
||||||
err "'$xbmkpwd/.git' is a symlink" "xbmk_git_init" "$@"
|
err "'$xbmkpwd/.git' is a symlink" "xbmk_git_init" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -e ".git" ]; then
|
if [ -e ".git" ]; then
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -580,13 +478,10 @@ xbmk_git_init()
|
|||||||
err "can't get date" "xbmk_git_init" "$@"
|
err "can't get date" "xbmk_git_init" "$@"
|
||||||
|
|
||||||
x_ git init 1>/dev/null 2>/dev/null
|
x_ git init 1>/dev/null 2>/dev/null
|
||||||
|
|
||||||
x_ git add -A . 1>/dev/null 2>/dev/null
|
x_ git add -A . 1>/dev/null 2>/dev/null
|
||||||
|
|
||||||
x_ git -c user.name="xbmk" -c user.email="xbmk@example.com" \
|
x_ git -c user.name="xbmk" -c user.email="xbmk@example.com" \
|
||||||
commit -m "$projectname $version" --date "$cdate" \
|
commit -m "$projectname $version" --date "$cdate" \
|
||||||
--author="xbmk <xbmk@example.com>" 1>/dev/null 2>/dev/null
|
--author="xbmk <xbmk@example.com>" 1>/dev/null 2>/dev/null
|
||||||
|
|
||||||
x_ git -c user.name="xbmk" -c user.email="xbmk@example.com" \
|
x_ git -c user.name="xbmk" -c user.email="xbmk@example.com" \
|
||||||
tag -a "$version" -m "$projectname $version" \
|
tag -a "$version" -m "$projectname $version" \
|
||||||
1>/dev/null 2>/dev/null; :
|
1>/dev/null 2>/dev/null; :
|
||||||
@@ -596,14 +491,10 @@ xbmk_child_exec()
|
|||||||
{
|
{
|
||||||
xbmk_rval=0
|
xbmk_rval=0
|
||||||
|
|
||||||
( x_ ./mk "$@" ) \
|
( x_ ./mk "$@" ) || xbmk_rval=1
|
||||||
|| xbmk_rval=1
|
|
||||||
|
|
||||||
( x_ rm -Rf "$xbtmp" ) \
|
( x_ rm -Rf "$xbtmp" ) || xbmk_rval=1
|
||||||
|| xbmk_rval=1
|
( x_ rm -f "$xbmklock" ) || xbmk_rval=1
|
||||||
|
|
||||||
( x_ rm -f "$xbmklock" ) \
|
|
||||||
|| xbmk_rval=1
|
|
||||||
|
|
||||||
exit $xbmk_rval
|
exit $xbmk_rval
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-59
@@ -10,14 +10,10 @@ nvmutil="util/nvmutil/nvmutil"
|
|||||||
ifdtool="elf/coreboot/default/ifdtool"
|
ifdtool="elf/coreboot/default/ifdtool"
|
||||||
|
|
||||||
checkvars="CONFIG_GBE_BIN_PATH"
|
checkvars="CONFIG_GBE_BIN_PATH"
|
||||||
|
|
||||||
if [ -n "$checkvarsxbmk" ]; then
|
if [ -n "$checkvarsxbmk" ]; then
|
||||||
|
|
||||||
checkvars="$checkvars $checkvarsxbmk"
|
checkvars="$checkvars $checkvarsxbmk"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$checkvarschk" ]; then
|
if [ -n "$checkvarschk" ]; then
|
||||||
|
|
||||||
checkvars="$checkvars $checkvarschk"
|
checkvars="$checkvars $checkvarschk"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -38,7 +34,6 @@ inject()
|
|||||||
remkdir "$tmpromdel"
|
remkdir "$tmpromdel"
|
||||||
|
|
||||||
if [ $# -lt 1 ]; then
|
if [ $# -lt 1 ]; then
|
||||||
|
|
||||||
err "No options specified" "inject" "$@"
|
err "No options specified" "inject" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -49,57 +44,39 @@ inject()
|
|||||||
xchanged=""
|
xchanged=""
|
||||||
|
|
||||||
[ $# -gt 1 ] && case "$2" in
|
[ $# -gt 1 ] && case "$2" in
|
||||||
|
|
||||||
nuke)
|
nuke)
|
||||||
|
|
||||||
new_mac=""
|
new_mac=""
|
||||||
nuke="nuke"
|
nuke="nuke"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
setmac)
|
setmac)
|
||||||
|
|
||||||
if [ $# -gt 2 ]; then
|
if [ $# -gt 2 ]; then
|
||||||
|
|
||||||
new_mac="$3" && \
|
new_mac="$3" && \
|
||||||
|
|
||||||
if [ -z "$new_mac" ]; then
|
if [ -z "$new_mac" ]; then
|
||||||
|
|
||||||
err "Empty MAC address specified" "inject" "$@"
|
err "Empty MAC address specified" "inject" "$@"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
|
|
||||||
err "Unrecognised inject mode: '$2'" "inject" "$@" ;;
|
err "Unrecognised inject mode: '$2'" "inject" "$@" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [ "$new_mac" = "keep" ]; then
|
if [ "$new_mac" = "keep" ]; then
|
||||||
|
|
||||||
new_mac=""
|
new_mac=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
check_release
|
check_release
|
||||||
|
|
||||||
if check_target; then
|
if check_target; then
|
||||||
|
|
||||||
if ! patch_release; then
|
if ! patch_release; then
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$xchanged" = "y" ]; then
|
if [ "$xchanged" = "y" ]; then
|
||||||
|
|
||||||
remktar
|
remktar
|
||||||
fi
|
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
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
printf "\n'%s' was NOT modified\n" "$archive" 1>&2
|
printf "\n'%s' was NOT modified\n" "$archive" 1>&2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -109,12 +86,9 @@ inject()
|
|||||||
check_release()
|
check_release()
|
||||||
{
|
{
|
||||||
if [ -L "$archive" ]; then
|
if [ -L "$archive" ]; then
|
||||||
|
|
||||||
err "'$archive' is a symlink" "check_release" "$@"
|
err "'$archive' is a symlink" "check_release" "$@"
|
||||||
fi
|
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
|
||||||
|
|
||||||
@@ -122,39 +96,28 @@ check_release()
|
|||||||
|| err "can't get '$archive' name" "check_release" "$@"
|
|| err "can't get '$archive' name" "check_release" "$@"
|
||||||
|
|
||||||
if [ -z "$archivename" ]; then
|
if [ -z "$archivename" ]; then
|
||||||
|
|
||||||
err "Can't determine archive name" "check_release" "$@"
|
err "Can't determine archive name" "check_release" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case "$archivename" in
|
case "$archivename" in
|
||||||
|
|
||||||
*_src.tar.xz)
|
*_src.tar.xz)
|
||||||
|
|
||||||
err "'$archive' is a src archive!" "check_release" "$@"
|
err "'$archive' is a src archive!" "check_release" "$@"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
grub_*|seagrub_*|custom_*|seauboot_*|seabios_withgrub_*)
|
grub_*|seagrub_*|custom_*|seauboot_*|seabios_withgrub_*)
|
||||||
|
|
||||||
err "'$archive' is a ROM image" "check_release" "$@"
|
err "'$archive' is a ROM image" "check_release" "$@"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*.tar.xz) _stripped_prefix="${archivename#*_}"
|
*.tar.xz) _stripped_prefix="${archivename#*_}"
|
||||||
|
|
||||||
board="${_stripped_prefix%.tar.xz}"
|
board="${_stripped_prefix%.tar.xz}"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
|
|
||||||
err "'$archive': cannot detect board" "check_release" "$@"
|
err "'$archive': cannot detect board" "check_release" "$@"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
esac; :
|
esac; :
|
||||||
}
|
}
|
||||||
|
|
||||||
check_target()
|
check_target()
|
||||||
{
|
{
|
||||||
if [ "$board" != "${board#serprog_}" ]; then
|
if [ "$board" != "${board#serprog_}" ]; then
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -164,7 +127,6 @@ check_target()
|
|||||||
err "Can't read '$boarddir/target.cfg'" "check_target" "$@"
|
err "Can't read '$boarddir/target.cfg'" "check_target" "$@"
|
||||||
|
|
||||||
if [ -z "$tree" ]; then
|
if [ -z "$tree" ]; then
|
||||||
|
|
||||||
err "tree unset in '$boarddir/target.cfg'" "check_target" "$@"
|
err "tree unset in '$boarddir/target.cfg'" "check_target" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -173,7 +135,6 @@ check_target()
|
|||||||
ifdtool="elf/coreboot/$tree/ifdtool"
|
ifdtool="elf/coreboot/$tree/ifdtool"
|
||||||
|
|
||||||
if [ -n "$IFD_platform" ]; then
|
if [ -n "$IFD_platform" ]; then
|
||||||
|
|
||||||
ifdprefix="-p $IFD_platform"
|
ifdprefix="-p $IFD_platform"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -181,7 +142,6 @@ check_target()
|
|||||||
patch_release()
|
patch_release()
|
||||||
{
|
{
|
||||||
if [ "$nuke" != "nuke" ]; then
|
if [ "$nuke" != "nuke" ]; then
|
||||||
|
|
||||||
x_ ./mk download "$board"
|
x_ ./mk download "$board"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -189,13 +149,10 @@ patch_release()
|
|||||||
tmpromdir="$tmpromdel/bin/$board"
|
tmpromdir="$tmpromdel/bin/$board"
|
||||||
|
|
||||||
remkdir "${tmpromdir%"/bin/$board"}"
|
remkdir "${tmpromdir%"/bin/$board"}"
|
||||||
|
|
||||||
x_ tar -xf "$archive" -C "${tmpromdir%"/bin/$board"}"
|
x_ tar -xf "$archive" -C "${tmpromdir%"/bin/$board"}"
|
||||||
|
|
||||||
for _hashes in "vendorhashes" "blobhashes"; do
|
for _hashes in "vendorhashes" "blobhashes"; do
|
||||||
|
|
||||||
if e "$tmpromdir/$_hashes" f; then
|
if e "$tmpromdir/$_hashes" f; then
|
||||||
|
|
||||||
has_hashes="y"
|
has_hashes="y"
|
||||||
hashfile="$_hashes"
|
hashfile="$_hashes"
|
||||||
|
|
||||||
@@ -204,12 +161,8 @@ patch_release()
|
|||||||
done
|
done
|
||||||
|
|
||||||
if ! readkconfig; then
|
if ! readkconfig; then
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
|
elif [ -n "$new_mac" ] && [ -n "$CONFIG_GBE_BIN_PATH" ]; then
|
||||||
elif [ -n "$new_mac" ] && \
|
|
||||||
[ -n "$CONFIG_GBE_BIN_PATH" ]; then
|
|
||||||
|
|
||||||
modify_mac
|
modify_mac
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -221,7 +174,6 @@ readkconfig()
|
|||||||
fx_ scankconfig x_ find "$boarddir/config" -type f
|
fx_ scankconfig x_ find "$boarddir/config" -type f
|
||||||
|
|
||||||
if e "$xbtmp/cbcfg" f missing; then
|
if e "$xbtmp/cbcfg" f missing; then
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -229,7 +181,6 @@ readkconfig()
|
|||||||
err "Can't read '$xbtmp/cbcfg'" "readkconfig" "$@"
|
err "Can't read '$xbtmp/cbcfg'" "readkconfig" "$@"
|
||||||
|
|
||||||
if ! setvfile "$@"; then
|
if ! setvfile "$@"; then
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -237,7 +188,6 @@ readkconfig()
|
|||||||
scankconfig()
|
scankconfig()
|
||||||
{
|
{
|
||||||
for cbc in $checkvars; do
|
for cbc in $checkvars; do
|
||||||
|
|
||||||
grep "$cbc" "$1" 2>/dev/null 1>>"$xbtmp/cbcfg" || :
|
grep "$cbc" "$1" 2>/dev/null 1>>"$xbtmp/cbcfg" || :
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
@@ -246,11 +196,8 @@ modify_mac()
|
|||||||
{
|
{
|
||||||
x_ cp "${CONFIG_GBE_BIN_PATH##*../}" "$xbtmp/gbe"
|
x_ cp "${CONFIG_GBE_BIN_PATH##*../}" "$xbtmp/gbe"
|
||||||
|
|
||||||
if [ -n "$new_mac" ] && \
|
if [ -n "$new_mac" ] && [ "$new_mac" != "restore" ]; then
|
||||||
[ "$new_mac" != "restore" ]; then
|
|
||||||
|
|
||||||
x_ make -C util/nvmutil clean
|
x_ make -C util/nvmutil clean
|
||||||
|
|
||||||
x_ make -C util/nvmutil
|
x_ make -C util/nvmutil
|
||||||
|
|
||||||
x_ "$nvmutil" "$xbtmp/gbe" setmac "$new_mac"
|
x_ "$nvmutil" "$xbtmp/gbe" setmac "$new_mac"
|
||||||
@@ -259,16 +206,13 @@ modify_mac()
|
|||||||
fx_ newmac x_ find "$tmpromdir" -maxdepth 1 -type f -name "*.rom"
|
fx_ newmac x_ find "$tmpromdir" -maxdepth 1 -type f -name "*.rom"
|
||||||
|
|
||||||
printf "\nThe following GbE NVM data will be written:\n"
|
printf "\nThe following GbE NVM data will be written:\n"
|
||||||
|
|
||||||
x_ "$nvmutil" "$xbtmp/gbe" dump | grep -v "bytes read from file" || :
|
x_ "$nvmutil" "$xbtmp/gbe" dump | grep -v "bytes read from file" || :
|
||||||
}
|
}
|
||||||
|
|
||||||
newmac()
|
newmac()
|
||||||
{
|
{
|
||||||
if e "$1" f; then
|
if e "$1" f; then
|
||||||
|
|
||||||
xchanged="y"
|
xchanged="y"
|
||||||
|
|
||||||
x_ "$ifdtool" $ifdprefix -i GbE:"$xbtmp/gbe" "$1" -O "$1"
|
x_ "$ifdtool" $ifdprefix -i GbE:"$xbtmp/gbe" "$1" -O "$1"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -279,7 +223,6 @@ remktar()
|
|||||||
x_ cd "${tmpromdir%"/bin/$board"}"
|
x_ cd "${tmpromdir%"/bin/$board"}"
|
||||||
|
|
||||||
printf "Re-building tar archive (please wait)\n"
|
printf "Re-building tar archive (please wait)\n"
|
||||||
|
|
||||||
mkrom_tarball "bin/$board" 1>/dev/null
|
mkrom_tarball "bin/$board" 1>/dev/null
|
||||||
|
|
||||||
) || err "Cannot re-generate '$archive'" "remktar" "$@"
|
) || err "Cannot re-generate '$archive'" "remktar" "$@"
|
||||||
|
|||||||
+36
-53
@@ -11,7 +11,6 @@ rmodtool="elf/coreboot/default/rmodtool"
|
|||||||
mkrom_tarball()
|
mkrom_tarball()
|
||||||
{
|
{
|
||||||
update_xbmkver "$1"
|
update_xbmkver "$1"
|
||||||
|
|
||||||
mktarball "$1" "${1%/*}/${relname}_${1##*/}.tar.xz"
|
mktarball "$1" "${1%/*}/${relname}_${1##*/}.tar.xz"
|
||||||
|
|
||||||
x_ rm -Rf "$1"
|
x_ rm -Rf "$1"
|
||||||
@@ -28,10 +27,14 @@ update_xbmkver()
|
|||||||
err "can't write '$versiondate'" "update_xbmkver" "$@"; :
|
err "can't write '$versiondate'" "update_xbmkver" "$@"; :
|
||||||
}
|
}
|
||||||
|
|
||||||
|
version()
|
||||||
|
{
|
||||||
|
printf "%s\nWebsite: %s\n" "$relname" "$projectsite"
|
||||||
|
}
|
||||||
|
|
||||||
xbmk_sanitize_version()
|
xbmk_sanitize_version()
|
||||||
{
|
{
|
||||||
if [ -z "$version" ]; then
|
if [ -z "$version" ]; then
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -44,7 +47,6 @@ xbmk_sanitize_version()
|
|||||||
version="${version#-}"
|
version="${version#-}"
|
||||||
|
|
||||||
if [ -z "$version" ]; then
|
if [ -z "$version" ]; then
|
||||||
|
|
||||||
err "'version' empty after sanitization" \
|
err "'version' empty after sanitization" \
|
||||||
"xbmk_sanitize_version" "$@"
|
"xbmk_sanitize_version" "$@"
|
||||||
fi
|
fi
|
||||||
@@ -55,7 +57,6 @@ 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
|
if [ "${2%/*}" != "$2" ]; then
|
||||||
|
|
||||||
x_ xbmkdir "${2%/*}"
|
x_ xbmkdir "${2%/*}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -68,7 +69,6 @@ e()
|
|||||||
es_t="e"
|
es_t="e"
|
||||||
|
|
||||||
if [ $# -gt 1 ]; then
|
if [ $# -gt 1 ]; then
|
||||||
|
|
||||||
es_t="$2"
|
es_t="$2"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -76,7 +76,6 @@ e()
|
|||||||
estr="[ -$es_t \"\$1\" ] || return 1"
|
estr="[ -$es_t \"\$1\" ] || return 1"
|
||||||
|
|
||||||
if [ $# -gt 2 ]; then
|
if [ $# -gt 2 ]; then
|
||||||
|
|
||||||
estr="[ -$es_t \"\$1\" ] && return 1"
|
estr="[ -$es_t \"\$1\" ] && return 1"
|
||||||
es2="missing"
|
es2="missing"
|
||||||
fi
|
fi
|
||||||
@@ -91,18 +90,14 @@ setvars()
|
|||||||
_setvars=""
|
_setvars=""
|
||||||
|
|
||||||
if [ $# -lt 2 ]; then
|
if [ $# -lt 2 ]; then
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
val="$1"
|
val="$1"
|
||||||
|
|
||||||
shift 1
|
shift 1
|
||||||
|
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]; do
|
||||||
|
|
||||||
printf "%s=\"%s\"\n" "$1" "$val"
|
printf "%s=\"%s\"\n" "$1" "$val"
|
||||||
|
|
||||||
shift 1
|
shift 1
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
@@ -118,16 +113,14 @@ singletree()
|
|||||||
findpath()
|
findpath()
|
||||||
{
|
{
|
||||||
if [ $# -lt 1 ]; then
|
if [ $# -lt 1 ]; then
|
||||||
|
|
||||||
err "findpath: No arguments provided" "findpath" "$@"
|
err "findpath: No arguments provided" "findpath" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]
|
||||||
|
do
|
||||||
found="`readlink -f "$1" 2>/dev/null`" || return 1; :
|
found="`readlink -f "$1" 2>/dev/null`" || return 1; :
|
||||||
|
|
||||||
if [ -z "$found" ]; then
|
if [ -z "$found" ]; then
|
||||||
|
|
||||||
found="`realpath "$1" 2>/dev/null`" || \
|
found="`realpath "$1" 2>/dev/null`" || \
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
@@ -155,7 +148,6 @@ unpad_one_byte()
|
|||||||
err "can't increment file size" "unpad_one_byte" "$@"
|
err "can't increment file size" "unpad_one_byte" "$@"
|
||||||
|
|
||||||
if [ $xromsize -lt 524288 ]; then
|
if [ $xromsize -lt 524288 ]; then
|
||||||
|
|
||||||
err "too small, $xromsize: $1" "unpad_one_byte" "$@"
|
err "too small, $xromsize: $1" "unpad_one_byte" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -163,14 +155,12 @@ unpad_one_byte()
|
|||||||
err "can't make tmp file" "unpad_one_byte" "$@"
|
err "can't make tmp file" "unpad_one_byte" "$@"
|
||||||
|
|
||||||
x_ dd if="$1" of="$unpaddedfile" bs=$xromsize count=1
|
x_ dd if="$1" of="$unpaddedfile" bs=$xromsize count=1
|
||||||
|
|
||||||
x_ mv "$unpaddedfile" "$1"
|
x_ mv "$unpaddedfile" "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
build_sbase()
|
build_sbase()
|
||||||
{
|
{
|
||||||
if [ ! -f "$sha512sum" ]; then
|
if [ ! -f "$sha512sum" ]; then
|
||||||
|
|
||||||
x_ make -C "$xbmkpwd/util/sbase"
|
x_ make -C "$xbmkpwd/util/sbase"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -178,16 +168,14 @@ build_sbase()
|
|||||||
remkdir()
|
remkdir()
|
||||||
{
|
{
|
||||||
x_ rm -Rf "$@"
|
x_ rm -Rf "$@"
|
||||||
|
|
||||||
x_ xbmkdir "$@"
|
x_ xbmkdir "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
xbmkdir()
|
xbmkdir()
|
||||||
{
|
{
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]
|
||||||
|
do
|
||||||
if [ ! -d "$1" ]; then
|
if [ ! -d "$1" ]; then
|
||||||
|
|
||||||
x_ mkdir -p "$1"
|
x_ mkdir -p "$1"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -198,14 +186,12 @@ xbmkdir()
|
|||||||
fx_()
|
fx_()
|
||||||
{
|
{
|
||||||
xchk fx_ "$@"
|
xchk fx_ "$@"
|
||||||
|
|
||||||
xcmd="$1"
|
xcmd="$1"
|
||||||
|
|
||||||
xfile="`mktemp || err "can't create tmpfile"`" || \
|
xfile="`mktemp || err "can't create tmpfile"`" || \
|
||||||
err "can't make tmpfile" "fx_" "$@"
|
err "can't make tmpfile" "fx_" "$@"
|
||||||
|
|
||||||
x_ rm -f "$xfile"
|
x_ rm -f "$xfile"
|
||||||
|
|
||||||
x_ touch "$xfile"
|
x_ touch "$xfile"
|
||||||
|
|
||||||
shift 1
|
shift 1
|
||||||
@@ -214,7 +200,6 @@ fx_()
|
|||||||
err "can't sort to '$xfile'" "fx_" "$xcmd" "$@"
|
err "can't sort to '$xfile'" "fx_" "$xcmd" "$@"
|
||||||
|
|
||||||
dx_ "$xcmd" "$xfile" || :
|
dx_ "$xcmd" "$xfile" || :
|
||||||
|
|
||||||
x_ rm -f "$xfile"
|
x_ rm -f "$xfile"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -223,43 +208,55 @@ dx_()
|
|||||||
xchk dx_ "$@"
|
xchk dx_ "$@"
|
||||||
|
|
||||||
if [ ! -f "$2" ]; then
|
if [ ! -f "$2" ]; then
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while read -r fx; do
|
while read -r fx; do
|
||||||
|
|
||||||
$1 "$fx" || return 1; :
|
$1 "$fx" || return 1; :
|
||||||
|
done < "$2" || err "cannot read '$2'" "dx_" "$@"; :
|
||||||
done < "$2" \
|
|
||||||
|| err "cannot read '$2'" "dx_" "$@"; :
|
|
||||||
}
|
}
|
||||||
|
|
||||||
x_()
|
x_()
|
||||||
{
|
{
|
||||||
if [ $# -lt 1 ]; then
|
if [ $# -lt 1 ]; then
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
elif [ -z "$1" ]; then
|
elif [ -z "$1" ]; then
|
||||||
|
|
||||||
err "Empty first arg" "x_" "$@"
|
err "Empty first arg" "x_" "$@"
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
"$@" || err "Unhandled error" "x_" "$@"
|
"$@" || err "Unhandled error" "x_" "$@"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
xeq()
|
||||||
|
{
|
||||||
|
if [ $# -lt 2 ]; then
|
||||||
|
err "no args" xeq
|
||||||
|
fi
|
||||||
|
xbcmd="$1"
|
||||||
|
chk="$2"
|
||||||
|
shift 2
|
||||||
|
|
||||||
|
case "$chk" in
|
||||||
|
-*)
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
for eq in "$@"; do
|
||||||
|
if [ "$chk" = "$eq" ]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
err "bad command" xeq "$xbcmd" "$chk" "$@"
|
||||||
|
}
|
||||||
|
|
||||||
xchk()
|
xchk()
|
||||||
{
|
{
|
||||||
if [ $# -lt 3 ]; then
|
if [ $# -lt 3 ]; then
|
||||||
|
|
||||||
err "$1 needs at least two arguments" "xchk" "$@"
|
err "$1 needs at least two arguments" "xchk" "$@"
|
||||||
|
elif [ -z "$2" ] || [ -z "$3" ]; then
|
||||||
elif [ -z "$2" ] || \
|
|
||||||
[ -z "$3" ]; then
|
|
||||||
|
|
||||||
err "arguments must not be empty" "xchk" "$@"
|
err "arguments must not be empty" "xchk" "$@"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -267,19 +264,12 @@ xchk()
|
|||||||
err()
|
err()
|
||||||
{
|
{
|
||||||
if [ $# -eq 1 ]; then
|
if [ $# -eq 1 ]; then
|
||||||
|
|
||||||
printf "ERROR %s: %s\n" "$0" "$1" 1>&2 || :
|
printf "ERROR %s: %s\n" "$0" "$1" 1>&2 || :
|
||||||
|
|
||||||
elif [ $# -gt 1 ]; then
|
elif [ $# -gt 1 ]; then
|
||||||
|
|
||||||
printf "ERROR %s: %s: in command with args: " "$0" "$1" 1>&2
|
printf "ERROR %s: %s: in command with args: " "$0" "$1" 1>&2
|
||||||
|
|
||||||
shift 1
|
shift 1
|
||||||
|
|
||||||
xprintf "$@" 1>&2
|
xprintf "$@" 1>&2
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
printf "ERROR, but no arguments provided to err\n" 1>&2
|
printf "ERROR, but no arguments provided to err\n" 1>&2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -289,23 +279,16 @@ err()
|
|||||||
xprintf()
|
xprintf()
|
||||||
{
|
{
|
||||||
xprintfargs=0
|
xprintfargs=0
|
||||||
|
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]; do
|
||||||
|
|
||||||
printf "\"%s\"" "$1"
|
printf "\"%s\"" "$1"
|
||||||
|
|
||||||
if [ $# -gt 1 ]; then
|
if [ $# -gt 1 ]; then
|
||||||
|
|
||||||
printf " "
|
printf " "
|
||||||
fi
|
fi
|
||||||
|
|
||||||
xprintfargs=1
|
xprintfargs=1
|
||||||
|
|
||||||
shift 1
|
shift 1
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ $xprintfargs -gt 0 ]; then
|
if [ $xprintfargs -gt 0 ]; then
|
||||||
|
|
||||||
printf "\n"
|
printf "\n"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-8
@@ -19,7 +19,6 @@ extract_refcode()
|
|||||||
# 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
|
if [ -z "$cbfstoolref" ]; then
|
||||||
|
|
||||||
err "cbfstoolref not set" "extract_refcode" "$@"
|
err "cbfstoolref not set" "extract_refcode" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -28,10 +27,8 @@ extract_refcode()
|
|||||||
x_ "$cbfstoolref" "$appdir/bios.bin" extract \
|
x_ "$cbfstoolref" "$appdir/bios.bin" extract \
|
||||||
-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
|
if [ -n "$MRC_refcode_gbe" ]; then
|
||||||
|
|
||||||
x_ dd if="config/ifd/hp820g2/1.bin" of="$appdir/ref" bs=1 \
|
x_ dd if="config/ifd/hp820g2/1.bin" of="$appdir/ref" bs=1 \
|
||||||
seek=$MRC_refcode_gbe count=1 conv=notrunc; :
|
seek=$MRC_refcode_gbe count=1 conv=notrunc; :
|
||||||
fi
|
fi
|
||||||
@@ -42,11 +39,8 @@ extract_refcode()
|
|||||||
extract_mrc()
|
extract_mrc()
|
||||||
{
|
{
|
||||||
if [ -z "$MRC_board" ]; then
|
if [ -z "$MRC_board" ]; then
|
||||||
|
|
||||||
err "MRC_board unset" "extract_mrc" "$@"
|
err "MRC_board unset" "extract_mrc" "$@"
|
||||||
|
|
||||||
elif [ -z "$CONFIG_MRC_FILE" ]; then
|
elif [ -z "$CONFIG_MRC_FILE" ]; then
|
||||||
|
|
||||||
err "CONFIG_MRC_FILE unset" "extract_mrc" "$@"
|
err "CONFIG_MRC_FILE unset" "extract_mrc" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -54,7 +48,6 @@ extract_mrc()
|
|||||||
|
|
||||||
(
|
(
|
||||||
x_ cd "$appdir"
|
x_ cd "$appdir"
|
||||||
|
|
||||||
extract_partition "${MRC_url##*/}"
|
extract_partition "${MRC_url##*/}"
|
||||||
extract_archive "$SHELLBALL" .
|
extract_archive "$SHELLBALL" .
|
||||||
|
|
||||||
|
|||||||
+3
-26
@@ -14,58 +14,45 @@ release()
|
|||||||
|
|
||||||
reldir="release"
|
reldir="release"
|
||||||
|
|
||||||
while getopts m: option; do
|
while getopts m: option
|
||||||
|
do
|
||||||
if [ -z "$OPTARG" ]; then
|
if [ -z "$OPTARG" ]; then
|
||||||
|
|
||||||
err "empty argument not allowed" "release" "$@"
|
err "empty argument not allowed" "release" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case "$option" in
|
case "$option" in
|
||||||
|
|
||||||
m)
|
m)
|
||||||
relmode="$OPTARG"
|
relmode="$OPTARG"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
err "invalid option '-$option'" "release" "$@"
|
err "invalid option '-$option'" "release" "$@"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
reldest="$reldir/$version"
|
reldest="$reldir/$version"
|
||||||
|
|
||||||
if [ -e "$reldest" ]; then
|
if [ -e "$reldest" ]; then
|
||||||
|
|
||||||
err "already exists: \"$reldest\"" "release" "$@"
|
err "already exists: \"$reldest\"" "release" "$@"
|
||||||
fi
|
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" "$@"
|
||||||
|
|
||||||
vdir="$vdir/$version"
|
vdir="$vdir/$version"
|
||||||
|
|
||||||
rsrc="$vdir/${relname}_src"
|
rsrc="$vdir/${relname}_src"
|
||||||
|
|
||||||
remkdir "$vdir"
|
remkdir "$vdir"
|
||||||
|
|
||||||
x_ git clone . "$rsrc"
|
x_ git clone . "$rsrc"
|
||||||
|
|
||||||
update_xbmkver "$rsrc"
|
update_xbmkver "$rsrc"
|
||||||
|
|
||||||
prep_release src
|
prep_release src
|
||||||
prep_release tarball
|
prep_release tarball
|
||||||
|
|
||||||
if [ "$relmode" != "src" ]; then
|
if [ "$relmode" != "src" ]; then
|
||||||
|
|
||||||
prep_release bin
|
prep_release bin
|
||||||
fi
|
fi
|
||||||
|
|
||||||
x_ rm -Rf "$rsrc"
|
x_ rm -Rf "$rsrc"
|
||||||
|
|
||||||
x_ xbmkdir "$reldir"
|
x_ xbmkdir "$reldir"
|
||||||
|
|
||||||
x_ mv "$vdir" "$reldir"
|
x_ mv "$vdir" "$reldir"
|
||||||
x_ rm -Rf "${vdir%"/$version"}"
|
x_ rm -Rf "${vdir%"/$version"}"
|
||||||
|
|
||||||
@@ -76,11 +63,8 @@ prep_release()
|
|||||||
{
|
{
|
||||||
(
|
(
|
||||||
if [ "$1" != "tarball" ]; then
|
if [ "$1" != "tarball" ]; then
|
||||||
|
|
||||||
x_ cd "$rsrc"
|
x_ cd "$rsrc"
|
||||||
|
|
||||||
if [ ! -e "cache" ]; then
|
if [ ! -e "cache" ]; then
|
||||||
|
|
||||||
x_ ln -s "$XBMK_CACHE" "cache"
|
x_ ln -s "$XBMK_CACHE" "cache"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -99,18 +83,15 @@ prep_release_src()
|
|||||||
fx_ "x_ rm -Rf" x_ find . -name ".git"
|
fx_ "x_ rm -Rf" x_ find . -name ".git"
|
||||||
fx_ "x_ rm -Rf" x_ find . -name ".gitmodules"
|
fx_ "x_ rm -Rf" x_ find . -name ".gitmodules"
|
||||||
|
|
||||||
# delete unwanted files from the release
|
|
||||||
( fx_ nuke x_ find config -type f -name "nuke.list" ) || \
|
( fx_ nuke x_ find config -type f -name "nuke.list" ) || \
|
||||||
err "can't prune project files" "prep_release_src" "$@"; :
|
err "can't prune project files" "prep_release_src" "$@"; :
|
||||||
}
|
}
|
||||||
|
|
||||||
# delete unwanted files from the release
|
|
||||||
nuke()
|
nuke()
|
||||||
{
|
{
|
||||||
r="$rsrc/src/${1#config/}"
|
r="$rsrc/src/${1#config/}"
|
||||||
|
|
||||||
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"
|
||||||
@@ -124,9 +105,7 @@ prep_release_tarball()
|
|||||||
err "can't create '$rsrc/CHANGELOG'" "prep_release_tarball" "$@"
|
err "can't create '$rsrc/CHANGELOG'" "prep_release_tarball" "$@"
|
||||||
|
|
||||||
x_ rm -f "$rsrc/lock" "$rsrc/cache"
|
x_ rm -f "$rsrc/lock" "$rsrc/cache"
|
||||||
|
|
||||||
x_ rm -Rf "$rsrc/xbmkwd" "$rsrc/util/sbase"
|
x_ rm -Rf "$rsrc/xbmkwd" "$rsrc/util/sbase"
|
||||||
|
|
||||||
x_ mv "$rsrc/util/sbase2" "$rsrc/util/sbase"
|
x_ mv "$rsrc/util/sbase2" "$rsrc/util/sbase"
|
||||||
|
|
||||||
(
|
(
|
||||||
@@ -139,12 +118,10 @@ prep_release_tarball()
|
|||||||
prep_release_bin()
|
prep_release_bin()
|
||||||
{
|
{
|
||||||
x_ ./mk -d coreboot
|
x_ ./mk -d coreboot
|
||||||
|
|
||||||
x_ ./mk -b coreboot
|
x_ ./mk -b coreboot
|
||||||
|
|
||||||
x_ ./mk -b pico-serprog
|
x_ ./mk -b pico-serprog
|
||||||
|
|
||||||
x_ ./mk -b stm32-vserprog
|
x_ ./mk -b stm32-vserprog
|
||||||
|
|
||||||
x_ ./mk -b pcsx-redux
|
x_ ./mk -b pcsx-redux
|
||||||
|
|
||||||
fx_ mkrom_tarball x_ find bin -maxdepth 1 -type d -name "serprog_*"
|
fx_ mkrom_tarball x_ find bin -maxdepth 1 -type d -name "serprog_*"
|
||||||
|
|||||||
+25
-156
@@ -11,21 +11,15 @@ grubdata="config/data/grub"
|
|||||||
buildser()
|
buildser()
|
||||||
{
|
{
|
||||||
if [ "$1" = "pico" ]; then
|
if [ "$1" = "pico" ]; then
|
||||||
|
|
||||||
x_ cmake -DPICO_BOARD="$2" \
|
x_ cmake -DPICO_BOARD="$2" \
|
||||||
-DPICO_SDK_PATH="$picosdk" -B "$sersrc/build" "$sersrc"
|
-DPICO_SDK_PATH="$picosdk" -B "$sersrc/build" "$sersrc"
|
||||||
|
|
||||||
x_ cmake --build "$sersrc/build"
|
x_ cmake --build "$sersrc/build"
|
||||||
|
|
||||||
elif [ "$1" = "stm32" ]; then
|
elif [ "$1" = "stm32" ]; then
|
||||||
|
|
||||||
x_ make -C "$sersrc" libopencm3-just-make BOARD=$2
|
x_ make -C "$sersrc" libopencm3-just-make BOARD=$2
|
||||||
|
|
||||||
x_ make -C "$sersrc" BOARD=$2
|
x_ make -C "$sersrc" BOARD=$2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
x_ xbmkdir "bin/serprog_$1"
|
x_ xbmkdir "bin/serprog_$1"
|
||||||
|
|
||||||
x_ mv "$serx" "bin/serprog_$1/serprog_$2.${serx##*.}"
|
x_ mv "$serx" "bin/serprog_$1/serprog_$2.${serx##*.}"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,9 +63,7 @@ mkpayload_grub()
|
|||||||
|
|
||||||
corebootpremake()
|
corebootpremake()
|
||||||
{
|
{
|
||||||
if [ "$XBMK_RELEASE" = "y" ] && \
|
if [ "$XBMK_RELEASE" = "y" ] && [ "$release" = "n" ]; then
|
||||||
[ "$release" = "n" ]; then
|
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -83,18 +75,14 @@ corebootpremake()
|
|||||||
printf "%s\n" "${version%%-*}" > "$srcdir/.coreboot-version" || \
|
printf "%s\n" "${version%%-*}" > "$srcdir/.coreboot-version" || \
|
||||||
err "!mk $srcdir .coreboot-version" "corebootpremake" "$@"
|
err "!mk $srcdir .coreboot-version" "corebootpremake" "$@"
|
||||||
|
|
||||||
if [ -z "$mode" ] && \
|
if [ -z "$mode" ] && [ "$target" != "$tree" ]; then
|
||||||
[ "$target" != "$tree" ]; then
|
|
||||||
|
|
||||||
x_ ./mk download "$target"
|
x_ ./mk download "$target"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
cook_coreboot_config()
|
cook_coreboot_config()
|
||||||
{
|
{
|
||||||
if [ -z "$mode" ] && \
|
if [ -z "$mode" ] && [ -f "$srcdir/.config" ]; then
|
||||||
[ -f "$srcdir/.config" ]; then
|
|
||||||
|
|
||||||
printf "CONFIG_CCACHE=y\n" >> "$srcdir/.config" || \
|
printf "CONFIG_CCACHE=y\n" >> "$srcdir/.config" || \
|
||||||
err "can't cook '$srcdir'" "cook_coreboot_config" "$@"
|
err "can't cook '$srcdir'" "cook_coreboot_config" "$@"
|
||||||
fi
|
fi
|
||||||
@@ -103,12 +91,9 @@ cook_coreboot_config()
|
|||||||
check_coreboot_util()
|
check_coreboot_util()
|
||||||
{
|
{
|
||||||
if [ "$badhash" = "y" ]; then
|
if [ "$badhash" = "y" ]; then
|
||||||
|
|
||||||
x_ rm -f "elf/coreboot/$tree/$1"
|
x_ rm -f "elf/coreboot/$tree/$1"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if e "elf/coreboot/$tree/$1" f; then
|
if e "elf/coreboot/$tree/$1" f; then
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -116,33 +101,26 @@ check_coreboot_util()
|
|||||||
utilsrcdir="src/coreboot/$tree/util/$1"
|
utilsrcdir="src/coreboot/$tree/util/$1"
|
||||||
|
|
||||||
utilmode=""
|
utilmode=""
|
||||||
|
|
||||||
if [ -n "$mode" ]; then
|
if [ -n "$mode" ]; then
|
||||||
|
|
||||||
utilmode="clean"
|
utilmode="clean"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
x_ make -C "$utilsrcdir" $utilmode -j$XBMK_THREADS $makeargs
|
x_ make -C "$utilsrcdir" $utilmode -j$XBMK_THREADS $makeargs
|
||||||
|
|
||||||
if [ -n "$mode" ]; then
|
if [ -n "$mode" ]; then
|
||||||
|
|
||||||
# TODO: is this rm command needed?
|
# TODO: is this rm command needed?
|
||||||
|
|
||||||
x_ rm -Rf "$utilelfdir"
|
x_ rm -Rf "$utilelfdir"
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
elif [ -n "$mode" ] || [ -f "$utilelfdir/$1" ]; then
|
||||||
elif [ -n "$mode" ] || \
|
|
||||||
[ -f "$utilelfdir/$1" ]; then
|
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
x_ xbmkdir "$utilelfdir"
|
x_ xbmkdir "$utilelfdir"
|
||||||
|
|
||||||
x_ cp "$utilsrcdir/$1" "$utilelfdir"
|
x_ cp "$utilsrcdir/$1" "$utilelfdir"
|
||||||
|
|
||||||
if [ "$1" = "cbfstool" ]; then
|
if [ "$1" = "cbfstool" ]; then
|
||||||
|
|
||||||
x_ cp "$utilsrcdir/rmodtool" "$utilelfdir"
|
x_ cp "$utilsrcdir/rmodtool" "$utilelfdir"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -159,9 +137,7 @@ coreboot_pad_one_byte()
|
|||||||
|
|
||||||
mkcorebootbin()
|
mkcorebootbin()
|
||||||
{
|
{
|
||||||
if [ "$XBMK_RELEASE" = "y" ] && \
|
if [ "$XBMK_RELEASE" = "y" ] && [ "$release" = "n" ]; then
|
||||||
[ "$release" = "n" ]; then
|
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -172,9 +148,7 @@ mkcorebootbin()
|
|||||||
check_coreboot_util ifdtool
|
check_coreboot_util ifdtool
|
||||||
|
|
||||||
for y in "$target_dir/config"/*; do
|
for y in "$target_dir/config"/*; do
|
||||||
|
|
||||||
defconfig="$y"
|
defconfig="$y"
|
||||||
|
|
||||||
mkcorebootbin_real
|
mkcorebootbin_real
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -184,7 +158,6 @@ mkcorebootbin()
|
|||||||
mkcorebootbin_real()
|
mkcorebootbin_real()
|
||||||
{
|
{
|
||||||
if [ "$target" = "$tree" ]; then
|
if [ "$target" = "$tree" ]; then
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -192,28 +165,21 @@ mkcorebootbin_real()
|
|||||||
|
|
||||||
initmode="${defconfig##*/}"
|
initmode="${defconfig##*/}"
|
||||||
displaymode="${initmode##*_}"
|
displaymode="${initmode##*_}"
|
||||||
|
|
||||||
if [ "$displaymode" = "$initmode" ]; then
|
if [ "$displaymode" = "$initmode" ]; then
|
||||||
|
|
||||||
# blank it for "normal" or "fspgop" configs:
|
# blank it for "normal" or "fspgop" configs:
|
||||||
|
|
||||||
displaymode=""
|
displaymode=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
initmode="${initmode%%_*}"
|
initmode="${initmode%%_*}"
|
||||||
|
|
||||||
cbfstool="elf/coreboot/$tree/cbfstool"
|
cbfstool="elf/coreboot/$tree/cbfstool"
|
||||||
|
|
||||||
# cbfstool option backends, if they exist
|
# cbfstool option backends, if they exist
|
||||||
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
|
if [ -n "$displaymode" ]; then
|
||||||
|
|
||||||
elfrom="${elfrom}_$displaymode"
|
elfrom="${elfrom}_$displaymode"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
elfrom="$elfrom/coreboot.rom"
|
elfrom="$elfrom/coreboot.rom"
|
||||||
|
|
||||||
$if_not_dry_build \
|
$if_not_dry_build \
|
||||||
@@ -222,69 +188,48 @@ mkcorebootbin_real()
|
|||||||
$if_not_dry_build \
|
$if_not_dry_build \
|
||||||
unpad_one_byte "$tmprom"
|
unpad_one_byte "$tmprom"
|
||||||
|
|
||||||
if [ -n "$payload_uboot" ] && \
|
if [ -n "$payload_uboot" ] && [ "$payload_uboot" != "amd64" ] && \
|
||||||
[ "$payload_uboot" != "amd64" ] && \
|
[ "$payload_uboot" != "i386" ] && [ "$payload_uboot" != "arm64" ]
|
||||||
[ "$payload_uboot" != "i386" ] && \
|
then
|
||||||
[ "$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
|
fi
|
||||||
|
|
||||||
if [ -n "$payload_uboot" ] && \
|
if [ -n "$payload_uboot" ] && [ "$payload_uboot" != "arm64" ]; then
|
||||||
[ "$payload_uboot" != "arm64" ]; then
|
|
||||||
|
|
||||||
payload_seabios="y"
|
payload_seabios="y"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$uboot_config" ]; then
|
if [ -z "$uboot_config" ]; then
|
||||||
|
|
||||||
uboot_config="default"
|
uboot_config="default"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$payload_grub" = "y" ]; then
|
if [ "$payload_grub" = "y" ]; then
|
||||||
|
|
||||||
payload_seabios="y"
|
payload_seabios="y"
|
||||||
fi
|
fi
|
||||||
|
if [ "$payload_seabios" = "y" ] && [ "$payload_uboot" = "arm64" ]; then
|
||||||
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
|
fi
|
||||||
|
|
||||||
if [ -z "$grub_scan_disk" ]; then
|
if [ -z "$grub_scan_disk" ]; then
|
||||||
|
|
||||||
grub_scan_disk="nvme ahci ata"
|
grub_scan_disk="nvme ahci ata"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$grubtree" ]; then
|
if [ -z "$grubtree" ]; then
|
||||||
|
|
||||||
grubtree="default"
|
grubtree="default"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
grubelf="elf/grub/$grubtree/$grubtree/payload/grub.elf"
|
grubelf="elf/grub/$grubtree/$grubtree/payload/grub.elf"
|
||||||
|
|
||||||
if [ "$payload_memtest" != "y" ]; then
|
if [ "$payload_memtest" != "y" ]; then
|
||||||
|
|
||||||
payload_memtest="n"
|
payload_memtest="n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$(uname -m)" != "x86_64" ]; then
|
if [ "$(uname -m)" != "x86_64" ]; then
|
||||||
|
|
||||||
payload_memtest="n"
|
payload_memtest="n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$payload_grubsea" = "y" ] && \
|
if [ "$payload_grubsea" = "y" ] && [ "$initmode" = "normal" ]; then
|
||||||
[ "$initmode" = "normal" ]; then
|
|
||||||
|
|
||||||
payload_grubsea="n"
|
payload_grubsea="n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$payload_grub" != "y" ]; then
|
if [ "$payload_grub" != "y" ]; then
|
||||||
|
|
||||||
payload_grubsea="n"
|
payload_grubsea="n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -292,29 +237,20 @@ mkcorebootbin_real()
|
|||||||
return 0
|
return 0
|
||||||
|
|
||||||
if [ -f "$cbfscfg" ]; then
|
if [ -f "$cbfscfg" ]; then
|
||||||
|
|
||||||
dx_ add_cbfs_option "$cbfscfg"
|
dx_ add_cbfs_option "$cbfscfg"
|
||||||
fi
|
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
|
||||||
|
|
||||||
pname="seabios"
|
pname="seabios"
|
||||||
|
|
||||||
add_seabios
|
add_seabios
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$payload_uboot" = "arm64" ]; then
|
if [ "$payload_uboot" = "arm64" ]; then
|
||||||
|
|
||||||
pname="uboot"
|
pname="uboot"
|
||||||
|
|
||||||
add_uboot
|
add_uboot
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
|
||||||
pname="custom"
|
pname="custom"
|
||||||
|
|
||||||
cprom
|
cprom
|
||||||
fi; :
|
fi; :
|
||||||
}
|
}
|
||||||
@@ -326,12 +262,9 @@ add_cbfs_option()
|
|||||||
# TODO: input sanitization (currently mitigated by careful config)
|
# TODO: input sanitization (currently mitigated by careful config)
|
||||||
|
|
||||||
op_name="`printf "%s\n" "$1" | awk '{print $1}'`"
|
op_name="`printf "%s\n" "$1" | awk '{print $1}'`"
|
||||||
|
|
||||||
op_arg="`printf "%s\n" "$1" | awk '{print $2}'`"
|
op_arg="`printf "%s\n" "$1" | awk '{print $2}'`"
|
||||||
|
|
||||||
if [ -z "$op_name" ] || \
|
if [ -z "$op_name" ] || [ -z "$op_arg" ]; then
|
||||||
[ -z "$op_arg" ]; then
|
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -350,9 +283,7 @@ add_cbfs_option()
|
|||||||
|
|
||||||
add_seabios()
|
add_seabios()
|
||||||
{
|
{
|
||||||
if [ -n "$payload_uboot" ] && \
|
if [ -n "$payload_uboot" ] && [ "$payload_uboot" != "arm64" ]; then
|
||||||
[ "$payload_uboot" != "arm64" ]; then
|
|
||||||
|
|
||||||
# we must add u-boot first, because it's added as a flat
|
# we must add u-boot first, because it's added as a flat
|
||||||
# binary at a specific offset for secondary program loader
|
# binary at a specific offset for secondary program loader
|
||||||
|
|
||||||
@@ -361,16 +292,11 @@ add_seabios()
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
_seabioself="elf/seabios/default/default/$initmode/bios.bin.elf"
|
_seabioself="elf/seabios/default/default/$initmode/bios.bin.elf"
|
||||||
|
[ "$initmode" = "fspgop" ] && \
|
||||||
if [ "$initmode" = "fspgop" ]; then
|
|
||||||
|
|
||||||
_seabioself="elf/seabios/default/default/libgfxinit/bios.bin.elf"
|
_seabioself="elf/seabios/default/default/libgfxinit/bios.bin.elf"
|
||||||
fi
|
|
||||||
|
|
||||||
_seaname="fallback/payload"
|
_seaname="fallback/payload"
|
||||||
|
|
||||||
if [ "$payload_grubsea" = "y" ]; then
|
if [ "$payload_grubsea" = "y" ]; then
|
||||||
|
|
||||||
_seaname="seabios.elf"
|
_seaname="seabios.elf"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -379,39 +305,27 @@ add_seabios()
|
|||||||
x_ "$cbfstool" "$tmprom" add-int -i 3000 -n etc/ps2-keyboard-spinup
|
x_ "$cbfstool" "$tmprom" add-int -i 3000 -n etc/ps2-keyboard-spinup
|
||||||
|
|
||||||
opexec="2"
|
opexec="2"
|
||||||
|
|
||||||
if [ "$initmode" = "vgarom" ]; then
|
if [ "$initmode" = "vgarom" ]; then
|
||||||
|
|
||||||
opexec="0"
|
opexec="0"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
x_ "$cbfstool" "$tmprom" add-int -i $opexec -n etc/pci-optionrom-exec
|
x_ "$cbfstool" "$tmprom" add-int -i $opexec -n etc/pci-optionrom-exec
|
||||||
|
|
||||||
x_ "$cbfstool" "$tmprom" add-int -i 0 -n etc/optionroms-checksum
|
x_ "$cbfstool" "$tmprom" add-int -i 0 -n etc/optionroms-checksum
|
||||||
|
if [ "$initmode" = "libgfxinit" ] || [ "$initmode" = "fspgop" ]; then
|
||||||
if [ "$initmode" = "libgfxinit" ] || \
|
|
||||||
[ "$initmode" = "fspgop" ]; then
|
|
||||||
|
|
||||||
cbfs "$tmprom" "$seavgabiosrom" vgaroms/seavgabios.bin raw
|
cbfs "$tmprom" "$seavgabiosrom" vgaroms/seavgabios.bin raw
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$payload_memtest" = "y" ]; then
|
if [ "$payload_memtest" = "y" ]; then
|
||||||
|
|
||||||
# because why not have memtest?
|
# because why not have memtest?
|
||||||
# we can have it. we are entitled to it.
|
|
||||||
# so we shall have it, yes. having memtest86+
|
|
||||||
# in your boot flash makes you a better person.
|
|
||||||
|
|
||||||
cbfs "$tmprom" "elf/memtest86plus/memtest.bin" img/memtest
|
cbfs "$tmprom" "elf/memtest86plus/memtest.bin" img/memtest
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$payload_grub" = "y" ]; then
|
if [ "$payload_grub" = "y" ]; then
|
||||||
|
|
||||||
add_grub
|
add_grub
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$payload_grubsea" != "y" ]; then
|
if [ "$payload_grubsea" != "y" ]; then
|
||||||
|
|
||||||
# ROM image where SeaBIOS doesn't load grub/u-boot first.
|
# ROM image where SeaBIOS doesn't load grub/u-boot first.
|
||||||
# U-Boot/GRUB available in ESC menu if enabled for the board
|
# U-Boot/GRUB available in ESC menu if enabled for the board
|
||||||
|
|
||||||
@@ -424,18 +338,13 @@ add_seabios()
|
|||||||
|
|
||||||
if [ "$payload_uboot" = "amd64" ] && \
|
if [ "$payload_uboot" = "amd64" ] && \
|
||||||
[ "$displaymode" != "txtmode" ] && \
|
[ "$displaymode" != "txtmode" ] && \
|
||||||
[ "$initmode" != "normal" ] && \
|
[ "$initmode" != "normal" ] && [ "$payload_grubsea" != "y" ]; then
|
||||||
[ "$payload_grubsea" != "y" ]; then
|
|
||||||
|
|
||||||
pname="seauboot"
|
pname="seauboot"
|
||||||
|
|
||||||
cprom "seauboot"
|
cprom "seauboot"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$payload_grub" = "y" ]; then
|
if [ "$payload_grub" = "y" ]; then
|
||||||
|
|
||||||
pname="seagrub"
|
pname="seagrub"
|
||||||
|
|
||||||
mkseagrub
|
mkseagrub
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -444,9 +353,7 @@ add_grub()
|
|||||||
{
|
{
|
||||||
# path in CBFS for the GRUB payload
|
# path in CBFS for the GRUB payload
|
||||||
_grubname="img/grub2"
|
_grubname="img/grub2"
|
||||||
|
|
||||||
if [ "$payload_grubsea" = "y" ]; then
|
if [ "$payload_grubsea" = "y" ]; then
|
||||||
|
|
||||||
_grubname="fallback/payload"
|
_grubname="fallback/payload"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -458,9 +365,7 @@ add_grub()
|
|||||||
|
|
||||||
cbfs "$tmprom" "$xbtmp/tmpcfg" scan.cfg raw
|
cbfs "$tmprom" "$xbtmp/tmpcfg" scan.cfg raw
|
||||||
|
|
||||||
if [ "$initmode" != "normal" ] && \
|
if [ "$initmode" != "normal" ] && [ "$displaymode" != "txtmode" ]; then
|
||||||
[ "$displaymode" != "txtmode" ]; then
|
|
||||||
|
|
||||||
cbfs "$tmprom" "$grubdata/background/background1280x800.png" \
|
cbfs "$tmprom" "$grubdata/background/background1280x800.png" \
|
||||||
"background.png" raw
|
"background.png" raw
|
||||||
fi
|
fi
|
||||||
@@ -469,10 +374,8 @@ add_grub()
|
|||||||
mkseagrub()
|
mkseagrub()
|
||||||
{
|
{
|
||||||
if [ "$payload_grubsea" = "y" ]; then
|
if [ "$payload_grubsea" = "y" ]; then
|
||||||
|
|
||||||
pname="grub"
|
pname="grub"
|
||||||
else
|
else
|
||||||
|
|
||||||
cbfs "$tmprom" "$grubdata/bootorder" bootorder raw
|
cbfs "$tmprom" "$grubdata/bootorder" bootorder raw
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -482,13 +385,10 @@ mkseagrub()
|
|||||||
add_uboot()
|
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
|
||||||
|
|
||||||
@@ -506,22 +406,17 @@ add_uboot()
|
|||||||
|
|
||||||
# override for x86/x86_64 targets:
|
# override for x86/x86_64 targets:
|
||||||
if [ -n "$payload_uboot" ] && [ "$payload_uboot" != "arm64" ]; then
|
if [ -n "$payload_uboot" ] && [ "$payload_uboot" != "arm64" ]; then
|
||||||
|
|
||||||
ubcbfsargs="-l 0x1110000 -e 0x1110000" # 64-bit and 32-bit
|
ubcbfsargs="-l 0x1110000 -e 0x1110000" # 64-bit and 32-bit
|
||||||
# on 64-bit, 0x1120000 is the SPL, with a stub that
|
# on 64-bit, 0x1120000 is the SPL, with a stub that
|
||||||
# loads it, located at 0x1110000
|
# loads it, located at 0x1110000
|
||||||
|
|
||||||
ubpath="img/u-boot" # 64-bit
|
ubpath="img/u-boot" # 64-bit
|
||||||
|
|
||||||
ubtree="x86_64"
|
ubtree="x86_64"
|
||||||
ubtarget="amd64coreboot"
|
ubtarget="amd64coreboot"
|
||||||
|
|
||||||
if [ "$payload_uboot" = "i386" ]; then
|
if [ "$payload_uboot" = "i386" ]
|
||||||
|
then
|
||||||
# override for 32-bit
|
ubpath="u-boot" # 32-bit
|
||||||
|
|
||||||
ubpath="u-boot"
|
|
||||||
|
|
||||||
ubtree="x86"
|
ubtree="x86"
|
||||||
ubtarget="i386coreboot"; :
|
ubtarget="i386coreboot"; :
|
||||||
fi
|
fi
|
||||||
@@ -530,29 +425,20 @@ add_uboot()
|
|||||||
ubdir="elf/u-boot/$ubtree/$ubtarget/$uboot_config"
|
ubdir="elf/u-boot/$ubtree/$ubtarget/$uboot_config"
|
||||||
|
|
||||||
# aarch64 targets:
|
# aarch64 targets:
|
||||||
|
|
||||||
ubootelf="$ubdir/u-boot.elf"
|
ubootelf="$ubdir/u-boot.elf"
|
||||||
|
|
||||||
if [ ! -f "$ubootelf" ]; then
|
if [ ! -f "$ubootelf" ]; then
|
||||||
|
|
||||||
ubootelf="$ubdir/u-boot"
|
ubootelf="$ubdir/u-boot"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# override for x86/x86_64 targets:
|
# override for x86/x86_64 targets:
|
||||||
|
|
||||||
if [ "$payload_uboot" = "i386" ]; then
|
if [ "$payload_uboot" = "i386" ]; then
|
||||||
|
|
||||||
ubootelf="$ubdir/u-boot-dtb.bin"
|
ubootelf="$ubdir/u-boot-dtb.bin"
|
||||||
|
|
||||||
elif [ "$payload_uboot" = "amd64" ]; then
|
elif [ "$payload_uboot" = "amd64" ]; then
|
||||||
|
|
||||||
ubootelf="$ubdir/u-boot-x86-with-spl.bin" # EFI-compatible
|
ubootelf="$ubdir/u-boot-x86-with-spl.bin" # EFI-compatible
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cbfs "$tmprom" "$ubootelf" "$ubpath" $ubcbfsargs
|
cbfs "$tmprom" "$ubootelf" "$ubpath" $ubcbfsargs
|
||||||
|
|
||||||
if [ "$payload_seabios" != "y" ]; then
|
if [ "$payload_seabios" != "y" ]; then
|
||||||
|
|
||||||
cprom
|
cprom
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -567,13 +453,9 @@ cprom()
|
|||||||
newrom="bin/$target/${pname}_${target}_$initmode.rom"
|
newrom="bin/$target/${pname}_${target}_$initmode.rom"
|
||||||
|
|
||||||
if [ -n "$displaymode" ]; then
|
if [ -n "$displaymode" ]; then
|
||||||
|
|
||||||
newrom="${newrom%.rom}_$displaymode.rom"
|
newrom="${newrom%.rom}_$displaymode.rom"
|
||||||
fi
|
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"
|
||||||
fi
|
fi
|
||||||
@@ -581,18 +463,14 @@ cprom()
|
|||||||
irom="$tmprom"
|
irom="$tmprom"
|
||||||
|
|
||||||
if [ $# -gt 0 ]; then
|
if [ $# -gt 0 ]; then
|
||||||
|
|
||||||
irom="$(mktemp || err "!mk irom, $(echo "$@")")" || \
|
irom="$(mktemp || err "!mk irom, $(echo "$@")")" || \
|
||||||
err "can't copy rom" "cprom" "$@"
|
err "can't copy rom" "cprom" "$@"
|
||||||
|
|
||||||
x_ cp "$tmprom" "$irom" && cpcmd="mv"
|
x_ cp "$tmprom" "$irom" && cpcmd="mv"
|
||||||
|
|
||||||
if [ "${1%.gkb}" != "$1" ]; then
|
if [ "${1%.gkb}" != "$1" ]; then
|
||||||
|
|
||||||
cbfs "$irom" "$grubdata/keymap/$tmpnew" keymap.gkb raw
|
cbfs "$irom" "$grubdata/keymap/$tmpnew" keymap.gkb raw
|
||||||
|
|
||||||
elif [ "$1" = "seauboot" ]; then
|
elif [ "$1" = "seauboot" ]; then
|
||||||
|
|
||||||
cbfs "$irom" "$grubdata/bootorder_uboot" bootorder raw
|
cbfs "$irom" "$grubdata/bootorder_uboot" bootorder raw
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -600,7 +478,6 @@ cprom()
|
|||||||
printf "Creating new %s image: '%s'\n" "$projectname" "$newrom"
|
printf "Creating new %s image: '%s'\n" "$projectname" "$newrom"
|
||||||
|
|
||||||
x_ xbmkdir "bin/$target"
|
x_ xbmkdir "bin/$target"
|
||||||
|
|
||||||
x_ $cpcmd "$irom" "$newrom"
|
x_ $cpcmd "$irom" "$newrom"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -609,15 +486,10 @@ cbfs()
|
|||||||
ccmd="add-payload"
|
ccmd="add-payload"
|
||||||
lzma="-c lzma"
|
lzma="-c lzma"
|
||||||
|
|
||||||
if [ $# -gt 3 ] && \
|
if [ $# -gt 3 ] && [ $# -lt 5 ]; then
|
||||||
[ $# -lt 5 ]; then
|
|
||||||
|
|
||||||
ccmd="add"
|
ccmd="add"
|
||||||
lzma="-t $4"
|
lzma="-t $4"
|
||||||
|
elif [ $# -gt 4 ] && [ "$5" = "0x1110000" ]; then
|
||||||
elif [ $# -gt 4 ] && \
|
|
||||||
[ "$5" = "0x1110000" ]; then
|
|
||||||
|
|
||||||
ccmd="add-flat-binary" && \
|
ccmd="add-flat-binary" && \
|
||||||
lzma="-c lzma -l 0x1110000 -e 0x1110000"
|
lzma="-c lzma -l 0x1110000 -e 0x1110000"
|
||||||
fi
|
fi
|
||||||
@@ -632,14 +504,11 @@ mkcoreboottar()
|
|||||||
$if_dry_build \
|
$if_dry_build \
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
if [ "$target" = "$tree" ] || \
|
if [ "$target" = "$tree" ] || [ "$XBMK_RELEASE" != "y" ] || \
|
||||||
[ "$XBMK_RELEASE" != "y" ] || \
|
|
||||||
[ "$release" = "n" ]; then
|
[ "$release" = "n" ]; then
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkrom_tarball "bin/$target"
|
mkrom_tarball "bin/$target"
|
||||||
|
|
||||||
x_ ./mk inject "bin/${relname}_${target}.tar.xz" nuke
|
x_ ./mk inject "bin/${relname}_${target}.tar.xz" nuke
|
||||||
}
|
}
|
||||||
|
|||||||
+33
-190
@@ -57,10 +57,9 @@ trees()
|
|||||||
{
|
{
|
||||||
flags="f:F:b:m:u:c:x:s:l:n:d:"
|
flags="f:F:b:m:u:c:x:s:l:n:d:"
|
||||||
|
|
||||||
while getopts $flags option; do
|
while getopts $flags option
|
||||||
|
do
|
||||||
if [ -n "$flag" ]; then
|
if [ -n "$flag" ]; then
|
||||||
|
|
||||||
err "only one flag is permitted" "trees" "$@"
|
err "only one flag is permitted" "trees" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -70,7 +69,6 @@ trees()
|
|||||||
# ./mk -m coreboot does: make menuconfig -C src/coreboot/tree
|
# ./mk -m coreboot does: make menuconfig -C src/coreboot/tree
|
||||||
|
|
||||||
case "$flag" in
|
case "$flag" in
|
||||||
|
|
||||||
-d)
|
-d)
|
||||||
# -d is similar to -b, except that
|
# -d is similar to -b, except that
|
||||||
# a large number of operations will be
|
# a large number of operations will be
|
||||||
@@ -81,20 +79,13 @@ trees()
|
|||||||
if_dry_build=""
|
if_dry_build=""
|
||||||
if_not_dry_build=":"
|
if_not_dry_build=":"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
-b) : ;;
|
-b) : ;;
|
||||||
|
|
||||||
-u) mode="oldconfig" ;;
|
-u) mode="oldconfig" ;;
|
||||||
|
|
||||||
-m) mode="menuconfig" ;;
|
-m) mode="menuconfig" ;;
|
||||||
|
|
||||||
-c) mode="distclean" ;;
|
-c) mode="distclean" ;;
|
||||||
|
|
||||||
-x) mode="crossgcc-clean" ;;
|
-x) mode="crossgcc-clean" ;;
|
||||||
|
|
||||||
-f|-F) # download source code for a project
|
-f|-F) # download source code for a project
|
||||||
# macros. colon means false.
|
# macros. colon means false.
|
||||||
|
|
||||||
if_do_make=":"
|
if_do_make=":"
|
||||||
if_dry_build=""
|
if_dry_build=""
|
||||||
if_not_do_make=""
|
if_not_do_make=""
|
||||||
@@ -105,19 +96,13 @@ trees()
|
|||||||
forcepull="y"
|
forcepull="y"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
-s) mode="savedefconfig" ;;
|
-s) mode="savedefconfig" ;;
|
||||||
|
|
||||||
-l) mode="olddefconfig" ;;
|
-l) mode="olddefconfig" ;;
|
||||||
|
|
||||||
-n) mode="nconfig" ;;
|
-n) mode="nconfig" ;;
|
||||||
|
|
||||||
*) err "invalid option '-$option'" "trees" "$@" ;;
|
*) err "invalid option '-$option'" "trees" "$@" ;;
|
||||||
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [ -z "${OPTARG+x}" ]; then
|
if [ -z "${OPTARG+x}" ]; then
|
||||||
|
|
||||||
shift 1
|
shift 1
|
||||||
|
|
||||||
break
|
break
|
||||||
@@ -130,17 +115,13 @@ trees()
|
|||||||
done
|
done
|
||||||
|
|
||||||
if [ -z "$flag" ]; then
|
if [ -z "$flag" ]; then
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
@@ -151,26 +132,19 @@ trees()
|
|||||||
dest_dir="$elfdir"
|
dest_dir="$elfdir"
|
||||||
|
|
||||||
listfile="$datadir/build.list"
|
listfile="$datadir/build.list"
|
||||||
|
|
||||||
if [ ! -f "$listfile" ]; then
|
if [ ! -f "$listfile" ]; then
|
||||||
|
|
||||||
listfile="" # build.list is optional on all projects
|
listfile="" # build.list is optional on all projects
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkhelpercfg="$datadir/mkhelper.cfg"
|
mkhelpercfg="$datadir/mkhelper.cfg"
|
||||||
|
|
||||||
if e "$mkhelpercfg" f missing; then
|
if e "$mkhelpercfg" f missing; then
|
||||||
|
|
||||||
mkhelpercfg="$xbtmp/mkhelper.cfg"
|
mkhelpercfg="$xbtmp/mkhelper.cfg"
|
||||||
|
|
||||||
x_ touch "$mkhelpercfg"
|
x_ touch "$mkhelpercfg"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
targets="$*"
|
targets="$*"
|
||||||
cmd="build_targets $targets"
|
cmd="build_targets $targets"
|
||||||
|
|
||||||
if singletree "$project"; then
|
if singletree "$project"; then
|
||||||
|
|
||||||
cmd="build_project"
|
cmd="build_project"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -180,29 +154,22 @@ trees()
|
|||||||
build_project()
|
build_project()
|
||||||
{
|
{
|
||||||
if ! configure_project "$configdir"; then
|
if ! configure_project "$configdir"; then
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
elif [ -f "$listfile" ]; then
|
elif [ -f "$listfile" ]; then
|
||||||
|
|
||||||
if ! $if_not_dry_build elfcheck; then
|
if ! $if_not_dry_build elfcheck; then
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$mode" = "distclean" ]; then
|
if [ "$mode" = "distclean" ]; then
|
||||||
|
|
||||||
mode="clean"
|
mode="clean"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! run_make_command; then
|
if ! run_make_command; then
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$mode" ]; then
|
if [ -z "$mode" ]; then
|
||||||
|
|
||||||
$if_not_dry_build \
|
$if_not_dry_build \
|
||||||
copy_elf; :
|
copy_elf; :
|
||||||
fi
|
fi
|
||||||
@@ -211,22 +178,18 @@ build_project()
|
|||||||
build_targets()
|
build_targets()
|
||||||
{
|
{
|
||||||
if [ ! -d "$configdir" ]; then
|
if [ ! -d "$configdir" ]; then
|
||||||
|
|
||||||
err "directory '$configdir' doesn't exist" "build_targets" "$@"
|
err "directory '$configdir' doesn't exist" "build_targets" "$@"
|
||||||
|
|
||||||
elif [ $# -lt 1 ]; then
|
elif [ $# -lt 1 ]; then
|
||||||
|
|
||||||
targets="$(ls -1 "$configdir")" || \
|
targets="$(ls -1 "$configdir")" || \
|
||||||
err "'$configdir': can't list targets" "build_targets" "$@"
|
err "'$configdir': can't list targets" "build_targets" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for x in $targets; do
|
for x in $targets
|
||||||
|
do
|
||||||
unset CROSS_COMPILE
|
unset CROSS_COMPILE
|
||||||
export PATH="$xbmkpath"
|
export PATH="$xbmkpath"
|
||||||
|
|
||||||
if [ "$x" = "list" ]; then
|
if [ "$x" = "list" ]; then
|
||||||
|
|
||||||
x_ ls -1 "config/$project"
|
x_ ls -1 "config/$project"
|
||||||
|
|
||||||
listfile=""
|
listfile=""
|
||||||
@@ -241,7 +204,6 @@ build_targets()
|
|||||||
x_ handle_defconfig
|
x_ handle_defconfig
|
||||||
|
|
||||||
if [ -z "$mode" ]; then
|
if [ -z "$mode" ]; then
|
||||||
|
|
||||||
x_ $postmake
|
x_ $postmake
|
||||||
fi
|
fi
|
||||||
done; :
|
done; :
|
||||||
@@ -252,54 +214,39 @@ handle_defconfig()
|
|||||||
target_dir="$configdir/$target"
|
target_dir="$configdir/$target"
|
||||||
|
|
||||||
if [ ! -f "CHANGELOG" ]; then
|
if [ ! -f "CHANGELOG" ]; then
|
||||||
|
|
||||||
fetch_project "$project"
|
fetch_project "$project"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! configure_project "$target_dir"; then
|
if ! configure_project "$target_dir"; then
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$tree" ]; then
|
if [ -z "$tree" ]; then
|
||||||
|
|
||||||
err "$configdir: 'tree' not set" "handle_defconfig" "$@"
|
err "$configdir: 'tree' not set" "handle_defconfig" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
srcdir="src/$project/$tree"
|
srcdir="src/$project/$tree"
|
||||||
|
|
||||||
if [ "$mode" = "${mode%clean}" ] && \
|
if [ "$mode" = "${mode%clean}" ] && [ ! -d "$srcdir" ]; then
|
||||||
[ ! -d "$srcdir" ]; then
|
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for y in "$target_dir/config"/*; do
|
for y in "$target_dir/config"/*
|
||||||
|
do
|
||||||
if [ "$flag" != "-d" ] && \
|
if [ "$flag" != "-d" ] && [ ! -f "$y" ]; then
|
||||||
[ ! -f "$y" ]; then
|
|
||||||
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
elif [ "$flag" != "-d" ]; then
|
elif [ "$flag" != "-d" ]; then
|
||||||
|
|
||||||
defconfig="$y"
|
defconfig="$y"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$mode" ]; then
|
if [ -z "$mode" ]; then
|
||||||
|
|
||||||
check_defconfig || continue; :
|
check_defconfig || continue; :
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$mode" ]; then
|
if [ -z "$mode" ]; then
|
||||||
|
|
||||||
for _xarch in $xarch; do
|
for _xarch in $xarch; do
|
||||||
|
|
||||||
$if_dry_build \
|
$if_dry_build \
|
||||||
break
|
break
|
||||||
|
|
||||||
if [ -n "$_xarch" ]; then
|
if [ -n "$_xarch" ]; then
|
||||||
|
|
||||||
check_cross_compiler "$_xarch"
|
check_cross_compiler "$_xarch"
|
||||||
fi
|
fi
|
||||||
done; :
|
done; :
|
||||||
@@ -308,7 +255,6 @@ handle_defconfig()
|
|||||||
handle_makefile
|
handle_makefile
|
||||||
|
|
||||||
if [ -z "$mode" ]; then
|
if [ -z "$mode" ]; then
|
||||||
|
|
||||||
$if_not_dry_build \
|
$if_not_dry_build \
|
||||||
copy_elf
|
copy_elf
|
||||||
fi
|
fi
|
||||||
@@ -317,7 +263,7 @@ handle_defconfig()
|
|||||||
|
|
||||||
configure_project()
|
configure_project()
|
||||||
{
|
{
|
||||||
tcfg="$1/target.cfg"
|
_tcfg="$1/target.cfg"
|
||||||
|
|
||||||
autoconfargs=""
|
autoconfargs=""
|
||||||
badhash=""
|
badhash=""
|
||||||
@@ -335,15 +281,13 @@ configure_project()
|
|||||||
xgcctree=""
|
xgcctree=""
|
||||||
xlang=""
|
xlang=""
|
||||||
|
|
||||||
if [ ! -f "$tcfg" ]; then
|
if [ ! -f "$_tcfg" ]; then
|
||||||
|
|
||||||
buildtype="auto"
|
buildtype="auto"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# globally initialise all variables for a source tree / target:
|
# globally initialise all variables for a source tree / target:
|
||||||
|
|
||||||
if e "$datadir/mkhelper.cfg" f; 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'" \
|
||||||
"configure_project" "$@"
|
"configure_project" "$@"
|
||||||
@@ -351,9 +295,8 @@ configure_project()
|
|||||||
|
|
||||||
# override target/tree specific variables from per-target config:
|
# override target/tree specific variables from per-target config:
|
||||||
|
|
||||||
while e "$tcfg" f || \
|
while e "$_tcfg" f || [ "$cmd" != "build_project" ]
|
||||||
[ "$cmd" != "build_project" ]; do
|
do
|
||||||
|
|
||||||
# TODO: implement infinite loop detection here, caused
|
# TODO: implement infinite loop detection here, caused
|
||||||
# by project targets pointing to other targets/trees
|
# by project targets pointing to other targets/trees
|
||||||
# when then ultimate point back repeatedly; this is
|
# when then ultimate point back repeatedly; this is
|
||||||
@@ -361,78 +304,59 @@ configure_project()
|
|||||||
# temporary files per tree/target name could be created
|
# temporary files per tree/target name could be created
|
||||||
# per iteration, and then checked the next time
|
# per iteration, and then checked the next time
|
||||||
|
|
||||||
printf "Loading %s config: %s\n" "$project" "$tcfg"
|
printf "Loading %s config: %s\n" "$project" "$_tcfg"
|
||||||
|
|
||||||
rev=""
|
rev=""
|
||||||
tree=""
|
tree=""
|
||||||
|
|
||||||
. "$tcfg" || \
|
. "$_tcfg" || \
|
||||||
err "Can't read '$tcfg'" "configure_project" "$@"
|
err "Can't read '$_tcfg'" "configure_project" "$@"
|
||||||
|
|
||||||
if [ "$flag" = "-d" ]; then
|
if [ "$flag" = "-d" ]; then
|
||||||
|
|
||||||
build_depend="" # dry run
|
build_depend="" # dry run
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$cmd" = "build_project" ]; then
|
if [ "$cmd" = "build_project" ]; then
|
||||||
|
|
||||||
# single-tree, so it can't be a target pointing
|
# single-tree, so it can't be a target pointing
|
||||||
# to a main source tree
|
# to a main source tree
|
||||||
|
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
|
||||||
$if_do_make \
|
$if_do_make \
|
||||||
break
|
break
|
||||||
|
if [ "${_tcfg%/*/target.cfg}" = "${_tcfg%"/$tree/target.cfg"}" ]
|
||||||
if [ "${tcfg%/*/target.cfg}" = "${tcfg%"/$tree/target.cfg"}" ]
|
|
||||||
then
|
then
|
||||||
|
|
||||||
# we have found the main source tree that
|
# we have found the main source tree that
|
||||||
# a given target uses; no need to continue
|
# a given target uses; no need to continue
|
||||||
|
|
||||||
break
|
break
|
||||||
|
|
||||||
else
|
else
|
||||||
|
_tcfg="${_tcfg%/*/target.cfg}/$tree/target.cfg"
|
||||||
tcfg="${tcfg%/*/target.cfg}/$tree/target.cfg"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ "$XBMK_RELEASE" = "y" ] && \
|
if [ "$XBMK_RELEASE" = "y" ] && [ "$release" = "n" ]; then
|
||||||
[ "$release" = "n" ]; then
|
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
if [ -n "$buildtype" ] && [ "${mode%config}" != "$mode" ]; then
|
||||||
if [ -n "$buildtype" ] && \
|
|
||||||
[ "${mode%config}" != "$mode" ]; then
|
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$mode" ]; then
|
if [ -z "$mode" ]; then
|
||||||
|
|
||||||
$if_not_dry_build \
|
$if_not_dry_build \
|
||||||
build_dependencies
|
build_dependencies
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mdir="$xbmkpwd/config/submodule/$project"
|
mdir="$xbmkpwd/config/submodule/$project"
|
||||||
|
|
||||||
if [ -n "$tree" ]; then
|
if [ -n "$tree" ]; then
|
||||||
|
|
||||||
mdir="$mdir/$tree"
|
mdir="$mdir/$tree"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f "CHANGELOG" ]; then
|
if [ ! -f "CHANGELOG" ]; then
|
||||||
|
|
||||||
delete_old_project_files
|
delete_old_project_files
|
||||||
|
|
||||||
$if_not_do_make \
|
$if_not_do_make \
|
||||||
fetch_${cmd#build_}
|
fetch_${cmd#build_}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
$if_not_do_make \
|
$if_not_do_make \
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
@@ -444,25 +368,20 @@ configure_project()
|
|||||||
|
|
||||||
build_dependencies()
|
build_dependencies()
|
||||||
{
|
{
|
||||||
for bd in $build_depend; do
|
for bd in $build_depend
|
||||||
|
do
|
||||||
bd_project="${bd%%/*}"
|
bd_project="${bd%%/*}"
|
||||||
bd_tree="${bd##*/}"
|
bd_tree="${bd##*/}"
|
||||||
|
|
||||||
if [ -z "$bd_project" ]; then
|
if [ -z "$bd_project" ]; then
|
||||||
|
|
||||||
$if_not_dry_build \
|
$if_not_dry_build \
|
||||||
err "$project/$tree: !bd '$bd'" \
|
err "$project/$tree: !bd '$bd'" \
|
||||||
"build_dependencies" "$@"
|
"build_dependencies" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${bd##*/}" = "$bd" ]; then
|
if [ "${bd##*/}" = "$bd" ]; then
|
||||||
|
|
||||||
bd_tree=""
|
bd_tree=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$bd_project" ]; then
|
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
|
fi
|
||||||
@@ -482,16 +401,13 @@ delete_old_project_files()
|
|||||||
# delete an entire source tree along with its builds:
|
# delete an entire source tree along with its builds:
|
||||||
if ! project_up_to_date hash "$tree" badhash "$datadir" \
|
if ! project_up_to_date hash "$tree" badhash "$datadir" \
|
||||||
"$configdir/$tree" "$mdir"; then
|
"$configdir/$tree" "$mdir"; then
|
||||||
|
|
||||||
x_ rm -Rf "src/$project/$tree" "elf/$project/$tree"
|
x_ rm -Rf "src/$project/$tree" "elf/$project/$tree"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
x_ cp "$xbtmp/new.hash" "$XBMK_CACHE/hash/$project$tree"
|
x_ cp "$xbtmp/new.hash" "$XBMK_CACHE/hash/$project$tree"
|
||||||
|
|
||||||
if singletree "$project" || \
|
if singletree "$project" || [ -z "$target" ] || [ "$target" = "$tree" ]
|
||||||
[ -z "$target" ] || \
|
then
|
||||||
[ "$target" = "$tree" ]; then
|
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -501,7 +417,6 @@ delete_old_project_files()
|
|||||||
|
|
||||||
if ! project_up_to_date tghash "$target" badtghash "$configdir/$target"
|
if ! project_up_to_date tghash "$target" badtghash "$configdir/$target"
|
||||||
then
|
then
|
||||||
|
|
||||||
x_ rm -Rf "elf/$project/$tree/$target"
|
x_ rm -Rf "elf/$project/$tree/$target"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -522,7 +437,6 @@ project_up_to_date()
|
|||||||
x_ xbmkdir "$XBMK_CACHE/$hashdir"
|
x_ xbmkdir "$XBMK_CACHE/$hashdir"
|
||||||
|
|
||||||
if [ -f "$XBMK_CACHE/$hashdir/$project$hashname" ]; then
|
if [ -f "$XBMK_CACHE/$hashdir/$project$hashname" ]; then
|
||||||
|
|
||||||
read -r old_hash < "$XBMK_CACHE/$hashdir/$project$hashname" \
|
read -r old_hash < "$XBMK_CACHE/$hashdir/$project$hashname" \
|
||||||
|| err \
|
|| err \
|
||||||
"$hashdir: err '$XBMK_CACHE/$hashdir/$project$hashname'" \
|
"$hashdir: err '$XBMK_CACHE/$hashdir/$project$hashname'" \
|
||||||
@@ -531,7 +445,6 @@ project_up_to_date()
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
build_sbase
|
build_sbase
|
||||||
|
|
||||||
fx_ "x_ util/sbase/sha512sum" find "$@" -type f -not -path \
|
fx_ "x_ util/sbase/sha512sum" find "$@" -type f -not -path \
|
||||||
"*/.git*/*" | awk '{print $1}' > "$xbtmp/tmp.hash" || \
|
"*/.git*/*" | awk '{print $1}' > "$xbtmp/tmp.hash" || \
|
||||||
err "!h $project $hashdir" \
|
err "!h $project $hashdir" \
|
||||||
@@ -543,7 +456,6 @@ project_up_to_date()
|
|||||||
|
|
||||||
if [ "$hash" != "$old_hash" ] || \
|
if [ "$hash" != "$old_hash" ] || \
|
||||||
[ ! -f "$XBMK_CACHE/$hashdir/$project$hashname" ]; then
|
[ ! -f "$XBMK_CACHE/$hashdir/$project$hashname" ]; then
|
||||||
|
|
||||||
eval "$badhashvar=\"y\""
|
eval "$badhashvar=\"y\""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -559,19 +471,15 @@ check_cross_compiler()
|
|||||||
cbdir="src/coreboot/$tree"
|
cbdir="src/coreboot/$tree"
|
||||||
|
|
||||||
if [ "$project" != "coreboot" ]; then
|
if [ "$project" != "coreboot" ]; then
|
||||||
|
|
||||||
cbdir="src/coreboot/default"
|
cbdir="src/coreboot/default"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$xgcctree" ]; then
|
if [ -n "$xgcctree" ]; then
|
||||||
|
|
||||||
cbdir="src/coreboot/$xgcctree"
|
cbdir="src/coreboot/$xgcctree"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
xfix="${1%-*}"
|
xfix="${1%-*}"
|
||||||
|
|
||||||
if [ "$xfix" = "x86_64" ]; then
|
if [ "$xfix" = "x86_64" ]; then
|
||||||
|
|
||||||
xfix="x64"
|
xfix="x64"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -579,55 +487,39 @@ check_cross_compiler()
|
|||||||
xgccargs="crossgcc-$xfix UPDATED_SUBMODULES=1 CPUS=$XBMK_THREADS"
|
xgccargs="crossgcc-$xfix UPDATED_SUBMODULES=1 CPUS=$XBMK_THREADS"
|
||||||
|
|
||||||
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?
|
||||||
|
|
||||||
export PATH="$xbmkpwd/$cbdir/util/crossgcc/xgcc/bin:$PATH"
|
export PATH="$xbmkpwd/$cbdir/util/crossgcc/xgcc/bin:$PATH"
|
||||||
|
|
||||||
export CROSS_COMPILE="${xarch% *}-"
|
export CROSS_COMPILE="${xarch% *}-"
|
||||||
|
|
||||||
if [ -n "$xlang" ]; then
|
if [ -n "$xlang" ]; then
|
||||||
|
|
||||||
export BUILD_LANGUAGES="$xlang"
|
export BUILD_LANGUAGES="$xlang"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "$xgccfile" ]; then
|
if [ -f "$xgccfile" ]; then
|
||||||
|
|
||||||
# skip the build, because a build already exists:
|
# skip the build, because a build already exists:
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
check_gnu_path gcc gnat || x_ check_gnu_path gnat gcc
|
check_gnu_path gcc gnat || x_ check_gnu_path gnat gcc
|
||||||
|
|
||||||
# try twice because xgcc sometimes fails for, like, no reason
|
|
||||||
#
|
|
||||||
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:
|
# this tells subsequent runs that the build was already done:
|
||||||
#
|
|
||||||
x_ touch "$xgccfile"
|
x_ touch "$xgccfile"
|
||||||
|
|
||||||
# reset hostcc in PATH:
|
# reset hostcc in PATH:
|
||||||
#
|
|
||||||
remkdir "$xbtmp/gnupath"
|
remkdir "$xbtmp/gnupath"
|
||||||
}
|
}
|
||||||
|
|
||||||
# host toolchain version correction:
|
|
||||||
|
|
||||||
# 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,
|
||||||
# trixie/sid had gnat-13 as gnat and gcc-14 as gcc, but has gnat-14 in apt. in
|
# trixie/sid had gnat-13 as gnat and gcc-14 as gcc, but has gnat-14 in apt. in
|
||||||
# some cases, gcc 13+14 and gnat-13 are present; or gnat-14 and gcc-14, but
|
# some cases, gcc 13+14 and gnat-13 are present; or gnat-14 and gcc-14, but
|
||||||
# gnat in PATH never resolves to gnat-14, because gnat-14 was "experimental"
|
# gnat in PATH never resolves to gnat-14, because gnat-14 was "experimental"
|
||||||
|
|
||||||
# note that this was implemented for debian trixie-testing, but this same
|
|
||||||
# issue will likely occur in future distros, including newer debian testing
|
|
||||||
# releases. this just matches up the versions of each toolchain component.
|
|
||||||
|
|
||||||
check_gnu_path()
|
check_gnu_path()
|
||||||
{
|
{
|
||||||
if ! command -v "$1" 1>/dev/null; then
|
if ! command -v "$1" 1>/dev/null; then
|
||||||
|
|
||||||
err "Host '$1' unavailable" "check_gnu_path" "$@"
|
err "Host '$1' unavailable" "check_gnu_path" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -639,11 +531,8 @@ check_gnu_path()
|
|||||||
gnatver=""
|
gnatver=""
|
||||||
|
|
||||||
if host_gcc_gnat_match "$@"; then
|
if host_gcc_gnat_match "$@"; then
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
elif ! match_gcc_gnat_versions "$@"; then
|
elif ! match_gcc_gnat_versions "$@"; then
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -653,47 +542,39 @@ check_gnu_path()
|
|||||||
host_gcc_gnat_match()
|
host_gcc_gnat_match()
|
||||||
{
|
{
|
||||||
if ! gnu_setver "$1" "$1"; then
|
if ! gnu_setver "$1" "$1"; then
|
||||||
|
|
||||||
err "Command '$1' unavailable." "check_gnu_path" "$@"
|
err "Command '$1' unavailable." "check_gnu_path" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
gnu_setver "$2" "$2" || :
|
gnu_setver "$2" "$2" || :
|
||||||
|
|
||||||
eval "[ -z \"\$$1ver\" ] && err \"Cannot detect host '$1' version\""
|
eval "[ -z \"\$$1ver\" ] && err \"Cannot detect host '$1' version\""
|
||||||
|
|
||||||
if [ "$gnatfull" != "$gccfull" ]; then
|
if [ "$gnatfull" != "$gccfull" ]; then
|
||||||
|
# non-matching gcc/gnat versions
|
||||||
# non-matching host gcc/gnat versions
|
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# find all host gcc/gnat versions, matching them up in PATH:
|
# find all gcc/gnat versions, matching them up in PATH:
|
||||||
|
|
||||||
match_gcc_gnat_versions()
|
match_gcc_gnat_versions()
|
||||||
{
|
{
|
||||||
eval "$1dir=\"$(dirname "$(command -v "$1")")\""
|
eval "$1dir=\"$(dirname "$(command -v "$1")")\""
|
||||||
|
|
||||||
eval "_gnudir=\"\$$1dir\""
|
eval "_gnudir=\"\$$1dir\""
|
||||||
eval "_gnuver=\"\$$1ver\""
|
eval "_gnuver=\"\$$1ver\""
|
||||||
|
|
||||||
for _bin in "$_gnudir/$2-"*; do
|
for _bin in "$_gnudir/$2-"*
|
||||||
|
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-"}"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if ! gnu_setver "$2" "$_gnudir/$2-$_gnuver"; then
|
if ! gnu_setver "$2" "$_gnudir/$2-$_gnuver"; then
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
elif [ "$gnatfull" != "$gccfull" ]; then
|
elif [ "$gnatfull" != "$gccfull" ]; then
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -712,12 +593,10 @@ link_gcc_gnat_versions()
|
|||||||
|
|
||||||
x_ cd "$xbtmp/gnupath"
|
x_ cd "$xbtmp/gnupath"
|
||||||
|
|
||||||
for _gnubin in "$_gnudir/$2"*"-$_gnuver"; do
|
for _gnubin in "$_gnudir/$2"*"-$_gnuver"
|
||||||
|
do
|
||||||
_gnuutil="${_gnubin##*/}"
|
_gnuutil="${_gnubin##*/}"
|
||||||
|
|
||||||
if [ -e "$_gnubin" ]; then
|
if [ -e "$_gnubin" ]; then
|
||||||
|
|
||||||
x_ ln -s "$_gnubin" "${_gnuutil%"-$_gnuver"}"
|
x_ ln -s "$_gnubin" "${_gnuutil%"-$_gnuver"}"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@@ -738,7 +617,6 @@ gnu_setver()
|
|||||||
check_defconfig()
|
check_defconfig()
|
||||||
{
|
{
|
||||||
if [ ! -f "$defconfig" ]; then
|
if [ ! -f "$defconfig" ]; then
|
||||||
|
|
||||||
$if_not_dry_build \
|
$if_not_dry_build \
|
||||||
err "$project/$target: no config" "check_defconfig" "$@"
|
err "$project/$target: no config" "check_defconfig" "$@"
|
||||||
fi
|
fi
|
||||||
@@ -749,9 +627,7 @@ check_defconfig()
|
|||||||
|
|
||||||
$if_dry_build \
|
$if_dry_build \
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
if ! elfcheck; then
|
if ! elfcheck; then
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -760,23 +636,17 @@ elfcheck()
|
|||||||
{
|
{
|
||||||
# TODO: *STILL* very hacky check. do it properly (based on build.list)
|
# TODO: *STILL* very hacky check. do it properly (based on build.list)
|
||||||
|
|
||||||
# extremely hacky check that glues the entire universe together
|
|
||||||
|
|
||||||
# beware demons
|
|
||||||
|
|
||||||
( fx_ "eval exit 1 && err" find "$dest_dir" -type f ) || return 1; :
|
( fx_ "eval exit 1 && err" find "$dest_dir" -type f ) || return 1; :
|
||||||
}
|
}
|
||||||
|
|
||||||
handle_makefile()
|
handle_makefile()
|
||||||
{
|
{
|
||||||
if $if_not_dry_build check_makefile "$srcdir"; then
|
if $if_not_dry_build check_makefile "$srcdir"; then
|
||||||
|
|
||||||
$if_not_dry_build \
|
$if_not_dry_build \
|
||||||
x_ make -C "$srcdir" $cleanargs clean
|
x_ make -C "$srcdir" $cleanargs clean
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "$defconfig" ]; then
|
if [ -f "$defconfig" ]; then
|
||||||
|
|
||||||
x_ cp "$defconfig" "$srcdir/.config"
|
x_ cp "$defconfig" "$srcdir/.config"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -786,20 +656,16 @@ handle_makefile()
|
|||||||
_copy=".config"
|
_copy=".config"
|
||||||
|
|
||||||
if [ "$mode" = "savedefconfig" ]; then
|
if [ "$mode" = "savedefconfig" ]; then
|
||||||
|
|
||||||
_copy="defconfig"
|
_copy="defconfig"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${mode%config}" != "$mode" ]; then
|
if [ "${mode%config}" != "$mode" ]; then
|
||||||
|
|
||||||
$if_not_dry_build \
|
$if_not_dry_build \
|
||||||
x_ cp "$srcdir/$_copy" "$defconfig"; :
|
x_ cp "$srcdir/$_copy" "$defconfig"; :
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -e "$srcdir/.git" ] && \
|
if [ -e "$srcdir/.git" ] && [ "$project" = "u-boot" ] && \
|
||||||
[ "$project" = "u-boot" ] && \
|
|
||||||
[ "$mode" = "distclean" ]; then
|
[ "$mode" = "distclean" ]; then
|
||||||
|
|
||||||
$if_not_dry_build \
|
$if_not_dry_build \
|
||||||
x_ git -C "$srcdir" $cleanargs clean -fdx; :
|
x_ git -C "$srcdir" $cleanargs clean -fdx; :
|
||||||
fi
|
fi
|
||||||
@@ -812,16 +678,12 @@ run_make_command()
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if $if_not_dry_build check_cmake "$srcdir"; then
|
if $if_not_dry_build check_cmake "$srcdir"; then
|
||||||
|
|
||||||
if [ -z "$mode" ]; then
|
if [ -z "$mode" ]; then
|
||||||
|
|
||||||
$if_not_dry_build \
|
$if_not_dry_build \
|
||||||
check_autoconf "$srcdir"
|
check_autoconf "$srcdir"
|
||||||
fi
|
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
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -829,22 +691,17 @@ run_make_command()
|
|||||||
x_ make -C "$srcdir" $mode -j$XBMK_THREADS $makeargs
|
x_ make -C "$srcdir" $mode -j$XBMK_THREADS $makeargs
|
||||||
|
|
||||||
if [ -z "$mode" ]; then
|
if [ -z "$mode" ]; then
|
||||||
|
|
||||||
x_ $mkhelper
|
x_ $mkhelper
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! check_makefile "$srcdir"; then
|
if ! check_makefile "$srcdir"; then
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$mode" = "clean" ]; then
|
if [ "$mode" = "clean" ]; then
|
||||||
|
|
||||||
$if_dry_build \
|
$if_dry_build \
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
if ! make -C "$srcdir" $cleanargs distclean; then
|
if ! make -C "$srcdir" $cleanargs distclean; then
|
||||||
|
|
||||||
x_ make -C "$srcdir" $cleanargs clean
|
x_ make -C "$srcdir" $cleanargs clean
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -854,18 +711,13 @@ check_cmake()
|
|||||||
{
|
{
|
||||||
$if_dry_build \
|
$if_dry_build \
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
if [ ! -n "$cmakedir" ]; then
|
if [ ! -n "$cmakedir" ]; then
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
elif ! check_makefile "$1"; then
|
elif ! check_makefile "$1"; then
|
||||||
|
|
||||||
if ! cmake -B "$1" "$1/$cmakedir"; then
|
if ! cmake -B "$1" "$1/$cmakedir"; then
|
||||||
|
|
||||||
x_ check_makefile "$1"
|
x_ check_makefile "$1"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
x_ check_makefile "$1"; :
|
x_ check_makefile "$1"; :
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -875,17 +727,12 @@ check_autoconf()
|
|||||||
x_ cd "$1"
|
x_ cd "$1"
|
||||||
|
|
||||||
if [ -f "bootstrap" ]; then
|
if [ -f "bootstrap" ]; then
|
||||||
|
|
||||||
x_ ./bootstrap $bootstrapargs
|
x_ ./bootstrap $bootstrapargs
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "autogen.sh" ]; then
|
if [ -f "autogen.sh" ]; then
|
||||||
|
|
||||||
x_ ./autogen.sh $autogenargs
|
x_ ./autogen.sh $autogenargs
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "configure" ]; then
|
if [ -f "configure" ]; then
|
||||||
|
|
||||||
x_ ./configure $autoconfargs; :
|
x_ ./configure $autoconfargs; :
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -894,8 +741,7 @@ check_autoconf()
|
|||||||
|
|
||||||
check_makefile()
|
check_makefile()
|
||||||
{
|
{
|
||||||
if [ ! -f "$1/Makefile" ] && \
|
if [ ! -f "$1/Makefile" ] && [ ! -f "$1/makefile" ] && \
|
||||||
[ ! -f "$1/makefile" ] && \
|
|
||||||
[ ! -f "$1/GNUmakefile" ]; then
|
[ ! -f "$1/GNUmakefile" ]; then
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
@@ -905,16 +751,13 @@ check_makefile()
|
|||||||
copy_elf()
|
copy_elf()
|
||||||
{
|
{
|
||||||
if [ -f "$listfile" ]; then
|
if [ -f "$listfile" ]; then
|
||||||
|
|
||||||
x_ xbmkdir "$dest_dir"
|
x_ xbmkdir "$dest_dir"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "$listfile" ]; then
|
if [ -f "$listfile" ]; then
|
||||||
|
while read -r f
|
||||||
while read -r f; do
|
do
|
||||||
|
|
||||||
if [ -f "$srcdir/$f" ]; then
|
if [ -f "$srcdir/$f" ]; then
|
||||||
|
|
||||||
x_ cp "$srcdir/$f" "$dest_dir"
|
x_ cp "$srcdir/$f" "$dest_dir"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
+22
-202
@@ -101,7 +101,6 @@ XBMKmecleaner=""
|
|||||||
download()
|
download()
|
||||||
{
|
{
|
||||||
if [ $# -lt 1 ]; then
|
if [ $# -lt 1 ]; then
|
||||||
|
|
||||||
err "No argument given" "download" "$@"
|
err "No argument given" "download" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -109,7 +108,6 @@ download()
|
|||||||
board="$1"
|
board="$1"
|
||||||
|
|
||||||
if check_target; then
|
if check_target; then
|
||||||
|
|
||||||
readkconfig download
|
readkconfig download
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -117,63 +115,44 @@ download()
|
|||||||
getfiles()
|
getfiles()
|
||||||
{
|
{
|
||||||
if [ -n "$CONFIG_HAVE_ME_BIN" ];then
|
if [ -n "$CONFIG_HAVE_ME_BIN" ];then
|
||||||
|
|
||||||
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
|
fi
|
||||||
|
|
||||||
if [ -n "$CONFIG_INCLUDE_SMSC_SCH5545_EC_FW" ]; then
|
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
|
fi
|
||||||
|
|
||||||
if [ -n "$CONFIG_KBC1126_FW1" ]; then
|
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
|
fi
|
||||||
|
|
||||||
if [ -n "$CONFIG_KBC1126_FW2" ]; then
|
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
|
fi
|
||||||
|
|
||||||
if [ -n "$CONFIG_VGA_BIOS_FILE" ]; then
|
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
|
fi
|
||||||
|
|
||||||
if [ -n "$CONFIG_HAVE_MRC" ]; then
|
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
|
fi
|
||||||
|
|
||||||
if [ -n "$CONFIG_REFCODE_BLOB_FILE" ]; then
|
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
|
fi
|
||||||
|
|
||||||
if [ -n "$CONFIG_LENOVO_TBFW_BIN" ]; then
|
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
|
fi
|
||||||
|
|
||||||
if [ -n "$CONFIG_FSP_M_FILE" ]; then
|
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
|
fi
|
||||||
|
|
||||||
if [ -n "$CONFIG_FSP_S_FILE" ]; then
|
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
|
fi
|
||||||
@@ -191,7 +170,6 @@ fetch()
|
|||||||
binsum="$7"
|
binsum="$7"
|
||||||
|
|
||||||
if [ -z "$binsum" ]; then
|
if [ -z "$binsum" ]; then
|
||||||
|
|
||||||
err "binsum is empty (no checksum)" "fetch" "$@"
|
err "binsum is empty (no checksum)" "fetch" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -199,29 +177,23 @@ fetch()
|
|||||||
_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
|
if [ "$5" = "/dev/null" ]; then
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
fi
|
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
|
||||||
|
|
||||||
remkdir "${_pre_dest%/*}" "$appdir"
|
remkdir "${_pre_dest%/*}" "$appdir"
|
||||||
|
|
||||||
# HACK: if grabbing fsp from coreboot, fix the path for lbmk:
|
# HACK: if grabbing fsp from coreboot, fix the path for lbmk
|
||||||
|
if [ "$dl_type" = "fsp" ]
|
||||||
if [ "$dl_type" = "fsp" ]; then
|
then
|
||||||
|
|
||||||
dl="${dl##*../}"
|
dl="${dl##*../}"
|
||||||
_cdp="$dl"
|
_cdp="$dl"
|
||||||
|
|
||||||
if [ ! -f "$_cdp" ]; then
|
if [ ! -f "$_cdp" ]; then
|
||||||
|
|
||||||
_cdp="$cbdir/$_cdp"
|
_cdp="$cbdir/$_cdp"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "$_cdp" ]; then
|
if [ -f "$_cdp" ]; then
|
||||||
|
|
||||||
dl="$_cdp"
|
dl="$_cdp"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -229,12 +201,9 @@ fetch()
|
|||||||
_cdp="$dl_bkup"
|
_cdp="$dl_bkup"
|
||||||
|
|
||||||
if [ ! -f "$_cdp" ]; then
|
if [ ! -f "$_cdp" ]; then
|
||||||
|
|
||||||
_cdp="$cbdir/$_cdp"
|
_cdp="$cbdir/$_cdp"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "$_cdp" ]; then
|
if [ -f "$_cdp" ]; then
|
||||||
|
|
||||||
dl_bkup="$_cdp"; :
|
dl_bkup="$_cdp"; :
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -247,50 +216,39 @@ 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
|
if [ -f "$_dest" ]; then
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
x_ xbmkdir "${_dest%/*}"
|
x_ xbmkdir "${_dest%/*}"
|
||||||
|
|
||||||
if [ "$dl_type" != "fsp" ]; then
|
if [ "$dl_type" != "fsp" ]; then
|
||||||
|
|
||||||
extract_archive "$_dl" "$appdir" || \
|
extract_archive "$_dl" "$appdir" || \
|
||||||
[ "$dl_type" = "e6400vga" ] || \
|
[ "$dl_type" = "e6400vga" ] || \
|
||||||
err "$_dest $dl_type: !extract" "fetch" "$@"
|
err "$_dest $dl_type: !extract" "fetch" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
x_ extract_$dl_type "$_dl" "$appdir"
|
x_ extract_$dl_type "$_dl" "$appdir"
|
||||||
|
|
||||||
set -u -e
|
set -u -e
|
||||||
|
|
||||||
# some functions don't output directly to the given file, _pre_dest.
|
# some functions don't output directly to the given file, _pre_dest.
|
||||||
# instead, they put multiple files there, but we need the one matching
|
# instead, they put multiple files there, but we need the one matching
|
||||||
# the given hashsum. So, search for a matching file via bruteforce:
|
# the given hashsum. So, search for a matching file via bruteforce:
|
||||||
|
|
||||||
( 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
|
if [ -f "$_dest" ]; then
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$binsum" ]; then
|
if [ -z "$binsum" ]; then
|
||||||
|
|
||||||
printf "'%s': checksum undefined\n" "$_dest" 1>&2
|
printf "'%s': checksum undefined\n" "$_dest" 1>&2
|
||||||
fi
|
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
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
x_ rm -f "$_dest"
|
x_ rm -f "$_dest"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -300,11 +258,8 @@ fetch()
|
|||||||
mkdst()
|
mkdst()
|
||||||
{
|
{
|
||||||
if bad_checksum "$1" "$2" 2>/dev/null; then
|
if bad_checksum "$1" "$2" 2>/dev/null; then
|
||||||
|
|
||||||
x_ rm -f "$2"
|
x_ rm -f "$2"
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
x_ mv "$2" "$_dl_bin"
|
x_ mv "$2" "$_dl_bin"
|
||||||
x_ cp "$_dl_bin" "$_dest"
|
x_ cp "$_dl_bin" "$_dest"
|
||||||
|
|
||||||
@@ -315,12 +270,10 @@ mkdst()
|
|||||||
extract_intel_me()
|
extract_intel_me()
|
||||||
{
|
{
|
||||||
if e "$mecleaner" f missing; then
|
if e "$mecleaner" f missing; then
|
||||||
|
|
||||||
err "$cbdir: me_cleaner missing" "extract_intel_me" "$@"
|
err "$cbdir: me_cleaner missing" "extract_intel_me" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mfs=""
|
mfs=""
|
||||||
|
|
||||||
_7ztest="$xbtmp/metmp/a"
|
_7ztest="$xbtmp/metmp/a"
|
||||||
_metmp="$xbtmp/me.bin"
|
_metmp="$xbtmp/me.bin"
|
||||||
|
|
||||||
@@ -328,26 +281,17 @@ extract_intel_me()
|
|||||||
x_ rm -Rf "$_7ztest"
|
x_ rm -Rf "$_7ztest"
|
||||||
|
|
||||||
# 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
|
if [ -z "$MEshrink" ]; then
|
||||||
|
|
||||||
MEshrink="y"
|
MEshrink="y"
|
||||||
fi
|
fi
|
||||||
|
if [ "$MEshrink" != "y" ] && [ "$MEshrink" != "n" ]; then
|
||||||
if [ "$MEshrink" != "y" ] && \
|
|
||||||
[ "$MEshrink" != "n" ]; then
|
|
||||||
|
|
||||||
err "MEshrink set badly on '$board' vendor config"
|
err "MEshrink set badly on '$board' vendor config"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$ME11bootguard" = "y" ]; then
|
if [ "$ME11bootguard" = "y" ]; then
|
||||||
|
if [ -z "$ME11delta" ] || [ -z "$ME11version" ] || \
|
||||||
if [ -z "$ME11delta" ] || \
|
[ -z "$ME11sku" ] || [ -z "$ME11pch" ]; then
|
||||||
[ -z "$ME11version" ] || \
|
|
||||||
[ -z "$ME11sku" ] || \
|
|
||||||
[ -z "$ME11pch" ]; then
|
|
||||||
|
|
||||||
err "$board: ME11delta/ME11version/ME11sku/ME11pch" \
|
err "$board: ME11delta/ME11version/ME11sku/ME11pch" \
|
||||||
"extract_intel_me" "$@"
|
"extract_intel_me" "$@"
|
||||||
fi
|
fi
|
||||||
@@ -362,11 +306,8 @@ extract_intel_me()
|
|||||||
set -u -e
|
set -u -e
|
||||||
|
|
||||||
if [ "$ME11bootguard" != "y" ]; then
|
if [ "$ME11bootguard" != "y" ]; then
|
||||||
|
|
||||||
x_ mv "$_metmp" "$_pre_dest"
|
x_ mv "$_metmp" "$_pre_dest"
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
( apply_deguard_hack ) || \
|
( apply_deguard_hack ) || \
|
||||||
err "deguard error on '$_dest'" "extract_intel_me" "$@"; :
|
err "deguard error on '$_dest'" "extract_intel_me" "$@"; :
|
||||||
fi
|
fi
|
||||||
@@ -377,13 +318,10 @@ extract_intel_me()
|
|||||||
find_me()
|
find_me()
|
||||||
{
|
{
|
||||||
if [ -f "$_metmp" ]; then
|
if [ -f "$_metmp" ]; then
|
||||||
|
|
||||||
# we found me.bin, so we stop searching
|
# we found me.bin, so we stop searching
|
||||||
|
|
||||||
exit 1
|
exit 1
|
||||||
|
|
||||||
elif [ -L "$1" ]; then
|
elif [ -L "$1" ]; then
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -395,21 +333,15 @@ find_me()
|
|||||||
_trunc="-t" # -t: truncate the ME size
|
_trunc="-t" # -t: truncate the ME size
|
||||||
|
|
||||||
if [ "$ME11bootguard" = "y" ]; then
|
if [ "$ME11bootguard" = "y" ]; then
|
||||||
|
|
||||||
mfs="--whitelist MFS"
|
mfs="--whitelist MFS"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$MEclean" = "n" ]; then
|
if [ "$MEclean" = "n" ]; then
|
||||||
|
|
||||||
MEshrink="n"
|
MEshrink="n"
|
||||||
|
|
||||||
_keep="-k" # keep ME modules, don't delete anything
|
_keep="-k" # keep ME modules, don't delete anything
|
||||||
mfs="" # no MFS whitelist needed, due to -r:
|
mfs="" # no MFS whitelist needed, due to -r:
|
||||||
fi
|
fi
|
||||||
|
if [ "$MEclean" = "n" ] || [ "$MEshrink" != "y" ]; then
|
||||||
if [ "$MEclean" = "n" ] || \
|
|
||||||
[ "$MEshrink" != "y" ]; then
|
|
||||||
|
|
||||||
# MEclean can still be y, this just means don't shrink,
|
# MEclean can still be y, this just means don't shrink,
|
||||||
# so deleted modules would become padded space. this
|
# so deleted modules would become padded space. this
|
||||||
# could also be used alongside --whitelist, if
|
# could also be used alongside --whitelist, if
|
||||||
@@ -418,57 +350,38 @@ 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
|
if [ "$MEcheck" = "n" ]; then
|
||||||
|
|
||||||
_pass="-p" # skip fptr check
|
_pass="-p" # skip fptr check
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$mfs" ]; then
|
if [ -n "$mfs" ]; then
|
||||||
|
|
||||||
_r="" # cannot re-locate modules if using --whitelist MFS
|
_r="" # cannot re-locate modules if using --whitelist MFS
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if "$mecleaner" $mfs $_r $_keep $_pass $_trunc -O "$xbtmp/a" \
|
if "$mecleaner" $mfs $_r $_keep $_pass $_trunc -O "$xbtmp/a" \
|
||||||
-M "$_metmp" "$1" \
|
-M "$_metmp" "$1" || [ -f "$_metmp" ]; then
|
||||||
|| \
|
|
||||||
[ -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
|
# could not extract anything, so we'll try the next file
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "$_metmp" ]; then
|
if [ -f "$_metmp" ]; then
|
||||||
|
|
||||||
# we found me.bin, so we stop searching
|
# we found me.bin, so we stop searching
|
||||||
|
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
|
|
||||||
# if the subshell does exit 1, we found me.bin, so exit 1
|
# if the subshell does exit 1, we found me.bin, so exit 1
|
||||||
|
|
||||||
( fx_ find_me x_ find "$_7ztest" -type f ) || exit 1; :
|
( fx_ find_me x_ find "$_7ztest" -type f ) || exit 1; :
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -485,32 +398,20 @@ apply_deguard_hack()
|
|||||||
extract_archive()
|
extract_archive()
|
||||||
{
|
{
|
||||||
if innoextract "$1" -d "$2"; then
|
if innoextract "$1" -d "$2"; then
|
||||||
|
|
||||||
:
|
:
|
||||||
|
|
||||||
elif python "$pfs_extract" "$1" -e; then
|
elif python "$pfs_extract" "$1" -e; then
|
||||||
|
|
||||||
:
|
:
|
||||||
|
|
||||||
elif 7z x "$1" -o"$2"; then
|
elif 7z x "$1" -o"$2"; then
|
||||||
|
|
||||||
:
|
:
|
||||||
|
|
||||||
elif "$bsdtar" -C "$2" -xf "$1"; then
|
elif "$bsdtar" -C "$2" -xf "$1"; then
|
||||||
|
|
||||||
:
|
:
|
||||||
|
|
||||||
elif "$bsdunzip" "$1" -d "$2"; then
|
elif "$bsdunzip" "$1" -d "$2"; then
|
||||||
|
|
||||||
:
|
:
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -d "${_dl}_extracted" ]; then
|
if [ -d "${_dl}_extracted" ]; then
|
||||||
|
|
||||||
x_ cp -R "${_dl}_extracted" "$2"
|
x_ cp -R "${_dl}_extracted" "$2"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -532,33 +433,22 @@ extract_kbc1126ec_dump()
|
|||||||
x_ cd "$appdir/"
|
x_ cd "$appdir/"
|
||||||
|
|
||||||
if mv Rompaq/68*.BIN ec.bin; then
|
if mv Rompaq/68*.BIN ec.bin; then
|
||||||
|
|
||||||
:
|
:
|
||||||
|
|
||||||
elif unar -D ROM.CAB Rom.bin; then
|
elif unar -D ROM.CAB Rom.bin; then
|
||||||
|
|
||||||
:
|
:
|
||||||
|
|
||||||
elif unar -D Rom.CAB Rom.bin; then
|
elif unar -D Rom.CAB Rom.bin; then
|
||||||
|
|
||||||
:
|
:
|
||||||
|
|
||||||
elif unar -D 68*.CAB Rom.bin; then
|
elif unar -D 68*.CAB Rom.bin; then
|
||||||
|
|
||||||
:
|
:
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
err "!kbc1126 unar" "extract_kbc1126ec" "$@"
|
err "!kbc1126 unar" "extract_kbc1126ec" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f "ec.bin" ]; then
|
if [ ! -f "ec.bin" ]; then
|
||||||
|
|
||||||
x_ mv Rom.bin ec.bin
|
x_ mv Rom.bin ec.bin
|
||||||
fi
|
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
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -567,9 +457,7 @@ extract_e6400vga()
|
|||||||
{
|
{
|
||||||
set +u +e
|
set +u +e
|
||||||
|
|
||||||
if [ -z "$E6400_VGA_offset" ] || \
|
if [ -z "$E6400_VGA_offset" ] || [ -z "$E6400_VGA_romname" ]; then
|
||||||
[ -z "$E6400_VGA_romname" ]; then
|
|
||||||
|
|
||||||
err "$board: E6400_VGA_romname/E6400_VGA_offset unset" \
|
err "$board: E6400_VGA_romname/E6400_VGA_offset unset" \
|
||||||
"extract_e6400vga" "$@"
|
"extract_e6400vga" "$@"
|
||||||
fi
|
fi
|
||||||
@@ -577,12 +465,9 @@ extract_e6400vga()
|
|||||||
tail -c +$E6400_VGA_offset "$_dl" | gunzip > "$appdir/bios.bin" || :
|
tail -c +$E6400_VGA_offset "$_dl" | gunzip > "$appdir/bios.bin" || :
|
||||||
|
|
||||||
(
|
(
|
||||||
|
|
||||||
x_ cd "$appdir"
|
x_ cd "$appdir"
|
||||||
x_ e "bios.bin" f
|
x_ e "bios.bin" f
|
||||||
|
|
||||||
"$e6400_unpack" bios.bin || printf "TODO: fix dell extract util\n"
|
"$e6400_unpack" bios.bin || printf "TODO: fix dell extract util\n"
|
||||||
|
|
||||||
) || err "can't extract e6400 vga rom" "extract_e6400vga" "$@"
|
) || err "can't extract e6400 vga rom" "extract_e6400vga" "$@"
|
||||||
|
|
||||||
x_ cp "$appdir/$E6400_VGA_romname" "$_pre_dest"
|
x_ cp "$appdir/$E6400_VGA_romname" "$_pre_dest"
|
||||||
@@ -599,7 +484,6 @@ extract_sch5545ec()
|
|||||||
_sch5545ec_fw="$_sch5545ec_fw/0 Raw section/body.bin" # <-- this!
|
_sch5545ec_fw="$_sch5545ec_fw/0 Raw section/body.bin" # <-- this!
|
||||||
|
|
||||||
x_ "$uefiextract" "$_bios"
|
x_ "$uefiextract" "$_bios"
|
||||||
|
|
||||||
x_ cp "$_sch5545ec_fw" "$_pre_dest"
|
x_ cp "$_sch5545ec_fw" "$_pre_dest"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -608,7 +492,6 @@ extract_sch5545ec()
|
|||||||
extract_tbfw()
|
extract_tbfw()
|
||||||
{
|
{
|
||||||
if [ -z "$TBFW_size" ]; then
|
if [ -z "$TBFW_size" ]; then
|
||||||
|
|
||||||
err "$board: TBFW_size unset" "extract_tbfw" "$@"
|
err "$board: TBFW_size unset" "extract_tbfw" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -617,9 +500,7 @@ extract_tbfw()
|
|||||||
|
|
||||||
copytb()
|
copytb()
|
||||||
{
|
{
|
||||||
if [ -f "$1" ] && \
|
if [ -f "$1" ] && [ ! -L "$1" ]; then
|
||||||
[ ! -L "$1" ]; then
|
|
||||||
|
|
||||||
x_ dd if=/dev/null of="$1" bs=1 seek=$TBFW_size
|
x_ dd if=/dev/null of="$1" bs=1 seek=$TBFW_size
|
||||||
x_ mv "$1" "$_pre_dest"
|
x_ mv "$1" "$_pre_dest"
|
||||||
|
|
||||||
@@ -635,29 +516,24 @@ extract_fsp()
|
|||||||
|
|
||||||
setvfile()
|
setvfile()
|
||||||
{
|
{
|
||||||
[ -n "$vcfg" ] && for c in $checkvarschk; do
|
[ -n "$vcfg" ] && for c in $checkvarschk
|
||||||
|
do
|
||||||
do_getvfile="n"
|
do_getvfile="n"
|
||||||
|
|
||||||
vcmd="[ \"\${$c}\" != \"/dev/null\" ] && [ -n \"\${$c}\" ]"
|
vcmd="[ \"\${$c}\" != \"/dev/null\" ] && [ -n \"\${$c}\" ]"
|
||||||
|
|
||||||
eval "$vcmd && do_getvfile=\"y\""
|
eval "$vcmd && do_getvfile=\"y\""
|
||||||
|
|
||||||
if [ "$do_getvfile" = "y" ]; then
|
if [ "$do_getvfile" = "y" ]; then
|
||||||
|
|
||||||
if getvfile "$@"; then
|
if getvfile "$@"; then
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
done && return 1; :
|
done && return 1; :
|
||||||
}
|
}
|
||||||
|
|
||||||
getvfile()
|
getvfile()
|
||||||
{
|
{
|
||||||
if e "config/vendor/$vcfg/pkg.cfg" f missing; then
|
if e "config/vendor/$vcfg/pkg.cfg" f missing; then
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -667,16 +543,13 @@ getvfile()
|
|||||||
bootstrap
|
bootstrap
|
||||||
|
|
||||||
if [ $# -gt 0 ]; then
|
if [ $# -gt 0 ]; then
|
||||||
|
|
||||||
# download vendor files
|
# download vendor files
|
||||||
|
|
||||||
getfiles
|
getfiles
|
||||||
else
|
else
|
||||||
|
|
||||||
# inject vendor files
|
# inject vendor files
|
||||||
|
|
||||||
fx_ prep x_ find "$tmpromdir" -maxdepth 1 -type f -name "*.rom"
|
fx_ prep x_ find "$tmpromdir" -maxdepth 1 -type f -name "*.rom"
|
||||||
|
|
||||||
( check_vendor_hashes ) || \
|
( check_vendor_hashes ) || \
|
||||||
err "$archive: Can't verify hashes" "getvfile" "$@"; :
|
err "$archive: Can't verify hashes" "getvfile" "$@"; :
|
||||||
fi
|
fi
|
||||||
@@ -691,9 +564,7 @@ bootstrap()
|
|||||||
rmodtool="elf/coreboot/$tree/rmodtool"
|
rmodtool="elf/coreboot/$tree/rmodtool"
|
||||||
|
|
||||||
mecleaner="$xbmkpwd/$cbdir/util/me_cleaner/me_cleaner.py"
|
mecleaner="$xbmkpwd/$cbdir/util/me_cleaner/me_cleaner.py"
|
||||||
|
|
||||||
if [ "$XBMKmecleaner" = "y" ]; then
|
if [ "$XBMKmecleaner" = "y" ]; then
|
||||||
|
|
||||||
mecleaner="$xbmkpwd/src/me_cleaner/me_cleaner.py"
|
mecleaner="$xbmkpwd/src/me_cleaner/me_cleaner.py"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -706,12 +577,10 @@ bootstrap()
|
|||||||
x_ ./mk -b libarchive # for bsdtar and bsdunzip
|
x_ ./mk -b libarchive # for bsdtar and bsdunzip
|
||||||
|
|
||||||
if [ -d "${kbc1126_ec_dump%/*}" ]; then
|
if [ -d "${kbc1126_ec_dump%/*}" ]; then
|
||||||
|
|
||||||
x_ make -C "$cbdir/util/kbc1126"
|
x_ make -C "$cbdir/util/kbc1126"
|
||||||
fi
|
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"
|
||||||
x_ ./mk -d coreboot "$MRC_refcode_cbtree"; :
|
x_ ./mk -d coreboot "$MRC_refcode_cbtree"; :
|
||||||
fi
|
fi
|
||||||
@@ -724,23 +593,20 @@ prep()
|
|||||||
_xromnew="${_xrom%/*}/${_xromname#"$vfix"}"
|
_xromnew="${_xrom%/*}/${_xromname#"$vfix"}"
|
||||||
|
|
||||||
if [ "$nuke" = "nuke" ]; then
|
if [ "$nuke" = "nuke" ]; then
|
||||||
|
|
||||||
_xromnew="${_xrom%/*}/$vfix${_xrom##*/}"
|
_xromnew="${_xrom%/*}/$vfix${_xrom##*/}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if e "$_xrom" f missing; then
|
if e "$_xrom" f missing; then
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "${_xromname#"$vfix"}" ]; then
|
if [ -z "${_xromname#"$vfix"}" ]; then
|
||||||
|
|
||||||
err "$_xromname / $vfix: name match" "prep" "$@"
|
err "$_xromname / $vfix: name match" "prep" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Remove the prefix and 1-byte pad
|
# Remove the prefix and 1-byte pad
|
||||||
if [ "${_xromname#"$vfix"}" != "$_xromname" ] && \
|
if [ "${_xromname#"$vfix"}" != "$_xromname" ] \
|
||||||
[ "$nuke" != "nuke" ]; then
|
&& [ "$nuke" != "nuke" ]; then
|
||||||
|
|
||||||
unpad_one_byte "$_xrom"
|
unpad_one_byte "$_xrom"
|
||||||
x_ mv "$_xrom" "$_xromnew"
|
x_ mv "$_xrom" "$_xromnew"
|
||||||
@@ -749,12 +615,10 @@ prep()
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$nuke" = "nuke" ]; then
|
if [ "$nuke" = "nuke" ]; then
|
||||||
|
|
||||||
( mksha512 "$_xrom" "vendorhashes" ) || err; :
|
( mksha512 "$_xrom" "vendorhashes" ) || err; :
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! add_vfiles "$_xrom"; then
|
if ! add_vfiles "$_xrom"; then
|
||||||
|
|
||||||
# no need to insert files. we will later
|
# no need to insert files. we will later
|
||||||
# still process MAC addresses as required
|
# still process MAC addresses as required
|
||||||
|
|
||||||
@@ -762,9 +626,7 @@ prep()
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$nuke" = "nuke" ]; then
|
if [ "$nuke" = "nuke" ]; then
|
||||||
|
|
||||||
pad_one_byte "$_xrom"
|
pad_one_byte "$_xrom"
|
||||||
|
|
||||||
x_ mv "$_xrom" "$_xromnew"
|
x_ mv "$_xrom" "$_xromnew"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -774,7 +636,6 @@ mksha512()
|
|||||||
build_sbase
|
build_sbase
|
||||||
|
|
||||||
if [ "${1%/*}" != "$1" ]; then
|
if [ "${1%/*}" != "$1" ]; then
|
||||||
|
|
||||||
x_ cd "${1%/*}"
|
x_ cd "${1%/*}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -787,68 +648,46 @@ add_vfiles()
|
|||||||
rom="$1"
|
rom="$1"
|
||||||
|
|
||||||
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
|
if [ -n "$CONFIG_HAVE_REFCODE_BLOB" ]; then
|
||||||
|
|
||||||
vfile "fallback/refcode" "$CONFIG_REFCODE_BLOB_FILE" "stage"
|
vfile "fallback/refcode" "$CONFIG_REFCODE_BLOB_FILE" "stage"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$CONFIG_HAVE_MRC" = "y" ]; then
|
if [ "$CONFIG_HAVE_MRC" = "y" ]; then
|
||||||
|
|
||||||
vfile "mrc.bin" "$CONFIG_MRC_FILE" "mrc" "0xfffa0000"
|
vfile "mrc.bin" "$CONFIG_MRC_FILE" "mrc" "0xfffa0000"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$CONFIG_HAVE_ME_BIN" = "y" ]; then
|
if [ "$CONFIG_HAVE_ME_BIN" = "y" ]; then
|
||||||
|
|
||||||
vfile IFD "$CONFIG_ME_BIN_PATH" me
|
vfile IFD "$CONFIG_ME_BIN_PATH" me
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$CONFIG_KBC1126_FW1" ]; then
|
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
|
fi
|
||||||
|
|
||||||
if [ -n "$CONFIG_KBC1126_FW2" ]; then
|
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
|
fi
|
||||||
|
|
||||||
if [ -n "$CONFIG_VGA_BIOS_FILE" ] && [ -n "$CONFIG_VGA_BIOS_ID" ]; then
|
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
|
fi
|
||||||
|
|
||||||
if [ "$CONFIG_INCLUDE_SMSC_SCH5545_EC_FW" = "y" ] && \
|
if [ "$CONFIG_INCLUDE_SMSC_SCH5545_EC_FW" = "y" ] && \
|
||||||
[ -n "$CONFIG_SMSC_SCH5545_EC_FW_FILE" ]; then
|
[ -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
|
fi
|
||||||
|
if [ -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" ]; then
|
[ -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
|
fi
|
||||||
|
if [ -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" ]; then
|
[ -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
|
fi
|
||||||
|
|
||||||
@@ -860,7 +699,6 @@ add_vfiles()
|
|||||||
vfile()
|
vfile()
|
||||||
{
|
{
|
||||||
if [ "$2" = "/dev/null" ]; then
|
if [ "$2" = "/dev/null" ]; then
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -870,50 +708,34 @@ vfile()
|
|||||||
|
|
||||||
_offset=""
|
_offset=""
|
||||||
|
|
||||||
if [ "$blobtype" = "fsp" ] && \
|
if [ "$blobtype" = "fsp" ] && [ $# -gt 3 ]; then
|
||||||
[ $# -gt 3 ]; then
|
|
||||||
|
|
||||||
_offset="$4"
|
_offset="$4"
|
||||||
|
elif [ $# -gt 3 ] && _offset="-b $4" && [ -z "$4" ]; then
|
||||||
elif [ $# -gt 3 ] && \
|
|
||||||
_offset="-b $4" && [ -z "$4" ]; then
|
|
||||||
|
|
||||||
err "$rom: offset given but empty (undefined)" "vfile" "$@"
|
err "$rom: offset given but empty (undefined)" "vfile" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$nuke" != "nuke" ]; then
|
if [ "$nuke" != "nuke" ]; then
|
||||||
|
|
||||||
x_ e "$_dest" f
|
x_ e "$_dest" f
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$cbfsname" = "IFD" ]; then
|
if [ "$cbfsname" = "IFD" ]; then
|
||||||
|
|
||||||
if [ "$nuke" = "nuke" ]; then
|
if [ "$nuke" = "nuke" ]; then
|
||||||
|
|
||||||
x_ "$ifdtool" $ifdprefix --nuke $blobtype "$rom" \
|
x_ "$ifdtool" $ifdprefix --nuke $blobtype "$rom" \
|
||||||
-O "$rom"
|
-O "$rom"
|
||||||
else
|
else
|
||||||
|
|
||||||
x_ "$ifdtool" $ifdprefix -i $blobtype:$_dest "$rom" \
|
x_ "$ifdtool" $ifdprefix -i $blobtype:$_dest "$rom" \
|
||||||
-O "$rom"
|
-O "$rom"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
elif [ "$nuke" = "nuke" ]; then
|
elif [ "$nuke" = "nuke" ]; then
|
||||||
|
|
||||||
x_ "$cbfstool" "$rom" remove -n "$cbfsname"
|
x_ "$cbfstool" "$rom" remove -n "$cbfsname"
|
||||||
|
|
||||||
elif [ "$blobtype" = "stage" ]; then
|
elif [ "$blobtype" = "stage" ]; then
|
||||||
|
|
||||||
# the only stage we handle is refcode
|
# the only stage we handle is refcode
|
||||||
|
|
||||||
x_ rm -f "$xbtmp/refcode"
|
x_ rm -f "$xbtmp/refcode"
|
||||||
|
|
||||||
x_ "$rmodtool" -i "$_dest" -o "$xbtmp/refcode"
|
x_ "$rmodtool" -i "$_dest" -o "$xbtmp/refcode"
|
||||||
x_ "$cbfstool" "$rom" add-stage -f "$xbtmp/refcode" \
|
x_ "$cbfstool" "$rom" add-stage -f "$xbtmp/refcode" \
|
||||||
-n "$cbfsname" -t stage
|
-n "$cbfsname" -t stage
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
x_ "$cbfstool" "$rom" add -f "$_dest" -n "$cbfsname" \
|
x_ "$cbfstool" "$rom" add -f "$_dest" -n "$cbfsname" \
|
||||||
-t $blobtype $_offset
|
-t $blobtype $_offset
|
||||||
fi
|
fi
|
||||||
@@ -928,9 +750,7 @@ check_vendor_hashes()
|
|||||||
|
|
||||||
x_ cd "$tmpromdir"
|
x_ cd "$tmpromdir"
|
||||||
|
|
||||||
if [ "$has_hashes" != "n" ] && \
|
if [ "$has_hashes" != "n" ] && [ "$nuke" != "nuke" ]; then
|
||||||
[ "$nuke" != "nuke" ]; then
|
|
||||||
|
|
||||||
( x_ "$sha512sum" -c "$hashfile" ) || \
|
( x_ "$sha512sum" -c "$hashfile" ) || \
|
||||||
x_ sha1sum -c "$hashfile"
|
x_ sha1sum -c "$hashfile"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -7,21 +7,20 @@
|
|||||||
|
|
||||||
set -u -e
|
set -u -e
|
||||||
|
|
||||||
ispwd="true"
|
xrval=0
|
||||||
|
|
||||||
if [ "$0" != "./mk" ]; then
|
(
|
||||||
|
xbarg0="$0"
|
||||||
ispwd="false"
|
if [ "${xbarg0##*/}" = "$xbarg0" ]; then
|
||||||
|
xbarg0="`command -v "$xbarg0"`"
|
||||||
fi
|
fi
|
||||||
if [ "$ispwd" = "true" ] && [ -L "mk" ]; then
|
|
||||||
|
|
||||||
ispwd="false"
|
xbcddir="`readlink -f "$xbarg0" 2>/dev/null`"
|
||||||
|
if [ -z "$xbcddir" ]; then
|
||||||
|
xbcddir="`realpath "$xbarg0" 2>/dev/null`"
|
||||||
fi
|
fi
|
||||||
if [ "$ispwd" = "false" ]; then
|
|
||||||
|
|
||||||
printf "You must run this in the proper work directory.\n" 1>&2
|
cd "${xbcddir%/*}" || exit 1
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
. "include/lib.sh"
|
. "include/lib.sh"
|
||||||
. "include/init.sh"
|
. "include/init.sh"
|
||||||
@@ -37,34 +36,16 @@ main()
|
|||||||
{
|
{
|
||||||
cmd=""
|
cmd=""
|
||||||
if [ $# -gt 0 ]; then
|
if [ $# -gt 0 ]; then
|
||||||
|
|
||||||
cmd="$1"
|
cmd="$1"
|
||||||
shift 1
|
shift 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case "$cmd" in
|
if ! xeq main "$cmd" \
|
||||||
|
version release download inject prep_mr_import; then
|
||||||
version)
|
|
||||||
|
|
||||||
printf "%s\nWebsite: %s\n" "$relname" "$projectsite"
|
|
||||||
;;
|
|
||||||
|
|
||||||
release|download|inject|prep_mr_import)
|
|
||||||
|
|
||||||
$cmd "$@"
|
|
||||||
;;
|
|
||||||
|
|
||||||
-*)
|
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
;;
|
fi
|
||||||
*)
|
|
||||||
|
|
||||||
err "bad command" main "$@"
|
$cmd "$@"
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# some commands disable them. turn them back on!
|
|
||||||
set -u -e
|
set -u -e
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
@@ -80,3 +61,6 @@ x_ touch "$mkhelpercfg"
|
|||||||
|
|
||||||
. "$mkhelpercfg"
|
. "$mkhelpercfg"
|
||||||
$cmd
|
$cmd
|
||||||
|
) || xrval=1
|
||||||
|
|
||||||
|
exit $xrval
|
||||||
|
|||||||
Reference in New Issue
Block a user