SlideShare une entreprise Scribd logo
1  sur  2
Télécharger pour lire hors ligne
Linux Training
                                                     Lab Book



Kernel source code
Objective: 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.

Setup
Go 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 keep
Get 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 file
implements a given function. So, it is useful to be familiar with
exploring 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 tool
Now that you know how to do things in a manual way, let's use
more automated tools.
                                                                                 Of course, if your kernel has a
Try LXR (Linux Cross Reference) at http://lxr.free-electrons.com                 significant amount of custom code, or
and choose the Linux version closest to yours.                                   if you are not always connected to
                                                                                 the Internet, you can run LXR on
If you don't have Internet access, you can use cscope or Kscope                  your own computer.
instead.
As in the previous section, use this tool to find where the
platform_device_register() is declared, implemented and even
used.

Accessing kernel sources with git
Later this week, we will also see another way of accessing kernel
sources, with the git source control management tool used by
kernel developers.
To save time with the git lab on the last day, let's advance us by
cloning the Linus Torvalds' git tree.
First, install required software packages:
sudo apt­get install git­core gitk git­email
Then, go to the /home/<user>/felabs/linux/git directory, and
run the below command:
git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux­2.6.git
                                                                                 Replace git:// by http:// if your
Now, just let this command run, from 30 minutes to several hours                 company firewall blocks the git
according to your workstation and network speed.                                 protocol.




              © 2004-2010 Free Electrons, http://free-electrons.com              Creative Commons License
Linux Training
                                 Lab book




© 2004-2010 Free Electrons, http://free-electrons.com   Creative Commons License

Contenu connexe

Plus de gowell (10)

Lua 语言介绍
Lua 语言介绍Lua 语言介绍
Lua 语言介绍
 
Kernel init
Kernel initKernel init
Kernel init
 
Logging develop
Logging developLogging develop
Logging develop
 
Logging introduce
Logging introduceLogging introduce
Logging introduce
 
Script meta
Script metaScript meta
Script meta
 
Script binding
Script bindingScript binding
Script binding
 
使用Lua提高开发效率
使用Lua提高开发效率使用Lua提高开发效率
使用Lua提高开发效率
 
Casing3d opengl
Casing3d openglCasing3d opengl
Casing3d opengl
 
Pytables
PytablesPytables
Pytables
 
从动态说开去
从动态说开去从动态说开去
从动态说开去
 

Dernier

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Dernier (20)

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 

Kernel sources-lab

  • 1. Linux Training Lab Book Kernel source code Objective: 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. Setup Go 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 keep Get 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 file implements a given function. So, it is useful to be familiar with exploring 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 tool Now that you know how to do things in a manual way, let's use more automated tools. Of course, if your kernel has a Try LXR (Linux Cross Reference) at http://lxr.free-electrons.com significant amount of custom code, or and choose the Linux version closest to yours. if you are not always connected to the Internet, you can run LXR on If you don't have Internet access, you can use cscope or Kscope  your own computer. instead. As in the previous section, use this tool to find where the platform_device_register() is declared, implemented and even used. Accessing kernel sources with git Later this week, we will also see another way of accessing kernel sources, with the git source control management tool used by kernel developers. To save time with the git lab on the last day, let's advance us by cloning the Linus Torvalds' git tree. First, install required software packages: sudo apt­get install git­core gitk git­email Then, go to the /home/<user>/felabs/linux/git directory, and run the below command: git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux­2.6.git Replace git:// by http:// if your Now, just let this command run, from 30 minutes to several hours company firewall blocks the git according to your workstation and network speed. protocol. © 2004-2010 Free Electrons, http://free-electrons.com Creative Commons License
  • 2. Linux Training Lab book © 2004-2010 Free Electrons, http://free-electrons.com Creative Commons License