<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta name="keywords" content="9p, 9p2000, research, Plan 9, Inferno, Unix, Open Source, Bell Labs" /> <meta name="description" content="Open source distributed operating system Plan 9 from Bell Labs." /> <link rel="stylesheet" href="/wiki-style.css" media="all" type="text/css" /> <title>Compiling kernels (Diff)</title></head><body><h1><a name="top"></a>Compiling kernels <i>-Diff-</i></h1> <div class='body'> <!-- ***************************** --> <hr /><div class='diff_head'><a href="index.html">Sun Mar 2 11:36:20 EST 2008</a>, stella</div><hr />ThesourceforthePlan9kernels(otherthantheoriginalstandalonefileserverkernelsin/sys/src/fs)iskeptin/sys/src/9.ThedistributionincludeskernelsfortheIntelPC,theAlphaPC,aMIPS-basedworkstationcalledaCarrera,theCompaqiPAQ(bitsy),andaPowerPC-basedembeddedsystem.<p class='para'>Themachine-independentsourcecodeisin/sys/src/9/port.Eacharchitecturealsohasamachine-dependentdirectory:pc,alphapc,carrera,mpc,andsoon.</p> <p class='para'>Tobuildakernelforapre-existingconfigurationyoucdintothecorrespondingarchdirectoryandthenrunmkwiththeCONFvariablesettotheconfigurationfileyouwanttouse.</p> <p class='para'>Forexampletobuildthedefaultterminalkernelpcf:<pre>cd /sys/src/9/pcmk 'CONF=pcf'</pre> </p> <p class='para'>Toinstallthenewkernelcopythegeneratedkernelwiththenameoftheconfigfileprecededby9(eg.,9pcf)toyour9fatdirectory:<pre>9fat:cp /sys/src/9/pc/9pcf /n/9fat/</pre> </p> <p class='para'>Itisrecommendedthatyoukeepyouroldkernelaroundsoyoucanbootitincasesomethingiswrongwiththenewone,fordetailsofhowtodothissee<a href="http://plan9.bell-labs.com/magic/man2html/8/plan9.ini"><i>plan9.ini</i>(8)</a></p> <a name="HOW_TO_CONFIGURE_A_CUSTOM_KERNEL" /><h3>HOW TO CONFIGURE A CUSTOM KERNEL</h3> <p class='para'>AdistinctionismadebetweenthekernelconfigurationforterminalsandforCPUservers:theyhaveslightlydifferentbootsequences,anddifferentkernel-to-usermemoryratios.</p> <p class='para'>Eachkernelisdescribedbyaconfigurationfile.Forexample,thisisanabridgedversionofthepcdiskterminalconfigurationfile/sys/src/9/pc/pcdisk.</p> <pre>dev root cons arch env ip link ether2000 ether8390 ethermedium misc archmp mp apic kfs.root vgamach64xx +cur vgamga2164w +cur ip il tcp port int cpuserver = 0; boot boot #S/sdC0/ il local</pre> <p class='para'>Theformatissimple:eachwordoneachindentedlineisthenameofanobjectfiletolink.Thenon-indentedlinesmarksections.Youcanincludeorexcludevariousdriversbyinsertingorremovinglines.</p> <p class='para'>The<a href="../bootdir">bootdir</a>sectiondescribeshowthethe#//bootdirectoryispopulated.</p> <p class='para'>Youmightwanttoeditapre-existingkernelconfigurationfileifforexampleyouwanttobuildastandaloneterminal/CPU/authserverbutthedefaultserverconfigurationdoesn'thaveyourvideocarddriver.Torebuild9pccpufwithyourcarddriver,edit/sys/src/9/pc/pccpufandaddtheappropriatevgaline.</p> <p class='para'>Formultiprocessors,makesuretheline</p> <pre> archmp mp apic</pre> <p class='para'>appearsinyourconfigfileorthenewkernelwillonlyuseoneCPU.</p> <p class='para'>Thenrebuildthatkernelandinstallit:</p> <pre>cd /sys/src/9/pcmk 'CONF=pccpuf'cp 9pccpuf /3869fat:cp 9pccpuf /n/9fat/</pre> <p class='para'>Theargumenttomkspecifieswhichconfigurationfiletouse.Thedefaultforthepckernelsis``pc''.</p> <p class='para'>Itisusuallybesttoplayinacopyoftheconfigfilesratherthaneditthemdirectly.Thenyoucanmkwith</p> <pre>mk 'CONF=pcmyusername'</pre> <p class='para'>ButevenifyouLines 1–500 of 722. Load more
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta name="keywords" content="9p, 9p2000, research, Plan 9, Inferno, Unix, Open Source, Bell Labs" /> <meta name="description" content="Open source distributed operating system Plan 9 from Bell Labs." /> <link rel="stylesheet" href="/wiki-style.css" media="all" type="text/css" /> <title>Compiling kernels (Diff)</title> </head> <body> <h1><a name="top"></a> Compiling kernels <i>-Diff-</i></h1> <div class='body'> <!-- ***************************** --> <hr /><div class='diff_head'> <a href="index.html">Sun Mar 2 11:36:20 EST 2008</a>, stella </div><hr />The source for the Plan 9 kernels (other than the original standalone file server kernels in /sys/src/fs) is kept in /sys/src/9. The distribution includes kernels for the Intel PC, the Alpha PC, a MIPS-based workstation called a Carrera, the Compaq iPAQ (bitsy), and a PowerPC-based embedded system. <p class='para'> The machine-independent source code is in /sys/src/9/port. Each architecture also has a machine-dependent directory: pc, alphapc, carrera, mpc, and so on. </p> <p class='para'> To build a kernel for a pre-existing configuration you cd into the corresponding arch directory and then run mk with the CONF variable set to the configuration file you want to use. </p> <p class='para'> For example to build the default terminal kernel pcf: <pre> cd /sys/src/9/pc mk 'CONF=pcf' </pre> </p> <p class='para'> To install the new kernel copy the generated kernel with the name of the config file preceded by 9(eg., 9pcf) to your 9fat directory: <pre> 9fat: cp /sys/src/9/pc/9pcf /n/9fat/ </pre> </p> <p class='para'> It is recommended that you keep your old kernel around so you can boot it in case something is wrong with the new one, for details of how to do this see <a href="http://plan9.bell-labs.com/magic/man2html/8/plan9.ini"><i>plan9.ini</i>(8)</a> </p> <a name="HOW_TO_CONFIGURE_A_CUSTOM_KERNEL" /><h3>HOW TO CONFIGURE A CUSTOM KERNEL</h3> <p class='para'> A distinction is made between the kernel configuration for terminals and for CPU servers: they have slightly different boot sequences, and different kernel-to-user memory ratios. </p> <p class='para'> Each kernel is described by a configuration file. For example, this is an abridged version of the pcdisk terminal configuration file /sys/src/9/pc/pcdisk. </p> <pre> dev root cons arch env ip link ether2000 ether8390 ethermedium misc archmp mp apic kfs.root vgamach64xx +cur vgamga2164w +cur ip il tcp port int cpuserver = 0; boot boot #S/sdC0/ il local </pre> <p class='para'> The format is simple: each word on each indented line is the name of an object file to link. The non-indented lines mark sections. You can include or exclude various drivers by inserting or removing lines. </p> <p class='para'> The <a href="../bootdir">bootdir</a> section describes how the the #//boot directory is populated. </p> <p class='para'> You might want to edit a pre-existing kernel configuration file if for example you want to build a standalone terminal/CPU/auth server but the default server configuration doesn't have your video card driver. To rebuild 9pccpuf with your card driver, edit /sys/src/9/pc/pccpuf and add the appropriate vga line. </p> <p class='para'> For multiprocessors, make sure the line </p> <pre> archmp mp apic </pre> <p class='para'> appears in your config file or the new kernel will only use one CPU. </p> <p class='para'> Then rebuild that kernel and install it: </p> <pre> cd /sys/src/9/pc mk 'CONF=pccpuf' cp 9pccpuf /386 9fat: cp 9pccpuf /n/9fat/ </pre> <p class='para'> The argument to mk specifies which configuration file to use. The default for the pc kernels is ``pc''. </p> <p class='para'> It is usually best to play in a copy of the config files rather than edit them directly. Then you can mk with </p> <pre> mk 'CONF=pcmyusername' </pre> <p class='para'> But even if you