2004-07-26-0741Z


Had some limited success with my PXE boot; I can at least lynx from the console now! I finally got rid of the initrd altogether and used nfsroot. Here's my /tftpboot/X86PC/pxelinux/pxelinux.cfg/default file:

DEFAULT vmlinuz-2.4.22 ip=dhcp root=/dev/nfs nfsroot=/nfsroot init=/init

And here's the /init file I've currently got (this will change a lot by the time I'm done)...

#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin
if [ "$$" != "1" ]; then
 echo This must only be run directly by the kernel as the init process >&2
 exit 1
fi
dd if=/dev/zero of=/dev/ram0 bs=1024 count=4096
mke2fs -q /dev/ram0 &>/dev/null
mount -n /dev/ram0 /tmp &>/dev/null
dd if=/dev/zero of=/dev/ram1 bs=1024 count=4096
mke2fs -q /dev/ram1 &>/dev/null
mount -n /dev/ram1 /etc &>/dev/null
dd if=/dev/zero of=/dev/ram2 bs=1024 count=4096
mke2fs -q /dev/ram2 &>/dev/null
mount -n /dev/ram2 /var &>/dev/null
cp /ref/etc/inittab /ref/etc/defaultdomain /etc
cp /ref/etc/ld.so.* /etc
cp -r /ref/etc/rc.d /etc
cp /ref/etc/{protocols,services} /etc
mkdir -p /var/yp /var/run /var/log /var/spool
echo /dev/nfs / ext2 ro 0 0 > /etc/fstab
echo /dev/ram0 /tmp ext2 rw 0 0 >> /etc/fstab
echo /dev/ram1 /etc ext2 rw 0 0 >> /etc/fstab
echo /dev/ram2 /var ext2 rw 0 0 >> /etc/fstab
cp -f /etc/fstab /etc/mtab
mount -t proc proc /proc
mount -o rw,gid=5,mode=620 -t devpts devpts /dev/pts
cp /proc/net/pnp /etc/resolv.conf
exec /bin/bash -l

That /proc/net/pnp solution is pretty neat, don't you think?

Now I'm working on /etc/rc.d/rc.S, but just fucked up. I had hardlinked everything (cp -rl /etc /var /nfsroot/ref), and, fool that I am, edited the copy under /nfsroot/ref, expecting it to create a new inode when I saved the modified version. Of course you can't count on that, so I lost the original. I think the changes I made were done in such a way as to not mess with a normal boot, but can't risk it. Got to get a clean copy of rc.S and check.

Getting too sleepy, I'll maybe call it a night.

Back to blog or home page

last updated 2013-01-10 20:25:42. served from tektonic.jcomeau.com