# HG changeset patch # User Rob Landley # Date 1309128242 18000 # Node ID b74d36876c0abbda38023507ee3bf89503a6df5e # Parent 06f26d3b636ef252ad6757345ce7c8834a752f2d Replace read_arch_dir with load_target, which understands that sources/targets/$TARGET can be a file or a directory. diff -r 06f26d3b636e -r b74d36876c0a linux-kernel.sh --- a/linux-kernel.sh Sun Jun 26 17:42:52 2011 -0500 +++ b/linux-kernel.sh Sun Jun 26 17:44:02 2011 -0500 @@ -4,9 +4,9 @@ source sources/include.sh || exit 1 -# Parse the sources/targets/$1 directory +# Parse sources/targets/$1 -read_arch_dir "$1" +load_target "$1" # If we have an initramfs, incorporate it into the kernel image. diff -r 06f26d3b636e -r b74d36876c0a more/cross-smoke-test.sh --- a/more/cross-smoke-test.sh Sun Jun 26 17:42:52 2011 -0500 +++ b/more/cross-smoke-test.sh Sun Jun 26 17:44:02 2011 -0500 @@ -3,7 +3,7 @@ # Perform a smoke test on a target's cross compiler by building "hello world" # and attempting to run it under QEMU application emulation. -source sources/include.sh && read_arch_dir "$1" || exit 1 +source sources/include.sh && load_target "$1" || exit 1 # Build statically linked hello world, if necessary diff -r 06f26d3b636e -r b74d36876c0a more/for-each-target.sh --- a/more/for-each-target.sh Sun Jun 26 17:42:52 2011 -0500 +++ b/more/for-each-target.sh Sun Jun 26 17:44:02 2011 -0500 @@ -8,10 +8,11 @@ . sources/utility_functions.sh || exit 1 [ -z "${ARCHES}" ] && - ARCHES="$(cd sources/targets/; ls | grep -v '^hw-')" + ARCHES="$(ls sources/targets)" for TARGET in $ARCHES do + [ ! -f "$TARGET" ] && continue maybe_fork "$* | maybe_quiet" done diff -r 06f26d3b636e -r b74d36876c0a more/migrate-kernel.sh --- a/more/migrate-kernel.sh Sun Jun 26 17:42:52 2011 -0500 +++ b/more/migrate-kernel.sh Sun Jun 26 17:44:02 2011 -0500 @@ -8,7 +8,7 @@ . sources/include.sh -read_arch_dir "$1" +load_target "$1" rmdir "$STAGE_DIR" [ -z "$BOOT_KARCH" ] && BOOT_KARCH="$KARCH" diff -r 06f26d3b636e -r b74d36876c0a more/test.sh --- a/more/test.sh Sun Jun 26 17:42:52 2011 -0500 +++ b/more/test.sh Sun Jun 26 17:44:02 2011 -0500 @@ -10,6 +10,6 @@ . sources/include.sh || exit 1 -read_arch_dir "$1" +load_target "$1" shift eval "$@" diff -r 06f26d3b636e -r b74d36876c0a native-compiler.sh --- a/native-compiler.sh Sun Jun 26 17:42:52 2011 -0500 +++ b/native-compiler.sh Sun Jun 26 17:44:02 2011 -0500 @@ -9,7 +9,7 @@ # The new compiler is built --with-shared, with thread support, has uClibc++ # installed, and is linked against uClibc (see BUILD_STATIC in config). -source sources/include.sh && read_arch_dir "$1" || exit 1 +source sources/include.sh && load_target "$1" || exit 1 check_for_base_arch || exit 0 check_prerequisite "${ARCH}-cc" diff -r 06f26d3b636e -r b74d36876c0a root-filesystem.sh --- a/root-filesystem.sh Sun Jun 26 17:42:52 2011 -0500 +++ b/root-filesystem.sh Sun Jun 26 17:44:02 2011 -0500 @@ -4,7 +4,7 @@ . sources/include.sh || exit 1 -read_arch_dir "$1" +load_target "$1" [ ! -d "$BUILD/simple-root-filesystem-$ARCH" ] && echo "No $BUILD/simple-root-filesystem-$ARCH" >&2 && diff -r 06f26d3b636e -r b74d36876c0a root-image.sh --- a/root-image.sh Sun Jun 26 17:42:52 2011 -0500 +++ b/root-image.sh Sun Jun 26 17:44:02 2011 -0500 @@ -4,9 +4,9 @@ source sources/include.sh || exit 1 -# Parse the sources/targets/$1 directory +# Parse sources/targets/$1 -read_arch_dir "$1" +load_target "$1" # Which directory do we package up? diff -r 06f26d3b636e -r b74d36876c0a simple-cross-compiler.sh --- a/simple-cross-compiler.sh Sun Jun 26 17:42:52 2011 -0500 +++ b/simple-cross-compiler.sh Sun Jun 26 17:44:02 2011 -0500 @@ -14,9 +14,9 @@ source sources/include.sh || exit 1 -# Parse the sources/targets/$1 directory +# Parse sources/targets/$1 -read_arch_dir "$1" +load_target "$1" # If this target has a base architecture that's already been built, use that. diff -r 06f26d3b636e -r b74d36876c0a simple-root-filesystem.sh --- a/simple-root-filesystem.sh Sun Jun 26 17:42:52 2011 -0500 +++ b/simple-root-filesystem.sh Sun Jun 26 17:44:02 2011 -0500 @@ -7,7 +7,7 @@ # prefix- name is correct. source sources/include.sh || exit 1 -read_arch_dir "$1" +load_target "$1" check_for_base_arch || exit 0 check_prerequisite "${ARCH}-cc" diff -r 06f26d3b636e -r b74d36876c0a sources/README --- a/sources/README Sun Jun 26 17:42:52 2011 -0500 +++ b/sources/README Sun Jun 26 17:44:02 2011 -0500 @@ -33,9 +33,10 @@ Each package has "$PACKAGE-*.patch" applied in alphabetical order, or "alt-$PACKAGE-*.patch" for USE_UNSTABLE versions. - targets: Configuration for each target platform, parsed by read_arch_dir() - and getconfig() in functions.sh. Each subdirectory is a - target name, and contains at least four files: + targets: Configuration for each target platform, parsed by load_target() + and getconfig() in functions.sh. Each entry is a target name, + either a self-contained script setting configuration information, + or else a directory containing: settings: Environment variables needed by the build. @@ -47,8 +48,6 @@ (If miniconfig-alt-uClibc exists, USE_UNSTABLE=uClibc will use that instead.) - description: Simple documentation about the platform - root-filesystem: Files to be copied verbatim into the target filesystem. Used by simple-root-filesystem.sh. diff -r 06f26d3b636e -r b74d36876c0a sources/functions.sh --- a/sources/functions.sh Sun Jun 26 17:42:52 2011 -0500 +++ b/sources/functions.sh Sun Jun 26 17:44:02 2011 -0500 @@ -17,24 +17,32 @@ echo -n "$i:" } -read_arch_dir() +load_target() { # Get target platform from first command line argument. ARCH_NAME="$1" - if [ ! -f "${SOURCES}/targets/${ARCH_NAME}/settings" ] + ARCH="$ARCH_NAME" + CONFIG_DIR="$SOURCES/targets" + + # Read the relevant config file. + + if [ -f "$CONFIG_DIR/$ARCH" ] then + source "$CONFIG_DIR/$ARCH" + CONFIG_DIR= + elif [ -f "$CONFIG_DIR/$ARCH/settings" ] + then + source "$CONFIG_DIR/$ARCH/settings" ] + else echo "Supported architectures: " - (cd "${SOURCES}/targets" && ls) + ls "$CONFIG_DIR" exit 1 fi - # Read the relevant config file. - ARCH="$ARCH_NAME" - CONFIG_DIR="${SOURCES}/targets" - source "${CONFIG_DIR}/${ARCH}/settings" + source "$CONFIG_DIR/$ARCH/settings" # Which platform are we building for? diff -r 06f26d3b636e -r b74d36876c0a system-image.sh --- a/system-image.sh Sun Jun 26 17:42:52 2011 -0500 +++ b/system-image.sh Sun Jun 26 17:44:02 2011 -0500 @@ -4,9 +4,9 @@ source sources/include.sh || exit 1 -# Parse the sources/targets/$1 directory +# Parse sources/targets/$1 -read_arch_dir "$1" +load_target "$1" cd "$BUILD/linux-kernel-$ARCH_NAME" && KERNEL="$(ls)" &&