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