Cleaned up sysroot creation

Removed all traces of sysroot.spec
Copy kernel headers instead of symlinking theam (~6.7MB more space)
This commit is contained in:
bauen1 2017-12-02 10:08:02 +01:00
parent 7d2de5053b
commit 58ccaa6ab1
No known key found for this signature in database
GPG Key ID: FF0AAF5E0812BA9C
2 changed files with 5 additions and 57 deletions

View File

@ -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

View File

@ -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"