summaryrefslogtreecommitdiffstats
path: root/bin/env.setup-kernel.sh
blob: f1c62115097f5d688dcfe312357e518d600f76f3 (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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash

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

. $ROOT_DIR/config/setup.conf

cd $ROOT_DIR/build
if [ ! -f linux-${kernel_version}.tar.bz2 ]; then
	echo -e "[setup-kernel]\t\t Download Kernel ($kernel_version)."
	wget -q -c "$kernel_url"
else
	echo -e "[setup-kernel]\t\t Found Kernel package - skip download."
fi

if [ ! -d linux-${kernel_version} ]; then
	echo -e "[setup-kernel]\t\t Unpack Kernel."
	tar xjf linux-${kernel_version}.tar.bz2
else
	echo -e "[setup-kernel]\t\t Found unpacked kernel - continue."
fi


	echo -e "[setup-kernel]\t\t Patch Kernel with aufs stuff."
git clone git://aufs.git.sourceforge.net/gitroot/aufs/aufs3-standalone.git 2>&1
cd aufs3-standalone
#TODO: automatic choose aufs version..
git checkout origin/aufs3.1 2>&1
tar c include/linux/aufs_type.h Documentation fs | tar x -C ../linux-${kernel_version}

cd ../linux-${kernel_version}

patch -p1 < ../aufs3-standalone/aufs3-kbuild.patch
patch -p1 < ../aufs3-standalone/aufs3-base.patch
patch -p1 < ../aufs3-standalone/aufs3-proc_map.patch

cp ../aufs3-standalone/include/linux/aufs_type.h include/linux/


echo -e "[setup-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 "[setup-kernel]\t\t Details can be found in the log file: $ROOT_DIR/build/log/kernel-oldconfig.log"

cd - >/dev/null  2>&1