about summary refs log blame commit diff stats
path: root/core/linux.html
blob: dc7f7f15a3855b89073e306b8fb8dd86f0bb699d (plain) (tree)











































































































                                                                                                                                                                                                                                                          
                                             






                                                                                    
 <!DOCTYPE html>
<html dir="ltr" lang="en">
    <head>
        <meta charset='utf-8'>
        <title>3. Kernel Linux</title>
    </head>
    <body>

        <a href="index.html">Systools Index</a>
        <h1 id="kernel">3.6. Kernel Linux</h1>

        <p>Linux is a monolith kernel, a big one !!!.</p>

        <p>This instructions are done
       with <a href="install.html#step6">active chroot</a>
       and inside chroot;</p>

       <pre>
       # chroot $CHROOT /bin/bash
       </pre>

        <h2 id="#linuxlibre">3.6.1. Port Linux Libre</h2>

        <p>This will install <a href="../ports/linux-libre/">linux-libre</a> port
        and dracut;</p>

        <pre>
        $ prt-get depinst linux-libre
        </pre>

        <h2 id="kinstall">3.6.2. Manual Install</h2>

        <p>Download Linux Source from <a href="http://linux-libre.fsfla.org/pub/linux-libre/releases/">linux libre</a>, this ensure that kernel is free of blobs.</p>

        <pre>
        $ pkgmk -do
        </pre>

        <p>Crux iso comes with config that you can use as
        a starting point.</p>

        <pre>

        cp ../linux-4.5.5.defconfig .config
        $ make oldefconfig
        </pre>


        <p>If you like <a href="https://github.com/graysky2/kernel_gcc_patch/">graysky2</a> kernel_gcc_patch (<a href="https://github.com/graysky2/kernel_gcc_patch/archive/master.zip">download master</a>) that adds more cpu options (FLAGS native)</p>

        <pre>
        $ unzip kernel_gcc_patch-master.zip
        </pre>

        <pre>
        $ cd ~/linux-4.5.5/
        $ patch -p1 &lt; ../kernel_gcc_patch-master/enable_additional_cpu_optimizations_fo
        r_gcc_v4.9+_kernel_v3.15+.patch
        patching file arch/x86/include/asm/module.h
        patching file arch/x86/Kconfig.cpu
        patching file arch/x86/Makefile
        Hunk #1 succeeded at 85 (offset -7 lines).
        patching file arch/x86/Makefile_32.cpu
        </pre>

        <p><a href="https://en.wikibooks.org/wiki/Grsecurity/Configuring_and_Installing_grsecurity#Patching_Your_Kernel_with_grsecurity">Gresecurity</a></p>

        <pre>
        patch -p1 &lt; $SRC/grsecurity-3.1-4.5.5-201605291201.patch
        </pre>

        <p>Configure kernel according to your current kernel
        hardware support run;</p>

        <pre>
        $ make localmodconfig
        </pre>

        <p>This will disable all unloaded modules,
        you can use localyesconfig mark all loaded
        to be built in the kernel. This example
        get information about which graphic
        module (driver) is in use;</p>

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


        <pre>
        $ cd ~/linux-4.5.5/
        $ make -j $(nproc) all
        $ sudo make modules_install
        $ sudo cp arch/x86/boot/bzImage /boot/vmlinuz-4.5.5
        $ sudo cp System.map /boot/System.map-4.5.5
        </pre>

        <h2 id="kuninstall">3.6.3. Manual Remove</h2>

        <pre>
        $ sudo rm -r /lib/modules/4.5.5-gnu
        $ sudo rm /boot/vmlinuz-4.5.5
        $ sudo rm /boot/System.map-4.5.5
        </pre>

        <a href="index.html">Systools Index</a>
        <p>This is part of the c9-doc Manual.
Copyright (C) 2016
Silvino Silva.
See the file <a href="../fdl-1.3-standalone.html">Gnu Free Documentation License</a>
for copying conditions.</p>

    </body>
</html>