Mercurial > hg > aboriginal
changeset 576:036dbe218036
Add BASE_ARCH support, so a hardware architecture can specify a base architecture and just provide a different kernel.
author | Rob Landley <rob@landley.net> |
---|---|
date | Fri, 09 Jan 2009 22:02:14 -0600 |
parents | b7b47788992b |
children | 2d22a34b6105 |
files | cross-compiler.sh mini-native.sh package-mini-native.sh sources/include.sh |
diffstat | 4 files changed, 45 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/cross-compiler.sh Fri Jan 09 15:13:11 2009 -0600 +++ b/cross-compiler.sh Fri Jan 09 22:02:14 2009 -0600 @@ -127,10 +127,20 @@ # Tar it up echo -n creating "build/cross-compiler-${ARCH}".tar.bz2 && -cd "${BUILD}" +cd "${BUILD}" || dienow { tar cjvf "cross-compiler-${ARCH}".tar.bz2 cross-compiler-"${ARCH}" || dienow } | dotprogress +# If we're building something with a $BASE_ARCH, symlink to actual target name. + +if [ "$ARCH" != "$ARCH_NAME" ] +then + rm -rf "cross-compiler-$ARCH_NAME"{,.tar.bz2} && + ln -s cross-compiler-"$ARCH" cross-compiler-"$ARCH_NAME" && + ln -s cross-compiler-"$ARCH".tar.bz2 cross-compiler-"$ARCH_NAME".tar.bz2 || + dienow +fi + # A quick hello world program to test the cross-compiler out. # Build hello.c dynamic, then static, to verify header/library paths.
--- a/mini-native.sh Fri Jan 09 15:13:11 2009 -0600 +++ b/mini-native.sh Fri Jan 09 22:02:14 2009 -0600 @@ -300,5 +300,16 @@ { tar cjvf "mini-native-${ARCH}.tar.bz2" "mini-native-${ARCH}" || dienow } | dotprogress +# If we're building something with a $BASE_ARCH, symlink to actual target name. + +if [ "$ARCH" != "$ARCH_NAME" ] +then + rm -rf "mini-native-$ARCH_NAME"{,.tar.bz2} && + ln -s mini-native-"$ARCH" mini-native-"$ARCH_NAME" && + ln -s mini-native-"$ARCH".tar.bz2 mini-native-"$ARCH_NAME".tar.bz2 || + dienow +fi + + # Color back to normal echo -e "\e[0mBuild complete"
--- a/package-mini-native.sh Fri Jan 09 15:13:11 2009 -0600 +++ b/package-mini-native.sh Fri Jan 09 22:02:14 2009 -0600 @@ -1,7 +1,8 @@ #!/bin/bash -# Create an ext2 root filesystem image from mini-native +# Create a bootable system image from mini-native +NO_BASE_ARCH=1 source sources/include.sh echo -e "$PACKAGE_COLOR"
--- a/sources/include.sh Fri Jan 09 15:13:11 2009 -0600 +++ b/sources/include.sh Fri Jan 09 22:02:14 2009 -0600 @@ -62,18 +62,26 @@ if [ -z "$NO_ARCH" ] then ARCH_NAME="$1" - ARCH="$(echo "$1" | sed 's@.*/@@')" - if [ ! -f "${TOP}/sources/targets/${ARCH}/details" ] + if [ ! -f "${TOP}/sources/targets/${ARCH_NAME}/details" ] then echo "Supported architectures: " (cd "${TOP}/sources/targets" && ls) exit 1 fi - # Read the relevant config file. + # Read the relevant config file, iterating to find base architecture if any. - CONFIG_DIR="${TOP}/sources/targets/${ARCH}" - source "${CONFIG_DIR}/details" + BASE_ARCH="$ARCH_NAME" + while [ ! -z "$BASE_ARCH" ] + do + export ARCH="$BASE_ARCH" + BASE_ARCH="" + if [ -z "$NO_BASE_ARCH" ] + then + export CONFIG_DIR="${TOP}/sources/targets/${ARCH}" + source "${CONFIG_DIR}/details" + fi + done # Which platform are we building for? @@ -94,15 +102,15 @@ export CROSS="${BUILD}/cross-compiler-$ARCH" export NATIVE="${BUILD}/mini-native-$ARCH" export PATH="${CROSS}/bin:$PATH" + + if [ ! -z "${NATIVE_TOOLSDIR}" ] + then + TOOLS="${NATIVE}/tools" + else + TOOLS="${NATIVE}/usr" + fi else - ARCH_NAME=host + HW_ARCH=host export WORK="${BUILD}/host-temp" mkdir -p "${WORK}" || dienow fi - -if [ ! -z "${NATIVE_TOOLSDIR}" ] -then - TOOLS="${NATIVE}/tools" -else - TOOLS="${NATIVE}/usr" -fi