Sean Hincheeinitial push75d07b48 years agoHistory
198 lines · 5.5 KB · HTML
RawDownload
<html><head><title>Compiling kernels (Editing Sun Mar  2 11:36:20 EST 2008 version)</title><META http-equiv="Content-Type" content="text/html; charset=utf-8"></head><!-- FFFFE9 is acme yellow; FFFFE9 is as close as you can get to it before charon decides to use  grey instead of map entry 254 --><body bgcolor="#FFFFE9" link="#0000AA" alink="#0000AA" vlink="#0000AA"><center><font size=+2><b>Compiling kernels</b></font> (Editing Sun Mar  2 11:36:20 EST 2008 version)</center><p> For information on editing, see thedescription of <a href="../0">Plan 9 wiki syntax</a>.<p><form action="/magic/wikipost" method="post"><table><tr><td valign=top><input type="submit" name="x" value="Put"></td><td><table><tr><td align=right>(optional) Comment:</td><td><input type="text" name="comment" value="" cols=40></td></tr><tr><td align=right>(optional) Email:</td><td><input type="text" name="author" value="" cols=40></td></tr></table><input type="hidden" name="title" value="Compiling kernels"><input type="hidden" name="version" value="1204475780"><input type="hidden" name="service" value="plan9"><input type="hidden" name="base" value="/wiki/plan9"><p><textarea name="text" wrap="virtual" cols="80" rows="25">The source for the Plan 9 kernels (other than the original standalonefile server kernels in /sys/src/fs) is kept in /sys/src/9. Thedistribution includes kernels for the Intel PC, the Alpha PC, aMIPS-based workstation called a Carrera, the Compaq iPAQ (bitsy), anda PowerPC-based embedded system. The machine-independent source code is in /sys/src/9/port. Eacharchitecture also has a machine-dependent directory: pc, alphapc,carrera, mpc, and so on. To build a kernel for a pre-existing configuration you cd into thecorresponding arch directory and then run mk with the CONF variableset to the configuration file you want to use. For example to build the default terminal kernel pcf:! cd /sys/src/9/pc! mk 'CONF=pcf' To install the new kernel copy the generated kernel with the name ofthe config file preceded by 9(eg., 9pcf) to your 9fat directory:! 9fat:! cp /sys/src/9/pc/9pcf /n/9fat/ It is recommended that you keep your old kernel around so you canboot it in case something is wrong with the new one, for details ofhow to do this see plan9.ini(8) HOW TO CONFIGURE A CUSTOM KERNEL A distinction is made between the kernel configuration for terminalsand for CPU servers: they have slightly different boot sequences, anddifferent kernel-to-user memory ratios. Each kernel is described by a configuration file. For example, thisis an abridged version of the pcdisk terminal configuration file/sys/src/9/pc/pcdisk. ! 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 The format is simple: each word on each indented line is the name ofan object file to link. The non-indented lines mark sections. You caninclude or exclude various drivers by inserting or removing lines. The [bootdir] section describes how the the #//boot directory ispopulated. You might want to edit a pre-existing kernel configuration file iffor example you want to build a standalone terminal/CPU/auth serverbut the default server configuration doesn't have your video carddriver. To rebuild 9pccpuf with your card driver, edit/sys/src/9/pc/pccpuf and add the appropriate vga line. For multiprocessors, make sure the line ! 	archmp		mp apic appears in your config file or the new kernel will only use one CPU. Then rebuild that kernel and install it: ! cd /sys/src/9/pc! mk 'CONF=pccpuf'! cp 9pccpuf /386! 9fat:! cp 9pccpuf /n/9fat/ The argument to mk specifies which configuration file to use. Thedefault for the pc kernels is ``pc''. It is usually best to play in a copy of the config files rather thanedit them directly. Then you can mk with ! mk 'CONF=pcmyusername' But even if you overwrite the existing files, remember that you canalways refer to the originals stored in /n/dump (see yesterday(1).) COMPILING WITHOUT WRITE PERMISSIONS FOR /SYS Personally, I prefer not to pollute my default install files. Icreate a set of empty directories that mirror /sys/src with srcbind: ! 	#!/bin/rc ! 	if(! test -d $1)! 		exit 'base directory not found (test -d ' ^$1 ^' failed)' ! 	for (d in (sys sys/src sys/src/9) )! 		if(! test -d $1/$d ) ! 			mkdir $1/$d ! 	for(d in (boot port pc))! 		if(! test -d $1/sys/src/9/$d ) ! 			mkdir $1/sys/src/9/$d ! 	bind -b -c $1/sys/src/9/boot /sys/src/9/boot! 	bind -b -c $1/sys/src/9/port /sys/src/9/port! 	bind -b -c $1/sys/src/9/pc /sys/src/9/pc and then ! 	ramfs! 	srcbind /tmp! 	cp /sys/src/9/pc/pcf /tmp/sys/src/9/pc/pcf edit pcf ! 	cd /sys/src/9/pc! 	mk 'CONF=pcf' ! 	ls -l /tmp/sys/src/9/pc/9pcf --rwxrwxr-x M 111 maht maht 2446793 Mar 5 22:56 /tmp/sys/src/9/pc/9pcf It would be wise not to use ramfs if you want to keep your updatedcopy of pcf Copy to 9fat and /386 in the normal way. You only need it in /386 ifyou boot diskless terminals as they get their kernels from /386 In this way you can compile and use a new kernel without having to bein sys or have write permissions turned off. </textarea><p></td></table></form> <hr><table width=100%><tr><td valign=center align=left></td><td valign=center align=right><a href="../about.html">About the server</a>| <a href="http://plan9.bell-labs.com/plan9"><img src="http://plan9.bell-labs.com/plan9/img/power36.gif"alt="Powered by Plan 9"></a></td></tr></table></html></body>