2015-06-06 03:18:27 +02:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
|
2015-09-11 00:39:22 +02:00
|
|
|
linux_next(){
|
|
|
|
(
|
|
|
|
cd /usr/src
|
|
|
|
|
|
|
|
# check if we already have the source checked out
|
|
|
|
if [[ -d linux ]]; then
|
|
|
|
cd linux
|
|
|
|
|
|
|
|
git checkout master
|
|
|
|
|
|
|
|
git remote update
|
|
|
|
else
|
|
|
|
# clone the source files
|
|
|
|
git clone https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
|
|
|
|
|
|
|
|
# add the linux-next remote
|
|
|
|
cd linux
|
|
|
|
git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
|
|
|
|
|
|
|
|
# fetch linux-next and tags
|
|
|
|
git fetch linux-next
|
|
|
|
git fetch --tags linux-next
|
|
|
|
fi
|
|
|
|
|
|
|
|
git checkout -b next-$(date +%Y%m%d) next-$(date +%Y%m%d)
|
|
|
|
|
|
|
|
if [[ ! -f .config ]] && [[ -f ../config ]]; then
|
|
|
|
cp ../config .config
|
|
|
|
fi
|
|
|
|
|
|
|
|
nice -19 make -j$JOBS KDEB_PKGVERSION=$PKGVERSION INSTALL_MOD_STRIP=1 deb-pkg
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2015-06-06 03:18:27 +02:00
|
|
|
install_kernel(){
|
|
|
|
local VERSION=$1
|
|
|
|
|
|
|
|
if [[ -z $VERSION ]]; then
|
|
|
|
echo "Please specify a kernel version."
|
|
|
|
exit 1
|
2015-09-11 00:39:22 +02:00
|
|
|
elif [[ "$VERSION" == "next" ]]; then
|
|
|
|
linux_next
|
|
|
|
exit 0
|
2015-06-06 03:18:27 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
local MAJOR_VERSION=${VERSION:0:1}
|
2015-09-03 06:33:43 +02:00
|
|
|
local V=( ${VERSION//./ } )
|
|
|
|
local MAJOR_MINOR_VERSION="${V[0]}.${V[1]}"
|
|
|
|
|
|
|
|
# get the kernel source
|
2015-06-06 03:18:27 +02:00
|
|
|
if [[ "$VERSION" == *-rc* ]]; then
|
|
|
|
[ -d /usr/src/linux-${VERSION} ] || curl -sSL https://kernel.org/pub/linux/kernel/v${MAJOR_VERSION}.x/testing/linux-${VERSION}.tar.xz | tar -v -C /usr/src -xJ
|
2015-09-11 00:39:22 +02:00
|
|
|
|
2015-09-03 06:33:43 +02:00
|
|
|
MAJOR_MINOR_VERSION="${MAJOR_VERSION}.x-rcN"
|
2015-06-06 03:18:27 +02:00
|
|
|
else
|
|
|
|
[ -d /usr/src/linux-${VERSION} ] || curl -sSL https://www.kernel.org/pub/linux/kernel/v${MAJOR_VERSION}.x/linux-${VERSION}.tar.xz | tar -v -C /usr/src -xJ
|
|
|
|
fi
|
|
|
|
|
2015-09-03 06:33:43 +02:00
|
|
|
# get the aufs standalone source
|
|
|
|
aufsdir=/usr/src/aufs4-standalone
|
|
|
|
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
|
|
|
|
cd $aufsdir
|
|
|
|
|
2015-06-06 03:18:27 +02:00
|
|
|
cd /usr/src/linux-${VERSION}
|
|
|
|
|
2015-09-03 06:33:43 +02:00
|
|
|
# apply the aufs patches
|
|
|
|
git apply $aufsdir/aufs4-kbuild.patch
|
|
|
|
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/
|
|
|
|
|
|
|
|
# remove aufs source
|
|
|
|
rm -rf $aufsdir
|
|
|
|
|
2015-06-16 21:52:08 +02:00
|
|
|
if [[ ! -f .config ]] && [[ -f ../config ]]; then
|
|
|
|
cp ../config .config
|
2015-09-03 06:33:43 +02:00
|
|
|
echo "CONFIG_AUFS_FS=y" >> .config
|
2015-06-16 21:52:08 +02:00
|
|
|
fi
|
|
|
|
|
2015-06-06 03:18:27 +02:00
|
|
|
nice -19 make -j$JOBS KDEB_PKGVERSION=$PKGVERSION INSTALL_MOD_STRIP=1 deb-pkg
|
|
|
|
}
|
|
|
|
|
|
|
|
install_kernel $@
|