chapter 4. the kernel sources (45) - the linux kernel: the...

24
Chapter 4. The Kernel Sources (45) Kernel Sources Structure Linux is "Unix-like". Linux is not a version of Unix, but a new OS highly reminiscent of Unix. Linux aims to be Unix-compatible, but it has been developed from scratch. This allows the authors develop a new core framework which is highly portable. In the years since the first Motorola 68000 port for the Amiga, Linux has been ported to virtually every platform from the PalmPilot to the IBM S/390 mainframe. Linux is also a large and complex piece of software. The kernel itself contains over 1.7 million lines of source code; by commercial software standards, such a project would take 5 five to 10 years and require up to 500 programmers. The methodology of open source has been proven through the kernel project: Richard Gooch’s Kernel FAQ (http://www.tux.org/lkml/)observes that Linux is a little more than 8 eight years old, placing it right on track compared to those commercial standards. Linux is written by thousands of programmers spread around the world, and under the peer-review of many thousands more. In the software industry, Brooks’ Law claims the communications complexity with large teams will grow exponentially, eventually stifling all progress. The Linux project defeats this law by two clever hacks: Linux is organized into modules and subsystems where development in one area can have minimal impact on other areas, and the explosive growth and experimentation on new features is isolated from the mainstream users through the division of Linux into development and production sources. The modular design factors Linux into sub-teams and sub-teams of sub-teams, distributing the communications load, and avoiding the omni-topology that invokes Brooks’ Law. Figure 4-1. Package map of /usr/src/linux 1

Upload: others

Post on 02-Aug-2020

8 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Chapter 4. The Kernel Sources (45) - The Linux Kernel: The Bookkernelbook.sourceforge.net/pdf/ch-sources.pdf · 2002-03-01 · Chapter 4. The Kernel Sources (45) Kernel Sources Structure

Chapter 4. The Kernel Sour ces (45)

Kernel Sour ces StructureLinux is "Unix-lik e". Linux is not a versionof Unix, but a new OShighly reminiscentof Unix. Linuxaimsto beUnix-compatible,but it hasbeendevelopedfrom scratch.Thisallows theauthorsdevelopanew coreframework which is highly portable.In theyearssincethefirst Motorola68000port for theAmiga,Linux hasbeenportedto virtually everyplatformfrom thePalmPilotto theIBM S/390mainframe.

Linux is alsoa largeandcomplex pieceof software.Thekernelitself containsover1.7million linesofsourcecode;by commercialsoftwarestandards,suchaprojectwould take5 five to 10 yearsandrequireup to 500programmers.Themethodologyof opensourcehasbeenproventhroughthekernelproject:RichardGooch’sKernelFAQ (http://www.tux.org/lkml/) observesthatLinux is a little morethan8 eightyearsold, placingit right on trackcomparedto thosecommercialstandards.

Linux is writtenby thousandsof programmersspreadaroundtheworld, andunderthepeer-review ofmany thousandsmore.In thesoftwareindustry, Brooks’ Law claimsthecommunicationscomplexitywith largeteamswill grow exponentially, eventuallystifling all progress.TheLinux projectdefeatsthislaw by two cleverhacks:Linux is organizedinto modulesandsubsystemswheredevelopmentin oneareacanhaveminimal impacton otherareas,andtheexplosivegrowth andexperimentationon newfeaturesis isolatedfrom themainstreamusersthroughthedivisionof Linux into developmentandproductionsources.ThemodulardesignfactorsLinux into sub-teamsandsub-teamsof sub-teams,distributing thecommunicationsload,andavoiding theomni-topologythatinvokesBrooks’Law.

Figure4-1.Packagemap of /usr/src/linux

1

Page 2: Chapter 4. The Kernel Sources (45) - The Linux Kernel: The Bookkernelbook.sourceforge.net/pdf/ch-sources.pdf · 2002-03-01 · Chapter 4. The Kernel Sources (45) Kernel Sources Structure

Chapter4. TheKernelSources(45)

Figure4-1showsa packagemapof thekernelsourcesandthepartitioninginto subsystems.A quickinspectionof linux/MAINTAINERS will show almostdirectcorrespondence.ThegrossstructureofLinux partitionsthesourcesby technologies;sincethosetechnologiessuit thefanciesof thedevelopers,someonewith aninterestin file systemsmaybedeeplyinvolvedin the/fs packageandonly marginallyinvolvedin /mm.

Theper-developerpartitioningis carrieddeeperin per-servicerelationshipswithin the/net and/driver packages.Thismakessensewhenyouconsidereachserviceis addedandmaintainedbyowners(or vendors)of thathardwarewho wouldwantto keeptheir realmof interestlocalized.This“implementation-oriented”sourcestructuremayoverlooksimilaritiesandopportunitiesfor codere-use,but it is highly pragmaticwithin thewide-openopensourcemethodology.

Kernel ModulesConfiguringa kernelprimarily involvesselectingsomedevicesandservicesandomittingothers.Linux2.0 introducedamiddlegroundallowing componentsto bedynamicallyloadedandunloadedfrom thekernel,asneeded,at runtime.

Modulesarealsoessentialwherethehardwaremustbeinitializedbeforea serviceis enabled.Oneexampleis with plug-and-playsoundcards,wherethebootprocessmustinitialize theinterruptsbeforethemodulecanbeinvoked.

2

Page 3: Chapter 4. The Kernel Sources (45) - The Linux Kernel: The Bookkernelbook.sourceforge.net/pdf/ch-sources.pdf · 2002-03-01 · Chapter 4. The Kernel Sources (45) Kernel Sources Structure

Chapter4. TheKernelSources(45)

Theintroductionof modulesto theLinux kernelalsohasapolitical implication:Becausemodulesystemcallsarenot considered“linking againstthekernel”,modulesarenot boundby theGPLwhich thatgovernstherestof thekernelsources.Developersarefreeto createproprietarymodulesandto distributethesewithout releasingthesourcecode.Thispolicy haspromptedseveralcommercialvendorsto providemoduleswherepatentor otherlicensingissueswouldotherwisepreventLinux support.

Many runtimeparameters,suchassoundcardports,harddiskgeometries,andIRQ assignments,canbesetusing“bootparams”,thecommandline optionsto theLILO. Also, many characteristicsof therunningkernel,evendelicateissuessuchasvirtual memoryandfilesystembehaviors,canbequeriedandsetthroughthe/proc filesystem(if /proc is enabledin yourkernel).

Most kernelservicesacceptbootparams;a completeguideto bootparameterscanalsobefoundwith theman bootparam command.

In additionto thebootparams,somemodulescanbequeriedandmanipulatedthroughechoing somevalueto a/proc file, for example,defenseagainstSyn-Cookieattacksis enabledby appendingthefollowing line to /etc/rc.d/rc.local:

echo 1 >/proc/sys/net/ipv4/tcp_syncookies

Kernel Version Number sLinux kernelversionnumbersidentify thebasedesignandtherevision,andalsoidentifieswhetheryouarerunninganexperimentalor a productionrelease.Theversionin useby any Linux systemcanbequeriedwith uname-a:

$ uname -aLinux kato 2.3.21 #1 Tue Oct 12 16:08:21 EDT 1999 i486 unknown

This line identifiesthatkernelasversion2.3.21andgivesthearchitectureandthedatewhenthekernelwascompiled.Theversionnumbercontainsthreeparts:

Themajornumber(2)Theminornumber(3)Thecurrentrevision (21)

Thereareenoughversion-1Linux machinesto beimpressive,but they arerare.For practicalpurposes,themajornumberis 2; no oneis quitesurewhata changewouldbebig enoughto jump to Linux-3, butwe mightassumeit would ceaseto promiseLinux-2 compatibility.

Thelastnumberis theincrementalpatchnumberandchangeswith everyupdate.Thefirst importantportionof thekernelversionnumberis themiddledigit, the“minor” number. Oddminornumbersdenote“experimental”kernels,thetestbedfor developersto explore,addnew codeandbounceideasoff eachother. Evenminors,on theotherhand,carrya stampof respectabilityas“productioneditions”.

3

Page 4: Chapter 4. The Kernel Sources (45) - The Linux Kernel: The Bookkernelbook.sourceforge.net/pdf/ch-sources.pdf · 2002-03-01 · Chapter 4. The Kernel Sources (45) Kernel Sources Structure

Chapter4. TheKernelSources(45)

Whena developmentkernelis ready, it follows theusualprocessof a featurefreeze,thenacodefreeze,andis thenpromotedto thenext evennumber. Thus,2.3.99became2.4.0andwassimultaneouslybranchedto becomethenew development2.5source.Theroadgoeseveron.

Newsflash: Development Kernels can breakDuring the rapid development of the odd-minor kernels, you cannot simply jump inand expect to join the other kernel surfers. Although developers try to only releasestable code, very often a core change can create havoc for other users. Thesetroubles may be traced to updated libraries, modules, or compiler tools, butsometimes it is just a broken system and the development kernel can strand wholecommunities of users. Always check the Linux Kernel web site (http://www.tux.org)or watch linux-kernel mailing list. If your hardware is not flagged in the troublereports, pick a development kernel revision which has been stable for at least afew days, and dive in.

Obtaining the Kernel Sour cesWhenfetchingkernelssources,it is goodnettiquetteto seeka mirror siteascloseto youaspossible.While famoussitessuchasRedHat (ftp://ftp.redhat.com)andKernel.Org (ftp://ftp.kernel.org/pub/linux)will have thefilesyouneed,youshouldcheckkernel.org (http://www.kernel.org) for anappropriatemirror site.

Distrib ution KernelsBefore you replace your kernel sources, be aware that most distributions applytheir own patches to the standard Linux sources; if you recompile from your distrosources, there may be features missing or added from what is covered in thischapter, and if you obtain “canonical” sources from the kernel FTP site(ftp://ftp.kernel.org), the resulting kernel may break special features in yourdistribution.

FTPmirrorspartitionkernelpackagesby majorandminorversionnumberssuchas/pub/linux/kernel/v2.4. Eachdirectorycontainswhole-enchiladasourcetarballsandcompressedpatchfiles— if you arejumpingup from 2.2or 2.3,or if you wantto startfresh,you needthefile namedlinux-VERSION.tar.gz (or .bz2). Althougha lot to downloadovera modemconnection,onceyouhaveastandardsourcetree,youcanupdateincrementallyby downloadingmuchsmallerpatchfiles.

Symbolic Links to the Kernel Sour ces: Before you unpack a kernel tarball, create a

4

Page 5: Chapter 4. The Kernel Sources (45) - The Linux Kernel: The Bookkernelbook.sourceforge.net/pdf/ch-sources.pdf · 2002-03-01 · Chapter 4. The Kernel Sources (45) Kernel Sources Structure

Chapter4. TheKernelSources(45)

version-tagged directory and symlink (ln -s) this to the generic /usr/src/linux location. Forexample, if you obtained linux-2.4.7.tar.gz, create /usr/src/linux-2.4.7 and a symlink/usr/src/linux before you unpack your kernel sources:

cd /usr/srcmkdir linux-2.4.7ln -s linux-2.4.7 linuxtar xzf linux-2.4.7.tar.gz

If /usr/include/linux is also symlinked to /usr/src/linux/include, your include files willalways belong to your current kernel. You can now keep several versions of the kernel, each in it’sown /usr/src/linux-X.Y.Z directory; when you patch your sources, the patch will apply to theappropriate kernel sources through the linux/ symlink, and you can experiment with multipleversions, quickly switching between them by simply replacing the symlink.

Coping with New Kernels

• Building and running the kernel depends on the softwareversions listed in linux/Documentation/Changes: Before youcompile or run any new kernel, you can save a lot ofheart-ache if you check your system against these versionnumbers!

• Drivers bundled with Linux may not be the very latest. If youhave problems with a particular device, or with very newhardware, search for an update before building your kernel.

• Kernel changes may require changes to your boot scripts, to/etc/lilo.conf, or /etc/conf.modules. Thelinux/Documentation collection contains many short READMEfiles on many different parts of the kernel, and each driversubdirectory may also contain additional information oninstalling or configuring difficult devices. Most kernel modulesaccept parameters either through the boot params, throughthe append line of /etc/lilo.conf, or, for dynamicallyloaded modules, on the /sbin/insmod command line or in/etc/conf.modules.

• If you give options both in lilo.conf and at the LILO:

prompt, the boot prompt options are appended to the end ofthe append options. This allows you to override installedoptions at the command line to pre-empt unwanted settings;this is also why many modules also include options to restoretheir default behavior.

5

Page 6: Chapter 4. The Kernel Sources (45) - The Linux Kernel: The Bookkernelbook.sourceforge.net/pdf/ch-sources.pdf · 2002-03-01 · Chapter 4. The Kernel Sources (45) Kernel Sources Structure

Chapter4. TheKernelSources(45)

Patching the Sour ce TreeUpdatesaredistributedaspatch files namedfor theversionwhich resultsfrom thepatch.For example,anupgradefrom 2.4.4to 2.4.5will becalledpatch-2.4.5.gz. Patchfilesaresimply context diffs, theoutputof theCVS or Unix diff -c command(seeman diff ) which list thedifferencesfrom thepriorversion.Thepatchis appliedby piping thefile throughtheGNU patch utility; patch will begivenlinesof context aroundthechangeandtold to delete,add,or replacelinesin thesourcefiles.

Patching Incremental VersionsPatch files can only upgrade by one revision number. Upgrading from 2.4.1 to2.4.6 will require patches for all intermediate releases. An exception to this rule isthe -ac series pre-release patches which are assembled by Alan Cox. Thesepatch files are always accumulative based on the most recent official release, forexample patch-2.4.1-ac12 might be Alan’s twelfth patch on the 2.4.1 release,but it must be applied to a clean 2.4.1 kernel; the patch will fail to upgrade frompatch-2.4.1-ac11.

Unless you have good reason to suspect otherwise, you should compile and testeach incremental revision before applying the next patch. Once a patch is applied,there is no way to undo the changes.

Patch files are also created by comparing the sources of totally clean Linuxdistributions. Before you run the patch, it is important to back up yourlinux/.config file and then to clean your kernel source tree to the most pristinestate using make mrpr oper :

cd /usr/src/linuxcp .config /usr/src/config-oldmake mrproper

This removes all residual generated files that could interfere with the patch or thekernel build. Saving your old .config (which would be removed by mrpr oper )allows you to bootstrap your next kernel with make oldconfig .

Two thingsyou shouldknow aboutpatchfiles:They aremuchsmallerthanthesourcetarball(typically afew hundredkilobytes),andthey do not alwayswork.

Verifying a patc h update: After patching your sources, search the kernel tree for reject files (find .-name "*.rej" ) containing the failed diffs; these are most often the result of some innocuousdifference in whitespace or tab stops between the sources owned by the creator of the diff and yourown sources. If you find any *.rej files, you must manually correct the associated source filesbefore you compile.

The linux/scripts/patch-kernel is a perl program which attempts to automate this process.patc h-kernel will deduce the current source version number and compare this to the patch files

6

Page 7: Chapter 4. The Kernel Sources (45) - The Linux Kernel: The Bookkernelbook.sourceforge.net/pdf/ch-sources.pdf · 2002-03-01 · Chapter 4. The Kernel Sources (45) Kernel Sources Structure

Chapter4. TheKernelSources(45)

found in the current directory. If higher-version patch files are found, the script will step through thesesequentially upgrading the sources. Frankly, I have never had much luck with this script, but yourmileage may vary.

Onceyouhavepatchedthesources,youcanbootstrapyournew kernelconfigurationby copying yourbackup.config file to linux/.config andusingmake oldconfig to migratetheoptionspresentinyourpreviousinstallation,preservingall thosefiddly settingsthataresooftenforgotten(suchastheIRQof yoursoundcard!).Youwill needto monitorthis process:oldconfig will stopandpromptfor any newoptionsaddedby thenew sources.Oncethis commandhasrun,usemakexconfig to recheckthesettings,andthencompilewith any of themake build targets.

Upgrades and ModulesOneof two modulethingscango wrongwith a modulewhenupgradingto a newerkernel1:

Themoduleutilities areincompatible.Themoduledependenciesmayconflict.

Thefirst situationis mostlikely. Theix386modutilshavebeenupdatedto usePIII instructionsandneweditionsmaynot havebeenincludedin yourdistributionfiles. If yourmoduleutilities meettherequirementsspelledout in linux/Documentation/Changes, youwill havenoproblem,but if youdohappento boota kernelwith old moduleutilities, youcanhangyoursystem.

Thesecondproblemcanhit anyone.This is oneof thosethingswhich,onceyouknow whathashappened,you realizethesolutionis just commonsense.For example,supposeyoucompileWindowsVFAT file systemsupportasa module,but thenyourbootscriptstry to usesomefile from yourwindowspartitionprior to themoduleloading.Or, andmorelikely, youconfigureyournetwork supportasamodule,forgettingthatthehttpd will hangthebootscriptswhile trying to resolve thehostname.

Thereis only a smalloverheadin loadingandunloading,andin thecodingof a driverasa module.Unlessmemoryor performanceis critical, thecodeis neededcontinuously, or themoduleis requiredearlyin thebootprocess,it canandprobablyshouldbecompiledasamodule.

Configuring Lin ux KernelOnceyouknow whatyournew kernelmustaccomplishandhavethesourcesinstalled,you arereadytobegin creatinga customizedLinux operatingsystem.Beforesettingthecompilein motion,thereareafew lastminutedetailsto ensurea successfulrun,or at leasta gracefulrecovery.

7

Page 8: Chapter 4. The Kernel Sources (45) - The Linux Kernel: The Bookkernelbook.sourceforge.net/pdf/ch-sources.pdf · 2002-03-01 · Chapter 4. The Kernel Sources (45) Kernel Sources Structure

Chapter4. TheKernelSources(45)

Preparing lilo.conf for kernel updatesBeforeyoubegin, doublecheckyoursystemagainsttherequirementsinlinux/Documentation/Changes. In particular, ensureyouhavethecorrectversionof thebinutilsandthegcccompiler.

You shouldalsocreateanentryin your/etc/lilo.conf to keepyourcurrentkernelinstalledasabackup.In additionto addinga few secondsdelayon thebootpromptwith thedelay parameter(soyoucaninterruptto addparametersor selectanalternateimage)adda sectionfor a known stablekernel(suchastheoriginaldistributionkernelimage)andalsofor thegeneratedbackupleft behindby thebuildcommands.

image=/boot/vmlinuz.origlabel=stableroot=/dev/hda3append=""read-onlyimage=/boot/vmlinuz.baklabel=backuproot=/dev/hda3append=""read-only

If you havetroublebootingfrom thenew kernel,youcanenterstable at theLILO: promptandbootyouroriginal kernel.

Themake bzlilo compilecommandwill automaticallybackupthepreviouskernelfrom$(INSTALL_PATH)/vmlinuz to $(INSTALL_PATH)/vmlinuz.old andthenrun the lilo commandtoinstall thenew kernels.Theabove/etc/lilo.conf sectionsgiveonemoreline of defenceagainstakernelwhichcannotboot.A fourth section,labeledbackup alsoallowsmeto makeperiodicbackupsofparticularlystabledevelopmentkernelsin caserepeatedcompilesleavebothvmlinuz andvmlinuz.old unstableandutility upgradeshavecutmeoff from theoriginalvmlinuz.orig. Ithappens.

Is lilo.conf preparedto find thenew kernel?Do you havea backupkernelanda bootdisk?Do youhaveenoughdiskspace?Thesemayseemtrivial questions,but they areimportant.An errorin any ofthesemayleaveyoursystemin aninoperablestateandentirelydevouryourweekend.Evenif all youaredoingis to seta few /proc valuesor addanetwork interfaceon thebootprompt,it is gooddefensivedriving to considertherecoveryplan.

8

Page 9: Chapter 4. The Kernel Sources (45) - The Linux Kernel: The Bookkernelbook.sourceforge.net/pdf/ch-sources.pdf · 2002-03-01 · Chapter 4. The Kernel Sources (45) Kernel Sources Structure

Chapter4. TheKernelSources(45)

Allo w a LILO DelayWhile experimenting with kernel options, remember to set the lilo delay parameterto give some grace time where you can select an alternate kernel. If your systemhas a delay of zero seconds, you will not have the opportunity to pre-empt loadingthe default kernel, and if that kernel is faulty, your only option is to boot from afloppy disk. For more dangerous experiments, delay set to -1 will wait indefinitelyfor a boot parameter.

Configuring with makeTheLinux Makefileprovidesfour methodsof settingyourconfigurationoptions:

makeconfig

A command-lineterminalprogram

makemenuconfig

An ncurses-basedconsoleprogram

makexconfig

A tk/tcl-basedX11 GUI program

makeoldconfig

A semi-automaticupdateprogram

Why haveacommand-lineinterfaceat all?Supposeyou hadanautonomousrobotsubmarine,or a spaceprobe.Imagineyouarein themidstof maneuversandneededa fastkernelreconfig.Simpledumbterminalinterfacescango placesotherinterfacescannotdreamof going!TheX11/tk interfacemaybemoreelegantandestheticallyappealing,but it doesrequirethatTk andX11 arebothinstalledandworking.

X11 is sometimesimpractical,for example,while doingremoteadministrationoveraslow telnetconnectionor in aLinux machinefor blind users.For thesesituations,we have thencursesbasedmenuconfig. Both theX11 andthencursesconfigurationtoolsoffer thesameoptionsin thesameorder,andthey haveroughlythesamecapabilityto navigatebackwardsandforwardsthroughtheconfigurationoptions2.

To starttheconfiguration,simply go to the/usr/src/linux directoryandenteroneof theconfigurationcommands.If youchooseeitherof thencursesor X11 methods,youwill seeabrief flurry

9

Page 10: Chapter 4. The Kernel Sources (45) - The Linux Kernel: The Bookkernelbook.sourceforge.net/pdf/ch-sources.pdf · 2002-03-01 · Chapter 4. The Kernel Sources (45) Kernel Sources Structure

Chapter4. TheKernelSources(45)

of compileractivity while theuser-interfaceprogramscompile,andthenyouwill begreetedby anoverview screenwith all thecategoriesof kerneloptions.

Configuration OptionsFigure4-2shows theinitial screenasseenin thexconfig displayfor the2.4kernel.2.2.xkernelsareverysimilar, but with feweroptionsandminorcosmeticdifferences.In all of theconfigurationmethods,mostkerneloptionscanbesetto beincluded,includedasamodule,or left out of thecompile.On thexconfig andmenuconfig screens,thereareoptionsto includeor excludecompletesectionsofconfiguration;disablingthesewill grey out any dependentoptions(thedumb-terminalconfigoptionwillsilently skip thesesections).

Figure4-2.screenshotof makexconfig screen

Whetheryouusethedumb-terminal,ncurses,or X11 method,andwhetheror not youarea beginneroradvanceduser, themostimportantfeatureon all thekernelconfigurationscreens,is theHELP option.Almost all kernelfeaturesaredocumentedright in theconfigurationscreen;whetheryouarelookingatoptionsfor installingsoundor network supportor seekingexpertoptionsfor filesystemsandfirewalls,mostoptionscarryvery reassuringadvice:“It is safeto sayY” (or N).

Preparing for a Kernel Configuration: To answer many of configuration questions, you must knowthe insides of your computer. Kernel configuration will ask about network cards, sound cards, PCIchipsets, IDE and SCSI controllers, and a host of other highly personal questions. When in doubt,use the defaults or the recommended option in the associated HELP page. If you’re feeling zealous,keep your computer manuals nearby or run through your first configuration with the panels taken offyour computer and a flashlight in hand.

10

Page 11: Chapter 4. The Kernel Sources (45) - The Linux Kernel: The Bookkernelbook.sourceforge.net/pdf/ch-sources.pdf · 2002-03-01 · Chapter 4. The Kernel Sources (45) Kernel Sources Structure

Chapter4. TheKernelSources(45)

It is not absolutely essential that you match your computer chipset perfectly on your first kernelconfiguration. The defaults are normally work very well.

Kernel Hacking

As of Linux 2.2,Kernel Hacking containsonly oneoption:To toggleSysRQsupport.SysRQ addsseveralveryusefulcommandsfor recoveringfrom a hungsystemthroughbindingrecoveryanddiagnosticoperationsto Ctrl Alt SysRqkey sequences.For example,if andtheconsoleor X-serverbecomeslockedbecausesomerenegadeprocessis blockingall I/O, youmight try to telnetto themachinein hopesof openinga super-usershellto kill thatprocessor rebootthemachine,but if thatfails,SysRQ canbeusedto syncandumount thefilesystems,andto forcea reboot.SeeTable4-1.

Security and SysRQKiosks, workstations and production machines should disable SysRQ; you maywant to also disable the Ctrl Alt Backspace command to exit X-Windows. Thisprevents novice (or knowledgeable) users from bringing down the machine withoutauthorization. In /etc/inittab, you can also customize the Ctrl Alt Del rebootinterrupt to give a longer grace period or to disable the command entirely.

Table 4-1.Kernel SysRQCommands

r Turnsoff keyboardRaw modeandsetsit to XLATE;. This is usefulwhentheconsoleor theX-Server is hung.

k Kills all programson thecurrentvirtual console.Usethis to shutdown a lockedX-server.

b ImmediatelyreBootsthesystemwithout synchingor unmountingfilesystems.Thiscommandmaycorruptyourfile-systemif you havenot alreadysynch’edandunmountedyourdisks.

o ShutsOff systempowervia APM (if configuredandsupported).

s Syncall mountedfilesystemsto minimizethefilesystemcorruptionwhichthatmayoccurfrom anungracefulshutdown.

u Unmountandremountall filesystemsasread-only, muchlike theshutdowncommand.This allowsyoursystemto readthebinariesrequiredfor anorderlyshutdown.

p Dumpsthecurrentregistersandflagsto yourconsole(i.e.generatesakernelPanic).

11

Page 12: Chapter 4. The Kernel Sources (45) - The Linux Kernel: The Bookkernelbook.sourceforge.net/pdf/ch-sources.pdf · 2002-03-01 · Chapter 4. The Kernel Sources (45) Kernel Sources Structure

Chapter4. TheKernelSources(45)

t Dumpsa list of currentTasksandtheir informationto yourconsole,to givingeyouthediagnosticdetailsfor to isolateingthecauseof thehang.

m DumpscurrentMemoryinfo to yourconsole.

0-9 Setstheconsolelog level thatfilters kernelmessages. For example,a level of zero0 wouldfilter outeverythingexceptpanicsandoopsmessages.

e/i SendstErm or kIll signalsto all processesexceptinit, effectively throwing you intosingle-usermode.

l SendsSIGKILL to all processes, including init, which

effectively halts your system.

Alternate Configurations

TheLoad/Save optionsareaconveniencefor thosewho needto maintainseveralalternateconfigurations,for exampleon a machineusedto compilekernelsfor othermachines,or whereyou needalternatekernelsfor differentpurposes.As you wouldexpect,this optionpopsup a dialog,askingfor thefilenameandthensaves.config to thenamedlocation.

Saving Your Configuration

Oncethekernelis configured,save and exit creates.config, and,if thekernelhasbeenconfiguredfor sound,generateslinux/include/linux/autoconf.h. Thekernelis now primedandreadyforbuilding.

CML2: The Next-g eneration Configuration ToolWhile theconfigurationscriptswhich drive themakefiledo thejob with a fair degreeof assurance,thissystemwasnever intendedto managea projectwith closeto two million linesof codeandhundredsofinterdependentoptions.To easethis situation,Eric Raymondhasdevotedhisairtravel andhoteltime tocreatinga next-generationsolution,the“ConfigurationManagementLanguage”,or CML2

AlthoughCML2 wasnot readyfor the2.4kernel,it will beincludedin 2.5asanalternativeconfigurationmethodandwill eitherbecomethestandardby 2.6or will besupercededby someotherCML. As muchpainasthiscausesin maintainingparallelversions,thepay-off for Linux 2.6andonwill beconsiderable.

ThecurrentCML2 will handleall kernelconfigurationoptions,andwill reportandpreventincompatibleor inconsistentconfigurations.Thedesignof this new scriptinglanguagemayalsoallow for somedayconfiguringthekernelin reverse,by specifyingthehardwareon a form andhaving theCML2 interpreter

12

Page 13: Chapter 4. The Kernel Sources (45) - The Linux Kernel: The Bookkernelbook.sourceforge.net/pdf/ch-sources.pdf · 2002-03-01 · Chapter 4. The Kernel Sources (45) Kernel Sources Structure

Chapter4. TheKernelSources(45)

deducethecorrectkerneloptions,a largesteptowardssomedayhaving kernelconfigurationproceedautomaticallyfrom thehardwaredetectionstage.

Example 4-1.Using CML2

In mostcases,migratingconfigurationspecsto CML2 only involvespatchingthemainrulesfilekernel-rules.cml, addingthesymboldeclarationsto kernel-symbols.cml andensuringthecorrectentryin kernel-menus.cml. Onceyour ruleshavebeenenteredinto thesefiles,configurationspecscanbetestedanddebuggedusingthecmlcompile.pyutility to displaythemenutreeor to run thecompilerin interactivemode.

kernel-rules.cml specifiesall optionswith their sub-optionsandrequiredcomponents.For example,themenurule for Network File Systems states

unless INET suppress CODA_FS NFS_FS SMB_FS NFSDunless (IPX!=n or INET!=n) suppress NCP_FS...menu nfs # Network file systems

CODA_FS? NFS_FS? {NFS_V3 ROOT_NFS} NFSD? {NFSD_V3}SMB_FS?NCP_FS? {ncpfs}

...menu ncpfs # NCP filesystem configuration

NCPFS_PACKET_SIGNING NCPFS_IOCTL_LOCKINGNCPFS_STRONG NCPFS_NFS_NS NCPFS_OS2_NS NCPFS_SMALLDOSNCPFS_MOUNT_SUBDIR NCPFS_NDS_DOMAINS NCPFS_NLS NCPFS_EXTRAS

...unless NCP_FS!=n suppress ncpfs...derive NLS from JOLIET==y or FAT_FS!=n or NTFS_FS!=n or NCPFS_NLS==y

This providesall fivedifferentnetwork file systemswhenINET is enabled,but only offerstheNCP_FS ifIPX is setbutINET is not.WhereNCP_FS is enabled,theconfigurationwill includetherelatedNCPFS_*options.Also, NCP_FS will imply includingtheNLS codepagesupport.

kernel-symbols.cml definesthepretty-printstringsfor thekernelsymbolsandis factoredoutof therulesfile to allow for translations.Thisfile holdsnosurprises:

NCP_FS ’NCP file system support (to mount NetWare volumes)’## NCP Filesystem configuration#NCPFS_PACKET_SIGNING ’Packet signatures’NCPFS_IOCTL_LOCKING ’Proprietary file locking’NCPFS_STRONG ’Clear remove/delete inhibit when needed’NCPFS_NFS_NS ’Use NFS namespace if available’

13

Page 14: Chapter 4. The Kernel Sources (45) - The Linux Kernel: The Bookkernelbook.sourceforge.net/pdf/ch-sources.pdf · 2002-03-01 · Chapter 4. The Kernel Sources (45) Kernel Sources Structure

Chapter4. TheKernelSources(45)

NCPFS_OS2_NS ’Use LONG (OS/2) namespace if available’NCPFS_SMALLDOS ’Lowercase DOS filenames’NCPFS_MOUNT_SUBDIR ’Allow mounting of volume subdirectories’NCPFS_NDS_DOMAINS ’NDS authentication support’NCPFS_NLS ’Use Native Language Support’NCPFS_EXTRAS ’Enable symbolic links and execute flags’

Similarly, kernel-menus.cml simplydefinesthetop-level menusfor thekernelconfigurationprocess.

Kernelconfigurationsaregeneratedin two stages,first to compilethemenusourcefile with thecmlcompile.pyprogram,andthento runcmlconfigure.py to setkerneloptions.Like theMakefilerulesit replaces,CML2 offersX, cursesandline orientedinterfacesselectedby thedefaultmodeor withthe-c and-t options:

cmlcompile.py kernel-rules.cmlcmlconfigure.py

Screenshotof CML2 v.0.6.0

14

Page 15: Chapter 4. The Kernel Sources (45) - The Linux Kernel: The Bookkernelbook.sourceforge.net/pdf/ch-sources.pdf · 2002-03-01 · Chapter 4. The Kernel Sources (45) Kernel Sources Structure

Chapter4. TheKernelSources(45)

CML2 is codedin thePython1.5.2to ensureportabilityandto allow directcompilationto a nativebinary. A completeguideto CML2 andthecurrentsourcefilescanbedownloadedfrom Eric Raymond’sKBuild Webpage(http://www.tuxedo.org/~esr/kbuild/).

Building and Installing the KernelYoucannow applyyourupdatedconfigurationto build thenew kernel,createthemodules,andinstall theworks.It’salsonow time to giveyourwristsabreakandreturnto thecommandline to put it all together.

Beforebuilding thenew kernel,youmustregenerateall dependency files to accountfor any changesinincludeor moduleoptions.Until CML2 becomesthestandard,this stepis neededwhenever thekernelconfigurationis changed.Themake depcleancommandwill rebuild thesedependency files andremoveany straygeneratedfiles.

Building the KernelAs with everythingelseaboutLinux, building thekerneloffersmany choices.All thebuild optionsareoutlinedin linux/Documentation/kbuild/commands.txt; themostcommoncasesarebuildingjust thekernelfile, only themodules,building both,anddoinganinstall of thekernelandor themodulesafterthebuild.

For example,youmayneedto build a kernelfile for someothercomputer(suchasa laptop)or to beinstalledby handundersomevery logical new name.Building this imagecouldbedonewith

make bzImage && \cp /usr/src/linux/arch/i386/boot/bzImage \

/boot/vmlinuz-scsi

Thefirst commandcompilesandcompressesthekernel(for a “largekernel” image;see) leaving theresultin arch/$(ARCH)/boot; theimageis thencopiedmanuallyto the/boot directory. Thisnewimagewill not beinstalleduntil it is registeredwith a bootloadersuchaslilo (seethesectioncalledManuallyInstallinga New Kernel. To automaticallyinstall a kernelimage,usethecommand

make bzlilo

This will createthesamecompressedimageandcopy thefile to $INSTALL_PATH/vmlinuz, thenrunthelilo command;make bzlilo assumesyour/etc/lilo.conf expectsthisfilenamein this location.

15

Page 16: Chapter 4. The Kernel Sources (45) - The Linux Kernel: The Bookkernelbook.sourceforge.net/pdf/ch-sources.pdf · 2002-03-01 · Chapter 4. The Kernel Sources (45) Kernel Sources Structure

Chapter4. TheKernelSources(45)

Big Kernels on Intel MachinesEach of the kernel build commands has a "big-kernel" counterpart that is needed ifthe kernel grows to be over 1MB in size when uncompressed. Installing theselarge kernel images with older versions of lilo will overwrite part of the boot loaderand the system will not boot. Since most configurations result in a big kernel andbuilding small kernels with the big-kernel commands seems benign, unless youare building a very simple kernel for an old machine or an embedded device,router, etc., use bzlilo and bzImage make targets just to be sure.

All z* targets are specific to the ix386 platform, and these will be removed duringthe 2.5 development and replaced by the bz* equivalents. For this reason, thischapter will use the normal z* commands.

Themostcommonandconvenientcommandfor creatinganew kernelis

make dep clean zlilo modules modules_install

This onecommandline will:

Performthedependency file generation.

Cleanthesources.

Createacompressedkernelimage.

Move$(INSTALL_PATH)/vmlinuz to $(INSTALL_PATH)/vmlinuz.old, copy the new zImage kernel file to $(INSTALL_PATH)vmlinuz, and run lilo to install the new images.

Build all modulesandinstall theseunder$(INSTALL_MOD_PATH)/lib/modules/2.2.5.

Puttingall thesecommandsin on oneline will ensurethatif any stageof this build fails,subsequentstageswill not bestarted.Thewholeprocesscanalsobescheduledto run in anxtermwindow oralt-console,canberun duringoff-peakhoursasanat job, or canbeusedasanexcuseto playsomeseriousNethackor XPilot .

Manuall y Installing a New Kernel

Thenew kernelfile is alwaysfoundin /usr/src/linux/arch/$(ARCH)/boot/zImage andmustbeinstalledusingthe lilo bootloaderor someotherLinux loaderbeforeit canbeused.

For example,to emulatetheRedHat/boot pathscheme,youwould needto copy thenew zImage to/boot/vmlinuz (save theold onefirst!) andmodify /etc/lilo.conf to includethebackupversion.Alternatively, to accommodatestubbornplug-and-playdevices,youmayneedto copy this new kerneltoyourWindows95 partitionfor useby theLinux loadlin.exebootloader.

Onefrequentrequirementis to createbootfloppies.A bootfloppy is nothingmorethanakernelcopieddirectly to thea floppy diskandsetto mounttheroot file systemfrom theharddrive.

16

Page 17: Chapter 4. The Kernel Sources (45) - The Linux Kernel: The Bookkernelbook.sourceforge.net/pdf/ch-sources.pdf · 2002-03-01 · Chapter 4. The Kernel Sources (45) Kernel Sources Structure

Chapter4. TheKernelSources(45)

While it is farmoremnemonicto createa bootfloppy usingthecommand

make zdisk

this is equivalentto usingdd to copy thefile directly to theraw sectorsof thefloppy diskdevice:

dd if=arch/i386/zImage of=/dev/fd0

Compiling for a Remote Machine: When you’re creating a kernel for some other machine (eg suchas a laptop), you can create put the compressed kernel file and all modules into an alternatedirectory tree by giving alternate values for the INSTALL_* path variables on the make commandline, for example:

INSTALL_PATH=/psitta \INSTALL_MOD_PATH=/psitta ROOT_DEV=/dev/hda1 \

make bzlilo modules_install

This will move the generated kernel, map, and module files to /psitta/vmlinuz,/psitta/System.map and /psitta/lib/modules, where you can conveniently tar the wholedirectory for shipment to the remote machine with the following:

cd /psitta && \tar cf - vmlinuz System.map lib | \

rsh psitta tar xCf / -

There is one side effect: The command will also run lilo , but since the /etc/lilo.conf file does notreference these new /psitta files, there is no adverse effect.

The only potential hazard of this trick is a possible change to files in /usr/include/linux, whichmay affect programs subsequently compiled on the build host. Some care must be taken to ensurethat the alternate kernel build does not leave unwanted changes in this directory on the buildmachine. Also, if the remote machine will be used to build software, after compiling the new kernel,you should copy the /usr/include/linux directory should also be copied over installed onto theremote machine after compiling the new kernel.

Troub leshooting the New Kernel/proc is your friend.Thepseudo-filesin the/proc directoryholda wealthof diagnosticinformationanda simplemeansto setruntimeparameters.

System Information Files

Themostfrequentlyuseful/proc diagnosticfilesareasfollows:

17

Page 18: Chapter 4. The Kernel Sources (45) - The Linux Kernel: The Bookkernelbook.sourceforge.net/pdf/ch-sources.pdf · 2002-03-01 · Chapter 4. The Kernel Sources (45) Kernel Sources Structure

Chapter4. TheKernelSources(45)

• /proc/cpuinfo lists theprocessortype,numberof ports,andotheressentialinformationaboutthecomputerhardware:

$cat /proc/cpuinfo

processor : 0vendor_id : AuthenticAMDcpu family : 5model : 8model name : AMD-K6(tm) 3D processorstepping : 12cpu MHz : 350.804507fdiv_bug : nohlt_bug : nosep_bug : nof00f_bug : nofpu : yesfpu_exception : yescpuid level : 1wp : yesflags : fpu vme de pse tsc msr mce cx8 sep pge mmx 3dnowbogomips : 699.60

• /proc/interrupts mapsIRQ linesto devices:

$ cat /proc/interrupts

CPU00: 30200579 XT-PIC timer1: 251230 XT-PIC keyboard2: 0 XT-PIC cascade4: 996021 XT-PIC serial5: 1 XT-PIC soundblaster7: 2 XT-PIC parport18: 1 XT-PIC rtc11: 3984 XT-PIC MSS audio codec12: 973494 XT-PIC eth013: 1 XT-PIC fpu14: 4253923 XT-PIC ide015: 4713361 XT-PIC ide1NMI: 0

• /proc/sound reportsthecurrentsoundsystemconfigurationandtheinstalledservices:

$ cat /proc/sound

18

Page 19: Chapter 4. The Kernel Sources (45) - The Linux Kernel: The Bookkernelbook.sourceforge.net/pdf/ch-sources.pdf · 2002-03-01 · Chapter 4. The Kernel Sources (45) Kernel Sources Structure

Chapter4. TheKernelSources(45)

OSS/Free:3.8s2++-971130

Load type: Driver compiled into kernelKernel: Linux maya.dyndns.org 2.2.5 #2 Thu Apr 15 18:34:07 EDT 1999 i586Config options: 0

Installed drivers:

Type 10: MS Sound SystemType 27: Compaq Deskpro XLType 1: OPL-2/OPL-3 FMType 26: MPU-401 (UART)Type 2: Sound BlasterType 29: Sound Blaster PnPType 7: SB MPU-401Type 36: SoftOSS Virtual Wave Table

Card config:SoftOSS Virtual Wave TableCompaq Deskpro XL at 0x530 irq 11 drq 0,0Sound Blaster at 0x220 irq 5 drq 1,5(SB MPU-401 at 0x330 irq 5 drq 0)OPL-2/OPL-3 FM at 0x388 drq 0

Audio devices:

0: MSS audio codec (SoundPro CMI 8330)1: Sound Blaster 16 (4.13) (DUPLEX)

Synth devices:

0: SoftOSS1: Yamaha OPL3

Midi devices:

Timers:

0: System clock1: SoftOSS

Mixers:

0: MSS audio codec (SoundPro CMI 8330)1: Sound Blaster

19

Page 20: Chapter 4. The Kernel Sources (45) - The Linux Kernel: The Bookkernelbook.sourceforge.net/pdf/ch-sources.pdf · 2002-03-01 · Chapter 4. The Kernel Sources (45) Kernel Sources Structure

Chapter4. TheKernelSources(45)

• /proc/parport containsdirectoriesfor eachparallelportandreportson thedevicesattachedto eachport:

$ cat /proc/parport/0/hardware

base: 0x378irq: nonedma: nonemodes: SPP,ECP,ECPEPP,ECPPS2

Setting Kernel Parameter s and Options

Kernelandotherlow-level runtimeparameterscanbesetthroughthe/proc/sys pseudo-files.Forexample,to setthemaximumnumberof file handlesto ahighervalue,you canincludea line in thebootscriptswhichthatechoesthenew numberdirectly into /proc/fs/file-max.

/proc Interfaces Chang esThere are a number of differences between the 2.0, 2.2 and 2.4 kernels regardingthe organization and format of /proc files. For example, the file-max pseudo-filewas located in the kernel subdirectory for 2.0, but has now moved to the fssubdirectory. Changes in formats can also cause utility programs such as top andxosvie w to fail. When in doubt, check the linux/Documentation/Changes file forcompatibility reports.

Recovering from Faulty KernelsIt happens.You executeanorderlyshutdown andreboot,themonitorflashes(or yourconnectiongoesdead),andyouwait for theboot,only to begreetedwith a partialLILO prompt. . . or worse.

Typically, a faultykernelwill exhibit oneof thefollowing behaviours:

• Themachinewill cyclesthroughrepeatedrebooting.

• You seesomesubstringof theLILO prompt,for suchasLIL- followedby a halt.

• Linux will beginsto loadbut haltsat somepoint duringthekernelmessages.

• Linux will loadsbut endsin akernelpanicmessage.

• Linux will loads,runs,letsyou log in, andthendieswhenit is leastconvenient.

20

Page 21: Chapter 4. The Kernel Sources (45) - The Linux Kernel: The Bookkernelbook.sourceforge.net/pdf/ch-sources.pdf · 2002-03-01 · Chapter 4. The Kernel Sources (45) Kernel Sources Structure

Chapter4. TheKernelSources(45)

If you’reareprepared,yourprognosisfor a full recovery is verygood.If youcangetup to theLILO:prompt,themostconvenientrecovery is to loadyourbackupkernelby specifyingits labelto thebootloader:

LILO: backup

This will bootfrom yourpreviouskernelandallow you in to soyou canfix theproblemandtry yourluck again.If youcannotgetto theLILO prompt,youronly alternative is to useyourbootdisketteor tousearescuedisk.Thebootdiskettemakeslife mucheasiersincebecausetherunningsystemwill beidenticalto yournormalsystem.If you usea rescuedisk,you mustmanuallymountyoursystempartitionsandenableany extra modules.

Wherealternatekernelsandbootdiskettesarenot practical,for instance,on thin clientswith limiteddiskspace,andif youcanreachtheLILO prompt,youcantry to startyoursystemin single-usermodetopreventtheprobingandloadingof many modules,suchasyournetwork card(a frequentculprit). Thedefault configurationfor single-user(akaAKA ’runlevel 1’) modeis specifiedby thefiles in/etc/rc.d/rc1.d, andit is a goodideato double-checkthesymlinksin thatdirectoryaftereachsystemupgradeto ensurethatthechoicesareintelligentfor thepurpose.Single-usermodewill put youdirectly into asystemshell;oncetheproblemhasbeencorrected,youcaneitherrebootthesystemor exittheshell to returnto multi-usermode.

Repeated RebootingNine timesout of ten,repeatedrebootingis causedby changingthekernelfile andforgettingto run liloto registerthenew imagewith thebootloader. lilo needstheraw sectorlocationof thekernel;copying akernelimagewill move it to a new disksectorandleave thepreviouspointerstoredby lilo danglingintoanabyss.

This problemcanbecorrectedby bootingfrom thebootfloppy andrunninglilo , or by usinga rescuedisk,mountingthebootpartitionunder/mnt, andrunninglilo with theoptionsto usea relativepath:

lilo -r /mnt

Partial LILO PromptA partialLILO promptis themostterrifying of all kernelbooterrors.Eachletterof theL-I-L-O signifiesa stagein thebootprocess:

• L- or LIL: Usuallya mediaerroror failureto includethebootpartitionor filesystemsupport(orincludingit asamodule).

21

Page 22: Chapter 4. The Kernel Sources (45) - The Linux Kernel: The Bookkernelbook.sourceforge.net/pdf/ch-sources.pdf · 2002-03-01 · Chapter 4. The Kernel Sources (45) Kernel Sources Structure

Chapter4. TheKernelSources(45)

• LI or LIL?: Either/boot/boot.b is missing,moved,or corrupt.Thesolutionis thesamefor all:re-runlilo .

More informationonusinglilo andthediagnosisof lilo errorcodescanbefoundin/usr/doc/lilo-0.x/TechnicalGuide.ps 3.

Kernel Halts While LoadingDeviceprobingis risky businessanda frequentcauseof kernelhaltswhile loading.For example,if youareconfiguringfor agateway/firewall machinewith two network interfaces,thesecondprobemaycausethekernelto halt.Othercausesof kernelhaltsareIRQ conflicts,memoryconflicts,andmismatcheddevicesselectingsimilarbut not-quite-identicaldrivers.

You canavoid probing,memory, andIRQ conflictsfor mostkernelmodulesanddevicesby supplyingconfigurationparametersin the/etc/lilo.conf append line or at theLILO. Theexactparameterstousedependon yourdevice,but you canfind adviceis oftenfoundin theREADME files,eitherinlinux/Documentation or in thesubdirectoriesof thedriversourcecode.

Resolving IRQs and memor y por ts: If you have IRQ and/or memory conflicts, and if you have aWindows partition, you can find the values used by Windows in the ControlPanel:System:Deviceslistings and then use these settings on the lilo command line, in /etc/conf.modules or in yourBIOS PnP settings. It is unfortunate, but a few manufacturers still believe their best business model isto restrict use of their hardware to Microsoft users. When techniques and interfaces for probing andconfiguring these devices are not available to Linux programmers, we are forced to reverse engineerthe protocols which can sometimes result in a lack of Linux support until after the device is obsolete.Fortunately, most manufacturers have seen the light and happily provide the information needed toincorporate their products under Linux.

Kernel PanicA kernelpanicmessagehasacertaincrypticpoetryto it. A robotichaiku,asnapshottestamentto thelastmomentsof a runningLinux kernel.A kernelpanicusuallyhastheform:

unable to handle kernel paging request at address C0000010Oops: 0002EIP: 0010:XXXXXXXXeax: xxxxxxxx ebx: xxxxxxxx ecx: xxxxxxxx edx: xxxxxxxxesi: xxxxxxxx edi: xxxxxxxx ebp: xxxxxxxxds: xxxx es: xxxx fs: xxxx gs: xxxxPid: xx, process nr: xx

xx xx xx xx xx xx xx xx xx xx

22

Page 23: Chapter 4. The Kernel Sources (45) - The Linux Kernel: The Bookkernelbook.sourceforge.net/pdf/ch-sources.pdf · 2002-03-01 · Chapter 4. The Kernel Sources (45) Kernel Sources Structure

Chapter4. TheKernelSources(45)

For mostpracticalpurposes,knowing wherethepanicoccursis moreusefulthaninterpretingthemessageitself. Theleadingtext tellswhattriggeredtheevent,andthis is followedby theaddressesheldin variousregisters.Intrepidreaderscanfind detailedinstructionson decodingthis messagein thelinux/Documentation/oops-tracing.txt file.

In productionkernels,panicmessagesarerareandusuallydueto a misconfigurationproblem,missingmodules,failureto loadamodulebeforeusingsomeessentialfeature,or dueto usinghardwarenotsupportedby thecurrentkernel.With developmentkernels,kernelpanicscanbecomea wayof life.

Notes1. Thereis a third possibilitywith pre-2.2kernels:Moduleversionnumbersaremismatched.This

happenswhenthekernelhasbeencompiledwith theoptionto checkmoduleversionnumbers,andthosenumbersdonot exactlymatch(ie includingthebuild number).Thesemodulesarerejected,andyoursystemmaynot bootif it dependsonsomecritical moduleto function.This is no longeranissuebecausethis testis no longerpartof theLinux configuration.

2. TheX andncursesconfigurationcommandsalsohavethesamepropensityto allow wildlyconflictingkerneloptionswith narya whisperof dissent. . . sometimeearlyin 2.5,this will allchangewith theadoptionof Eric Raymond’sCML2 ConfigurationManagementLanguage(seethesectioncalledCML2: TheNext-generationConfigurationTool)

3. You canview PostscriptfilesbothunderX andon theLinux consoleusingGhostview (gv).Ghostscript(gs) canalsobeusedto createa varietyof printerandgraphicimageoutputs.

23

Page 24: Chapter 4. The Kernel Sources (45) - The Linux Kernel: The Bookkernelbook.sourceforge.net/pdf/ch-sources.pdf · 2002-03-01 · Chapter 4. The Kernel Sources (45) Kernel Sources Structure