Core OS Index

2.1. Kernel Linux

Linux is a monolith kernel, a big one ! Visit Linux Libre and Linux Non-Libre pages for more links and information.

2.1.1. Port Linux Libre

Default crux configuration can be obtained from iso, this port depends on dracut and grub but is not required to install them. To build and install this port using prt-get;

        $ prt-get depinst linux-libre
        

2.1.2. Manual Install

Download Linux Source from linux libre, or using the port system;

Crux iso comes with config that is more generic than used on linux-libre port, crux default is a good starting point to personalize according to your needs (build default, detect modules needed);

        $ mkdir ~/kernel
        $ cd ~/kernel
        $ cp /usr/ports/distfiles/linux-libre-4.9.11-gnu.tar.xz .
        $ tar xf linux-libre-4.9.11-gnu.tar.xz
        $ cd linux-4.9.11/
        

Grsecurity patch for 4.9.11. Gcc graysky2 kernel_gcc_patch (master.zip) that adds more cpu options (FLAGS native). Check Pkgfile for instructions and more patches used on linux-libre port. Read patching your kernel with gresecurity.

Configure kernel according to your current kernel hardware support;

        $ make localmodconfig
        

This will disable all unloaded modules, you can use localyesconfig mark all loaded to be built in the kernel. To get information about your hardware, for example information about which graphic module (driver) is in use as root run;

        # lspci -nnk | grep -i vga -A3 | grep 'in use'
        Kernel driver in use: i915
        

Before start compiling check configuration;

        $ make nconfig
        
        $ make -j $(nproc) bzImage modules
        $ sudo make modules_install
        $ sudo cp arch/x86/boot/bzImage /boot/vmlinuz-4.9.11-gnu
        $ sudo cp System.map /boot/System.map-4.9.11-gnu
        

Create dracut initramfs;

        $sudo dracut --fstab /boot/initramfs-4.9.11-gnu.img 4.9.11-gnu
        

Update grub;

        # grub-mkconfig -o /boot/grub/grub.cfg
        

2.1.3. Manual Remove

        $ sudo rm -r /lib/modules/4.9.11-gnu
        $ sudo rm /boot/vmlinuz-4.9.11-gnu
        $ sudo rm /boot/System.map-4.9.11-gnu
        

2.1.4. Dracut

Install dracut;

        # cd /usr/ports/c9-ports/dracut
        # pkgmk -d
        # pkgadd /usr/ports/packages/dracut#044-2.pkg.tar.gz
        

Review configuration file;

        # PUT YOUR CONFIG IN separate files
        # in /etc/dracut.conf.d named ".conf"

        # Equivalent to -H
        hostonly="yes"

        # Mount / and /usr read-only by default.
        ro_mnt="no"

        # Equivalent to -m "module module module"
        dracutmodules+="dash kernel-modules rootfs-block udev-rules usrmount base fs-lib shutdown"

        # Equivalent to -a "module"
        add_dracutmodules+="caps debug"

        # Equivalent to -o "module"
        #omit_dracutmodules+="systemd systemd-bootchart systemd-networkd systemd-initrd"

        # SEE man dracut.conf(5) for options
        

Run dracut to create init ram filesystem for port linux-blob kernel;

        # dracut -v /boot/initramfs-4.9.11-blob.img 4.9.11-blob
        
Core OS Index

This is part of the c9-doc Manual. Copyright (C) 2017 c9 team. See the file Gnu Free Documentation License for copying conditions.