Remove lfs-uefi.txt symlink
[linux_from_scratch_hints.git] / PREVIOUS_FORMAT / lfs_appliance.txt
blob6d45b1fbb54374397348f76a7f8c9a070e9e5136
1 TITLE:          Linux Appliance
2 LFS VERSION:    Tested Against 4.0
3 AUTHOR:         Robert Petersen <robert_lfshint@orangefood.com> (LFS ID:2092)
5 SYNOPSIS:
6         Build a very small LFS based GNU/Linux system suitable for use as a 
7 "network appliance."
9 HINT:
11 HINT VERSION: 0.0.1 (20030329)
13 CHANGELOG:
14         0.0.1
15                 Initial Draft Version
18 ==================================
19 0. Table of Content
20 ==================================
22 1...................................Introduction
23 2.......................................Packages
24 3.........................LFS Chapter 5 Addendum
25 4.............................Post LFS Chapter 5
26 5.........................Configuring the system
27 6............................................FAQ
28 Appendix A............................References
29 Appendix B..........................LFS Packages
30 Appendix C...............................Patches
31 Appendix D..........................init Scripts
32 Appendix E......................Hardware Example
34 ==================================
35 1. Introduction
36 ==================================
37 The purpose of this hint is to create a "network appliance."  What this means
38 for each person is an object of some debate.  Webopedia says:
40      A typically inexpensive personal computer, sometimes called 
41      a thin client, that enables Internet access and some business-
42      related activities but lacks many features of a fully equipped 
43      PC, such as a hard drive or CD-ROM. Applications used on 
44      network appliances typically are housed on a Web server accessed
45      by the appliance. Network appliances are used to ease remote 
46      management and cut costs.
48      http://networking.webopedia.com/TERM/N/network_appliance.html  
50 Despite the various meanings which exist, for the purposes of this hint a 
51 network appliance is:
52 - An inexpensive computer, x86 based in this case
53 - Limited utility outside it's particular purpose, e.g. file serving, mp3
54   playing, X10 controlling, firewall, etc.
55 - Limited resources such as: minimal storage(e.g. fit on a CF card), not an 
56   very fast processor, minimal memory.
58 To get a better idea if this hint will be right for you it might helpful to 
59 understand what my initial project was.  I wanted a small and quite computer 
60 which will play MP3s streamed from a remote "server" and show a slide show of 
61 images also hosted on a remote computer.  The details of the hardware I used in
62 my project are listed in Appendix E, though this hint should work on hardware
63 other than that which is listed.
65 So, "why not use vanilla LFS," you ask?  Well LFS was a little bit big for me.
66 Part of the "quite" part of the target system was to use a CF card rather than
67 a hard drive (see Appendix E).  Also LFS makes a rather useful generic system,
68 I had a specific purpose in mind, and development and the associated tools, 
69 were not part of that purpose, so no GCC.
71 In a nutshell here are the changes I made to the standard LFS:
72 - No development tools on the target system
73 - No documentation
74 - No glibc, used uClibc instead
75 - Use busybox rather than various miscellaneous utilities and the shell
76 - No getty or login
77 - No system v init scripts, use the busybox version.
79 This leaves a platform perfect adding whatever functionality you want with a 
80 minimal amount of overhead, but on it's own has very limited functionality.
82 If this sounds like what you are looking for then keep reading.  If this sounds
83 a bit too striped down then you may want to read these hints instead:
85 uclibc-lfs:
86         http://hints.linuxfromscratch.org/hints/uclibc-lfs.txt
88 Stripping down an LFS:
89         http://hints.linuxfromscratch.org/hints/stripped-down.txt
91 Glad you decided to keep reading!
93 Despite your willingness to continue on you might want the above hints anyway,
94 as they inform a lot of what happens here.  Also your success with this hint 
95 is more likely if you have actually built a "regular" LFS system.  Also the 
96 instructions here are _very_ brief and not really explained well, so reading
97 LFS will help you gain a greater understanding.
99 ==================================
100 2. Packages
101 ==================================
102 One of the benefits of building a smaller system is that you need to download
103 fewer packages.  While there is no harm in downloading all the LFS packages. If
104 you would rather download only the necessary files then checkout Appendix B 
105 and download only those files.
107 In addition to the set of "standard" LFS packages you'll need to download the
108 following packages and extract them in the same directory as the other packages.
110 uClibc Patches
111 ftp://ftp.linuxfromscratch.org/lfs-hints/patches/uclibc-lfs-patches-0.3.tar.bz2
113 uClibc 0.9.14
114 http://www.uclibc.org/downloads/uClibc-0.9.14.tar.gz
116 BusyBox 0.60.5
117 http://www.busybox.net/downloads/busybox-0.60.5.tar.bz2
119 ==================================
120 3. LFS Chapter 5 Addendum
121 ==================================
122 Chapter 5 created a bunch of tools which are statically linked.  Thus, when we 
123 enter the chroot environment the tools will continue to work in the absence 
124 shared libraries, a more detailed and undoubtedly more correct explanation 
125 can be found here: 
126 http://www.linuxfromscratch.org/view/4.0/chapter05/whystatic.html.  
127 Chapter 6 
128 continues to build the main system
129 the LFS system once we enter the chroot environment (Chapter 6).  However given
130 that we will not be building all the packages in Chapter 6, specifically some
131 of the necessary development packages, we need to create statically linked 
132 versions of those which are needed.  It turns out that we really only need to 
133 build two packages:
134 - Perl (for the uClibc build)
135 - modutils (for the kernel build)
138 --INSTALL STATICALY LINKED PERL 5.8.0--
139 ./Configure -Dprefix=/static -Dinstallprefix=$LFS/static -Dso=none \
140   -Dldflags=-static -Uinstallusrbinperl -Uusedl -Dman1dir=none \
141   -d -e &&
142 make &&
143 make install
145 --INSTALL STATICALY LINKED MODUTILS 2.4.19--
146 ./configure --prefix=$LFS/static/usr &&
147 make LDFLAGS=-static &&
148 make install
150 ==================================
151 4. Post LFS Chapter 5
152 ==================================
153 This section of the hint is an alternative to rest of LFS only insomuch 
154 as it provides the commands to execute to build the basic LFS appliance system.
155 If you've not built the full LFS system then you should give the original LFS
156 a read, as it explains the purpose of each command, the files in the 
157 packages and is very educational.  That being said to actually build the system
158 you should execute the commands listed here.
160 As an aside, I don't really trust "make clean" so as a personal preference I
161 usually delete the source and start over.  By the way there is no real basis 
162 for this irrational disbelief in "make clean" so a reasonable person would 
163 ignore me.
165 Before you begin make sure you are root again and the $LFS is set.
167 --ENTER THE CHROOT ENVIRONMENT--
168 chroot $LFS /static/bin/env -i \
169     HOME=/root TERM=$TERM PS1='\u:\w\$ ' \
170     PATH=/bin:/usr/bin:/sbin:/usr/sbin:/static/bin \
171     /static/bin/bash --login
173 --CHANGE OWNERSHIP--
174 chown -R 0:0 *
176 --CREATE DIRECTORIES--
177 mkdir -p /{bin,boot,dev/pts,etc,home,lib,mnt,proc} &&
178 mkdir -p /{root,sbin,tmp,usr,var} &&
179 mkdir -p /usr/{bin,etc,lib,sbin,include,share}
180 mkdir /var/{lock,log,mail,run,spool} &&
181 mkdir -p /var/{tmp,cache,lib/misc,local} &&
182 ln -s ../var/tmp /usr
184 *note: This directory tree is based on the LFS tree which is based on FHS
185 (http://www.pathname.com/fhs/) but lacks /usr/local/games and /usr/share/games.
186 This tree lacks additional directories:
187 /usr/src
188 /usr/share/*
189 /usr/local/*
190 /opt/*
192 /usr/include is created but will be deleted during the cleanup.
194 --SET PERMISSIONS--
195 chmod 0750 /root &&
196 chmod 1777 /tmp /var/tmp
198 --MOUNT THE PROC FILE SYSTEM--
199 mount proc /proc -t proc
201 *note: The message "warning: can't open /etc/fstab: No such file or directory"
202 is ok
204 --CREATE THE SYMLINKS--
205 ln -sf /proc/mounts /etc/mtab &&
206 ln -sf /static/bin/bash /bin &&
207 ln -sf bash /bin/sh &&
208 ln -sf /static/bin/perl /usr/bin &&
209 ln -sf /static/bin/true /bin &&
210 ln -sf /static/usr/sbin/depmod /sbin &&
211 ln -sf /static/bin/find /usr/bin/ &&
212 ln -sf /static/bin/gzip /bin/gzip
214 --CREATE THE PASSWD AND GROUP FILES--
215 echo "root:x:0:0:root:/root:/bin/bash" > /etc/passwd &&
216 cat > /etc/group << "EOF"
217 root:x:0:
218 bin:x:1:
219 sys:x:2:
220 kmem:x:3:
221 tty:x:4:
222 tape:x:5:
223 daemon:x:6:
224 floppy:x:7:
225 disk:x:8:
226 lp:x:9:
227 dialout:x:10:
228 audio:x:11:
231 --CREATE DEVICES--
232 cp MAKEDEV-1.7 /dev/MAKEDEV &&
233 cd /dev &&
234 chmod 754 MAKEDEV &&
235 ./MAKEDEV -v generic
237 --INSTALL KERNAL HEADERS--
238 ln -sf /static/bin/pwd /bin/pwd &&
239 make mrproper &&
240 make include/linux/version.h &&
241 make symlinks &&
242 mkdir /usr/include/asm &&
243 cp include/asm/* /usr/include/asm &&
244 cp -R include/asm-generic /usr/include &&
245 cp -R include/linux /usr/include &&
246 touch /usr/include/linux/autoconf.h &&
247 rm /bin/pwd
249 --INSTALL UCLIBC --
250 patch -Np1 < ../uclibc-lfs-patches/uClibc-0.9.14.patch &&
251 ln -sf extra/Configs/Config.i386 Config &&
252 make DOSHAREDMAIN=true DO_C99_MATH=true HAS_SHADOW=true DOLFS=true \
253   INCLUDE_RPC=true HAS_WCHAR=true KERNEL_SOURCE=/usr/src/linux-2.4.19 \
254   all install
256 --INSTALL BUSYBOX--
257 patch -Np1 < ../busybox-0.60.5-appliance.patch &&
258 make &&
259 make PREFIX=/ install
262 --INSTALL LINUX KERNEL--
263 Installing Linux is a bit interesting in our chroot environment.  The first
264 thing to do is prepare the source code by executing the command:
266 make mrproper
268 Next is to configure the kernel.  You ought to read this:
269 http://www.linuxfromscratch.org/view/4.0/chapter08/kernel.html
270 You should include what your system needs.  Helpful statement huh?  Well I'll
271 tell you for my project I configured the following;
272 - My network card (as a module)
273 - My sound card (as a module)
274 - Frame buffer support
276 We don't have ncurses so "make menuconfig" will _not_ work in the chroot 
277 environment, so if you want to configure the kernel in the chroot environment
278 then your are stuck with this:
280 make config
282 * What I do, and this is very ungeek because it involves a gui, is switch to
283 another terminal window in X and do a "make xconfig".  The same technique 
284 applies to menuconfig.
286 Now you we actually build the kernel:
288 make dep &&
289 make bzImage &&
290 make modules &&
291 make modules_install &&
292 cp arch/i386/boot/bzImage /boot/kernel-2.4.19 &&
293 ln -sf kernel-2.4.19 /boot/bzImage &&
294 cp System.map /boot/System.map-2.4.19 &&
295 ln -sf System.map-2.4.19 /boot/System.map
297 ==================================
298 5. Configuring the system
299 ==================================
300 You've now got actually have _very_ basic system which is essentially the 
301 appliance platform. As it is not configured if you started it up you would
302 get a prompt, some nifty programs and not much else.  This chapter introduces
303 the init system and does some cleanup
305 --init scripts--
306 The details of the init script are highly specific to my purposes.  Your needs
307 will likely be different.  Therefore the scripts here are presented as a guide
308 rather something which should be copied.
310 In our system init program is actually BusyBox.  BusyBox _does not_ provide
311 a full System V style init.  To understand how it works read the "init" 
312 description on:
313 http://www.busybox.net/downloads/BusyBox.html
315 BusyBox looks for a program called /etc/init.d/rcS.  The listing of all the
316 init scripts in Appendix D.  Briefly, my scripts do this: 
318 /etc/init.d/rcS
319   This program simply looks in /etc/init.d/rcS.d/ for any scripts that 
320   start with an 'S' and runs that program.  If there is an error then 
321   a message is printed to the console.
322 /etc/init.d/rcS.d/S01rd
323   Sets up a ram disk
324 /etc/init.d/rcS.d/S02syslog
325   Starts logging
326 /etc/init.d/rcS.d/S03mount
327   Mounts the filesystems
328 /etc/init.d/rcS.d/S04network
329   Starts the network
330 /etc/init.d/rcS.d/S05sound
331   Loads the sound modules
332 /etc/init.d/rcS.d/S04modules
333   Loads kernel modules
335 -- Clean Up --
336 If you have more programs to build, which you should because they system isn't 
337 very useful right now, then do that first.  
339 Exit the chroot environment:
340 exit
342 At this point we move the sources, the headers and the statically linked tools.
343 Insure that $LFS is set.  Also there should be a place to hold the sources,
344 headers and tools.  I create a directory, /lfs_static and set the environment
345 variable $LFS_STATIC.  The point of moving the files is so that if later some
346 additional software needs to be build or some kernel modules added then that
347 can be done.
349 mv $LFS/usr/include $LFS_STATIC &&
350 mv $LFS/usr/src $LFS_STATIC &&
351 mv $LFS/static $LFS_STATIC &&
352 rm /bin/bash &&
353 rm /sbin/depmod &&
354 ln -sf busybox /bin/sh &&
355 ln -sf busybox /bin/gzip &&
356 ln -sf ../../bin/busybox /usr/bin/find
358 ==================================
359 6. FAQ
360 ==================================
361 There are no FAQ, yet.
363 ==================================
364 Appendix A: References
365 ==================================
366 LFS, this is base LFS book
367 http://www.linuxfromscratch.org/
369 BusyBox, provides commands, a simple shell and init. 
370 "The Swiss Army Knife of Embedded Linux"
371 http://www.busybox.net/ 
372 uClibc (yew-see-lib-see), a much smaller glibc replacement
373 http://www.uclibc.org/
375 udhcp, a small dhcp client/server.  Indirectly referenced in the init script
376 appendix.
377 http://udhcp.busybox.net/
379 ==================================
380 Appendix B: LFS Packages
381 ==================================
383 Bash (2.05a) - 1,400 KB:
384 ftp://ftp.linuxfromscratch.org/lfs-packages/4.0/bash-2.05a.tar.bz2
385 http://ftp.linuxfromscratch.org/lfs-packages/4.0/bash-2.05a.tar.bz2
387 Binutils (2.13) - 9,651 KB:
388 ftp://ftp.linuxfromscratch.org/lfs-packages/4.0/binutils-2.13.tar.bz2
389 http://ftp.linuxfromscratch.org/lfs-packages/4.0/binutils-2.13.tar.bz2
391 Bzip2 (1.0.2) - 610 KB:
392 ftp://ftp.linuxfromscratch.org/lfs-packages/4.0/bzip2-1.0.2.tar.bz2
393 http://ftp.linuxfromscratch.org/lfs-packages/4.0/bzip2-1.0.2.tar.bz2
395 Diffutils (2.8.1) - 642 KB:
396 ftp://ftp.linuxfromscratch.org/lfs-packages/4.0/diffutils-2.8.1.tar.bz2
397 http://ftp.linuxfromscratch.org/lfs-packages/4.0/diffutils-2.8.1.tar.bz2
399 Fileutils (4.1) - 1,217 KB:
400 ftp://ftp.linuxfromscratch.org/lfs-packages/4.0/fileutils-4.1.tar.bz2
401 http://ftp.linuxfromscratch.org/lfs-packages/4.0/fileutils-4.1.tar.bz2
403 Fileutils Patch (4.1) - 1 KB:
404 ftp://ftp.linuxfromscratch.org/lfs-packages/4.0/fileutils-4.1.patch.bz2
405 http://ftp.linuxfromscratch.org/lfs-packages/4.0/fileutils-4.1.patch.bz2
407 Findutils (4.1) - 226 KB:
408 ftp://ftp.linuxfromscratch.org/lfs-packages/4.0/findutils-4.1.tar.bz2
409 http://ftp.linuxfromscratch.org/lfs-packages/4.0/findutils-4.1.tar.bz2
411 Findutils Patch (4.1) - 1 KB:
412 ftp://ftp.linuxfromscratch.org/lfs-packages/4.0/findutils-4.1.patch.bz2
413 http://ftp.linuxfromscratch.org/lfs-packages/4.0/findutils-4.1.patch.bz2
415 Gawk (3.1.1) - 1,420 KB:
416 ftp://ftp.linuxfromscratch.org/lfs-packages/4.0/gawk-3.1.1.tar.bz2
417 http://ftp.linuxfromscratch.org/lfs-packages/4.0/gawk-3.1.1.tar.bz2
419 Gawk Patch (3.1.1-2) - 1 KB:
420 ftp://ftp.linuxfromscratch.org/lfs-packages/4.0/gawk-3.1.1-2.patch.bz2
421 http://ftp.linuxfromscratch.org/lfs-packages/4.0/gawk-3.1.1-2.patch.bz2
423 GCC (3.2) - 20,043 KB:
424 ftp://ftp.linuxfromscratch.org/lfs-packages/4.0/gcc-3.2.tar.bz2
425 http://ftp.linuxfromscratch.org/lfs-packages/4.0/gcc-3.2.tar.bz2
427 GCC Patch (3.2) - 4 KB:
428 ftp://ftp.linuxfromscratch.org/lfs-packages/4.0/gcc-3.2.patch.bz2
429 http://ftp.linuxfromscratch.org/lfs-packages/4.0/gcc-3.2.patch.bz2
431 Grep (2.5) - 545 KB:
432 ftp://ftp.linuxfromscratch.org/lfs-packages/4.0/grep-2.5.tar.bz2
433 http://ftp.linuxfromscratch.org/lfs-packages/4.0/grep-2.5.tar.bz2
435 Gzip (1.2.4a) - 179 KB:
436 ftp://ftp.linuxfromscratch.org/lfs-packages/4.0/gzip-1.2.4a.tar.bz2
437 http://ftp.linuxfromscratch.org/lfs-packages/4.0/gzip-1.2.4a.tar.bz2
439 Gzip Patch (1.2.4b) - 1 KB:
440 ftp://ftp.linuxfromscratch.org/lfs-packages/4.0/gzip-1.2.4b.patch.bz2
441 http://ftp.linuxfromscratch.org/lfs-packages/4.0/gzip-1.2.4b.patch.bz2
443 Linux (2.4.19) - 25,432 KB:
444 ftp://ftp.linuxfromscratch.org/lfs-packages/4.0/linux-2.4.19.tar.bz2
445 http://ftp.linuxfromscratch.org/lfs-packages/4.0/linux-2.4.19.tar.bz2
447 Make (3.79.1) - 794 KB:
448 ftp://ftp.linuxfromscratch.org/lfs-packages/4.0/make-3.79.1.tar.bz2
449 http://ftp.linuxfromscratch.org/lfs-packages/4.0/make-3.79.1.tar.bz2
451 Modutils (2.4.19) - 213 KB:
452 ftp://ftp.linuxfromscratch.org/lfs-packages/4.0/modutils-2.4.19.tar.bz2
453 http://ftp.linuxfromscratch.org/lfs-packages/4.0/modutils-2.4.19.tar.bz2
455 Patch (2.5.4) - 149 KB:
456 ftp://ftp.linuxfromscratch.org/lfs-packages/4.0/patch-2.5.4.tar.bz2
457 http://ftp.linuxfromscratch.org/lfs-packages/4.0/patch-2.5.4.tar.bz2
459 Perl (5.8.0) - 8,416 KB:
460 ftp://ftp.linuxfromscratch.org/lfs-packages/4.0/perl-5.8.0.tar.bz2
461 http://ftp.linuxfromscratch.org/lfs-packages/4.0/perl-5.8.0.tar.bz2
463 Sed (3.02) - 221 KB:
464 ftp://ftp.linuxfromscratch.org/lfs-packages/4.0/sed-3.02.tar.bz2
465 http://ftp.linuxfromscratch.org/lfs-packages/4.0/sed-3.02.tar.bz2
467 Sh-utils (2.0) - 824 KB:
468 ftp://ftp.linuxfromscratch.org/lfs-packages/4.0/sh-utils-2.0.tar.bz2
469 http://ftp.linuxfromscratch.org/lfs-packages/4.0/sh-utils-2.0.tar.bz2
471 Sh-utils Patch (2.0) - 1 KB:
472 ftp://ftp.linuxfromscratch.org/lfs-packages/4.0/sh-utils-2.0.patch.bz2
473 http://ftp.linuxfromscratch.org/lfs-packages/4.0/sh-utils-2.0.patch.bz2
475 Tar (1.13) - 730 KB:
476 ftp://ftp.linuxfromscratch.org/lfs-packages/4.0/tar-1.13.tar.bz2
477 http://ftp.linuxfromscratch.org/lfs-packages/4.0/tar-1.13.tar.bz2
479 Tar Patch (1.13) - 1 KB:
480 ftp://ftp.linuxfromscratch.org/lfs-packages/4.0/tar-1.13.patch.bz2
481 http://ftp.linuxfromscratch.org/lfs-packages/4.0/tar-1.13.patch.bz2
483 Texinfo (4.2) - 1,175 KB:
484 ftp://ftp.linuxfromscratch.org/lfs-packages/4.0/texinfo-4.2.tar.bz2
485 http://ftp.linuxfromscratch.org/lfs-packages/4.0/texinfo-4.2.tar.bz2
487 Textutils (2.1) - 1,847 KB:
488 ftp://ftp.linuxfromscratch.org/lfs-packages/4.0/textutils-2.1.tar.bz2
489 http://ftp.linuxfromscratch.org/lfs-packages/4.0/textutils-2.1.tar.bz2
491 Util-linux (2.11u) - 1,073 KB:
492 ftp://ftp.linuxfromscratch.org/lfs-packages/4.0/util-linux-2.11u.tar.bz2
493 http://ftp.linuxfromscratch.org/lfs-packages/4.0/util-linux-2.11u.tar.bz2
495 ==================================
496 Appendix C: Patches
497 ==================================
498 This patch to the BusyBox Config.h enables a few extra featurs, like insmod,
499 without which our system would be really useless.  If you plan on adjusting
500 Config.h to suit your own needs then you don't need this patch
502 diff -ru busybox-0.60.5.orig/Config.h busybox-0.60.5/Config.h
503 --- busybox-0.60.5.orig/Config.h        2002-09-17 15:04:28.000000000 -0700
504 +++ busybox-0.60.5/Config.h     2003-03-19 22:54:19.000000000 -0800
505 @@ -38,7 +38,7 @@
506  #define BB_ECHO
507  #define BB_ENV
508  //#define BB_EXPR
509 -//#define BB_FBSET
510 +#define BB_FBSET
511  //#define BB_FDFLUSH
512  #define BB_FIND
513  #define BB_FREE
514 @@ -51,12 +51,12 @@
515  #define BB_HALT
516  #define BB_HEAD
517  //#define BB_HOSTID
518 -//#define BB_HOSTNAME
519 +#define BB_HOSTNAME
520  //#define BB_HUSH
521  #define BB_ID
522 -//#define BB_IFCONFIG
523 +#define BB_IFCONFIG
524  #define BB_INIT
525 -//#define BB_INSMOD
526 +#define BB_INSMOD
527  #define BB_KILL
528  #define BB_KILLALL
529  #define BB_KLOGD
530 @@ -75,9 +75,9 @@
531  //#define BB_MD5SUM
532  #define BB_MKDIR
533  //#define BB_MKFIFO
534 -//#define BB_MKFS_MINIX
535 +#define BB_MKFS_MINIX
536  #define BB_MKNOD
537 -#define BB_MKSWAP
538 +//#define BB_MKSWAP
539  //#define BB_MKTEMP
540  #define BB_MODPROBE
541  #define BB_MORE
542 @@ -86,9 +86,9 @@
543  //#define BB_MT
544  #define BB_MV
545  //#define BB_NC
546 -//#define BB_NSLOOKUP
547 +#define BB_NSLOOKUP
548  #define BB_PIDOF
549 -//#define BB_PING
550 +#define BB_PING
551  //#define BB_PIVOT_ROOT
552  #define BB_POWEROFF
553  //#define BB_PRINTF
554 @@ -102,7 +102,7 @@
555  #define BB_RM
556  #define BB_RMDIR
557  //#define BB_RMMOD
558 -//#define BB_ROUTE
559 +#define BB_ROUTE
560  //#define BB_RPM2CPIO
561  #define BB_SED
562  //#define BB_SETKEYCODES
563 @@ -134,7 +134,7 @@
564  //#define BB_UPDATE
565  #define BB_UPTIME
566  //#define BB_USLEEP
567 -//#define BB_VI
568 +#define BB_VI
569  //#define BB_WATCHDOG
570  #define BB_WC
571  //#define BB_WGET
572 @@ -333,7 +333,7 @@
573  //#define BB_FEATURE_MINIX2
574  //
575  // Enable ifconfig status reporting output -- this feature adds 7k.
576 -//#define BB_FEATURE_IFCONFIG_STATUS
577 +#define BB_FEATURE_IFCONFIG_STATUS
578  //
579  // Enable ifconfig slip-specific options "keepalive" and "outfill"
580  //#define BB_FEATURE_IFCONFIG_SLIP
581 diff -ru busybox-0.60.5.orig/Makefile busybox-0.60.5/Makefile
582 --- busybox-0.60.5.orig/Makefile        2002-10-26 21:47:54.000000000 -0700
583 +++ busybox-0.60.5/Makefile     2003-03-19 21:07:34.000000000 -0800
584 @@ -49,7 +49,7 @@
585  # just 1.4k to the binary size (which is a _lot_ less then glibc NSS costs).
586  # Note that if you want hostname resolution to work with glibc, you still need
587  # the libnss_* libraries.  
588 -USE_SYSTEM_PWD_GRP = true
589 +USE_SYSTEM_PWD_GRP = false
591  # This enables compiling with dmalloc ( http://dmalloc.com/ )
592  # which is an excellent public domain mem leak and malloc problem
594 ==================================
595 Appendix D: init Scripts
596 ==================================
598 -- /etc/init.d/rcS --
599 This program simply looks in /etc/init.d/rcS.d/ for any scripts that 
600 start with an 'S' and runs that program.  If there is an error then 
601 a message is printed to the console.
603 #!/bin/sh
604 # Begin /etc/init.d/rcS
606 for i in /etc/init.d/rcS.d/S*
608   [ ! -f  "$i" ] && continue;
609   $i start
610   error_value=$?
612   if [ $error_value != 0 ]
613   then
614     echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
615     echo "An unexpected error has occurred is the script $i."
616     echo "The script exited with a return value of $error_value."
617     echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
618   fi
619 done
621 # End /etc/init.d/rcS
623 -- /etc/init.d/rcS.d/S01rd --
624 On the system I build I mount the root partition as read only.  The root 
625 partition is a CF card and I didn't want to use up the 100,000 write cycles
626 with a bunch of logging and temp stuff.  So the writable areas are mapped to
627 a ram disk.  The kernel will need to be compiled with ram disk support, but
628 initrd is not necessary for this.  This is useful for CD-ROM as well.
630 Preparations:
631 The first thing to do is setup the writable bits of the LFS partition to
632 link to the ram disk, in this case /mnt/ram.  Execute these commands, insure
633 that $LFS is set:
635 mkdir $LFS/mnt/ram
636 ln -sf /mnt/ram/etc/resolv.conf $LFS/etc/resolv.conf &&
637 rm -Rf $LFS/var &&
638 ln -sf /mnt/ram/var $LFS/var &&
639 rm -Rf $LFS/tmp &&
640 ln -sf var/tmp $LFS/tmp &&
642 The dhcp client will write the names servers to use to /etc/resolv.conf so
643 this file is linked to the ram disk. The /var and /tmp areas need to be writable
644 by various programs and for logging so they too are linked to the ram disk.
646 The script creates ram disk of 20MB, though you can make it what ever size
647 suits your needs.  It then creates a filesystem. Minix is used because it's the
648 only thing BusyBox knows how to create.  The ram disk is mounted and the 
649 appropriate directories are created to satisfy the links.
651 echo Setting up ramdisk
652 insmod rd rd_size=20000
653 dd if=/dev/zero of=/dev/ram
654 mkfs.minix /dev/ram
655 mount /dev/ram /mnt/ram -t minix
656 mkdir -p /mnt/ram/var/log
657 mkdir /mnt/ram/var/tmp
658 mkdir /mnt/ram/etc
659 echo Setting up ramdisk complete
661 -- /etc/init.d/rcS.d/S02syslog --
662 Simply starts up the logging daemons.
664 echo Starting system logging
665 klogd
666 syslogd
667 echo Starting system logging complete
670 -- /etc/init.d/rcS.d/S03mount --
671 Mounts the file systems, in this case /proc.  A mount -a could be thrown in if
672 you have other filesystems listed in /etc/fstab (I don't).
674 echo Mounting file systems
675 mount /proc /proc -t proc
676 echo Mounting file systems complete
678 -- /etc/init.d/rcS.d/S04network --
679 Loads the correct network module, yours will likely be different and starts
680 the udhcp client.  *note the udhcp client is not installed as part of this hint
681 see the URL in the references appendix for more information.
683 echo Bringing up network
684 modprobe via-rhine
685 ifconfig eth0 up
686 udhcpc
687 echo Bringing up network complete
689 -- /etc/init.d/rcS.d/S05sound --
690 Loads the sound card module.  Your sound card will likely be different.
692 echo Starting sounds subsystems
693 modprobe via82cxxx_audio
694 echo Starting sounds subsystems complete
696 ==================================
697 Appendix E: Hardware Example
698 ==================================
699 This is a list of the hardware I used for my project.  You don't need to use
700 this hardware, though I've only tested on the hardware listed below.  I main
701 reason for this selection of hardware is that it was relatively inexpensive and
702 quite.  I have no fans or moving parts in this system.  The three main pieces 
703 a computer which move and make noise are the CPU fan on the mainboard, the
704 hard drive and the power supply.
706 -- Mainboard --
707 VIA EPIA M 
708 (http://www.viavpsd.com/product/epia_m_spec.jsp?motherboardId=81)
709 This mainboard was selected because of it's size and fanless operation. The 
710 mainboard includes a network interface, sound subsystem, 1 PCI slot, fireware,
711 USB 2.0 and TV out.  Full details at the link above.
713 Unfortunately as a Linux platform it is less that perfect.  Driver support 
714 isn't fantastic.  A good thread on the current support is here:
715 http://forums.viaarena.com/messageview.cfm?catid=28&threadid=33324
717 I have not tried to use the USB or the firewire, they are not even compiled 
718 into the kernel, so I have no idea if they will work.  The network device 
719 works with the VIA Rhine module that comes with the stock kernel 
720 (CONFIG_VIA_RHINE).
722 The sound drives were a bit of a trick, as they are not supported in the 2.4.19
723 kernel, the kernel which this hint and LFS are based on.  The modules in the
724 Alan Cox patched 2.4.20 kernel (2.4.20-ac2) do work.  You can get them from
725 kernel.org:
726 http://www.kernel.org/pub/linux/kernel/v2.4/linux-2.4.20.tar.bz2
727 http://www.kernel.org/pub/linux/kernel/people/alan/linux-2.4/2.4.20/patch-2.4.20-ac2.bz2
729 -- Hard drive --
730 I replaced the hard drive with a CF card, I'm using a 16 MB CF card and have 
731 about 10 MB left over.  It looks like a regular hard drive with the help of 
732 an IDE/CF adapter, the software doesn't need to be changed at all.  I bought 
733 this one:
734 http://www.acscontrol.com/Index_ACS.asp?Page=/Pages/Products/CompactFlash/IDE_To_CF_Adapter.htm
736 -- Power Supply --
737 As of this moment my power supply is on back order.  I am planning on using 
738 This one, which has no fan and produces 60 watts of power from a 12 volt 
739 input:
740 http://www.mini-box.com/PW-60.htm
741 It's been a couple of weeks now so I may end up building one myself.