Last active
August 29, 2015 14:16
-
-
Save lorenzo-stoakes/8a23e4765fdaa0388148 to your computer and use it in GitHub Desktop.
Custom Kernel Build Script
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
#!/bin/bash | |
set -o errexit | |
# Ref: http://stackoverflow.com/a/6481016 | |
CORES=$(grep -c ^processor /proc/cpuinfo) | |
pushd ~/linux | |
make mrproper | |
make defconfig | |
# Required for systemd. | |
scripts/config --enable fhandle | |
# 1 extra thread to account for I/O waiting. | |
make -j$((CORES + 1)) | |
# Now to configure our kerndev environment. | |
sudo umount /mnt || true | |
sudo mount -o loop $HOME/kerndev/rootfs.img /mnt | |
trap "sudo umount /mnt" EXIT | |
sudo make headers_install INSTALL_HDR_PATH=/mnt/usr/ | |
sudo make modules_install INSTALL_MOD_PATH=/mnt/ | |
# Now build a new initrd using our environment. | |
sudo mkinitcpio -r /mnt -k ~/linux/arch/x86/boot/bzImage -g ~/kerndev/init.img | |
popd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment