summaryrefslogtreecommitdiffstats
path: root/bin/build.kernel.sh
blob: 76699eb59702e0dbd59df2973355122fa830ffc8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash

ROOT_DIR=$(readlink -f $(dirname $(readlink -f $0))/..)

. $ROOT_DIR/config/setup.conf

cd $ROOT_DIR/build

if [ ! -d linux-${kernel_version} ]; then
  echo -e "[build-kernel] \t\t Can't find kernel-sources. Re-run kernel env setup."
  $ROOT_DIR/bin/env.setup-kernel.sh
fi

echo -e "[build-kernel]\t\t Update Kernel config."
cd linux-${kernel_version}
cp ${ROOT_DIR}/config/kernel.config ./.config

mkdir -p $ROOT_DIR/build/log

yes "" | linux32 make oldconfig > $ROOT_DIR/build/log/kernel-oldconfig.log 2>&1

echo -e "[build-kernel]\t\t Build Kernel (Could take some time)."
linux32 make -j $make_num_jobs > $ROOT_DIR/build/log/kernel-compile.log 2>&1

cp arch/x86/boot/bzImage ../kernel-preboot-latest 

KERNEL_SIZE=$(stat -c %s ${ROOT_DIR}/build/kernel-preboot-latest)

echo -e "[build-kernel] \t\t New Kernel build successfully."
echo -e "\t\t\t   Location: ${ROOT_DIR}/build/kernel-preboot-latest ."
echo -e "\t\t\t   Size: ${KERNEL_SIZE} bytes."

cd - >/dev/null  2>&1