Initial import from FreeBSD RELENG_4:
[dragonfly.git] / release / picobsd / doc / src / intrinsics.html
1 <html>
2 <! $FreeBSD: src/release/picobsd/doc/src/intrinsics.html,v 1.3 1999/08/28 01:33:25 peter Exp $ >
3 <head>
4 <title><center>Details of building process</center></title>
5 </head>
6 <body>
7 <h1><center>            Details of building process.</center></h1>
8
9 <p>For those of you who really want to know what's going on behind the scene,
10 and can't quite deduce it from scripts themselves, here's short description of
11 the build process:</p>
12
13 <ul>
14 <li>    The './build' script sets the basic parameters of the floppy, such as:
15 <ul>
16 <li>    LANGUAGE: language of the various system messages, and C locale.
17         Available choices are: "en" (English) and "pl" (Polish).
18 </li>
19 <li>
20         SIZE: size of the memory filesystem (MFS), which will contain all the
21         binaries (except the kernel). Make it big enough for all the pieces to
22         fit, but keep it as small as possible (remember that running system
23         needs some space in /var and /tmp!). Presently, "dial" type of floppy
24         requires at least SIZE=1700, and others require ca. 2800 (numbers
25         are in kB).
26 </li>
27 <li>
28         TYPE: determines which set of programs and which trees will be
29         installed on the floppies. This simply acts as a selector to dive into
30         respective subdirectories in ../. Presently, the TYPE can be one of:
31         "dial" (dialup floppy), "net" (networking floppy), "router" (router
32         floppy) or "isp" (work in progress - not really usable yet).
33 </li>
34 </ul>
35 <li>
36         Then the './build' scripts checks if there is a kernel built on basis
37         of previously set parameters. The check is error prone, but is simple:
38         the target config file is called PICOBSD-${TYPE}.${SIZE}, and if there
39         exists a file called /sys/compile/PICOBSD-${TYPE}.${SIZE}/kernel, then
40         it is assumed it's the right one.
41
42 <p>     If there is no such file, the script starts compilation of the kernel,
43         using template in ../${YTPE}/conf/PICOBSD, and adding parameters which
44         determine the built-in MFS size.</p>
45 <li>
46         Then the './build' script starts the consecutive stages of the build
47         process, which are performed by scripts (in the following order):
48         stage1, populate, stage2, stage3.
49 </li>
50 <li>
51         'stage1' prepares the file called fs.PICOBSD with given size - it's a
52         placeholder for the future MFS. Next, it turns it into device (using
53         vnconfig), and then performs some tricks :-) which allow for
54         doing 'disklabel'. I use the 'auto' option to disklabel(8), which
55         behaves strangely in 2.2.x - what it's supposed to do is to
56         automagically determine the disk parameters from the  underlying
57         device (in this case, /dev/rvn0). This works ok in 3.0-current, and
58         allows for using arbitrary (>1024kB) MFS sizes.
59
60 <p>     One notable exception here is with the "router" floppy - I use one
61         of extended floppy formats (820kB).</p>
62
63 <p>     After the file is labelled, the newfs(8) is run. Here you can adjust
64         the parameter -i, which can gain you some space on the MFS (sacrificing
65         available number of inodes, so be careful).</p>
66
67 <p>     Such prepared blank filesystem is mounted on /mnt. Here the stage1
68         ends.</p>
69 </li>
70 <li>
71         'populate', as its name suggests, transfers all the pieces which will
72         reside in MFS, to the filesystem mounted on /mnt. This includes:
73 <ul>
74 <li>    copying language dependent files from ../${TYPE}/lang/</li>
75 <li>    making the MFS hierarchy according to informations in 
76         ../${TYPE}/mfs.tree/ subdir.
77 <p>      The MFS tree includes the /etc, which will contain the startup file
78         /etc/rc.
79         This file in turn doesn't do anything useful except copying the
80         real /etc hierarchy from the floppy filesystem. (There's one possible
81         improvement which comes to my mind - to have the whole /etc on the
82         floppy in tar.gz - this would require only one inode to store the whole
83         /etc, and we could gain some kB on the floppy)</p>
84 </li>
85 <li>    making and installing the set of crunched programs, basing on the
86         description in ../${TYPE}/crunch1/crunch.conf. This involves
87         making the 'crunch', copying it to /mnt and making hard links to
88         the names of all the programs contained therein.</li>
89 <li>    preparing a short list of kernel symbols, which will be used by
90         various utilities at runtime. In case of "net" and "isp" floppy, it also
91         prepares the kvm_kernel.db database, which will be used by such
92         programs as ps, netstat and others</li>
93 <li>    preparing the list of "virgin" configuration of devices in kernel -
94         this list will be used by kget(8) program to save the changes to
95         /kernel.config file.</li>
96 </ul>
97 </li>
98 <li>
99         'stage2' prepares the target kernel. It takes the filesystem contained
100         in fs.PICOBSD (which has all the above pieces inside), and writes it
101         into the target kernel. Then it kzip(8)'s such construed kernel. This
102         process also strips the symbols from the kernel (that's why we prepared
103         the symbol list earlier).
104 </li>
105 <li>
106         'stage3' does almost the same as 'stage1', but this time it prepares
107         the filesystem of the target floppy. Default size for the floppy is
108         set at 1440kB.
109 <p>     After preparing the filesystem (which again involves doing disklabel(8)
110         and newfs(8) - here you can notice that the resulting FS has very small
111         number of inodes in order to save space), the script transfers the
112          floppy hierarchy (which is
113         taken from ../${TYPE}/floppy.tree). Notice that it also contains
114         the /etc directory - its contents is copied right after bootup to the
115         real /etc in MFS. This allows for changing the system behaviour
116          (because you can't change the MFS contents without recompiling).</p>
117 <p>     The script finally copies previously prepared kernel to the floppy
118         filesystem. The filesystem is unmounted, and here the build process
119         ends.</p>
120 </li>
121 </ul>
122
123 <h6>
124 Last modified:
125 @DATE@
126 </h6>