Download and start the CoreOS development image in a container. Make sure to bind writable directories over the kernel's build and install paths.
wget 'http://alpha.release.core-os.net/amd64-usr/current/coreos_developer_container.bin.bz2'
bzcat coreos_developer_container.bin.bz2 > coreos_developer_container.bin
mkdir boot modules src
sudo systemd-nspawn \
--bind="$PWD/boot:/boot" \
--bind="$PWD/modules:/lib/modules" \
--bind="$PWD/src:/usr/src" \
--image=coreos_developer_container.bin
Using the shell inside the container, prepare and configure the Linux source.
emerge-gitclone
emerge -gKv bootengine coreos-sources dracut
update-bootengine -o /usr/src/linux/bootengine.cpio
echo 'CONFIG_INITRAMFS_SOURCE="bootengine.cpio"' | cat \
/var/lib/portage/coreos-overlay/sys-kernel/coreos-modules/files/{common,amd64_def}config-4.7 \
- > /usr/src/linux/.config
make -C /usr/src/linux menuconfig
Change the following modules to builtins.
squashfs
andloop
to be able to switch to the real imagevfat
,nls_cp437
, andnls_ascii
for configdrive support
For the ThinkPad X260, remember to enable the following drivers.
- DRM and Intel graphics (under Graphics devices)
- Wireless (under Networking) and Intel WiFi + MVM (under Network devices)
- Realtek PCIe (under Multifunction devices) and Realtek MMC (under MMC)
- Lenovo ACPI (under x86 platforms)
Set up keys for module signing. This creates a one-off pair; substitute your own if this build matters.
openssl req -batch -days 365 -newkey rsa:4096 -nodes -sha256 -x509 \
-keyform PEM -keyout /usr/src/linux/certs/modules.key.pem \
-outform PEM -out /usr/src/linux/certs/modules.pub.pem \
-subj '/CN=Kernel module signing key'
cat /usr/src/linux/certs/modules.{pub,key}.pem > /usr/src/linux/certs/modules.pem
make -C /usr/src/linux -j$(( 2 * `getconf _NPROCESSORS_ONLN` )) certs V=1
Build and install everything.
make -C /usr/src/linux -j$(( 2 * `getconf _NPROCESSORS_ONLN` )) all V=1
make -C /usr/src/linux install modules_install
With everything installed successfully, exit the container. The final binaries
are in the boot
and modules
directories.
Hi @dm0- . I found your gist when I was googling information about coreos kernel modification. Could you please advice how to install or move result modules to
/lib/modules
directory after compilation?