Added build hack to enforce Intel's "Turbo Boost". This should be harmless for single/virtual core processors. Now 'make' is always invoked with number of jobs higher than the available CPU cores.

This commit is contained in:
Ivan Davidov 2016-05-23 15:30:22 +03:00
parent cb775d98fa
commit a6dbd498ac
6 changed files with 68 additions and 16 deletions

View File

@ -137,3 +137,10 @@ COPY_SOURCE_ISO=true
# is 'true' for demonstration purposes.
USE_BOOT_LOGO=true
# This property is the multiplicator which is used during the build process. The
# total number of each 'make' jobs will be equal to the number of detected CPU
# cores mutiplied by this property. For example, if your CPU has 4 cores, then
# the number of 'make' jobs will be 4 * 2 = 8. Don't change this value unless
# you know what 'make' jobs are!
JOB_FACTOR=2

View File

@ -4,6 +4,15 @@ echo "*** BUILD KERNEL BEGIN ***"
SRC_DIR=$(pwd)
# Read the 'JOB_FACTOR' property from '.config'
JOB_FACTOR="$(grep -i ^JOB_FACTOR .config | cut -f2 -d'=')"
# Find the number of available CPU cores.
NUM_CORES=$(grep ^processor /proc/cpuinfo | wc -l)
# Calculate the number of 'make' jobs to be used later.
NUM_JOBS=$((NUM_CORES * JOB_FACTOR))
cd work/kernel
# Change to the kernel source directory which ls finds, e.g. 'linux-4.4.6'.
@ -11,7 +20,7 @@ cd $(ls -d linux-*)
# Cleans up the kernel sources, including configuration files.
echo "Preparing kernel work area..."
make mrproper
make mrproper -j $NUM_JOBS
# Read the 'USE_PREDEFINED_KERNEL_CONFIG' property from '.config'
USE_PREDEFINED_KERNEL_CONFIG="$(grep -i ^USE_PREDEFINED_KERNEL_CONFIG $SRC_DIR/.config | cut -f2 -d'=')"
@ -27,7 +36,7 @@ if [ "$USE_PREDEFINED_KERNEL_CONFIG" = "true" ] ; then
cp -f $SRC_DIR/minimal_config/kernel.config .config
else
# Create default configuration file for the kernel.
make defconfig
make defconfig -j $NUM_JOBS
echo "Generated default kernel configuration."
# Changes the name of the system to 'minimal'.
@ -66,12 +75,12 @@ fi
echo "Building kernel..."
make \
CFLAGS="-Os -s -fno-stack-protector -U_FORTIFY_SOURCE" \
bzImage -j $(grep ^processor /proc/cpuinfo | wc -l)
bzImage -j $NUM_JOBS
# Install kernel headers in './usr' (this is not '/usr') which are used later
# when we build and configure the GNU C library (glibc).
echo "Generating kernel headers..."
make headers_install
make headers_install -j $NUM_JOBS
cd $SRC_DIR

View File

@ -4,6 +4,15 @@ echo "*** BUILD GLIBC BEGIN ***"
SRC_DIR=$(pwd)
# Read the 'JOB_FACTOR' property from '.config'
JOB_FACTOR="$(grep -i ^JOB_FACTOR .config | cut -f2 -d'=')"
# Find the number of available CPU cores.
NUM_CORES=$(grep ^processor /proc/cpuinfo | wc -l)
# Calculate the number of 'make' jobs to be used later.
NUM_JOBS=$((NUM_CORES * JOB_FACTOR))
# Find the kernel build directory.
cd work/kernel
cd $(ls -d linux-*)
@ -48,13 +57,13 @@ $GLIBC_SRC/configure \
# Compile glibc with optimization for "parallel jobs" = "number of processors".
echo "Building glibc..."
make -j $(grep ^processor /proc/cpuinfo | wc -l)
make -j $NUM_JOBS
# Install glibc in the installation area, e.g. 'work/glibc/glibc_installed'.
echo "Installing glibc..."
make install \
DESTDIR=$GLIBC_INSTALLED \
-j $(grep ^processor /proc/cpuinfo | wc -l)
-j $NUM_JOBS
cd $SRC_DIR

View File

@ -4,6 +4,15 @@ echo "*** BUILD BUSYBOX BEGIN ***"
SRC_DIR=$(pwd)
# Read the 'JOB_FACTOR' property from '.config'
JOB_FACTOR="$(grep -i ^JOB_FACTOR .config | cut -f2 -d'=')"
# Find the number of available CPU cores.
NUM_CORES=$(grep ^processor /proc/cpuinfo | wc -l)
# Calculate the number of 'make' jobs to be used later.
NUM_JOBS=$((NUM_CORES * JOB_FACTOR))
# Remember the glibc installation area.
GLIBC_PREPARED=$(pwd)/work/glibc/glibc_prepared
@ -17,7 +26,7 @@ cd $(ls -d busybox-*)
# Remove previously generated artifacts.
echo "Preparing BusyBox work area. This may take a while..."
make distclean
make distclean -j $NUM_JOBS
# Read the 'USE_PREDEFINED_BUSYBOX_CONFIG' property from '.config'
USE_PREDEFINED_BUSYBOX_CONFIG="$(grep -i ^USE_PREDEFINED_BUSYBOX_CONFIG $SRC_DIR/.config | cut -f2 -d'=')"
@ -34,7 +43,7 @@ if [ "$USE_PREDEFINED_BUSYBOX_CONFIG" = "true" ] ; then
else
# Create default configuration file.
echo "Generating default BusyBox configuration..."
make defconfig
make defconfig -j $NUM_JOBS
# The 'inetd' applet fails to compile because we use the glibc installation area as
# main pointer to the kernel headers (see 05_prepare_glibc.sh) and some headers are
@ -53,13 +62,13 @@ sed -i "s/.*CONFIG_SYSROOT.*/CONFIG_SYSROOT=$GLIBC_PREPARED_ESCAPED/" .config
echo "Building BusyBox..."
make \
EXTRA_CFLAGS="-Os -s -fno-stack-protector -U_FORTIFY_SOURCE" \
busybox -j $(grep ^processor /proc/cpuinfo | wc -l)
busybox -j $NUM_JOBS
# Create the symlinks for busybox. The file 'busybox.links' is used for this.
echo "Generating BusyBox based initramfs area..."
make \
CONFIG_PREFIX="../busybox_installed" \
install
install -j $NUM_JOBS
cd $SRC_DIR

View File

@ -2,6 +2,15 @@
SRC_DIR=$(pwd)
# Read the 'JOB_FACTOR' property from '.config'
JOB_FACTOR="$(grep -i ^JOB_FACTOR .config | cut -f2 -d'=')"
# Find the number of available CPU cores.
NUM_CORES=$(grep ^processor /proc/cpuinfo | wc -l)
# Calculate the number of 'make' jobs to be used later.
NUM_JOBS=$((NUM_CORES * JOB_FACTOR))
if [ ! -d $SRC_DIR/work/glibc/glibc_prepared ] ; then
echo "Cannot continue - Dropbear SSH depends on GLIBC. Please buld GLIBC first."
exit 1
@ -13,7 +22,7 @@ cd work/overlay/dropbear
cd $(ls -d dropbear-*)
echo "Preparing Dropbear work area. This may take a while..."
make clean 2>/dev/null
make clean -j $NUM_JOBS 2>/dev/null
rm -rf ../dropbear_installed
@ -25,10 +34,10 @@ echo "Configuring Dropbear..."
CFLAGS="-Os -s -fno-stack-protector -U_FORTIFY_SOURCE"
echo "Building Dropbear..."
make
make -j $NUM_JOBS
echo "Installing Dropbear..."
make install
make install -j $NUM_JOBS
mkdir -p ../dropbear_installed/lib

View File

@ -2,13 +2,22 @@
SRC_DIR=$(pwd)
# Read the 'JOB_FACTOR' property from '.config'
JOB_FACTOR="$(grep -i ^JOB_FACTOR .config | cut -f2 -d'=')"
# Find the number of available CPU cores.
NUM_CORES=$(grep ^processor /proc/cpuinfo | wc -l)
# Calculate the number of 'make' jobs to be used later.
NUM_JOBS=$((NUM_CORES * JOB_FACTOR))
cd work/overlay/links
# Change to the Links source directory which ls finds, e.g. 'links-2.12'.
cd $(ls -d links-*)
echo "Preparing Links work area. This may take a while..."
make clean 2>/dev/null
make clean -j $NUM_JOBS 2>/dev/null
rm -rf ../links_installed
@ -25,10 +34,10 @@ echo "Configuring Links..."
sed -i "s/^CFLAGS = .*/CFLAGS = \\-Os \\-s \\-fno\\-stack\\-protector \\-U_FORTIFY_SOURCE/" Makefile
echo "Building Links..."
make
make -j $NUM_JOBS
echo "Installing Links..."
make install
make install -j $NUM_JOBS
echo "Reducing Links size..."
strip -g ../links_installed/bin/* 2>/dev/null