In the previous post, we successfully built a Angstrom kernel and kept all the source code. In this post we’ll learn how to modify the source code and rebuild it.

First we need to locate the source code. Since we’ve commented out INHERIT += "rm_work" in conf/local.conf, it should be kept somewhere on our hard disk. It is located at setup-scripts/build/tmp-angstrom_v2012_05-eglibc/work/beagleboard-angstrom-linux-gnueabi/linux-mainline-3.2.28-r122a/git/ . If you open this folder, you will see the complete kernel source tree here. Let’s try a simple example:

1. Go to source tree folder and use text editor to open /kernel/fork.c.

2. Locate function do_fork.

3. Add static long int do_fork_count = 0; right above do_fork function outside any function.

4. Add printk("Message: This call to do_fork is number %ld.\n", ++do_fork_count); to do_fork function body.

5. Now open a shell and go to setup-scripts folder. Enter bitbake -f -c compile virtual/kernel . This shouldn’t take too much time since we only modified one file.

6. After it’s done, copy uImage to micro SD card following previous post’s instructions.

7. Plug in power to BeagleBoard, this time we should see a lot of “Message: This call to do_fork is number XX” on screen. If so, we’ve successfully done it.

 

References:
http://www.cs.albany.edu/~sdc/CSI500/Fal11/Labs/L05/LKSetupLab.html

arrow
arrow
    全站熱搜

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