So now we know how to build and run the distribution we made ourselves. But how do we modify it? How do we modify the source code and rebuild it? This serious of posts will guide you through it.

This method of kernel modification is based on bitbake scripts from github that described in previous posts. If you haven’t done it, please finish it first.

1. Install necessary packages. Since we’ve already installed a bunch of packages, right now we only need git-core. Simply type “sudo apt-get install git-core” will do the job.

2. Go to setup-scripts folder. Use text editor to open /setup-scripts/conf/local.conf and do the following modification:
2.a Add MACHINE ?= "beagleboard" to specify the platform we’re going to build.
2.b Add GLIBC_GENERATE_LOCALES = "en_US.UTF-8 en_GB.UTF-8 de_DE.UTF-8 fr_FR.UTF-8 pt_BR.UTF-8 es_ES.UTF-8 kn_IN.UTF-8 ml_IN.UTF-8 ta_IN.UTF-8 . This is to specify language to speed up build time.
2.c Comment out INHERIT += "rm_work" . By commenting this line, all the sources downloaded will be kept on our hard disk after build. We will later modify the source code.

3. Open a shell and go to setup-scripts folder.
3.a Enter ./oebb.sh config beagleboard
3.b Enter ./oebb.sh update
3.c Enter source ~/.oe/environment-angstromv2012.05

4. Now we have all the prerequisite ready. Since we used this folder to compile previous build, we need to clean it first.
4.a bitbake -c clean virtual/kernel . This will clean up all previous source codes.
4.b bitbake -f -c compile virtual/kernel . This will give us a new kernel.

5. The result kernel file is located at the same place as before: setup-scripts/build/tmp-Angstrom_vxxxxxx/deploy/images/beagleboard/ . This time there’s only uImage, no MLO, uboot or rootfs because the parameter we used is virtual/kernel. Copy this file to micro SD card and overwrite previous kernel. Assume the 2nd partition of the micro SD card is /media/Angstrom/, copy uImage (kernel file) to /media/Angstrom/boot/ and overwrite previous uImage. Next time we plug in the power, we are booting from the new kernel we just built.

To be continued…

 

References:
http://elinux.org/EBC_Exercise_08_Installing_Development_Tools_-_bitbake
http://elinux.org/EBC_Exercise_22_Cross-Compiling_and_Finding_the_Right_Kernel_-_bitbake

silentlain 發表在 痞客邦 PIXNET 留言(0) 人氣()