12 export SOURCES
="${TOP}/sources"
13 export SCRIPTS
="${SOURCES}/scripts"
14 export SRCDIR
="${TOP}/packages"
15 export ROOT_DIR
="${TOP}/rootfs"
16 export ROOT_OVERLAY
="${TOP}/rootfs-overlay"
17 export BUILD
="${TOP}/build"
18 export CONFIG_DIR
="${TOP}/sources/configs"
19 export WORK
="${BUILD}/temp-${ARCH}"
20 export STAGING_DIR
="${TOP}/staging-dir"
22 # Default flags to point the compiler to the right libraries and
23 # include files. In the case of cross compiling this assumes that
24 # the compiler doesn't add system directories to it's search paths.
25 # This is taken care of by a gcc wrapper script which passes things
26 # like -nostdinc -nostdlibs -nodefaultlibs to gcc.
28 CFLAGS_HEADERS
="-I$STAGING_DIR/usr/include"
30 if [ -z "$DEBUG" ]; then
31 CFLAGS
="$CFLAGS_HEADERS -Os -pipe -march=armv4t -mtune=arm920t"
33 CFLAGS
="$CFLAGS_HEADERS -O0 -g -ggdb -pipe -march=armv4t -mtune=arm920t"
38 # Make sure that pkg-config uses the right paths and doesn't pull
39 # in depencies from the host system.
40 export PKG_CONFIG_PATH
="${STAGING_DIR}/usr/lib/pkgconfig"
41 export PKG_CONFIG_LIBDIR
="${STAGING_DIR}/usr/lib/pkgconfig"
42 export PKG_CONFIG_SYSROOT_DIR
="${STAGING_DIR}"
44 # check if we are building natively or if we are cross compiling
46 if [[ ! $
(uname
-m) == arm
* ]]
49 CROSS_CONFIGURE_FLAGS
="--build=`$SCRIPTS/config.guess` \
50 --target=armv4tl-unknown-linux-gnueabi \
51 --host=armv4tl-unknown-linux-gnueabi"
52 # cross compiler prefix used by kernel, uclibc and busybox
54 [ -z "$CROSS" ] && CROSS
="armv4tl-"
58 [ -z "$CC" ] && export CC
="${CROSS}gcc"
60 # tell the compiler wrapper to link against the libc from
61 # $STAGING_DIR and not against the one from the toolchain
63 export CCWRAP_TOPDIR
="$STAGING_DIR/usr"
64 export CCWRAP_CC
="${CROSS}rawcc"
68 # Tell bash not to cache the $PATH because we modify it. Without
69 # this, bash won't find new executables added after startup.
72 [ -e config
] && source config
73 source sources
/functions-fwl.sh
74 source sources
/functions.sh
76 # How many processors should make -j use?
80 export CPUS
=$
(echo /sys
/devices
/system
/cpu
/cpu
[0-9]* |
wc -w)
81 [ "$CPUS" -lt 1 ] && CPUS
=1
84 export MAKEFLAGS
="-j $CPUS"
86 # This is an if instead of && so the exit code of include.sh is reliably 0
87 if [ ! -z "$BUILD_VERBOSE" ]