rev |
line source |
paul@197
|
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
paul@197
|
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
paul@197
|
3 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
paul@197
|
4 <head>
|
paul@197
|
5 <title>SliTaz Scratchbook - Base System</title>
|
paul@197
|
6 <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
|
paul@197
|
7 <meta name="description" content="" />
|
paul@197
|
8 <meta name="expires" content="never" />
|
paul@197
|
9 <meta name="modified" content="2008-11-22 17:00:00" />
|
paul@197
|
10 <meta name="publisher" content="www.slitaz.org" />
|
paul@197
|
11 <meta name="author" content="Christophe Lincoln"/>
|
paul@197
|
12 <link rel="shortcut icon" href="favicon.ico" />
|
paul@197
|
13 <link rel="stylesheet" type="text/css" href="book.css" />
|
paul@197
|
14 </head>
|
paul@197
|
15 <body bgcolor="#ffffff">
|
paul@197
|
16
|
paul@197
|
17 <!-- Header and quick navigation -->
|
paul@197
|
18 <div id="header">
|
paul@197
|
19 <div align="right" id="quicknav">
|
paul@197
|
20 <a name="top"></a>
|
paul@226
|
21 <a href="index.html">Table of contents</a> |
|
paul@226
|
22 <a href="base-apps.html">Base apps</a>
|
paul@197
|
23 </div>
|
paul@197
|
24 <h1><font color="#3E1220">SliTaz Scratchbook</font></h1>
|
paul@197
|
25 </div>
|
paul@197
|
26
|
paul@197
|
27 <!-- Content. -->
|
paul@197
|
28 <div id="content">
|
paul@197
|
29 <div class="content-right"></div>
|
paul@197
|
30
|
paul@197
|
31
|
paul@197
|
32 <h2><font color="#df8f06">Base System</font></h2>
|
paul@197
|
33 <p>
|
paul@197
|
34 Build a SliTaz GNU/Linux distro running in RAM and using BusyBox.
|
paul@197
|
35 </p>
|
paul@197
|
36 <ul>
|
pascal@550
|
37 <li><a href="base-system.html#about">About.</a></li>
|
pascal@550
|
38 <li><a href="base-system.html#src">Wget src.</a></li>
|
pascal@550
|
39 <li><a href="base-system.html#prepa">Unpack and prepare the Linux kernel.</a></li>
|
pascal@550
|
40 <li><a href="base-system.html#rootfs">Creation of the Root System</a>, the root
|
paul@197
|
41 file System (rootfs).</li>
|
pascal@550
|
42 <li><a href="base-system.html#config">Configure the box.</a></li>
|
pascal@550
|
43 <li><a href="base-system.html#initramfs">Generate the initramfs</a>, compressed cpio archive.</li>
|
pascal@550
|
44 <li><a href="base-system.html#rootcd">Construction of the root of the cdrom</a> (rootcd), and the
|
paul@197
|
45 configuration files of Syslinux.</li>
|
pascal@550
|
46 <li><a href="base-system.html#mkiso">Create an ISO image with genisoimage or mkisofs.</a></li>
|
pascal@550
|
47 <li><a href="base-system.html#testiso">Burn or test the ISO with Qemu.</a></li>
|
paul@197
|
48 </ul>
|
paul@197
|
49 <a name="about"></a>
|
paul@197
|
50 <h3><font color="#6c0023">About</font></h3>
|
paul@197
|
51 <p>
|
paul@197
|
52 This document describes the construction of the SliTaz base system and why we use a
|
paul@197
|
53 Linux Kernel, BusyBox and Syslinux to boot the system. SliTaz uses an initramfs
|
paul@197
|
54 archive unpacked in RAM by the kernel at boot. We will create a box to hold a
|
paul@197
|
55 root of 3 to 4MB and use strip on the libraries and binaries to save space.
|
paul@197
|
56 </p>
|
paul@197
|
57 <p>
|
paul@197
|
58 The scripts and configuration files are created with GNU nano, using the keystroke
|
paul@197
|
59 <ctrl+x> to save and exit. But of course you are free to replace with your own text editor.
|
paul@197
|
60 </p>
|
paul@197
|
61 <p>
|
paul@197
|
62 This document is based on a howto found in the archive of BusyBox, which is itself based on
|
paul@197
|
63 a paper presented by Erik Anderson in the Embedded Systems Conference in 2001.
|
paul@197
|
64 </p>
|
paul@197
|
65 <a name="src"></a>
|
paul@197
|
66 <h3><font color="#6c0023">Wget src</font></h3>
|
paul@197
|
67 <p>
|
paul@197
|
68 Create a src directory for downloading and compiling:
|
paul@197
|
69 </p>
|
paul@197
|
70 <pre> # mkdir -p src
|
paul@197
|
71 # cd src
|
paul@197
|
72 </pre>
|
paul@197
|
73 <ul>
|
paul@197
|
74 <li>Linux Kernel 2.6.20
|
paul@197
|
75 (<a href="http://www.kernel.org/">http://www.kernel.org/</a>).
|
paul@197
|
76 <pre># wget ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.20.tar.bz2</pre>
|
paul@197
|
77 </li>
|
paul@197
|
78 <li>Busybox 1.2.2
|
paul@197
|
79 (<a href="http://www.busybox.net/">http://www.busybox.net/</a>).
|
paul@197
|
80 <pre># wget http://www.busybox.net/downloads/busybox-1.2.2.tar.bz2</pre>
|
paul@197
|
81 </li>
|
paul@197
|
82 <li>Syslinux 3.35
|
paul@197
|
83 (<a href="http://syslinux.zytor.com/">http://syslinux.zytor.com/</a>).
|
paul@197
|
84 <pre># wget ftp://ftp.kernel.org/pub/linux/boot/syslinux/syslinux-3.35.tar.gz</pre>
|
paul@197
|
85 </li>
|
paul@197
|
86 <li>SliTaz tools 1.1. Download SliTaz tools, unpack, save the file in src/ and that's it:
|
paul@197
|
87 <pre> # wget http://download.tuxfamily.org/slitaz/sources/tools/slitaz-tools-1.1.tar.gz
|
paul@197
|
88 # tar xzf slitaz-tools-1.1.tar.gz</pre>
|
paul@197
|
89 </li>
|
paul@197
|
90 </ul>
|
paul@197
|
91 <a name="prepa"></a>
|
paul@197
|
92 <h3><font color="#6c0023">Unpack and prepare the Linux Kernel</font></h3>
|
paul@197
|
93 <p>
|
paul@197
|
94 We will begin by compiling a Linux kernel, which may take a little time.
|
paul@197
|
95 </p>
|
paul@197
|
96 <h4>Linux Kernel</h4>
|
paul@197
|
97 <p>
|
paul@197
|
98 Your kernel must support the intramfs filesystem, otherwise the cdrom will not start. You can
|
paul@197
|
99 also install the modules in a directory so as not to touch the host system. The configuration
|
paul@197
|
100 of the Linux kernel sources is done by <code>make menuconfig</code> using ncurses or graphically
|
paul@197
|
101 with <code>make gconfig</code> or <code>make xconfig</code> using GTK development packages and/or
|
pascal@844
|
102 QT respectively. You can find in <a href="http://doc.slitaz.org/en:cookbook:slitaztools">SliTaz tools</a>,
|
paul@197
|
103 Makefiles for the various 2.6.xx kernels.
|
paul@197
|
104 </p>
|
paul@197
|
105 <p>
|
paul@197
|
106 A feature of the 2.6 kernels is that if we make menuconfig, xconfig or config for the first time,
|
paul@197
|
107 the setup menu is displayed based on the configuration of our current kernel.
|
paul@197
|
108 </p>
|
paul@197
|
109 <p>
|
paul@197
|
110 The options depend on your needs, you can install module-init-tools to support compressed modules
|
paul@197
|
111 or for a minimal install, you can select only the vital options.
|
paul@197
|
112 </p>
|
paul@197
|
113 <p>
|
paul@197
|
114 We start by changing into the sources, <code>make mrproper</code> to put things in order, then we start a
|
paul@197
|
115 configuration interface: gconfig, xconfig, menuconfig or oldconfig:
|
paul@197
|
116 </p>
|
paul@197
|
117 <pre> # tar xjf linux-2.6.20.tar.bz2
|
paul@197
|
118 # cd linux-2.6.20
|
paul@197
|
119 # make mrproper
|
paul@197
|
120 # cp ../slitaz-tools-1.1/Makefiles/linux-2.6.20-slitaz.config .config
|
paul@197
|
121 # make oldconfig
|
paul@197
|
122 (# make menuconfig)
|
paul@197
|
123 # make bzImage
|
paul@197
|
124 # make modules
|
paul@197
|
125 # make INSTALL_MOD_PATH=$PWD/_pkg modules_install
|
paul@197
|
126 # cd ..
|
paul@197
|
127 </pre>
|
paul@197
|
128 <p>
|
paul@197
|
129 If you want more info on compiling kernels, there are many textbooks. Note that you can install the
|
paul@197
|
130 kernel and after rebooting, you can compile your own kernel following the same instructions.
|
paul@197
|
131 </p>
|
paul@197
|
132 <a name="rootfs"></a>
|
paul@197
|
133 <h3><font color="#6c0023">Creation of the root system (rootfs)</font></h3>
|
paul@197
|
134 <p>
|
paul@197
|
135 The next step will create a file named 'rootfs' - Root File System, in the working directory SliTaz/:
|
paul@197
|
136 </p>
|
paul@197
|
137 <pre> # mkdir ../rootfs
|
paul@197
|
138 </pre>
|
paul@197
|
139 <h4>Install BusyBox</h4>
|
paul@197
|
140 <p>
|
paul@197
|
141 BusyBox (<a href="http://www.busybox.net/">www.busybox.net</a>) is a single executable offering
|
paul@197
|
142 versions of the main tools necessary to use a Linux kernel. It is (mainly) intended to be used
|
paul@197
|
143 embedded and can do almost anything. As well as proposing (coreutils) shell commands and a daemons
|
paul@197
|
144 system, it also provides a websever and client/server (DHCP, udhcpc).
|
paul@197
|
145 </p>
|
paul@197
|
146 <pre> # tar xjf busybox-1.2.2.tar.bz2
|
paul@197
|
147 </pre>
|
paul@197
|
148 <p>
|
paul@197
|
149 Configure and compile, remembering the dumpkmap options, init, etc - you can find help in the Makefile in
|
paul@197
|
150 SliTaz Busybox tools. Make install creates a _install directory in the current directory:
|
paul@197
|
151 </p>
|
paul@197
|
152 <pre> # cd busybox-1.2.2
|
paul@197
|
153 # cp ../slitaz-tools-1.1/Makefiles/busybox-1.2.2.config .config
|
paul@197
|
154 # make oldconfig
|
paul@197
|
155 (# make menuconfig)
|
paul@197
|
156 # make
|
paul@197
|
157 # make install
|
paul@197
|
158 # chmod 4755 _install/bin/busybox
|
paul@197
|
159 </pre>
|
paul@197
|
160 <p>
|
paul@197
|
161 Copy files compiled by BusyBox in the directory _install to the root file system (rootfs):
|
paul@197
|
162 </p>
|
paul@197
|
163 <pre> # cp -a _install/* ../../rootfs
|
paul@197
|
164 </pre>
|
paul@197
|
165 <p>
|
paul@197
|
166 The linuxrc link pointing to /bin/busybox, folders /bin, /lib and /sbin were added to the directory
|
paul@197
|
167 /rootfs - you can check this. It may be that the link isn't there if you didn't select the option
|
paul@197
|
168 initrd support in Busybox. We'll delete the linuxrc link and create a link for init that points to
|
paul@197
|
169 /bin/busybox:
|
paul@197
|
170 </p>
|
paul@197
|
171 <pre> # cd ../../rootfs
|
paul@197
|
172 # ls -CF
|
paul@197
|
173 bin/ linuxrc@ sbin/ usr/
|
paul@197
|
174
|
paul@197
|
175 # rm linuxrc
|
paul@197
|
176 # ln -s bin/busybox init
|
paul@197
|
177 </pre>
|
paul@197
|
178 <h4>ldd on BusyBox</h4>
|
paul@197
|
179 <p>
|
paul@197
|
180 The ldd command can show any libraries used by a program. Libraries used by Busybox may differ
|
paul@197
|
181 depending on the host system. On Debian for example, copying the libraries in /lib/tls. The following
|
paul@197
|
182 commands are given using 'v' for verbose mode. To eliminate the symbols of executable binaries
|
paul@197
|
183 and shared libraries we can utilize strip. Note you may also use the mklibs or uClibc libraries.
|
paul@197
|
184 </p>
|
paul@197
|
185 <pre> # mkdir lib
|
paul@197
|
186 </pre>
|
paul@197
|
187 <p>
|
paul@197
|
188 SliTaz or another:
|
paul@197
|
189 </p>
|
paul@197
|
190 <pre> # cp /lib/{libcrypt.so.1,libm.so.6,libc.so.6} lib
|
paul@197
|
191 # cp /lib/ld-linux.so.2 lib
|
paul@197
|
192 </pre>
|
paul@197
|
193 <p>
|
paul@197
|
194 Example on Debian Etch:
|
paul@197
|
195 </p>
|
paul@197
|
196 <pre> # cp /lib/tls/{libcrypt.so.1,libm.so.6,libc.so.6} lib
|
paul@197
|
197 # cp /lib/ld-linux.so.2 lib
|
paul@197
|
198 </pre>
|
paul@197
|
199 <p>
|
paul@197
|
200 Cleanup libraries with strip:
|
paul@197
|
201 </p>
|
paul@197
|
202 <pre> # strip -v lib/*
|
paul@197
|
203 </pre>
|
paul@197
|
204 <h4>Linux tree and configuration</h4>
|
paul@197
|
205 <p>
|
paul@197
|
206 Make some directories for a classic Linux branch SliTaz installation. /dev for devices, /etc, /home,
|
paul@197
|
207 /usr, /proc, /root and co. To learn more about the hierarchy of a file system and its contents,
|
paul@197
|
208 there is a File System Hierarchy Standard available in various formats at
|
paul@197
|
209 <a href="http://www.pathname.com/fhs/">www.pathname.com/fhs/</a>.
|
paul@197
|
210 </p>
|
paul@197
|
211 <p>
|
paul@197
|
212 You are free to create your own directory tree. In traditional Unix systems, /usr usually contains
|
paul@222
|
213 files from the distribution, /dev contains devices (devices), /etc contains configuration files,
|
paul@197
|
214 /lib libraries, /home for home users and /var for variable data. Note that we do not create
|
paul@197
|
215 /lib, /bin or /sbin - these are created when BusyBox is installed.
|
paul@197
|
216 </p>
|
paul@197
|
217 <pre> # mkdir -p dev etc root home proc media mnt sys tmp var
|
paul@197
|
218 # mkdir -p usr/{lib,local,games,share} \
|
paul@197
|
219 var/{cache,lib,lock,log,games,run,spool} \
|
paul@197
|
220 media/{cdrom,flash,usbdisk}
|
paul@197
|
221 </pre>
|
paul@197
|
222 <p>
|
paul@197
|
223 Change permissions on the /tmp directory:
|
paul@197
|
224 </p>
|
paul@197
|
225 <pre> # chmod 1777 tmp
|
paul@197
|
226 </pre>
|
paul@197
|
227 <p>
|
paul@197
|
228 Setting up glibc - note /etc/ld.so.conf and /etc/rpc are not essential for a micro system:
|
paul@197
|
229 </p>
|
paul@197
|
230 <pre> # touch etc/ld.so.conf
|
paul@197
|
231 # cp /etc/rpc etc
|
paul@197
|
232 </pre>
|
paul@197
|
233 <h4>Create the devices in /dev</h4>
|
paul@197
|
234 <p>
|
paul@197
|
235 This can be done with the script 'mkdevs.sh' found in BusyBox, or with our script 'mktazdevs.sh' in
|
paul@310
|
236 SliTaz tools. If you want more details, read the scripts. If you used the BusyBox version, we must
|
paul@197
|
237 still create the pts directory:
|
paul@197
|
238 </p>
|
paul@197
|
239 <pre> # cp ../src/slitaz-tools-1.1/utils/mktazdevs.sh bin
|
paul@197
|
240 # ./bin/mktazdevs.sh dev
|
paul@197
|
241 or:
|
paul@197
|
242 # cp ../src/busybox-1.2.2/examples/bootfloppy/mkdevs.sh bin
|
paul@197
|
243 # ./bin/mkdevs.sh dev
|
paul@197
|
244 # mkdir -p dev/{pts,input,shm,net,usb}
|
paul@197
|
245 </pre>
|
paul@197
|
246 <p>
|
paul@197
|
247 Note that we start mdev-s with the rcS script to create devices dynamically at boot.
|
paul@197
|
248 </p>
|
paul@197
|
249 <h4>Support for the resolution of hostnames (DNS)</h4>
|
paul@197
|
250 <p>
|
paul@197
|
251 Copy the libraries libnss_* of the host system into our SliTaz system. These libraries are used for
|
paul@197
|
252 name resolution and are cleaned with strip:
|
paul@197
|
253 </p>
|
paul@197
|
254 <pre> # cp /lib/{libnss_dns.so.2,libnss_files.so.2} lib
|
paul@197
|
255 # cp /lib/libresolv.so.2 lib
|
paul@197
|
256 # strip -v lib/*.so*
|
paul@197
|
257 </pre>
|
paul@197
|
258 <a name="config"></a>
|
paul@197
|
259 <h3><font color="#6c0023">Configuration of your box</font></h3>
|
paul@197
|
260 <p>
|
paul@197
|
261 Create the necessary files in /etc. For more info, just look at the contents of the files.
|
paul@197
|
262 We start by creating some files relevant to the core operating system.
|
paul@197
|
263 </p>
|
paul@197
|
264 <h4>Network</h4>
|
paul@197
|
265 <p>
|
paul@197
|
266 Create basic files used to configure the network:
|
paul@197
|
267 </p>
|
paul@197
|
268 <pre> # echo "127.0.0.1 localhost" > etc/hosts
|
paul@197
|
269 # echo "localnet 127.0.0.1" > etc/networks
|
paul@197
|
270 # echo "slitaz" > etc/hostname
|
paul@197
|
271 # echo "order hosts,bind" > etc/host.conf
|
paul@197
|
272 # echo "multi on" >> etc/host.conf
|
paul@197
|
273 </pre>
|
paul@197
|
274 <h4>/etc/nsswitch.conf</h4>
|
paul@197
|
275 <p>
|
paul@197
|
276 Configuration files used to resolve names:
|
paul@197
|
277 </p>
|
paul@197
|
278 <pre> # nano etc/nsswitch.conf
|
paul@197
|
279 </pre>
|
paul@197
|
280 <pre class="script"># /etc/nsswitch.conf: GNU Name Service Switch config.
|
paul@197
|
281 #
|
paul@197
|
282
|
paul@197
|
283 passwd: files
|
paul@197
|
284 group: files
|
paul@197
|
285 shadow: files
|
paul@197
|
286
|
paul@197
|
287 hosts: files dns
|
paul@197
|
288 networks: files
|
paul@197
|
289
|
paul@197
|
290 </pre>
|
paul@197
|
291 <h4>/etc/securetty</h4>
|
paul@197
|
292 <p>
|
paul@197
|
293 /etc/securetty lists terminals that can connect to root:
|
paul@197
|
294 </p>
|
paul@197
|
295 <pre> # nano etc/securetty
|
paul@197
|
296 </pre>
|
paul@197
|
297 <pre class="script"># /etc/securetty: List of terminals on which root is allowed to login.
|
paul@197
|
298 #
|
paul@197
|
299 console
|
paul@197
|
300
|
paul@197
|
301 # For people with serial port consoles
|
paul@197
|
302 ttyS0
|
paul@197
|
303
|
paul@197
|
304 # Standard consoles
|
paul@197
|
305 tty1
|
paul@197
|
306 tty2
|
paul@197
|
307 tty3
|
paul@197
|
308 tty4
|
paul@197
|
309 tty5
|
paul@197
|
310 tty6
|
paul@197
|
311 tty7
|
paul@197
|
312
|
paul@197
|
313 </pre>
|
paul@197
|
314 <h4>/etc/shells</h4>
|
paul@197
|
315 <p>
|
paul@197
|
316 /etc/shells, a shells list of valid connections. This file is used by the SSH server (Dropbear):
|
paul@197
|
317 </p>
|
paul@197
|
318 <pre> # nano etc/shells
|
paul@197
|
319 </pre>
|
paul@197
|
320 <pre class="script"># /etc/shells: valid login shells.
|
paul@197
|
321 /bin/sh
|
paul@197
|
322 /bin/ash
|
paul@197
|
323 /bin/hush
|
paul@197
|
324
|
paul@197
|
325 </pre>
|
paul@197
|
326 <h4>/etc/issue and /etc/motd</h4>
|
paul@197
|
327 <p>
|
paul@197
|
328 /etc/issue is displayed at the end of boot and the message of the day is displayed after logging in:
|
paul@197
|
329 </p>
|
paul@197
|
330 <pre> # echo "SliTaz GNU/Linux 1.0 Kernel \r \l" > etc/issue
|
paul@197
|
331 # echo "" >> etc/issue
|
paul@197
|
332 # nano etc/motd
|
paul@197
|
333 </pre>
|
paul@197
|
334 <pre class="script">
|
paul@197
|
335 (°- { Get documentation in: /usr/share/doc.
|
paul@197
|
336 //\ Use: 'less' or 'more' to read files, 'su' to be root. }
|
paul@197
|
337 v_/_
|
paul@197
|
338
|
paul@197
|
339 SliTaz is distributed in the hope that it will be useful, but
|
paul@197
|
340 with ABSOLUTELY NO WARRANTY.
|
paul@197
|
341
|
paul@197
|
342 </pre>
|
paul@197
|
343 <h4>/etc/busybox.conf</h4>
|
paul@197
|
344 <p>
|
paul@197
|
345 The configuration file for BusyBox, it can set duties on BusyBox applications. For more information, you can read the
|
pascal@845
|
346 <a href="http://doc.slitaz.org/en:handbook:security">security</a> page in the Handbook. BusyBox.conf file:
|
paul@197
|
347
|
paul@197
|
348 </p>
|
paul@197
|
349 <pre> # nano etc/busybox.conf
|
paul@197
|
350 </pre>
|
paul@197
|
351 <pre class="script"># /etc/busybox.conf: SliTaz GNU/linux Busybox configuration.
|
paul@197
|
352 #
|
paul@197
|
353
|
paul@197
|
354 [SUID]
|
paul@197
|
355 # Allow command to be run by anyone.
|
paul@197
|
356 su = ssx root.root
|
paul@197
|
357 passwd = ssx root.root
|
paul@197
|
358 loadkmap = ssx root.root
|
paul@197
|
359 mount = ssx root.root
|
paul@197
|
360 reboot = ssx root.root
|
paul@197
|
361 halt = ssx root.root
|
paul@197
|
362
|
paul@197
|
363 </pre>
|
paul@197
|
364 <p>
|
paul@197
|
365 For added security, change the permissions on the file:
|
paul@197
|
366 </p>
|
paul@197
|
367 <pre> # chmod 600 etc/busybox.conf
|
paul@197
|
368 </pre>
|
paul@197
|
369 <h4>/etc/inittab</h4>
|
paul@197
|
370 <p>
|
paul@197
|
371 Minimal configuration file for init. It helps to have a root console without having to
|
paul@197
|
372 go through the login and a console on tty2.
|
paul@197
|
373 </p>
|
paul@197
|
374 <pre> # nano etc/inittab
|
paul@197
|
375 </pre>
|
paul@197
|
376 <pre class="script"># /etc/inittab: init configuration for SliTaz GNU/Linux.
|
paul@197
|
377
|
paul@197
|
378 ::sysinit:/etc/init.d/rcS
|
paul@197
|
379 ::respawn:-/bin/sh
|
paul@197
|
380 tty2::askfirst:-/bin/sh
|
paul@197
|
381 ::ctrlaltdel:/bin/umount -a -r
|
paul@197
|
382 ::ctrlaltdel:/sbin/reboot
|
paul@197
|
383
|
paul@197
|
384 </pre>
|
paul@197
|
385 <p>
|
paul@197
|
386 You will also find a wider example of an inittab file in the archive of BusyBox.
|
paul@197
|
387 </p>
|
paul@197
|
388 <h4>/etc/profile</h4>
|
paul@197
|
389 <p>
|
paul@197
|
390 This file is read at each login and affects all users. We must use the ./profile
|
paul@197
|
391 config file for each individual user:
|
paul@197
|
392 </p>
|
paul@197
|
393 <pre> # nano etc/profile
|
paul@197
|
394 </pre>
|
paul@197
|
395 <pre class="script"># /etc/profile: system-wide .profile file for the Bourne shells
|
paul@197
|
396
|
paul@197
|
397 PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
|
paul@197
|
398 LD_LIBRARY_PATH="/usr/lib:/lib"
|
paul@197
|
399
|
paul@197
|
400 if [ "`id -u`" -eq 0 ]; then
|
paul@197
|
401 PS1='\e[1m\u@\h:\w\#\e[m '
|
paul@197
|
402 else
|
paul@197
|
403 PS1='\e[1m\u@\h:\w\$\e[m '
|
paul@197
|
404 fi
|
paul@197
|
405
|
paul@197
|
406 DISPLAY=:0.0
|
paul@197
|
407
|
paul@197
|
408 export PATH LD_LIBRARY_PATH PS1 DISPLAY ignoreeof
|
paul@197
|
409 umask 022
|
paul@197
|
410
|
paul@197
|
411 </pre>
|
paul@197
|
412 <h4>Users, groups and passwords</h4>
|
paul@197
|
413 <p>
|
paul@197
|
414 Create configuration files of users, groups and passwords in /etc/ {passwd, shadow, group, gshadow}, and adjust permissions:
|
paul@197
|
415 </p>
|
paul@197
|
416 <pre> # echo "root:x:0:0:root:/root:/bin/sh" > etc/passwd
|
paul@197
|
417 # echo "root::13525:0:99999:7:::" > etc/shadow
|
paul@197
|
418 # echo "root:x:0:" > etc/group
|
paul@197
|
419 # echo "root:*::" > etc/gshadow
|
paul@197
|
420 # chmod 640 etc/shadow
|
paul@197
|
421 # chmod 640 etc/gshadow
|
paul@197
|
422 </pre>
|
paul@197
|
423 <p>
|
paul@197
|
424 You can add other users, like hacker is used by the LiveCD mode. You can also configure a password for the root user
|
paul@197
|
425 with the <code>passwd</code> command. To add an existing user to an existing group, you must edit /etc/group and /etc/gshadow because
|
paul@197
|
426 the applet <code>adduser</code> provided by BusyBox doesn't offer all of the options provided by the original program.
|
paul@197
|
427 </p>
|
paul@197
|
428 <h4>/etc/fstab or /etc/mtab</h4>
|
paul@197
|
429 <p>
|
paul@197
|
430 List filesystems to be mounted:
|
paul@197
|
431 </p>
|
paul@197
|
432 <pre> # nano etc/fstab
|
paul@197
|
433 </pre>
|
paul@197
|
434 <pre class="script"># /etc/fstab: information about static file system.
|
paul@197
|
435 #
|
paul@197
|
436 proc /proc proc defaults 0 0
|
paul@197
|
437 sysfs /sys sysfs defaults 0 0
|
paul@197
|
438 devpts /dev/pts devpts defaults 0 0
|
paul@197
|
439 tmpfs /dev/shm tmpfs defaults 0 0
|
paul@197
|
440
|
paul@197
|
441 </pre>
|
paul@197
|
442 <p>
|
paul@197
|
443 /etc/mtab is used by other mkfs*, for listing the mounted partitions. It needs /proc because there is a link on /proc/mounts:
|
paul@197
|
444 </p>
|
paul@197
|
445 <pre> # chroot . /bin/ash
|
paul@197
|
446 /# ln -s /proc/mounts /etc/mtab
|
paul@197
|
447 </pre>
|
paul@197
|
448 <h4>Keyboard</h4>
|
paul@197
|
449 <p>
|
paul@197
|
450 You can create a kmap file specific to your keyboard with the dumpkmap command provided by BusyBox.
|
paul@197
|
451 You can find some kmap files in SliTaz tools. To create a fr_CH kmap file:
|
paul@197
|
452 </p>
|
paul@197
|
453 <pre> /# mkdir /usr/share/kmap
|
paul@197
|
454 /# /bin/busybox dumpkmap > /usr/share/kmap/fr_CH.kmap
|
paul@197
|
455 /# exit
|
paul@197
|
456 </pre>
|
paul@197
|
457 <p>
|
paul@197
|
458 Once this is done, you can automatically load your keyboard with loadkmap in a /etc/init.d/rcS script:
|
paul@197
|
459 </p>
|
paul@197
|
460 <h4>/usr/share/doc</h4>
|
paul@197
|
461 <p>
|
paul@197
|
462 You can also add various documents, such as a SliTaz user manual, which you can download as a tar.gz from the website:
|
paul@197
|
463 </p>
|
paul@197
|
464 <pre> # mkdir -p usr/share/doc
|
paul@197
|
465 </pre>
|
paul@197
|
466 <h4>Installing the udhcpc script</h4>
|
paul@197
|
467 <p>
|
paul@197
|
468 Udhcpc DHCP client supplied by Busybox is fast and stable, but is developed independently.
|
paul@197
|
469 Web site: <a href="http://udhcp.busybox.net/">http://udhcp.busybox.net/</a>. You can use the default
|
paul@197
|
470 script found in the archive of BusyBox. This script goes into /usr/share/udhcpc/default.script,
|
paul@197
|
471 but this can be changed via the command line. On SliTaz, the client is started at boot by the script
|
paul@197
|
472 /etc/init.d/network.sh via the configuration file /etc/network.conf:
|
paul@197
|
473 </p>
|
paul@197
|
474 <pre> # mkdir usr/share/udhcpc
|
paul@197
|
475 # cp ../src/busybox-1.2.2/examples/udhcp/simple.script \
|
paul@197
|
476 usr/share/udhcpc/default.script
|
paul@197
|
477 # chmod +x usr/share/udhcpc/default.script
|
paul@197
|
478 </pre>
|
paul@197
|
479 <h4>/etc/init.d/rcS</h4>
|
paul@197
|
480 <p>
|
paul@197
|
481 To finish off this draft, you must create the init script /etc/init.d/rcS to mount the filesystems
|
paul@197
|
482 and run some commands. For more information, you can look at the
|
pascal@844
|
483 <a href="http://doc.slitaz.org/en:cookbook:bootscripts">boot scripts</a> page.
|
paul@197
|
484 You can change the value of the variable KMAP= for the keyboard:
|
paul@197
|
485 </p>
|
paul@197
|
486 <pre> # mkdir etc/init.d
|
paul@197
|
487 # nano etc/init.d/rcS
|
paul@197
|
488 </pre>
|
paul@197
|
489 <pre class="script">#! /bin/sh
|
paul@197
|
490 # /etc/init.d/rcS: rcS initial script.
|
paul@197
|
491 #
|
paul@197
|
492
|
paul@197
|
493 KMAP=fr_CH
|
paul@197
|
494
|
paul@197
|
495 echo "Processing /etc/init.d/rcS... "
|
paul@197
|
496
|
paul@197
|
497 /bin/mount proc
|
paul@197
|
498 /bin/mount -a
|
paul@197
|
499 /bin/hostname -F /etc/hostname
|
paul@197
|
500 /sbin/ifconfig lo 127.0.0.1 up
|
paul@197
|
501 /sbin/loadkmap < /usr/share/kmap/$KMAP.kmap
|
paul@197
|
502
|
paul@197
|
503
|
paul@197
|
504 </pre>
|
paul@197
|
505 <pre> # chmod +x etc/init.d/rcS
|
paul@197
|
506 </pre>
|
paul@197
|
507 <h4>Note</h4>
|
paul@197
|
508 <p>
|
paul@285
|
509 Note that you can still install the Tazpkg package manager (10 kb) that we created,
|
paul@197
|
510 you will find information to install in the source tarball. You can also install various
|
paul@197
|
511 files from SliTaz tools, such as the licence.
|
paul@197
|
512 </p>
|
paul@197
|
513
|
paul@197
|
514 <a name="initramfs"></a>
|
paul@197
|
515 <h3><font color="#6c0023">Build an initramfs cpio archive</font></h3>
|
paul@197
|
516 <p>
|
paul@197
|
517 The initramfs is a <code>cpio</code> archive generated from the root of the system,
|
paul@197
|
518 it is decompressed in RAM by the Linux kernel at boot to create the filesystem (also in RAM).
|
paul@197
|
519 To generate an initramfs archive, using the root directory of system files (rootfs), we
|
paul@197
|
520 facilitate a search with <code>find</code> and add some pipes <code>|</code>.
|
paul@197
|
521 Then we create a cpio archive using <code>gzip</code> which we put in the working directory.
|
paul@197
|
522 </p>
|
paul@197
|
523 <p>
|
paul@197
|
524 The SliTaz initramfs <strong>rootfs.gz</strong> is the root system, but with a <code>.gz</code>
|
paul@197
|
525 extension. If you want to change the name, you need to edit the configuration file for
|
paul@197
|
526 isolinux: isolinux.cfg or the menu.lst for GRUB.
|
paul@197
|
527 </p>
|
paul@197
|
528 <p>
|
paul@197
|
529 Generation of the initramfs:
|
paul@197
|
530 </p>
|
paul@197
|
531 <pre> # find . -print | cpio -o -H newc | gzip -9 > ../rootfs.gz
|
paul@197
|
532 </pre>
|
paul@197
|
533 <p>
|
paul@285
|
534 You should now have a file rootfs.gz about 1 to 2MB in the working directory SliTaz/.
|
paul@197
|
535 </p>
|
paul@197
|
536 <p>
|
paul@197
|
537 For a new image, when making changes in rootfs, simply copy the new rootfs.gz archive to rootcd/boot
|
paul@197
|
538 and create a new image with <code>genisoimage</code> or <code>mkisofs</code>. For this you can also
|
paul@197
|
539 use <strong>mktaziso</strong> within SliTaz tools. This script will check if the directories are present,
|
paul@222
|
540 create a new compressed cpio archive and generate a new bootable ISO image.
|
paul@197
|
541 </p>
|
paul@197
|
542 <a name="rootcd"></a>
|
paul@197
|
543 <h3><font color="#6c0023">Make rootcd files</font></h3>
|
paul@197
|
544 <p>
|
paul@197
|
545 The following steps will help you create the root of the bootable CD-ROM. We begin by creating the rootcd,
|
paul@197
|
546 boot and isolinux directories for the cd-rom files:
|
paul@197
|
547 </p>
|
paul@197
|
548 <pre> # cd ..
|
paul@197
|
549 # mkdir -p rootcd/boot/isolinux
|
paul@197
|
550 </pre>
|
paul@197
|
551 <p>
|
paul@197
|
552 Optionally, you can create some other directories in which to place various data, such as HTML documents or packages.
|
paul@197
|
553 </p>
|
paul@197
|
554 <a name="linux"></a>
|
paul@197
|
555 <h4>Copy the kernel</h4>
|
paul@197
|
556 <p>
|
paul@197
|
557 Just copy the kernel previously compiled to rootcd/boot:
|
paul@197
|
558 </p>
|
paul@197
|
559 <pre> # cp src/linux-2.6.20/arch/i386/boot/bzImage rootcd/boot
|
paul@197
|
560 </pre>
|
paul@197
|
561 <h4>Copy the initramfs into rootcd/boot</h4>
|
paul@197
|
562 <p>
|
paul@197
|
563 Copy the rootfs.gz to rootcd/boot. We must not forget to generate a new initramfs archive for any changes
|
paul@197
|
564 made to the rootfs (root file system):
|
paul@197
|
565 </p>
|
paul@197
|
566 <pre> # cp rootfs.gz rootcd/boot
|
paul@197
|
567 </pre>
|
paul@197
|
568 <h4>Install the isolinux bootloader</h4>
|
paul@197
|
569 <p>
|
paul@197
|
570 The bootloader isolinux - simply copy the isolinux.bin from the source archive of Syslinux:
|
paul@197
|
571 </p>
|
paul@197
|
572 <pre> # cd src
|
paul@197
|
573 # tar xzf syslinux-3.35.tar.gz
|
paul@197
|
574 # cp syslinux-3.35/isolinux.bin ../rootcd/boot/isolinux
|
paul@197
|
575 # cd ..
|
paul@197
|
576 </pre>
|
paul@197
|
577 <h4>isolinux.cfg - Configure isolinux</h4>
|
paul@197
|
578 <p>
|
paul@197
|
579 Here is an example of an isolinux.cfg file that should work well. You can change it if you wish:
|
paul@197
|
580 </p>
|
paul@197
|
581 <pre> # nano rootcd/boot/isolinux/isolinux.cfg
|
paul@197
|
582 </pre>
|
paul@197
|
583 <pre class="script">display display.txt
|
paul@197
|
584 default slitaz
|
paul@197
|
585 label slitaz
|
paul@197
|
586 kernel /boot/bzImage
|
paul@197
|
587 append initrd=/boot/rootfs.gz rw root=/dev/null vga=788
|
paul@197
|
588 implicit 0
|
paul@197
|
589 prompt 1
|
paul@197
|
590 timeout 80
|
paul@197
|
591
|
paul@197
|
592 </pre>
|
paul@197
|
593 <p>
|
paul@197
|
594 Here are some changes that you might like to make in isolinux.cfg:
|
paul@197
|
595 </p>
|
paul@197
|
596 <ul>
|
paul@197
|
597 <li>The timeout value is the number of seconds to wait before booting
|
paul@197
|
598 You can make it 0 or delete the line to start instantly, or choose to wait as long as 10s.</li>
|
paul@197
|
599 <li>prompt can be set to 0 to disable the 'boot:' prompt.</li>
|
paul@197
|
600 <li>You can add more lines to view the contents of several text files when the user presses F1, F2, F3, etc.</li>
|
paul@197
|
601 </ul>
|
paul@197
|
602 <h4>display.txt</h4>
|
paul@197
|
603 <p>
|
paul@197
|
604 A small welcome note, powered by isolinux, you can modify this file if you wish:
|
paul@197
|
605 </p>
|
paul@197
|
606 <pre> # nano rootcd/boot/isolinux/display.txt
|
paul@197
|
607 </pre>
|
paul@197
|
608 <pre class="script">/* _\|/_
|
paul@197
|
609 (o o)
|
paul@197
|
610 +----oOO-{_}-OOo---------------------------------------------------+
|
paul@197
|
611 ____ _ _ _____
|
paul@197
|
612 / ___|| (_)_ _|_ _ ____
|
paul@197
|
613 \___ \| | | | |/ _` |_ /
|
paul@197
|
614 ___) | | | | | (_| |/ /
|
paul@197
|
615 |____/|_|_| |_|\__,_/___|
|
paul@197
|
616
|
paul@197
|
617 SliTaz GNU/Linux - Temporary Autonomous Zone
|
paul@197
|
618
|
paul@197
|
619 <ENTER> to boot.
|
paul@197
|
620
|
paul@197
|
621 */
|
paul@197
|
622 </pre>
|
paul@197
|
623 <a name="mkiso"></a>
|
paul@197
|
624 <h3><font color="#6c0023">Create an ISO image with genisoimage or mkisofs</font></h3>
|
paul@197
|
625 <pre> # genisoimage -R -o slitaz-cooking.iso -b boot/isolinux/isolinux.bin \
|
paul@197
|
626 -c boot/isolinux/boot.cat -no-emul-boot -boot-load-size 4 \
|
paul@197
|
627 -V "SliTaz" -input-charset iso8859-1 -boot-info-table rootcd
|
paul@197
|
628 </pre>
|
paul@197
|
629 <p>
|
paul@197
|
630 For each change in the root of the box, you must create a new ISO image.
|
paul@197
|
631 </p>
|
paul@197
|
632 <p>
|
paul@197
|
633 You can create a small script that will generate a new compressed cpio archive and a new image,
|
paul@197
|
634 or use mktaziso within SliTaz tools. Note that you can also use GRUB to boot the box.
|
paul@197
|
635 </p>
|
paul@197
|
636 <a name="testiso"></a>
|
paul@197
|
637 <h3><font color="#6c0023">Burn or test ISO image with Qemu</font></h3>
|
paul@197
|
638 <p>
|
paul@197
|
639 You can burn the ISO image with Graveman, k3b or wodim and boot it. Simple burning command using wodim (also valid for cdrecord), with a 2.6.XX. kernel:
|
paul@197
|
640 </p>
|
paul@197
|
641 <pre># wodim -v -speed=24 -data slitaz-cooking.iso
|
paul@197
|
642 </pre>
|
paul@197
|
643 <h4>Qemu</h4>
|
paul@197
|
644 <p>
|
paul@197
|
645 Note that you can test the ISO image with the software emulator Qemu (On Debian # aptitude install qemu).
|
paul@197
|
646 To emulate the newly created ISO image, simply type:
|
paul@197
|
647 </p>
|
paul@197
|
648 <pre># qemu -cdrom slitaz-cooking.iso
|
paul@197
|
649 </pre>
|
paul@226
|
650 <h4>Following chapter</h4>
|
paul@226
|
651 <p>
|
paul@226
|
652 The next chapter <a href="base-apps.html">Base applications</a> provides all the instructions to install
|
paul@226
|
653 and configure the basic applications and libraries.
|
paul@226
|
654 </p>
|
paul@197
|
655
|
paul@197
|
656 <!-- End of content -->
|
paul@197
|
657 </div>
|
paul@197
|
658
|
paul@197
|
659 <!-- Footer. -->
|
paul@197
|
660 <div id="footer">
|
paul@197
|
661 <div class="footer-right"></div>
|
pascal@550
|
662 <a href="base-system.html#top">Top of the page</a> |
|
paul@197
|
663 <a href="index.html">Table of contents</a>
|
paul@197
|
664 </div>
|
paul@197
|
665
|
paul@197
|
666 <div id="copy">
|
pascal@669
|
667 Copyright © <span class="year"></span> <a href="http://www.slitaz.org/en/">SliTaz</a> -
|
paul@197
|
668 <a href="http://www.gnu.org/licenses/gpl.html">GNU General Public License</a>;<br />
|
paul@197
|
669 Documentation is under
|
paul@197
|
670 <a href="http://www.gnu.org/copyleft/fdl.html">GNU Free Documentation License</a>
|
paul@197
|
671 and code is <a href="http://validator.w3.org/">valid xHTML 1.0</a>.
|
paul@197
|
672 </div>
|
paul@197
|
673
|
paul@197
|
674 </body>
|
paul@197
|
675 </html>
|