From 99dfb770358781d41c056aaf3569437002aa9e76 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Tue, 5 May 2020 13:56:29 -0500 Subject: 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. --- scripts/mkroot.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'scripts/mkroot.sh') 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 -- cgit v1.2.3