Added more default CFLAGS for better comaptibility with Ubuntu toolchain. Added the '-Os' flag which produces smaller output files. These changes haven't been tested yet.

This commit is contained in:
Ivan Davidov 2016-05-02 05:51:53 +03:00
parent 3fd9ada9a9
commit fe195af1ae
3 changed files with 13 additions and 3 deletions

View File

@ -39,7 +39,9 @@ fi
# Good explanation of the different kernels: # Good explanation of the different kernels:
# http://unix.stackexchange.com/questions/5518/what-is-the-difference-between-the-following-kernel-makefile-terms-vmlinux-vmlinux # http://unix.stackexchange.com/questions/5518/what-is-the-difference-between-the-following-kernel-makefile-terms-vmlinux-vmlinux
echo "Building kernel..." echo "Building kernel..."
make bzImage -j $(grep ^processor /proc/cpuinfo | wc -l) make \
CFLAGS="-Os -fno-stack-protector -U_FORTIFY_SOURCE" \
bzImage -j $(grep ^processor /proc/cpuinfo | wc -l)
# Install kernel headers in './usr' (this is not '/usr') which are used later # Install kernel headers in './usr' (this is not '/usr') which are used later
# when we build and configure the GNU C library (glibc). # when we build and configure the GNU C library (glibc).

View File

@ -30,7 +30,13 @@ cd ../glibc_objects
# will be installed in '/lib'. Kernel headers are taken from our already prepared # will be installed in '/lib'. Kernel headers are taken from our already prepared
# kernel header area (see 02_build_kernel.sh). Packages 'gd' and 'selinux' are disabled. # kernel header area (see 02_build_kernel.sh). Packages 'gd' and 'selinux' are disabled.
echo "Configuring glibc..." echo "Configuring glibc..."
../configure --prefix= --with-headers=$WORK_KERNEL_DIR/usr/include --without-gd --without-selinux --disable-werror ../configure \
--prefix= \
--with-headers=$WORK_KERNEL_DIR/usr/include \
--without-gd \
--without-selinux \
--disable-werror \
CFLAGS="-Os -fno-stack-protector -U_FORTIFY_SOURCE"
# Compile glibc with optimization for "parallel jobs" = "number of processors". # Compile glibc with optimization for "parallel jobs" = "number of processors".
echo "Building glibc..." echo "Building glibc..."

View File

@ -50,7 +50,9 @@ sed -i "s/.*CONFIG_SYSROOT.*/CONFIG_SYSROOT=$GLIBC_INSTALLED_ESCAPED/" .config
# Compile busybox with optimization for "parallel jobs" = "number of processors". # Compile busybox with optimization for "parallel jobs" = "number of processors".
echo "Building BusyBox..." echo "Building BusyBox..."
make EXTRA_CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0" busybox -j $(grep ^processor /proc/cpuinfo | wc -l) make \
EXTRA_CFLAGS="-Os -fno-stack-protector -U_FORTIFY_SOURCE" \
busybox -j $(grep ^processor /proc/cpuinfo | wc -l)
# Create the symlinks for busybox. The file 'busybox.links' is used for this. # Create the symlinks for busybox. The file 'busybox.links' is used for this.
echo "Generating BusyBox based initramfs area..." echo "Generating BusyBox based initramfs area..."