kernel builder

Signed-off-by: Jessica Frazelle <acidburn@docker.com>
This commit is contained in:
Jessica Frazelle 2015-09-02 21:33:43 -07:00
parent bafa1304c7
commit ea1c8173d2
2 changed files with 26 additions and 1 deletions

View File

@ -4,6 +4,7 @@ MAINTAINER Jessica Frazelle <jess@docker.com>
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
ca-certificates \ ca-certificates \
curl \ curl \
git \
kernel-package \ kernel-package \
make \ make \
libncurses5-dev \ libncurses5-dev \

View File

@ -10,17 +10,41 @@ install_kernel(){
fi fi
local MAJOR_VERSION=${VERSION:0:1} local MAJOR_VERSION=${VERSION:0:1}
local V=( ${VERSION//./ } )
local MAJOR_MINOR_VERSION="${V[0]}.${V[1]}"
# get the kernel source
if [[ "$VERSION" == *-rc* ]]; then 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 [ -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
MAJOR_MINOR_VERSION="${MAJOR_VERSION}.x-rcN"
else 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 [ -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 fi
# 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
cd /usr/src/linux-${VERSION} cd /usr/src/linux-${VERSION}
# 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
if [[ ! -f .config ]] && [[ -f ../config ]]; then if [[ ! -f .config ]] && [[ -f ../config ]]; then
cp ../config .config cp ../config .config
echo "CONFIG_AUFS_FS=y" >> .config
fi fi
nice -19 make -j$JOBS KDEB_PKGVERSION=$PKGVERSION INSTALL_MOD_STRIP=1 deb-pkg nice -19 make -j$JOBS KDEB_PKGVERSION=$PKGVERSION INSTALL_MOD_STRIP=1 deb-pkg