conf 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  1. .TH CONF 9
  2. .SH NAME
  3. conf \- native and hosted kernel configuration file
  4. .SH DESCRIPTION
  5. Plan 9 kernels are built for a given target
  6. .I platform
  7. using platform-specific code in directory
  8. .BI /sys/src/9/ platform
  9. and portable code in
  10. .BR /sys/src/9/port ,
  11. .B /sys/src/9/ip
  12. and elsewhere.
  13. Existing
  14. .I platforms
  15. include
  16. .B alphapc
  17. for the DEC Alpha,
  18. .B iPAQ
  19. for the Compaq iPAQ,
  20. .B pc
  21. for the Intel x86,
  22. and
  23. .B ppc
  24. for the IBM/Motorola PowerPC.
  25. Each
  26. .I platform
  27. can have several different kernels with different configurations.
  28. A given configuration is built in the platform's directory using the
  29. .IR mk (1)
  30. command:
  31. .IP
  32. .EX
  33. mk 'CONF=\fIconf\fP'
  34. .EE
  35. .PP
  36. where
  37. .I conf
  38. is a text file that specifies drivers, protocols and other parameters for that
  39. particular kernel:
  40. a parts list.
  41. The result of a successful
  42. .I mk
  43. is
  44. an executable or bootable file with a name determined by the
  45. .IR platform 's
  46. .BR mkfile ,
  47. typically
  48. .BI 9 conf.
  49. .PP
  50. A kernel configuration file has several sections of the form
  51. .IP
  52. .EX
  53. .I "label"
  54. .IR " item" " [ " "subitem ..." " ]"
  55. \& ...
  56. .EE
  57. .PP
  58. Each section begins with a
  59. .I label
  60. at the start of a line, which names a configuration
  61. category, followed by
  62. a list of each
  63. .I item
  64. to select from that category,
  65. one line per item, with white space (ie, blank or tab) at the start of the line.
  66. An
  67. .I item
  68. line can optionally list one or more
  69. .I subitems
  70. that must be included in the kernel to support it.
  71. A line that starts with a
  72. .L #
  73. is a comment.
  74. Empty lines are ignored.
  75. .PP
  76. .I Labels
  77. are chosen from the following set, listed in the order
  78. in which they conventionally appear in a configuration file:
  79. .TF etherxx
  80. .TP
  81. .B dev
  82. Device drivers
  83. .TP
  84. .B ip
  85. IP protocols (native kernels only) taken from
  86. .B ../ip
  87. .TP
  88. .B link
  89. Hardware-specific parts of device drivers.
  90. .TP
  91. .B misc
  92. Architecture-specific files; specific VGA and SCSI interfaces
  93. .TP
  94. .B lib
  95. Libraries to link with the kernel
  96. .TP
  97. .B port
  98. C code and declarations to include as-is in the generated configuration file
  99. .TP
  100. .B boot
  101. Configuration for
  102. .IR boot (8)
  103. .TP
  104. .B bootdir
  105. List of files and directories to put in the
  106. .B boot
  107. directory of
  108. .IR root (3).
  109. .PD
  110. .PP
  111. When an
  112. .I item
  113. is listed
  114. under a given
  115. .I label
  116. it causes a corresponding component to be included in the kernel.
  117. The details depend on the
  118. .IR label ,
  119. as discussed below.
  120. Each
  121. .I subitem
  122. represents a kernel subcomponent required by the corresponding
  123. .IR item .
  124. Both items and subitems can be either portable (platform-independent)
  125. or platform-specific.
  126. The source file for a given item or subitem
  127. is sought in the platform-directory
  128. (for platform-specific code), and
  129. in directories
  130. .BR ../port
  131. and
  132. .BR ../ip ,
  133. under control of the platform's
  134. .BR mkfile
  135. and
  136. .B ../port/portmkfile
  137. (which is included by
  138. .BR mkfile ).
  139. Resulting object files are left in the
  140. .I platform
  141. directory.
  142. .PP
  143. Outside the
  144. .B dev
  145. section,
  146. each item and subitem
  147. .I x
  148. causes the kernel image to include the code compiled from
  149. .IB x .c ,
  150. (or
  151. .IB x .s
  152. for assembly-language support),
  153. or
  154. .IB portdir / x .c ,
  155. where
  156. .I portdir
  157. is one of the portable directories mentioned above.
  158. In the
  159. .B dev
  160. section, an item
  161. .I x
  162. corresponds instead to the driver source file
  163. .BI dev x .c
  164. in the current (platform-specific)
  165. directory or a portable driver
  166. .IB portdir /dev x .c .
  167. Subitems are handled as in any other section.
  168. Typically they are auxiliary files that are needed by the associated driver.
  169. .PP
  170. For instance, in a native kernel
  171. the portable driver for the
  172. .B draw
  173. device uses platform-specific code from
  174. .BR screen.c .
  175. That can be represented as follows:
  176. .IP
  177. .EX
  178. dev
  179. draw screen
  180. .EE
  181. .PP
  182. Each item
  183. .I x
  184. in the
  185. .B ip
  186. section
  187. corresponds to a protocol implementation compiled from
  188. .BI ../ip/ x .c .
  189. Any subitems
  190. are dealt with in the same way as in the
  191. .B dev
  192. section.
  193. .PP
  194. The
  195. .B link
  196. section provides a way for hardware-specific
  197. parts of drivers to link at runtime to the hardware-invariant part of a device
  198. drivers.
  199. For each item
  200. .IR x ,
  201. the kernel will call the function
  202. .IB x link
  203. during its initialisation.
  204. Typically that function makes itself known to the device driver by
  205. calling a function provided by that driver,
  206. passing the address of a interface-specific data structure or linkage table.
  207. For example,
  208. .B ethersmc
  209. is an interface-specific component:
  210. .IP
  211. .EX
  212. link
  213. \fR...\fP
  214. ethersmc
  215. .EE
  216. .PP
  217. and its source file
  218. .B ethersmc.c
  219. provides a function
  220. .B ethersmclink
  221. that
  222. calls
  223. .B addethercard
  224. in the interface-invariant part of the driver,
  225. .BR devether.c :
  226. .IP
  227. .EX
  228. void
  229. ethersmclink(void)
  230. {
  231. addethercard("smc91cXX", reset);
  232. }
  233. .EE
  234. .PP
  235. The
  236. .B boot
  237. section configures
  238. .IR boot (8),
  239. the first user program run by the kernel.
  240. Each line in the section names a possible boot method (see
  241. .IR boot (8)
  242. for the current list).
  243. The first will be the default.
  244. Also by default,
  245. .B /boot
  246. will run
  247. .B /bin/termrc
  248. from
  249. .IR cpurc (8),
  250. with
  251. .B bootdisk
  252. set to
  253. .BR #S/sdC0/ .
  254. To change the defaults, the line (or lines) containing a
  255. .B boot
  256. label can be given some options:
  257. .RS
  258. .TP
  259. .B "boot cpu"
  260. .br
  261. The kernel is a cpu server: run
  262. .B /bin/cpurc
  263. not
  264. .B /bin/termrc
  265. (see
  266. .IR cpurc (8)).
  267. .TP
  268. .BI "boot cpu boot " disk
  269. Use
  270. .I disk
  271. as the default
  272. .BR bootdisk .
  273. .RE
  274. .PP
  275. The
  276. .B lib
  277. section lists the libraries to include when linking the kernel,
  278. in an order that satisfies any dependencies amongst them.
  279. Each item
  280. .I x
  281. corresponds to
  282. .BI /$objtype/lib x .a ,
  283. a target-specific library
  284. produced by compiling the C source code in
  285. .BI /sys/src/lib item,
  286. where
  287. .B objtype
  288. is set in the platform's
  289. .B mkfile
  290. to the target system's object type
  291. (eg,
  292. .BR 386 ,
  293. .BR power ,
  294. etc).
  295. .PP
  296. An item in the
  297. .B bootdir
  298. section
  299. has one of the forms:
  300. .IP
  301. .EX
  302. .I name
  303. .I "source name"
  304. .EE
  305. .PP
  306. where
  307. .I name
  308. and
  309. .I source
  310. are path names (often absolute path names).
  311. The kernel's initial root file system (see
  312. .IR root (3))
  313. will contain a file or directory with the given
  314. .IR name .
  315. The contents will come from the file
  316. .I name
  317. (which must exist) unless an explicit
  318. .I source
  319. file is given.
  320. .PP
  321. The
  322. .B port
  323. section usually contains initialisations for kernel-specific values.
  324. The most common one is
  325. .IP
  326. .EX
  327. int cpuserver = \fIn\fP;
  328. .EE
  329. .PP
  330. where
  331. .I n
  332. is non-zero for cpu servers and file servers, and zero otherwise.
  333. .SH FILES
  334. .B /sys/src/9/port/mkdevc
  335. .br
  336. .B /sys/src/9/port/mkdevlist
  337. .br
  338. .B /sys/src/9/port/mkroot
  339. .SH SEE ALSO
  340. .IR mk (1)