File: buildlinux.rst

package info (click to toggle)
kworkflow 1%3A0.10-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 5,212 kB
  • sloc: sh: 31,869; perl: 2,172; sql: 268; ansic: 114; xml: 84; python: 76; makefile: 27
file content (91 lines) | stat: -rw-r--r-- 2,614 bytes parent folder | download
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
============================================================
  How to build the Linux kernel for an x86_64 architecture
============================================================
.. _buildlinux:

.. contents::
   :depth: 1
   :local:
   :backlinks: none

.. highlight:: console

Get a Linux repository
----------------------
After successfully :ref:`installing kw<install-and-remove-kw>`, it's time to
build the Linux kernel using it. Let's start by cloning the Linux repository
from Torvalds into our current working directory::

  git clone https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git

Then, change the current directory to the Linux repository::

  cd linux

.. note::
    From now on, all commands will assume you're in the kernel folder.

Get .config
-----------
To build the kernel, a **.config** file is necessary. This file contains
configurations about the kernel compilation process.
To retrieve this file from your computer, run either::

  cp /boot/config-`uname -r` .config

Or::

  zcat /proc/config.gz > .config

.. note::
    Get the **.config** file from the same Linux distribution you plan on using
    the customized kernel in.

Change .config a bit
--------------------
A small modification you can make in the **.config** file is changing the kernel
release name. To do that, run::

  kw build --menu

Or its shorter form::

  kw b -n

The default menu config option is set in the **kworkflow.config** file as
nconfig, but it can be changed, for instance, to menuconfig, or whichever you
prefer. To change this option, you can use::

  kw config build.menu_config menuconfig

After running the command above, go to *General setup*, then *Local version -
append to kernel release*, choose any name you like, save the new configuration
and exit the menu.

.. note::
  You can read more about the **kworkflow.config** file in our
  :ref:`manual<manual>`.

Build!
------
Building the kernel now is as easy as invoking::

  kw build

And it can be even simpler by just running::

  kw b

Well, that's it. kw will automatically infer the number of job slots for
compiling based on the number of cores of your machine (i.e. when running make
``-j<number>``, *<number>* is an integer that specifies the number of processes
that will run at the same time), and compilation will begin!

Compiling patchsets
-------------------
You may want to try compiling every patch in your patchset to test if everything is alright.
You can do this by using the "from-sha" flag::

  kw build --from-sha SHA

This will compile every patch after the commit with given SHA to the branch HEAD.