Professional Documents
Culture Documents
Introduction
WhoamI?
WorkingonFreeSoftwaresincemid'90s Myprofessionsince1997:) Presentlyenjoyingsometimeoffafter7highlyenjoyableyearsat IBM'sLTCinOzLabs MostlyworkedonPowerPCstuff,particularlyLinux
Whatisthistalkabout?
Thetipsandtricksusedbyexperiencedkernel/FOSSdevelopers I'mnotanexpert,butamfortunatetohaveworkedwith/knowa numberofthem! BasedonownexperienceswithTaishanboardportandsuggestions solicitedfromfriends&colleagues
Questionswelcomeatanytime
Topics
Hardwaresetup Earlybringup Gettingthekernelrunning Workingwithkernelsource Buildingkernels Randomdatapoints
HardwareSetup
HardwareSetup(continued)
HardwareSetup(continued)
Remotereset Remotepowercontrol
e.g.http://www.dontronicsshop.com/elexol.htmlEtherIO24Module Variouscommercialproductstodomainsswitchingareavailableoff theshelf
Serialconcentrators
e.g.http://www.opengear.com/productcm4148.htmlRunsLinux:)
Ethernethub/switcheswithmonitoringport Localsubnets/tftpservers
Sometimefirmwarehasbrokentftp/dhcpsupport
Incircuitdebuggers
EarlyBringup
Simulators
SpecialisedlowlevelCPUsimulators qemuandfriends
NewhardwarecanhaveinterestingFeatures
ChickenSwitches&BrokenThings
Ignoringfirmware
Dosome/alldeviceinitialisationyourself?
Inmemoryconsole Devicenumberingfun
Linuxthinks:eth0andeth1 Hardwarethinks:EMAC2andEMAC3 PCBislabelled:EthernetIandEthernetII You'renotpluggedintoanyofthem?
Gettingthekernelrunning
Getitintomemory
Ifnecessaryhackyourbootloadertogetsomethinggoing jtagorICEtrickery
SomeGotchas
Kernelwillreinitialiseserialports Canleadyouastrayifdivisorswrongorotherregisters incorrect Don'tforgetdebugonkernelcommandline... Watchtherightserialport...
Workingwithkernelsource
Gettingacurrenttree
gitpull
MattMackall'sketchup Visualisingsourcetree&commits
gitk tig
Findingbugsw/bisectionsearch
gitbisectstart gitbisectgoodv2.6.24 gitbisectbadv2.6.25
buildresultingkernel
gitbisectgoodorgitbisectbadasappropriate
repeat
gitbisectreset
Canbeautomated...
Combinedwithremotepower/reset,canheavilyautomatetests
Workingwithkernelsource(continued)
Quiltiswonderful
Modestlearningcurvetimewellspent Tutorialwouldbeawholesessioninitself
Keepworkaspatches
Makestrackingmainlinemucheasier Takesabitofgettingusedto,butwellwortheffort Navigatingtree etags(emacs)orctags(vi/vim)
AlsovariousGUIsthatuseCTAGsgivesyouEclipseLike integration
Genericdiffvisualisation
dirdiff
Buildingkernels(oranythingbig...)
You'regoingtodothisalot,somakeitquick
Buyahonkin'bigcompilebox IBMp59564wayPOWER6 About3kernels/second Orborrowcycles ccache distcc ccontrol Objectcodeinseparatetreetokernelsource makeO=../someotherdir[...] Niceforkeepingbuildcruftoutofyoursourcetree
Canalsobesetasanenvironmentvariable Remembercantemporarilysetenvironmentvariableson commandlineforaoneshotchange Alsoconsidersymbolicorhardlinkstoduplicateorbuildoutof treee.g.cpRs<src><dest>
RandomDatapoints
Aneatconversionutility
iprint Inspectbitfieldswithease bitfield
bash stuff
Commandlinecompletion /etc/bash.completion
e.g.aptget<tab>,make<tab>etc. bashcompletionalsoworkswithscpreallyniceifyouhaveyoursshkey onremotebox. e.g.scp<localfile>hugh@ozlabs.org/~<tab> Canlookinsidetarballstoo...
Timesaving #forreallylongcommandlines
RandomDatapoints(continued)
Tameyourphotocollectionorsourcetree
fdupes
Manpagestoreadinclude
ssh Moretunnels,portforwardsandusefulthingsthanyouthink! lsof
Whyismysoundunavailable,lookingatopensocketsetc.
x11vnc
Fixingfamilymembersmachinesremotely
screenx
Goodoverslow/unreliablelinks Lettingaslowbuildon(say)anembeddedsystemrunovernight
RandomDatapoints(continued)
ASwissArmyknife
LD_PRELOAD=/path/to/some/hack/i/made.so SessionbyKevinPulotomorrowafternoon Usefulcodesnippets http://samba.org/~tridge/junkcode ccanIfperlcan,maybeccan? http://ccan.ozlabs.org
RandomQuotes
Whenyouhaveahardproblem,findasmartpersontohelpyou
solveit paulus(paraphrased) Therearemanycaseswhereyoudon'tneedtocheckpreconditions forthingsyou'retryingtodo.Simplestexampleisopeningafile.No needtofstat(3)afiletoseeifitexistsbeforetryingfopen(3). fopen(3)willtellyouifthefileisn'tthere.Moreover,checkingfirst cancausearacecondition,especiallyifthefilemightdisappear betweenthefstat(3)andthefopen(3). Tridge(paraphrased) Don'tsendemailwhendrunk gkh(notparaphrased:)
Close
Questions? Thankyouto
StephenRothwell,JeremyKerr,PaulMackerras,Tridge,Greg KroahHartman,MichaelNeuling,RonnieSahlberg,Matt Mackall,DavidGibsonandMartinSchwenke Membersoftheaudienceatearlierversionsofthispresentation fortheirsuggestions Contributionswelcome