Posted: . At: 10:50 AM. This was 8 years ago. Post ID: 8832
Page permalink. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters.
These cookies expire two weeks after they are set.


How to build a 4.6 kernel on Ubuntu 16.04.


Firstly, download a kernel tarball from kernel.org.

jason@jason-desktop:~$ wget https://cdn.kernel.org/pub/linux/kernel/v4.x/testing/linux-4.6-rc1.tar.xz
--2016-03-29 10:22:34--  https://cdn.kernel.org/pub/linux/kernel/v4.x/testing/linux-4.6-rc1.tar.xz
Resolving cdn.kernel.org (cdn.kernel.org)... 103.245.222.69
Connecting to cdn.kernel.org (cdn.kernel.org)|103.245.222.69|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 89423304 (85M) [application/x-xz]
Saving to: 'linux-4.6-rc1.tar.xz’
 
linux-4.6-rc1.tar.xz                  100%[======================================================================>]  85.28M  1.29MB/s    in 66s
 
2016-03-29 10:23:54 (1.28 MB/s) - 'linux-4.6-rc1.tar.xz’ saved [89423304/89423304]

Then unpack the kernel tarball.

jason@jason-desktop:~$ tar -xvf linux-4.6-rc1.tar.xz

Then copy an existing kernel configuration from your /boot folder to create a config for the menuconfig to use.

jason@jason-desktop:~/linux-4.6-rc1$ cp /boot/config-4.5.0-johnpc .config

Then run this command to setup the kernel.

jason@jason-desktop:~/linux-4.6-rc1$ make menuconfig

Then build the kernel and modules. I am connected to my machine over the Internet with SSH, so I will run this command in the background with NOHUP.

jason@jason-desktop:~/linux-4.6-rc1$ nohup make && make modules &

Once this has completed, install all of the modules to the /lib/modules directory.

jason@jason-desktop:~$ sudo make modules_install

Then install the kernel to the system.

jason@jason-desktop:~$ sudo make install

Now after all of this effort, we need to prepare the kernel source for installation.

jason@jason-desktop:~/linux-4.6-rc1$ sudo make clean prepare

The source code tree is copied to the /usr/src directory and symlinks created so that it looks like this.

jason@jason-desktop:~/linux-4.6-rc1$ ls -hula /usr/src/
total 36K
drwxr-xr-x  9 root  root  4.0K Mar 30 10:44 .
drwxr-xr-x 11 root  root  4.0K Mar 30  2016 ..
drwxrwxr-x 25 jason jason 4.0K Mar 22 11:16 linux-4.5
drwxrwxr-x 25 jason jason 4.0K Mar 30 10:44 linux-4.6-rc1
drwxr-xr-x 27 root  root  4.0K Jan 16 13:13 linux-headers-4.3.0-6
drwxr-xr-x  7 root  root  4.0K Jan 16 13:16 linux-headers-4.3.0-6-generic
drwxr-xr-x 24 root  root  4.0K Jan 16 13:07 linux-headers-4.3.3-gnu
drwxr-xr-x 27 root  root  4.0K Mar  4 18:42 linux-headers-4.4.0-9
drwxr-xr-x  7 root  root  4.0K Mar  4 18:42 linux-headers-4.4.0-9-generic
lrwxrwxrwx  1 root  root    18 Mar 30 10:44 linux-headers-4.5 -> /usr/src/linux-4.5
lrwxrwxrwx  1 root  root    22 Mar 30 10:44 linux-headers-4.6-rc1 -> /usr/src/linux-4.6-rc1

Then edit the symlinks in /lib/modules so they point to the proper source tree.

jason@jason-desktop:~/linux-4.6-rc1$ ls -hula /lib/modules/4.6.0-rc1-jason/
total 4.4M
drwxr-xr-x  3 root root  4.0K Mar 30 10:48 .
drwxr-xr-x  5 root root  4.0K Mar 30 10:38 ..
lrwxrwxrwx  1 root root    22 Mar 30 10:45 build -> /usr/src/linux-4.6-rc1
drwxr-xr-x 12 root root  4.0K Mar 29 13:18 kernel
-rw-r--r--  1 root root  1.1M Mar 29 13:18 modules.alias
-rw-r--r--  1 root root 1020K Mar 30  2016 modules.alias.bin
-rw-r--r--  1 root root  6.8K Mar 29 13:18 modules.builtin
-rw-r--r--  1 root root  8.5K Mar 30  2016 modules.builtin.bin
-rw-r--r--  1 root root  451K Mar 29 13:18 modules.dep
-rw-r--r--  1 root root  646K Mar 30  2016 modules.dep.bin
-rw-r--r--  1 root root   263 Mar 29 13:18 modules.devname
-rw-r--r--  1 root root  173K Mar 29 13:18 modules.order
-rw-r--r--  1 root root   114 Mar 30  2016 modules.softdep
-rw-r--r--  1 root root  460K Mar 29 13:18 modules.symbols
-rw-r--r--  1 root root  570K Mar 30  2016 modules.symbols.bin
lrwxrwxrwx  1 root root    22 Mar 30 10:45 source -> /usr/src/linux-4.6-rc1

And now re-boot into your brand new kernel!


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.