update kernel builder

Signed-off-by: Jess Frazelle <jess@mesosphere.com>
This commit is contained in:
Jess Frazelle 2016-03-23 10:42:00 -07:00
parent d5dbee9c86
commit 1faa831e49
No known key found for this signature in database
GPG Key ID: 18F3685C0022BFF3

View File

@ -39,6 +39,7 @@ linux_next(){
install_kernel(){ install_kernel(){
local VERSION=$1 local VERSION=$1
local OPT=$2
if [[ -z $VERSION ]]; then if [[ -z $VERSION ]]; then
echo "Please specify a kernel version." echo "Please specify a kernel version."
@ -61,46 +62,60 @@ install_kernel(){
[ -d /usr/src/linux-${VERSION} ] || curl -sSL https://cdn.kernel.org/pub/linux/kernel/v${MAJOR_VERSION}.x/linux-${VERSION}.tar.xz | tar -v -C /usr/src -xJ [ -d /usr/src/linux-${VERSION} ] || curl -sSL https://cdn.kernel.org/pub/linux/kernel/v${MAJOR_VERSION}.x/linux-${VERSION}.tar.xz | tar -v -C /usr/src -xJ
fi fi
# get the aufs standalone source if [[ "$OPT" == "aufs" ]]; then
aufsdir=/tmp/aufs4-standalone # get the aufs standalone source
if [[ -d $aufsdir ]]; then aufsdir=/tmp/aufs4-standalone
rm -rf $aufsdir if [[ -d $aufsdir ]]; then
rm -rf $aufsdir
fi
git clone -b aufs${MAJOR_MINOR_VERSION} --single-branch --depth 1 https://github.com/sfjro/aufs4-standalone.git $aufsdir
fi fi
git clone -b aufs${MAJOR_MINOR_VERSION} --single-branch --depth 1 https://github.com/sfjro/aufs4-standalone.git $aufsdir
# get the grsec patches if [[ "$OPT" == "grsec" ]]; then
grsecdir=/tmp/grsec # get the grsec patches
if [[ -d $grsecdir ]]; then grsecdir=/tmp/grsec
rm -rf $grsecdir if [[ -d $grsecdir ]]; then
rm -rf $grsecdir
fi
mkdir -p $grsecdir
curl -sSL -o "${grsecdir}/grsecurity.patch" "https://grsecurity.net/test/grsecurity-${GRSEC_VERSION}.patch"
curl -sSL -o "${grsecdir}/grsecurity.patch.sig" "https://grsecurity.net/test/grsecurity-${GRSEC_VERSION}.patch.sig"
# add the gpg key
gpg --keyserver pgp.mit.edu --recv-keys "DE94 52CE 46F4 2094 907F 108B 44D1 C0F8 2525 FE49"
# verify the patch
gpg --verify $grsecdir/grsecurity.patch.sig
fi fi
mkdir -p $grsecdir
curl -sSL -o "${grsecdir}/grsecurity.patch" "https://grsecurity.net/test/grsecurity-${GRSEC_VERSION}.patch"
curl -sSL -o "${grsecdir}/grsecurity.patch.sig" "https://grsecurity.net/test/grsecurity-${GRSEC_VERSION}.patch.sig"
# add the gpg key
gpg --keyserver pgp.mit.edu --recv-keys "DE94 52CE 46F4 2094 907F 108B 44D1 C0F8 2525 FE49"
# verify the patch
gpg --verify $grsecdir/grsecurity.patch.sig
# apply the patches and compile the kernel # apply the patches and compile the kernel
cd /usr/src/linux-${VERSION} cd /usr/src/linux-${VERSION}
# apply the aufs patches # apply the patches
patch -p1 < $grsecdir/grsecurity.patch || true if [[ "$OPT" == "grsec" ]]; then
git apply $aufsdir/aufs4-kbuild.patch patch -p1 < $grsecdir/grsecurity.patch || true
git apply $aufsdir/aufs4-base.patch fi
git apply $aufsdir/aufs4-mmap.patch if [[ "$OPT" == "aufs" ]]; then
cp -r $aufsdir/{Documentation,fs} . git apply $aufsdir/aufs4-kbuild.patch
cp $aufsdir/include/uapi/linux/aufs_type.h include/uapi/linux/ git apply $aufsdir/aufs4-base.patch
git apply $aufsdir/aufs4-mmap.patch
cp -r $aufsdir/{Documentation,fs} .
cp $aufsdir/include/uapi/linux/aufs_type.h include/uapi/linux/
fi
# remove aufs source if [[ "$OPT" == "aufs" ]]; then
rm -rf $aufsdir # remove aufs source
rm -rf $aufsdir
fi
# remove grsecdir if [[ "$OPT" == "grsec" ]]; then
rm -rf $grsecdir # remove grsecdir
rm -rf $grsecdir
fi
if [[ ! -f .config ]] && [[ -f ../config ]]; then if [[ ! -f .config ]] && [[ -f ../config ]]; then
cp ../config .config cp ../config .config
echo "CONFIG_AUFS_FS=y" >> .config if [[ "$OPT" == "aufs" ]]; then
echo "CONFIG_AUFS_FS=y" >> .config
fi
fi fi
nice -19 make -j$JOBS KDEB_PKGVERSION=$PKGVERSION DISABLE_PAX_PLUGINS=y INSTALL_MOD_STRIP=1 deb-pkg nice -19 make -j$JOBS KDEB_PKGVERSION=$PKGVERSION DISABLE_PAX_PLUGINS=y INSTALL_MOD_STRIP=1 deb-pkg