Kernel sources-lab

433 views

Published on

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
433
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
4
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Kernel sources-lab

  1. 1. Linux Training Lab BookKernel source codeObjective: Get familiar with the kernel source code.After this lab, you will be able to Explore the sources in search for files, function headers or other kinds of information... Browse the kernel sources with tools like cscope and LXR.SetupGo to the /home/<user>/felabs/linux/sources directory.Download the Linux 2.6.35 kernel sources from http://kernel.org. Please use this exact version, and not 2.6.35.x updates. Doing this will keepGet familiar with the sources it easy to upgrade to 2.6.36 in the next lab.As a Linux kernel user, you will very often need to find which fileimplements a given function. So, it is useful to be familiar withexploring the kernel sources.1. Find the Linux logo image in the sources You may look for all files with logo in their name.2. Find who the maintainer of the 3C505 network driver is.3. Find the declaration of the platform_device_register()  function.Use a kernel source indexing toolNow that you know how to do things in a manual way, lets usemore automated tools. Of course, if your kernel has aTry LXR (Linux Cross Reference) at http://lxr.free-electrons.com significant amount of custom code, orand choose the Linux version closest to yours. if you are not always connected to the Internet, you can run LXR onIf you dont have Internet access, you can use cscope or Kscope  your own computer.instead.As in the previous section, use this tool to find where theplatform_device_register() is declared, implemented and evenused.Accessing kernel sources with gitLater this week, we will also see another way of accessing kernelsources, with the git source control management tool used bykernel developers.To save time with the git lab on the last day, lets advance us bycloning the Linus Torvalds git tree.First, install required software packages:sudo apt­get install git­core gitk git­emailThen, go to the /home/<user>/felabs/linux/git directory, andrun the below command:git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux­2.6.git Replace git:// by http:// if yourNow, just let this command run, from 30 minutes to several hours company firewall blocks the gitaccording to your workstation and network speed. protocol. © 2004-2010 Free Electrons, http://free-electrons.com Creative Commons License
  2. 2. Linux Training Lab book© 2004-2010 Free Electrons, http://free-electrons.com Creative Commons License

×