Why Build a New kernel?
There are many reasons, I find the most likely one is because some functionality exists in the very latest build but not in the version you are currently running. Also there are build options you might want to change on the current version such as enabling highmem on the current kernel to allow use of the full 1Gb of RAM on the PandaBoard (currently disabled because of compiler segfault issues).
The reasons boil down to trying something new, tweaking something to run better or fixing an error. There are others of course.
Assumptions:
The following assumes you are running Ubuntu natively on a PandaBoard, you have several gigabytes of free space available to the Pandaboard, a reasonably fast Internet connection to the PandaBoard and hours of time to let it compile.
Step 1: Setup
There are many reasons, I find the most likely one is because some functionality exists in the very latest build but not in the version you are currently running. Also there are build options you might want to change on the current version such as enabling highmem on the current kernel to allow use of the full 1Gb of RAM on the PandaBoard (currently disabled because of compiler segfault issues).
The reasons boil down to trying something new, tweaking something to run better or fixing an error. There are others of course.
Assumptions:
The following assumes you are running Ubuntu natively on a PandaBoard, you have several gigabytes of free space available to the Pandaboard, a reasonably fast Internet connection to the PandaBoard and hours of time to let it compile.
Step 1: Setup
As we will be using recent packages from the repositories it is a good idea to avoid subtle dependency errors by updating the repository lists:
sudo apt-get update
To start with you will need to install the packages which give you all the dependencies for the kernel, open a terminal and type:
sudo apt-get build-dep linux-image-$(uname -r)
This will likely result in a about 500 MB of downloads and about 800 MB of space being used up. It will also take a while (hour) for the process of downloading and installing to complete.
Step2: Download Kernel Sources
Then find a location which has several gigabytes free (I would guess ~2GB is a minimum), chdir into that location and pull down (clone) the kernel source files for the official Ubuntu kernel:
git clone git://kernel.ubuntu.com/ubuntu/ubuntu-maverick.git
This will clone the source files into the current directory. It will take about half an hour at least, I was able to achieve ~300KB/s from the server.
Now checkout the working directory with:
git checkout -b working origin/ti-omap4
Step2A: Change the Build Configuration Options
This step is purely optional. If you want to edit the configuration files which control what is included in the built kernel (ie which drivers, which file systems are supported etc) run the following command:
fakeroot debian/rules editconfigs
Step3: Build the Kernel From Source
Then chdir into that directory, into /ubuntu-maverick/ and generate the kernel package with these commands:
fakeroot debian/rules clean
export $(dpkg-architecture -aarmel)
do_tools=false fakeroot debian/rules binary-arch
[You can also try the following:
fakeroot debian/rules clean
dpkg-buildpackage -B -uc -us ]
This last command will take a significant amount of time (hours), several gigabytes worth of disk space and generate page after page of compilation information.
The final result of this will be many *.deb files in the root directory where you cloned the git repository to.
After a successful build the root level of your kernel directory should have the follow *.deb files in amongst many *.udeb files:
The final result of this will be many *.deb files in the root directory where you cloned the git repository to.
After a successful build the root level of your kernel directory should have the follow *.deb files in amongst many *.udeb files:
linux-headers-2.6.35-25-omap_2.6.35-25.44_armel.debStep4: Install the Kernel
linux-headers-2.6.35-25-versatile_2.6.35-25.44_armel.deb
linux-image-2.6.35-25-omap_2.6.35-25.44_armel.deb
linux-image-2.6.35-25-versatile_2.6.35-25.44_armel.deb
linux-libc-dev_2.6.35-1025.44_armel.deb
linux-tools-2.6.35-25_2.6.35-25.44_armel.deb
Once this process has completed successfully you will need to install the new kernel. To do this you will install the following *.deb files (change for your version):
linux-headers-2.6.35-903_2.6.35-903.22_armel.deb
linux-headers-2.6.35-903-omap4_2.6.35-903.22_armel.deb
linux-image-2.6.35-903-omap4_2.6.35-903.22_armel.deb
It is important to install these deb files in the right order to avoid subtle errors.
To install these *.deb files type the following command, note you will have to change the version numbers if the version numbers in the files names have changed (ie they have to be the same as the files in the directory.
sudo dpkg -i linux-headers-2.6.35-903_2.6.35-903.22_armel.deb
sudo dpkg -i linux-headers-2.6.35-903-omap4_2.6.35-903.22_armel.deb
sudo dpkg -i linux-headers-2.6.35-903-omap4_2.6.35-903.22_armel.deb
sudo dpkg -i linux-image-2.6.35-903-omap4_2.6.35-903.22_armel.deb
Each of these commands will take a while to execute (about 20 minutes all up in my experience).
The final step is to copy the kernel to the correct parts of the SD Card so that uBoot can find it on the next bootup.
The command is:
sudo flash-kernel 2.6.35-903-omap4
Now to explain this "sudo flash-kernel" is the command to execute flash-kernel which copies vmlinuz from /boot/ to the boot up file system.
[Lachlan rightly points out: "The "flash-kernel" command writes the uImage, uInitrd and boot.scr files to the boot partition of your SD card, usually /dev/mmcblk0p1."]
Normally it would guess the correct file to copy but in this case we explicitly ask it to copy the file "vmlinuz.2.6.35-903-omap4" by specifying 2.6.35-903-omap4 after the command.
flash-kernel will append the "vmlinuz-" part to the file name and automatically look in /boot/ for it.
Useful Links:
Comments
fakeroot debian/rules clean
before being able to edit my configurations.
Thanks for the info. Just a small note... The PandaBoard does not have any NAND. The "flash-kernel" command writes the uImage, uInitrd and boot.scr files to the boot partition of your SD card, usually /dev/mmcblk0p1.
Thanks again for the info.
Thanks for the correction, I've updated the post with it.
Thanks for that.
Cheers,
Dingo_aus
Can anyone please let me know that how much sized memory card is require for kernel compilation on pandaboard itself or I should try to boot it from external USB?
Thanks.
I successfully compiled and installed 3.0.0-omap4 on a Pandaboard ES running ubuntu 11-10 by following your guide.
To make the kernel compile I had to use gcc-4.7, as 4.6 contains a bug relating to arm-compilation.
gcc-4.7 can be installed by adding
deb ftp://ftp.debian.org/debian/ unstable main contrib non-free
to /etc/apt/sources.list, then running sudo apt-get update
Can anyone help me ???
I have panda4430 running ubuntu 11.10LTS
and i tried to cross-compile linux-2.6.35-903-omap4 on my X86_64 pc and installed the generated debian packages on the panda4430 running 11.10LTS by following this blog...when i tried to restart the board hoping to come-up with newer ubuntu-2.6.35-903...but unfortunately i end up with blue screen ,continuously running ..>
udevd[81]: unable to receive ctrl connection: Function not implemented
any one having any solution for the above mentioned problem
Regards,
Linux Online Training | Linux Training in Hyderabad | Linux Online Training in Hyderabad | Linux Online Training in India | Linux Online Training Institutes in Hyderabad | Best Institutes for Linux in Hyderabad | Linux Training Institutes in Hyderabad | Linux Training Institutes in India | Linux Online Training hyderabad | Linux Online Training India | Best Institutes for Linux | Linux Administration Training in Hyderabad | Linux Certification Training | Linux Training in Ameerpet, Hyderabad | Red Hat Linux Training in Hyderabad | Linux Certification Training in Hyderabad | Best Linux online Training Institutes in Hyderabad | Learn Linux | Learn Linux Online