From 58ccaa6ab112326bbb986823784f2d155b6f29b5 Mon Sep 17 00:00:00 2001 From: bauen1 Date: Sat, 2 Dec 2017 10:08:02 +0100 Subject: [PATCH] Cleaned up sysroot creation Removed all traces of sysroot.spec Copy kernel headers instead of symlinking theam (~6.7MB more space) --- src/05_prepare_sysroot.sh | 48 ++++------------------------------- src/minimal_overlay/common.sh | 14 ---------- 2 files changed, 5 insertions(+), 57 deletions(-) diff --git a/src/05_prepare_sysroot.sh b/src/05_prepare_sysroot.sh index e8e4c5c96..b1731dca4 100755 --- a/src/05_prepare_sysroot.sh +++ b/src/05_prepare_sysroot.sh @@ -8,52 +8,14 @@ cd work echo "Cleaning existing sysroot. This may take a while." rm -rf sysroot -rm -rf sysroot.specs echo "Preparing glibc. This may take a while." -cp -r glibc/glibc_installed sysroot -cd sysroot +mkdir -p sysroot/usr +ln -s ../include sysroot/usr/include +ln -s ../lib sysroot/usr/lib -# Create custom 'usr' area and link it with some of the kernel header directories. -# BusyBox compilation process uses these linked directories. The following -# directories are affected: -# -# usr (glibc) -# | -# +--include (glibc) -# | | -# | +--asm (kernel) -# | | -# | +--asm-generic (kernel) -# | | -# | +--linux (kernel) -# | | -# | +--mtd (kernel) -# | -# +--lib (glibc) - -mkdir -p usr - -ln -s ../include usr/include -ln -s ../lib usr/lib - -ln -s ../../kernel/kernel_installed/include/linux include/linux -ln -s ../../kernel/kernel_installed/include/asm include/asm -ln -s ../../kernel/kernel_installed/include/asm-generic include/asm-generic -ln -s ../../kernel/kernel_installed/include/mtd include/mtd - -cd .. - -echo "generating sysroot.specs" -SYSROOT="$PWD/sysroot" - -# gcc has a "internal" path that needs to be added to find the static versions of libgcc_* -GCC_INTERNAL_PATH=$(dirname $(gcc -print-libgcc-file-name)) - -cat << CEOF > sysroot.specs -*link_libgcc: --L$SYSROOT/lib -L$SYSROOT/lib64 -L$SYSROOT/usr/lib -L$SYSROOT/usr/lib64 -L$SYSROOT/usr/local/lib -L$SYSROOT/usr/local/lib64 -L$GCC_INTERNAL_PATH -CEOF +cp -r kernel/kernel_installed/include sysroot +cp -r glibc/glibc_installed/* sysroot cd $SRC_DIR diff --git a/src/minimal_overlay/common.sh b/src/minimal_overlay/common.sh index e7eae9d98..f66061c4d 100755 --- a/src/minimal_overlay/common.sh +++ b/src/minimal_overlay/common.sh @@ -13,7 +13,6 @@ export BUNDLE_NAME=`basename $SRC_DIR` export DEST_DIR=$WORK_DIR/overlay/$BUNDLE_NAME/${BUNDLE_NAME}_installed export CONFIG=$MAIN_SRC_DIR/.config export SYSROOT=$WORK_DIR/sysroot -#export SYSROOT_SPECS=$WORK_DIR/sysroot.specs # Read the 'JOB_FACTOR' property from $CONFIG export JOB_FACTOR="$(grep -i ^JOB_FACTOR $CONFIG | cut -f2 -d'=')" @@ -29,16 +28,3 @@ export NUM_JOBS=$((NUM_CORES * JOB_FACTOR)) # Ideally we would export MAKE at this point with -j etc to allow programs to just run $(MAKE) and not worry about extra flags that need to be passed # export MAKE="${MAKE-make} -j $NUM_JOBS" - -# sysroot flags for the compiler - -#-Wl,-nostdlib is required to make ld / gcc ignore the host's /usr/lib and /lib -#ld_flags="-Wl,-nostdlib $(grep -- \"-L\" $SYSROOT_SPECS)" -#-static-libgcc is neeeded since we don't have the gcc-libs in our sysroot -#gcc_flags="-specs=$SYSROOT_SPECS -static-libgcc" - -# $ld_flags is passed 2 times because sometimes bundles ignore one of the variables -#export CC="${CC-gcc} $gcc_flags $ld_flags" -#export CFLAGS="$CFLAGS" -#export LDFLAGS="$LDFLAGS $ld_flags" -