Continued discussion in this direction should likely be done at PLUG-devel@lists.plug.phoenix.az.us. -Paul On Fri, 21 Nov 2003 06:37:58 -0700, Ed Skinner wrote: > I'd be interested at two levels. First, of course, there are the steps > you went through to reach the successful level your router is now at. Things > such as "what booter did you use," and "how did you get it into the flash" > and "which parts of the system need which files" would be great to know. > But additionally, and perhaps a harder thing to answer, would be the > process you went through in figuring out those steps. That is, did you have a > "cook book" that laid out every step or were there areas where you had to > figure it out on your own and, if so, what resources (the net, man-pages, > looking at a live system, asking an expert, etc.) did you try? This "view" of > what you've built may often be about the wrong turns taken as much as about > the right ones, and may help others at a meta-level in finding their own > solutions to different problems. The CF has an IDE interface and looks very much like a HD. I'd purchased a CF to IDE adapter card a year ago, but hadn't used it. To boot the system I use grub. As for building the filesystem, here's my script: #/sbin/mke2fs -b 1024 -m 0 -L ROUTER -N 2048 /dev/hde1 #/sbin/tune2fs -c 0 -i 0 /dev/hde1 mount -t ext2 /dev/hde1 /mnt/card df /mnt/card cd /home/dickson/red/downloads/router rsync -avu --delete image/ /mnt/card/ find /mnt/card/ -exec chown root. \{\} \; sync df /mnt/card #/sbin/grub-install --root-directory=/mnt/card '(hd1)' umount /dev/hde1 /sbin/cardctl eject 1 The first two lines are for when I trash the filesystem. Sometimes writing to the CF trash the partitions (don't know why, maybe IDE bugs). The other commented-out line is for installing grub on the CF card. hd1 is the second hard drive (counting starts from 0 in grub). The remaining lines mount the card (which is fdisk'd to have an ext2 on the first partition), show some stats (df), cd to the filesystem location which has a copy of the CF's filesystem, sync's with that filesystem (adding and deleting files), forces root owner of the files, and flushes/writes it all with a sync. Then outputs new stats, unmounts the filesystem, and logically ejects the cardbus card of my laptop. Software-wise, there are two main packages installed upon everything else is built: uClibc[1] (you-see-lib-see) and busybox[2]. On the uClibc web page[1] there is a compressed development system[3] for compiling software to run using uClibc (this is about 25 MB compressed, about a 2-3 hours download for me). Once I download this dev system, I uncompressed it, and mounted it on a loop device to extract the contents for a build environment. I placed this at /home/dickson/red/downloads/router/b. When I want to build something, I do: chroot /home/dickson/red/downloads/router/b /usr/bin/env -i TERM=linux /bin/bash --login Within this environment, I created /router/image (the developmental CF filesystem) and /router/src (the location for building software). Yes, this is NOT the same CF filesystem as the above script. They are kept separate to I don't trash my copy. For simplicity, the linux kernel was implemented using devfs. Then I only needed an empty /dev in the CF's filesystem. I need to acknowledge my friend Kevin, who got me started with the first several packages. He builds his systems using LinuxFromScratch, so his his initial help really jump started this project. It took me about a month from to get to this point, nearly two weeks were wasted trying to get my LexarMedia CF card to work (it would work, then upon rebooting, the BIOS couldn't read grub of the CF, and the card never being R/W). uClibc-0.9.21: make menuconfig make make PREFIX=/router/image install_target Do the make menuconfig to set "kernel header location" to /usr, "shared library loader path" to /lib and whatever other options you want. The options have changed slightly for 0.9.23, but you can still build with this environment. And yes, these two packages have a build system similar to the 2.4 Linux kernels (but I now like the 2.6 system). busybox: make menuconfig make make install make menuconfig to set "busybox installation prefix" to /router/image and whatever else you want. Just building these two pages will give you 80 to 90 percent of my final system. Busybox provides lots of tools. I used the inittab and have httpd compiled in, but not running. I hope to eventually have a web interface (yes it does cgi-bin stuff), but I haven't done anything along that path yet. The shell ash is very similar to bash, so it's not very often that I had to edit bash scripts. In fact, I was able to compress RedHat's ifup and ifup-ppp scripts from 500 lines to 37 lines (with comments), mostly because the scripts are intended for my system but there's still some flexibility. Here are some of the packages I've installed: busybox-1.00-pre3.tar curl-7.10.8.tar daemontools-0.76.tar djbdns-1.05.tar iptables-1.2.8.tar less-381.tar libpcap-0.7.2.tar man-1.5m2.tar mini_sendmail-1.3.4.tar ntp-4.2.0.tar openssh-3.7.1p2.tar openssl-0.9.7c.tar ppp-2.4.1.tar strace-4.5.tar tcpdump-3.7.2.tar uClibc-0.9.23.tar ucspi-tcp-0.88.tar zlib-1.1.4.tar I'm planning on adding pciutils later today. My router's system has a second network card installed (which I found when I replaced the HDs with the CF. I'd like to know what it is so I can use it when I get a highspeed connection. I'd also like to use Python-2.3.2. I've compiled it but it comes to 44 MB. This is is a little much for the 64 MB CF card (22 + 44 means impossible). I do have isolinux on the CF filesystem, so it's just a matter of creating an isolinux.cfg file and generating a CD. The currently run read-only, with only /var being a tmpf. I could then write my scripts in much simpler python. -Paul [1] http://www.uclibc.org/ [2] http://busybox.net/ [3] http://www.kernel.org/pub/linux/libs/uclibc/root_fs_i386.bz2