Table of Contents
CentOS Custom Kernel
Build Environment
LXC containers are just great! With LXC and LXD installed, we can set up a clean build environment with a single command:
[root@kurma ktm5j]# lxc launch images:centos/7 kernel01 [root@kurma ktm5j]# lxc exec kernel01 -- /bin/bash <- Get a shell [root@kernel01 ~]# <- bam
RPM build
There's a great article about getting kernel source packages here: https://wiki.centos.org/HowTos/I_need_the_Kernel_Source
And information about the dev/build process: https://wiki.centos.org/HowTos/Custom_Kernel
After modifying the tree, run build:
[user@host SPECS]$ rpmbuild -bb --target=`uname -m` kernel.spec 2> build-err.log | tee build-out.log
To install all kernel-* packages, run:
[root@host]# yum localinstall kernel-*.rpm
Patch for Overlay Filesystem
For this kernel we want to apply the following patch: https://kernel.ubuntu.com/git/ubuntu/ubuntu-xenial.git/commit?id=0c29f9eb00d76a0a99804d97b9e6aba5d0bf19b3
diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c index 8b2369c..d510975 100644 --- a/fs/overlayfs/super.c +++ b/fs/overlayfs/super.c @@ -1174,6 +1174,7 @@ static struct file_system_type ovl_fs_type = { .name = "overlay", .mount = ovl_mount, .kill_sb = kill_anon_super, + .fs_flags = FS_USERNS_MOUNT, }; MODULE_ALIAS_FS("overlay");
Using the process/information from above, we need to:
- Obtain kernel source packages
- Install packages as non-root user
- Modify the source tree (placed in user home dir)
- Build new RPM packages with modified source tree
A tarball containing the resulting packages from this build can be found in the software partition: /sw/pkgs/kernel-3.10.0-957.1.3.el7.cs_benchexec.x86_64.tar.xz