summaryrefslogtreecommitdiffstats
path: root/release/picobsd/doc/src/intrinsics.html
blob: c69d022a61263fa205fd52ac6610a5c5433448e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<html>
<! $FreeBSD$ >
<head>
<title><center>Details of building process</center></title>
</head>
<body>
<h1><center>		Details of building process.</center></h1>

<p>For those of you who really want to know what's going on behind the scene,
and can't quite deduce it from scripts themselves, here's short description of
the build process:</p>

<ul>
<li>	The './build' script sets the basic parameters of the floppy, such as:
<ul>
<li>	LANGUAGE: language of the various system messages, and C locale.
	Available choices are: "en" (English) and "pl" (Polish).
</li>
<li>
	SIZE: size of the memory filesystem (MFS), which will contain all the
	binaries (except the kernel). Make it big enough for all the pieces to
	fit, but keep it as small as possible (remember that running system
	needs some space in /var and /tmp!). Presently, "dial" type of floppy
	requires at least SIZE=1700, and others require ca. 2800 (numbers
	are in kB).
</li>
<li>
	TYPE: determines which set of programs and which trees will be
	installed on the floppies. This simply acts as a selector to dive into
	respective subdirectories in ../. Presently, the TYPE can be one of:
	"dial" (dialup floppy), "net" (networking floppy), "router" (router
	floppy) or "isp" (work in progress - not really usable yet).
</li>
</ul>
<li>
	Then the './build' scripts checks if there is a kernel built on basis
	of previously set parameters. The check is error prone, but is simple:
	the target config file is called PICOBSD-${TYPE}.${SIZE}, and if there
	exists a file called /sys/compile/PICOBSD-${TYPE}.${SIZE}/kernel, then
	it is assumed it's the right one.

<p>	If there is no such file, the script starts compilation of the kernel,
	using template in ../${YTPE}/conf/PICOBSD, and adding parameters which
	determine the built-in MFS size.</p>
<li>
	Then the './build' script starts the consecutive stages of the build
	process, which are performed by scripts (in the following order):
	stage1, populate, stage2, stage3.
</li>
<li>
	'stage1' prepares the file called fs.PICOBSD with given size - it's a
	placeholder for the future MFS. Next, it turns it into device (using
	vnconfig), and then performs some tricks :-) which allow for
	doing 'disklabel'. I use the 'auto' option to disklabel(8), which
	behaves strangely in 2.2.x - what it's supposed to do is to
	automagically determine the disk parameters from the  underlying
	device (in this case, /dev/rvn0). This works ok in 3.0-current, and
	allows for using arbitrary (>1024kB) MFS sizes.

<p>	One notable exception here is with the "router" floppy - I use one
	of extended floppy formats (820kB).</p>

<p>	After the file is labelled, the newfs(8) is run. Here you can adjust
	the parameter -i, which can gain you some space on the MFS (sacrificing
	available number of inodes, so be careful).</p>

<p>	Such prepared blank filesystem is mounted on /mnt. Here the stage1
	ends.</p>
</li>
<li>
	'populate', as its name suggests, transfers all the pieces which will
	reside in MFS, to the filesystem mounted on /mnt. This includes:
<ul>
<li>	copying language dependent files from ../${TYPE}/lang/</li>
<li>	making the MFS hierarchy according to informations in 
	../${TYPE}/mfs.tree/ subdir.
<p>	 The MFS tree includes the /etc, which will contain the startup file
	/etc/rc.
	This file in turn doesn't do anything useful except copying the
	real /etc hierarchy from the floppy filesystem. (There's one possible
	improvement which comes to my mind - to have the whole /etc on the
	floppy in tar.gz - this would require only one inode to store the whole
	/etc, and we could gain some kB on the floppy)</p>
</li>
<li>	making and installing the set of crunched programs, basing on the
	description in ../${TYPE}/crunch1/crunch.conf. This involves
	making the 'crunch', copying it to /mnt and making hard links to
	the names of all the programs contained therein.</li>
<li>	preparing a short list of kernel symbols, which will be used by
	various utilities at runtime. In case of "net" and "isp" floppy, it also
	prepares the kvm_kernel.db database, which will be used by such
	programs as ps, netstat and others</li>
<li>	preparing the list of "virgin" configuration of devices in kernel -
	this list will be used by kget(8) program to save the changes to
	/kernel.config file.</li>
</ul>
</li>
<li>
	'stage2' prepares the target kernel. It takes the filesystem contained
	in fs.PICOBSD (which has all the above pieces inside), and writes it
	into the target kernel. Then it kzip(8)'s such construed kernel. This
	process also strips the symbols from the kernel (that's why we prepared
	the symbol list earlier).
</li>
<li>
	'stage3' does almost the same as 'stage1', but this time it prepares
	the filesystem of the target floppy. Default size for the floppy is
	set at 1440kB.
<p>	After preparing the filesystem (which again involves doing disklabel(8)
	and newfs(8) - here you can notice that the resulting FS has very small
	number of inodes in order to save space), the script transfers the
	 floppy hierarchy (which is
	taken from ../${TYPE}/floppy.tree). Notice that it also contains
	the /etc directory - its contents is copied right after bootup to the
	real /etc in MFS. This allows for changing the system behaviour
	 (because you can't change the MFS contents without recompiling).</p>
<p>	The script finally copies previously prepared kernel to the floppy
	filesystem. The filesystem is unmounted, and here the build process
	ends.</p>
</li>
</ul>

<h6>
Last modified:
@DATE@
</h6>
OpenPOWER on IntegriCloud