aboutsummaryrefslogtreecommitdiff
path: root/scripts/mkroot.sh
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2020-05-05 13:56:29 -0500
committerRob Landley <rob@landley.net>2020-05-05 13:56:29 -0500
commit99dfb770358781d41c056aaf3569437002aa9e76 (patch)
tree84be9f57d9b7824a6cfe0b274d27a3554aa04aba /scripts/mkroot.sh
parenteae46378f7bfe5f39c717da8eac2a50230509342 (diff)
downloadtoybox-99dfb770358781d41c056aaf3569437002aa9e76.tar.gz
Teach mkroot to cross compile additional packages, with dropbear as example.
scripts/mkroot.sh CROSS=sh4 LINUX=~/linux dropbear No, I'm not going down the rathole of adding lots of packages, but this shows _how_ to do it if you want to. The hooks are there. They don't have to be in scripts/root, that's just a default search location, you can provide a path on the command line or have them be in the $PATH.
Diffstat (limited to 'scripts/mkroot.sh')
-rwxr-xr-xscripts/mkroot.sh7
1 files changed, 4 insertions, 3 deletions
diff --git a/scripts/mkroot.sh b/scripts/mkroot.sh
index 77284e76..43500ef1 100755
--- a/scripts/mkroot.sh
+++ b/scripts/mkroot.sh
@@ -11,7 +11,8 @@ getcross() { X="$(echo "$CCC/$1"-*cross/bin/"$1"*-cc)"; echo "${X%cc}"; }
# assign command line NAME=VALUE args to env vars
while [ $# -ne 0 ]; do
- [ "${1/=/}" != "$1" ] && eval "export ${1/=*/}=\"\${1#*=}\"" || PKG="$PKG $i"
+ [ "${1/=/}" != "$1" ] && eval "export ${1/=*/}=\"\${1#*=}\"" ||
+ { [ "$1" != '--' ] && PKG="${PKG:-plumbing} $1"; }
shift
done
@@ -48,7 +49,7 @@ else
fi
echo "Building for ${CROSS:=host}"
-: ${OUTPUT:=$TOP/$CROSS}
+: ${OUTPUT:=$TOP/$CROSS} ${PKGDIR:=$PWD/scripts/root}
[ -z "$ROOT" ] && ROOT="$OUTPUT/fs" && rm -rf "$ROOT"
MYBUILD="$BUILD/${CROSS_BASE:-host-}tmp"
rm -rf "$MYBUILD" && mkdir -p "$MYBUILD" || exit 1
@@ -228,7 +229,7 @@ else
fi
# Build any modules, clean up, and package root filesystem for initramfs.
-for i in $PKG; do announce "$i"; ./$i; done
+for i in $PKG; do announce "$i"; PATH="$PKGDIR:$PATH" source $i; done
rmdir "$MYBUILD" "$BUILD" 2>/dev/null
announce "${CROSS_BASE}root.cpio.gz"
(cd "$ROOT" && find .|cpio -o -H newc|gzip) > "$OUTPUT/$CROSS_BASE"root.cpio.gz