<!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>bootdir (Diff)</title></head><body><h1><a name="top"></a>bootdir <i>-Diff-</i></h1> <div class='body'> <!-- ***************************** --> <hr /><div class='diff_head'><a href="index.html">Wed Dec 28 14:58:09 EST 2005</a>, ziphos (207.183.171.11)</div><hr />InMidDecember2002,anewfeaturewasaddedtothesystem.Itchangestheprevious#//boottobeadirectoryratherthanafile,andallowswhatusedtobeabinarythathadtobecompiledtobeascriptinstead.<p class='para'>RussCoxsaidsomethinglikethisin<a href="http://groups.google.com/groups?dq=&hl=en&lr=&ie=UTF-8&selm=606456fcdc17ce997666a1895d86f9ba%40plan9.bell-labs.com">http://groups.google.com/groups?dq=&hl=en&lr=&ie=UTF-8&selm=606456fcdc17ce997666a1895d86f9ba%40plan9.bell-labs.com</a></p> <p class='para'>Thereisanewkernelconfigfilesectioncalled"bootdir"thatliststhefilestobeplacedin#//boot.Therearenobinariesin#/itselfanymore.</p> <p class='para'>Atypicalbootdirsectionmightlooklike</p> <pre> bootdir bootpcdisk.out boot /386/bin/ip/ipconfig /386/bin/auth/factotum /386/bin/disk/kfs /386/bin/cfs</pre> <p class='para'>whichsaysthat/bootwillcontainfourfiles:boot,ipconfig,factotum,kfs,andcfs,copiedfromthelistedpaths.</p> <p class='para'>Thekernelshavealwaysspecialcasedboot$CONF.outtogetitlistedas/boot.Itisnow/boot/boot,andnolongeraspecialcase.</p> <p class='para'>Nowthateverythingisin/boot,initcodehadtochangeforallthekernels;/boot/bootitselfhadtochangetoexec/boot/ipconfig(insteadof/ipconfig),etc.Finally,auth_getkeychanged.Itlooksfor/factotumandthen/boot/factotum,todealwitheithertypeofkernel.</p> <p class='para'>Thebootfile/386/bin/ip/ipconfig(e.g.)turnsinto_386_bin_ip_ipconfig.root.sandthen_386_bin_ip_ipconfig.root.8.It'sabitofanuglyname,butmkcleanwillgetridofthem.Youcouldimaginejustusingthelastpathelement,butthatmightleadtoweirdbuildinconsistenciesifkernelswereusingtwodifferentfileswiththesamelastelement.Oneunfortunateconsequenceofthebignameisthat_386_bin_auth_factotum.root.sistoolongforthecurrentfileserverstodealwith.Youcoulduselnfstogetaroundthis,butIdidn'twanttorequire<a href="http://plan9.bell-labs.com/magic/man2html/4/lnfs"><i>lnfs</i>(4)</a>forthekernelbuild,sowehavearuleinportmkfilethatcopiesfactotumandipconfigtofactotum.hackandipconfig.hackandthenthebootdirsectionactuallylookslike:</p> <pre> bootdir bootpcdisk.out boot ipconfig.hack ipconfig factotum.hack factotum /386/bin/disk/kfs /386/bin/cfs</pre> <p class='para'>sadly.Thatwillgoawaywhenwegetlongfilenames.</p> <p class='para'>Thepcinitcodeisalsochanged.Whereasbeforeitusedtodo</p> <pre> exec("/boot", ["boot", 0]);</pre> <p class='para'>inhand-codedassembly(pc/initcode.s),itnowdoes</p> <pre> open("#c/cons", OREAD); open("#c/cons", OWRITE); open("#c/cons", OWRITE); bind("#c", "/dev", MAFTER); bind("#ec", "/env", MAFTER); bind("#e", "/env", MCREATE|MAFTER); bind("#s", "/srv", MREPL|MCREATE); execl("/boot/boot", "/boot/boot", 0);</pre> <p class='para'>inC(port/initcode.c).Thepointistosetupenoughofanamespacethat/boot/bootcanbeashellscript.Eventuallytheotherarchitecturesshouldchangetoo,thoughit'snoturgent.Ifsomeonewantstodothebitsy,sendmemailandI'llletyouknowwhatittooktogetoneoftheoldundistributedmipskernelschangedover.(Thecompilersetupissimilar.)</p> <p class='para'>Asamuchbiggerexample,Ibuiltakernelcalledpcexttheothernight.ItusesrxandtrampolinetoconnectthroughaPlan9gatewaymachinetotherootfileserver.Lines 1–500 of 676. 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>bootdir (Diff)</title> </head> <body> <h1><a name="top"></a> bootdir <i>-Diff-</i></h1> <div class='body'> <!-- ***************************** --> <hr /><div class='diff_head'> <a href="index.html">Wed Dec 28 14:58:09 EST 2005</a>, ziphos (207.183.171.11) </div><hr />In Mid December 2002, a new feature was added to the system. It changes the previous #//boot to be a directory rather than a file, and allows what used to be a binary that had to be compiled to be a script instead. <p class='para'> Russ Cox said something like this in <a href="http://groups.google.com/groups?dq=&hl=en&lr=&ie=UTF-8&selm=606456fcdc17ce997666a1895d86f9ba%40plan9.bell-labs.com">http://groups.google.com/groups?dq=&hl=en&lr=&ie=UTF-8&selm=606456fcdc17ce997666a1895d86f9ba%40plan9.bell-labs.com</a> </p> <p class='para'> There is a new kernel config file section called "bootdir" that lists the files to be placed in #//boot. There are no binaries in #/ itself anymore. </p> <p class='para'> A typical bootdir section might look like </p> <pre> bootdir bootpcdisk.out boot /386/bin/ip/ipconfig /386/bin/auth/factotum /386/bin/disk/kfs /386/bin/cfs </pre> <p class='para'> which says that /boot will contain four files: boot, ipconfig, factotum, kfs, and cfs, copied from the listed paths. </p> <p class='para'> The kernels have always special cased boot$CONF.out to get it listed as /boot. It is now /boot/boot, and no longer a special case. </p> <p class='para'> Now that everything is in /boot, initcode had to change for all the kernels; /boot/boot itself had to change to exec /boot/ipconfig (instead of /ipconfig), etc. Finally, auth_getkey changed. It looks for /factotum and then /boot/factotum, to deal with either type of kernel. </p> <p class='para'> The boot file /386/bin/ip/ipconfig (e.g.) turns into _386_bin_ip_ipconfig.root.s and then _386_bin_ip_ipconfig.root.8. It's a bit of an ugly name, but mk clean will get rid of them. You could imagine just using the last path element, but that might lead to weird build inconsistencies if kernels were using two different files with the same last element. One unfortunate consequence of the big name is that _386_bin_auth_factotum.root.s is too long for the current file servers to deal with. You could use lnfs to get around this, but I didn't want to require <a href="http://plan9.bell-labs.com/magic/man2html/4/lnfs"><i>lnfs</i>(4)</a> for the kernel build, so we have a rule in portmkfile that copies factotum and ipconfig to factotum.hack and ipconfig.hack and then the bootdir section actually looks like: </p> <pre> bootdir bootpcdisk.out boot ipconfig.hack ipconfig factotum.hack factotum /386/bin/disk/kfs /386/bin/cfs </pre> <p class='para'> sadly. That will go away when we get long file names. </p> <p class='para'> The pc initcode is also changed. Whereas before it used to do </p> <pre> exec("/boot", ["boot", 0]); </pre> <p class='para'> in hand-coded assembly (pc/initcode.s), it now does </p> <pre> open("#c/cons", OREAD); open("#c/cons", OWRITE); open("#c/cons", OWRITE); bind("#c", "/dev", MAFTER); bind("#ec", "/env", MAFTER); bind("#e", "/env", MCREATE|MAFTER); bind("#s", "/srv", MREPL|MCREATE); execl("/boot/boot", "/boot/boot", 0); </pre> <p class='para'> in C (port/initcode.c). The point is to set up enough of a namespace that /boot/boot can be a shell script. Eventually the other architectures should change too, though it's not urgent. If someone wants to do the bitsy, send me mail and I'll let you know what it took to get one of the old undistributed mips kernels changed over. (The compiler setup is similar.) </p> <p class='para'> As a much bigger example, I built a kernel called pcext the other night. It uses rx and trampoline to connect through a Plan 9 gateway machine to the root file server.