blob: 51386762d0787780574a03202d91b103cbe653d5 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #666666 } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008800 } /* Keyword.Pseudo */
.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */
.highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */
.highlight .na { color: #336699 } /* Name.Attribute */
.highlight .nb { color: #003388 } /* Name.Builtin */
.highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */
.highlight .no { color: #003366; font-weight: bold } /* Name.Constant */
.highlight .nd { color: #555555 } /* Name.Decorator */
.highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */
.highlight .nl { color: #336699; font-style: italic } /* Name.Label */
.highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */
.highlight .py { color: #336699; font-weight: bold } /* Name.Property */
.highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */
.highlight .nv { color: #336699 } /* Name.Variable */
.highlight .ow { color: #008800 } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */
.highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */
.highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ <!DOCTYPE html>
<html dir="ltr" lang="en">
<head>
<meta charset='utf-8'>
<title>2.1. Kernel Linux</title>
</head>
<body>
<a href="index.html">Core OS Index</a>
<h1 id="kernel">2.1. 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.1.1. Port Linux Libre</h2>
<p>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;</p>
<pre>
$ prt-get depinst linux-libre
</pre>
<h2 id="kinstall">2.1.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>
<p>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);</p>
<pre>
$ 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/
</pre>
<p><a href="grsecurity.net">Grsecurity</a> patch for
<a href="https://grsecurity.net/test/grsecurity-3.1-4.9.9-201702122044.patch">4.9.11</a>.
Gcc <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">master.zip</a>)
that adds more cpu options (FLAGS native).
Check <a href="ports/linux-libre/Pkgfile">Pkgfile</a> for instructions and
more patches used on linux-libre port. Read patching your kernel with
<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. 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) 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
</pre>
<p>Create dracut initramfs;</p>
<pre>
$sudo dracut --fstab /boot/initramfs-4.9.11-gnu.img 4.9.11-gnu
</pre>
<p>Update grub;</p>
<pre>
# grub-mkconfig -o /boot/grub/grub.cfg
</pre>
<h2 id="kuninstall">2.1.3. Manual Remove</h2>
<pre>
$ 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
</pre>
<h2 id="dracut">2.1.4. Dracut</h2>
<p>Install dracut;</p>
<pre>
# cd /usr/ports/c9-ports/dracut
# pkgmk -d
# pkgadd /usr/ports/packages/dracut#044-2.pkg.tar.gz
</pre>
<p>Review configuration file;</p>
<pre>
# PUT YOUR CONFIG IN separate files
# in /etc/dracut.conf.d named "<name>.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
</pre>
<p>Run dracut to create init ram filesystem for
port linux-blob kernel;</p>
<pre>
# dracut -v /boot/initramfs-4.9.11-blob.img 4.9.11-blob
</pre>
<a href="index.html">Core OS Index</a>
<p>This is part of the c9-doc Manual.
Copyright (C) 2017
c9 team.
See the file <a href="../fdl-1.3-standalone.html">Gnu Free Documentation License</a>
for copying conditions.</p>
</body>
</html>
|