Size: 2558
Comment:
|
← Revision 12 as of 2021-01-10 19:01:52 ⇥
Size: 3303
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
"DRAFT" DaveHolt 20120511 15:38 PST - needs better formatting! | ## page was renamed from BuildLinux3.3 ## page was renamed from DraftKernelBuilding120511 by DaveHolt - 2012 May 16 |
Line 3: | Line 5: |
This is a worked example of building a Linux 3.3 kernel. When complete I intend to link to it from the kernel building FAQ. | This is a worked example of building a Linux 3.3 kernel in May 2012. It does not try to list all possibilities, but should provide the reader with a clear, specific path to build a modern Linux kernel. I include timing info (and system specs) to give you an idea how long to expect the steps to take on your system. |
Line 5: | Line 7: |
Simple (but detailed) example of building a customized Linux 3.3 kernel on Ubuntu 12.04 LTS. I started with an uninitialized system, and tried to document everything needed to build a modern kernel. |
I started with an uninitialized (VMware) virtual machine (1GB Memory, 2 processors (2.8MHz i5 760), and 32GB disk). I downloaded using a nominal 6Mbps ADSL. |
Line 8: | Line 9: |
The intent is to include everything I needed (e.g. libncurses5-dev ) without including unnecessary steps (emacs + RCS). | Note that building a single kernel from scratch (using this method) will use about 10GiB of disk. Be sure you have disk space available before starting. (32GiB provided room for the base system plus two kernel trees). |
Line 10: | Line 11: |
Using an existing system to download the CD image of Ubuntu 12.04 LTS (desktop 32bit edition) from http://www.ubuntu.com took about an hour. | |
Line 11: | Line 13: |
On 26 April 2012 I downloaded + burned a CD with "Ubuntu 12.04 LTS" (Desktop 32bit edition) from http://www.ubuntu.com . That took about an hour (your performance will vary with the speed of the network and your system). | Scratch-installing the CD on the VM took about an hour. This led to a system that boots. All further work was done on this system. |
Line 13: | Line 15: |
I booted the CD on a scratch system (a VMware VM), and told it to install. That also took about an hour. The system now booted. | I ran "Update Manager" from "Dash Home" and let it update. That also took about an hour. You may need to let the system reboot once. You now have a current Ubuntu 12.04 system. |
Line 15: | Line 17: |
I ran the Update Manager from "Dash Home" and let it update. That also took about an hour. | Next, I ran firefox, directing it to http://kernel.org . Clicking on "Latest Stable Kernel" caused the 3.3.6 tree to download (default target ~/Downloads/). |
Line 17: | Line 19: |
I started firefox and went to http://kernel.org and downloaded the "Latest Stable Kernel", which was 3.3.3 , selecting save_file to ~/Downloads . I then did |
I then did |
Line 22: | Line 22: |
cd ~/Downloads tar xf linux-3.3.3.tar.bz2 |
cd ~/Downloads tar xf linux-3.3.6.tar.bz2 |
Line 26: | Line 26: |
which extracted the source tree in ~/Downloads/Linux-3.3.3/ | which extracted the source tree in ~/Downloads/Linux-3.3.6/ . This took 1 minute. |
Line 31: | Line 31: |
sudo apt-get install build-essential | sudo apt-get install build-essential |
Line 34: | Line 34: |
Hit return to tell it to continue. | Hit return to tell it to continue. This took a few minutes. |
Line 39: | Line 39: |
sudo apt-get install libncurses5-dev | sudo apt-get install libncurses5-dev |
Line 42: | Line 42: |
Now go to the kernel tree (depends on what kernel sources you download), and begin the configuration process. | This also took a few minutes. Next go to the kernel tree, and begin the configuration process. |
Line 45: | Line 47: |
cd linux-3.3.3/ make menuconfig |
cd linux-3.3.6/ make menuconfig |
Line 51: | Line 53: |
Here are three pictures showing the process: {{attachment:3.3.6_view_1.png}} {{attachment:3.3.6_view_2.png}} {{attachment:3.3.6_view_3.png}} |
|
Line 53: | Line 66: |
Next, begin making the kernl (takes ~90 minutes) with | Next, begin making the kernel (takes ~90 minutes) with |
Line 55: | Line 69: |
make | make |
Line 57: | Line 71: |
Line 61: | Line 76: |
sudo make install | sudo make install |
Line 63: | Line 78: |
These take about 4 and 2 minutes respectively. |
|
Line 67: | Line 84: |
{{{ sudo shutdown -r now }}} you will come up running your new kernel, which you can verify with |
|
Line 73: | Line 86: |
uname -a | sudo shutdown -r now |
Line 76: | Line 89: |
You will see your initials in the name of the kernel running. | |
Line 78: | Line 90: |
Go forth and modify! | (after roughly 5 minutes,) you will come up running your new kernel, which you can verify with {{{ uname -a }}} You will see your initials in the name of the running kernel. Congratulations - you just built a modified Linux kernel! Now that you have the basic process working, start making more interesting changes. |
by DaveHolt - 2012 May 16
This is a worked example of building a Linux 3.3 kernel in May 2012. It does not try to list all possibilities, but should provide the reader with a clear, specific path to build a modern Linux kernel. I include timing info (and system specs) to give you an idea how long to expect the steps to take on your system.
I started with an uninitialized (VMware) virtual machine (1GB Memory, 2 processors (2.8MHz i5 760), and 32GB disk). I downloaded using a nominal 6Mbps ADSL.
Note that building a single kernel from scratch (using this method) will use about 10GiB of disk. Be sure you have disk space available before starting. (32GiB provided room for the base system plus two kernel trees).
Using an existing system to download the CD image of Ubuntu 12.04 LTS (desktop 32bit edition) from http://www.ubuntu.com took about an hour.
Scratch-installing the CD on the VM took about an hour. This led to a system that boots. All further work was done on this system.
I ran "Update Manager" from "Dash Home" and let it update. That also took about an hour. You may need to let the system reboot once. You now have a current Ubuntu 12.04 system.
Next, I ran firefox, directing it to http://kernel.org . Clicking on "Latest Stable Kernel" caused the 3.3.6 tree to download (default target ~/Downloads/).
I then did
cd ~/Downloads tar xf linux-3.3.6.tar.bz2
which extracted the source tree in ~/Downloads/Linux-3.3.6/ . This took 1 minute.
Next I installed a recommended package for kernel building (sudo for privilege required to install software on system - it may prompt for your password).
sudo apt-get install build-essential
Hit return to tell it to continue. This took a few minutes.
I then installed ncurses to allow the most basic "graphical" config interface (menuconfig).
sudo apt-get install libncurses5-dev
This also took a few minutes.
Next go to the kernel tree, and begin the configuration process.
cd linux-3.3.6/ make menuconfig
In the "General setup" section, select "Local version". Add something to your customized kernel (e.g. initials).
Here are three pictures showing the process:
Exit menuconfig, saving (which writes the hidden file .config ).
Next, begin making the kernel (takes ~90 minutes) with
make
Now elevate your privileges with sudo to install the kernel:
sudo make modules_install sudo make install
These take about 4 and 2 minutes respectively.
Note that this automatically does other necessary updates, including initrd, and updating the grub2 configuration.
After you reboot, as with a command like
sudo shutdown -r now
(after roughly 5 minutes,) you will come up running your new kernel, which you can verify with
uname -a
You will see your initials in the name of the running kernel.
Congratulations - you just built a modified Linux kernel!
Now that you have the basic process working, start making more interesting changes.