about summary refs log blame commit diff stats
path: root/core/linux.html
blob: ba80aab84c67f2bf1e922bab70da5499a20711e0 (plain) (tree)
1
2
3
4
5
6
7
8
9
10



                              
                                        


           

                                              
 




                                                                                   
 
                                                         
 



                                                                      




                                     
                                                    
 


                                                                                         

             

                                            

              

                                                                         

             





                                                                     

              


                                                                                                                                                                                                                                                          
                                                                                                                                   


              

                                                   


                                                   
                                                              
                                              
         

              
                                                                                                                                                                  

                                                            
                             






                                                  




                                                   



                                                      

              




                                                          

             

                                   













                                                                                

              
                                                     

             


                                                  

              
                                              
                                             






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

        <a href="index.html">Core OS Index</a>
        <h1 id="kernel">2.3. Kernel Linux</h1>

        <p>Linux is a monolith kernel, a big one ! Visit
        <a href="http://www.fsfla.org/ikiwiki/selibre/linux-libre/">Linux Libre</a>
        and
        <a href="https://www.kernel.org/">Linux Non-Libre</a> pages for more links
        and information.</p>

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

        <p>Collection c9-ports have linux-libre port with default crux
        configuration, this port depends on dracut and grub but is not
        required to install them. To build and install this port using
        prt-get;</p>

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

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

        <p>Download Linux Source from
        <a href="http://linux-libre.fsfla.org/pub/linux-libre/releases/">linux libre</a>,
        or using the port system;</p>

        <pre>
        $ cd /usr/ports/c9-ports/linux-libre
        $ sudo -u pkgmk pkgmk -do
        </pre>

        <p>Crux iso comes with config that is used in this port, is
        a good starting point to personalize according to your needs;</p>

        <pre>
        $ mkdir ~/kernel
        $ cd ~/kernel
        $ cp /usr/ports/c9-ports/linux-libre/linux-4.1.32.defconfig .
        $ cp /usr/ports/distfiles/linux-libre-4.1.32-gnu.tar.xz .
        $ tar xf linux-libre-4.1.32-gnu.tar.xz
        $ cp linux-4.1.32.defconfig linux-4.1.32/.config
        </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>
        $ cp /usr/ports/distfiles/enable_additional_cpu_optimizations_for_gcc_v4.9%2B_kernel_v3.15%2B.patch cpu_optimizations.patch
        </pre>

        <pre>
        $ cd ~/linux-4.1.32/
        $ patch -p1 &lt; ../cpu_optimizations.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 with fuzz 1 (offset -9 lines).
        patching file arch/x86/Makefile_32.cpu
        $
        </pre>

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

        <p>Configure kernel according to your current kernel
        hardware support;</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.</p>

        <p>To get information about your hardware,
        for example information about which graphic
        module (driver) is in use as root run;</p>

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

        <p>Before start compiling check configuration;</p>

        <pre>
        $ make nconfig
        </pre>

        <pre>
        $ make -j $(nproc) all
        $ sudo make modules_install
        $ sudo cp arch/x86/boot/bzImage /boot/vmlinuz-4.1.32-gnu_crux
        $ sudo cp System.map /boot/System.map-4.1.32-gnu_crux
        </pre>

        <p>Create dracut initramfs;</p>

        <pre>
        $sudo dracut --fstab /boot/initramfs-4.1.32-gnu_crux.img 4.1.32-gnu_crux
        </pre>

        <p>Update grub;</p>

        <pre>
        # grub-mkconfig -o /boot/grub/grub.cfg
        </pre>

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

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

        <a href="index.html">Core OS 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>