Last active
September 21, 2017 22:29
-
-
Save tklengyel/6082a4227ab824cfebd9101e9e8f8095 to your computer and use it in GitHub Desktop.
Compile Linux with initrd and cmdline baked in
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Linux initrd and cmdline bake-in (on Debian stretch) | |
wget https://git.kernel.org/torvalds/t/linux-4.14-rc1.tar.gz | |
tar xvf linux-4.14-rc1.tar.gz | |
cp /boot/config-4.9.0-3-amd64 .config | |
make oldconfig # choosing all default options is fine | |
make -j8 deb-pkg | |
sudo dpkg -i ../linux-image-4.14.0-rc1_4.14.0-rc1-1_amd64.deb | |
mkdir initramfs | |
cd initramfs | |
zcat /boot/initrd.img-4.14.0-rc1 | cpio -idmv | |
# make changes if needed | |
cd .. | |
sudo apt-get remove linux-image-4.14.0-rc1 | |
#edit .config | |
CONFIG_BLK_DEV_INITRD=y | |
CONFIG_INITRAMFS_SOURCE="initramfs" | |
CONFIG_INITRAMFS_ROOT_UID=1000 <--- make sure it matches current owner of the initramfs folder | |
CONFIG_INITRAMFS_ROOT_GID=1000 <--- make sure it matches current owner of the initramfs folder | |
... | |
CONFIG_CMDLINE_BOOL=y | |
CONFIG_CMDLINE="root=/dev/sda2 ro quiet" # encoding root=UUID= path for root will break the kernel booting on other systems, make sure the disk is actually visible in fdisk -l as "sda" | |
CONFIG_CMDLINE_OVERRIDE=y | |
... | |
# Bake-in any other kernel modules needed here as appropriate | |
# recompile | |
make -j8 deb-pkg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment