資源描述:
《解讀linux內核源碼的入門方法(interpretation of linux kernel source entry method)》由會員上傳分享,免費在線閱讀,更多相關內容在教育資源-天天文庫。
1、解讀linux內核源碼的入門方法(InterpretationofLinuxkernelsourceentrymethod)Author:anonymouseditor:lujiezhenFormanyLinuxenthusiastsareinterestedinthekernel,butnowayout,thisarticleaimstointroduceaninterpretationoftheLinuxkernelsourceentrymethod,ratherthanexplainthecomplexLinuxkernelme
2、chanism;I.fileorganizationofthekernelsource:1.Linuxcoresourceprogramisusuallyinstalledinthe/usr/src/linux,andithasaverysimplenumberingConvention:thecoreofanyevennumber(e.g.2.0.30)isastablecoreissue,andanyoddcore(suchas2.1.42)isadevelopmentinthecore.Basedonthestable2.2.5
3、sourcecode,thesecondpartoftheimplementationplatformforRedhatLinux6.2.thekernelsourcefilesareorganizedintreestructures,andatthetopofthesourcetreeyouwillseesomeofthesedirectories:TheArch:archsubdirectoryincludesallofthecorecoderelatedtothearchitecture.Eachofitssubdirector
4、iesrepresentsasupportedarchitecture,suchasi386,whichisasubdirectoryofIntel,CPU,anditscompatiblearchitecture.PCmachinesaregenerallybasedonthisdirectory;TheInclude:includesubdirectoryincludesmostoftheheaderfilesneededtocompilethekernel.Theplatformindependentheaderfilesare
5、intheinclude/linuxsubdirectory,andtheheaderfilesassociatedwiththeIntelCPUareintheinclude/asm-i386subdirectory,whiletheinclude/scsidirectoryistheheaderfiledirectoryfortheSCSIdevice;PSInit:thisdirectorycontainsthecoreinitializationcode(Note:notthesystembootcode)andcontain
6、stwofiles,main.candVersion.c,whichisaverygoodstartingpointforhowthecoreworks.Mm:ThisincludesallmemorymanagementcodeisindependentoftheCPUarchitecture,suchasstoragemanagementpageallocationandreleaseofmemory;andmemorymanagementcodeandthesystemstructureislocatedinarch/*/mm/
7、,suchasarch/i386/mm/Fault.c-Kernel:themaincoreofthecode,thedirectoryfiletoimplementakernelfunctionofmostLinuxsystems,oneofthemostimportantdocumentissched.c;similarly,architectureandrelatedcodeinarch/*/kernel;Drivers:placealldevicedriversforthesystem;eachdrivertakesasubd
8、irectory:/block,forexampleIsablockdevicedriver,suchasIDE(ide.c).Ifyouwanttoseehowallofthedevicesthatmightconta