Kernel/Arch Build System
zh-CN:Kernels/Compilation/Arch Build System The Arch Build System can be used to build a custom kernel based on the official package. This compilation method can automate the entire process, and is based on a very well tested package. You can edit the PKGBUILD to use a custom kernel configuration or add additional patches.
Getting the Ingredients
# pacman -S abs base-devel
First of all, you need a clean kernel to start your customization from. Fetch the kernel package files from ABS:
$ ABSROOT=. abs core/linux
If you have some problem with the firewall blocking the rsync port, you can try with -t, which uses the tarball to sync.
$ ABSROOT=. abs core/linux -t
Then, get any other file you need (e.g. custom configuration files, patches, etc.) from the respective sources.
Modifying the PKGBUILD
pkgbase for your custom package name, e.g.:
If you dont want to build -headers or -docs package, remove them from
pkgname at the bottom of the file, e.g.:
You probably need a custom .config file for your kernel. You can uncomment one of the possibilities shown in the build() function of the PKGBUILD, e.g.:
... # load configuration # Configure the kernel. Replace the line below with one of your choice. #make menuconfig # CLI menu for configuration make nconfig # new CLI menu for configuration #make xconfig # X-based configuration #make oldconfig # using old config from previous kernel version # ... or manually edit .config ...
If you have already a kernel config file, I suggest to uncomment one interactive config tool, such as nconfig, and load your config from there. This avoids problems with kernel naming I have met with other methods.
You can now proceed to compile you kernel by the usual command
If you have chosen an interactive program for configuring the kernel parameters (like menuconfig), you need to be there during the compilation.
After the makepkg, you can have a look at the linux.install file. You will see that some variables have changed. Now, you only have to install the package as usual with pacman (or equivalent program):
# pacman -U <kernel_package>
Now, the folders and files for your custom kernel have been created, e.g.
/boot/vmlinuz-linux-test. To test your kernel, update your bootloader (/boot/grub/menu.lst for GRUB) and add new entries ('default' and 'fallback') for your custom kernel. That way, you can have both the stock kernel and the custom one to choose from.