- Download the latest sources via the Arch Built System tool
abs:
sudo abs community/linux-grsec
The default abs directory is /var/abs/, so the linux-grsec build files will be located in
/var/abs/community/linux-grsec/.
I build kernel things in my home directory, so I change to that directory:
cd ~/src/abs/
- Copy the abs directory to the current working directory:
cp -R /var/abs/community/linux-grsec/ .
cd linux-grsec/
-
Open the
PKGBUILDfile with your favourite editor.- Replace
pkgbase=linux-grsecwithpkgbase=linux-grsec-custom. - Scroll down to the section
#load configurationand uncomment your favourite config tool. I likemake nconfig.
- Replace
-
Save the file and exit your editor.
-
Rename the .install file to match the name specified in
PKGBUILD:
mv linux-grsec.install linux-grsec-custom.install
- Start the
makepkgprocess:
MAKEFLAGS="-j$(nproc)" makepkg -s
The -j flag specifies the number of jobs to be run simultaneously my make.
We set it to $(nproc) - the number of processor cores on our machine.
Using multiple cores speeds up the compilation considerably.
Once makepkg has downloaded the kernel sources and patches,
you will see the kernel configuration menu pop up in your terminal.
Now you can either find and set kernel options by yourself (view a
list of grsec config options here), or provide an existing config file.
For example, use the following command to write your current .config to a file:
sudo zcat /proc/config.gz > current.config
(You may need to move the file into the src/linux-*/ subdirectory so your config editor can find it.)
- When you're done setting kernel options, exit the configuration menu and watch the kernel compile. That's going to take a while.
Once compilation is finished, you will find that makepkg has written 3 files to your current directory:
linux-grsec-custom-*.pkg.tar
linux-grsec-custom-docs-*.pkg.tar
linux-grsec-custom-headers-*.pkg.tar
- Install them with
sudo pacman -U linux-grsec-custom-*.pkg.tarand you're done!