HOWTO - make MiniMyth boot from and use an NFS partition

Share your success stories with others

Moderator: Pablo

Post Reply
Nem
Contributor
Posts: 76
Joined: Sat Aug 30, 2003 12:09 am
Location: Cambridge, UK

HOWTO - make MiniMyth boot from and use an NFS partition

Post by Nem » Sun Sep 07, 2003 11:48 pm

HOWTO - make MiniMyth boot from and use an NFS partition

First off, I'd like to say I'm not the wordsmith that Larry is, so please bear with me. (Larry please feel free to get your big red pen out and make this doc a bit more user friendly :-) )

The idea of booting off NFS was to make modifying MiniMyth a bit of a quicker process, as with the system configured this way I can make modifications to the filesystem in real time. An example of how this was useful to me was in getting mplayer working. I was able to keep running mplayer and keep adding libraries until I had all the ones I needed. To do this rebooting with cramfs would have taken ages. I have to say tho, that eventually I do intend to cramfs the finished filesystem. I think it will probably yield a more responsive system to run this way, as the frontend wont be calling for files from the server all the time.

Anyway to begin... GET EVERYTHING WORKING WITH CRAMFS

Now we can start getting things working with NFS.

CONFIGURE PXELINUX
==================

The first thing we need to do is tell PXELinux that we want to boot from somewhere else other than the cramfs system. We do this in /var/lib/tftpboot/PXEClient/pxelinux.cfg/default

My default file looks like this..

--8<-----8<----8<-----8<-----8<----8<-----8<-----8<-----8<-----
PROMPT 1
DEFAULT n
DISPLAY messages
TIMEOUT 1
label local
LOCALBOOT 0

#label linux
# KERNEL memdisk
# APPEND initrd=images/linux/network.img

#F1 images/local/help.txt

label r

KERNEL kernel
# don't use quotes on the append line
APPEND initrd=rootfs ramdisk_blocksize=4096 ramdisk=50000 root=/dev/ram0 MYTHSERVER=192.168.0.1

label n

KERNEL kernel
# don't use quotes on the append line
APPEND root=/dev/nfs nfsroot=192.168.0.1:/var/lib/mythroot,rsize=8192,wsize=8192,rw ip=dhcp MYTHSERVER=192.168.0.1

----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<---8<---

"label r" is the ram disk which is the original MiniMyth cramfs boot and "label n" is the NFS boot option.

CHANGE YOUR KERNEL
=========================

You will need a slightly different kernel to allow NFS to work.
You can get a finished one from here http://n-e-m.net/Myth/NFSBoot/bzImage.

Or you can build your own using the same patched source that the original MiniMyth uses along with this .config http://n-e-m.net/Myth/NFSBoot/.config

Copy the kernel to /var/lib/tftpboot/PXEClient/kernel

CONFIGURE NFS
=============

if you haven't got NFS setup go here http://www.mandrakeuser.org/docs/connect/cnfs.html and follow the instructions.

We need to export the MiniMyth filesystem from the server so edit your /etc/exports to include an extra line as follows. (if /etc/exports doesn't exist then create it, and you may need to start up the nfs services afterwards)

/var/lib/mythroot 192.168.0.6(rw,no_root_squash)

save the exports file and make sure you run

exportfs -ra

to update the shared directories.


Extracting the MiniMyth filesystem
==================================

Download the Bzipped MiniMyth file system from Larrys web site .. currently this is here http://linpvr.org/rel-0.1/minimyth-0.1.tar.bz2

unzip this in your home dir

tar -jvxf minimyth-0.1.tar.bz2

Now CD to /var/lib and make the mythroot directory.

cd into the mythroot dir and copy the MiniMyth filesystem in

cp -R ~/minimyth-0.1/* .


Editing MiniMyth for NFS
========================

Okay, hopefully your with me so far.

cd into your new file systems etc dir which is here /var/lib/mythroot/etc

Edit the fstab file to mount the NFS filesystem, adding this line..

192.168.0.1:/var/lib/mythroot / nfs rw,hard,intr 0 0

Change the IP address to match where you shared the filesystem from.

Now edit the RC script and make the following changes. Comment out the call to the network.script, and optionally remount the filesystem.rw so you can make changes on the host system.

My rc script looks like this ..

--8<-----8<----8<-----8<-----8<----8<-----8<-----8<-----8<-----
#!/bin/sh
mount -o remount,rw /
#/etc/network.script
export PATH=/usr/X11R6/bin:/usr/bin:/usr/sbin:/sbin/:/bin:/usr/X11R6/lib:/usr/local/bin
/sbin/devfsd /dev
/bin/mount -t tmpfs -o size=512K tmpfs /var
/bin/mount -t tmpfs -o size=512K tmpfs /tmp
/bin/mkdir /var/lock
/bin/mkdir /var/log
/bin/mkdir /var/run
/bin/mkdir /var/root
/bin/mount -av
/etc/loadmods.script
/etc/software.script
/etc/lirc.script
xinit
--8<-----8<----8<-----8<-----8<----8<-----8<-----8<-----8<-----

I have written all of this from memory so I'm sure I missed something, but let assume I didn't :-P.

Boot your EPIA and you should now be booting from and using your NFS filesystem.

Please let me know if you find any problems or omissions with/from this HOWTO.

Have fun,

Regards,

Darren[/url]

sw25481
Member
Posts: 10
Joined: Thu Oct 23, 2003 8:46 pm

0.4Beta3

Post by sw25481 » Tue Feb 17, 2004 9:50 pm

Has anyone got NFS mounted root to work with 0.4Beta3. The kernel already has NFS root compiled in by the looks of things, so I followed the rest of the instructions. By watching the packets it is clear I am able to have MiniMyth mount the NFS root successfully. An amount of NFS traffic gets transfered then I just get an error something like

nfs rpc call returned error 101

scroll up the screen.

Nem
Contributor
Posts: 76
Joined: Sat Aug 30, 2003 12:09 am
Location: Cambridge, UK

Post by Nem » Sat Feb 21, 2004 12:17 am

Hello sw,

You will need to mod some of the scripts slighly.

firstly the error your seeing is caused by the following line

/usr/sbin/udhcpc -s /etc/dhcp.script

comment this out like

#/usr/sbin/udhcpc -s /etc/dhcp.script

Also you need to call the network script early on in your rc script you may also want to mount the root partition rw. Mine looks like this ...

#!/bin/sh
mount -o remount,rw /
/etc/network.script

export PATH=/usr/X11R6/bin:/usr/bin:/usr/sbin:/sbin/:/bin:/usr/X11R6/lib:/usr/local/bin
export HOME=/root
# file system
/sbin/devfsd /dev
#/bin/mount /proc
/bin/mount -t tmpfs -o size=512K tmpfs /var
/bin/mount -t tmpfs -o size=512K tmpfs /tmp
/bin/mount -t tmpfs -o size=512K tmpfs /mnt
/bin/mkdir /var/lock
/bin/mkdir /var/log
/bin/mkdir /var/run
/bin/mount -av
# for other dirs edit preapp.script
# config
/sbin/syslogd
/sbin/klogd
/sbin/portmap
/etc/loadmods.script
/etc/network.script
/etc/getremotefiles.script
# customize the preapp script for other modules, other mounts, etc.
# any new mounts should be under /mnt
# btw, preapp can retrieve its own files using the getit.sh script.
[ -e /tmp/preapp.script ] && /bin/sh /tmp/preapp.script
/bin/mount -a
# applications
/etc/servers.script
/etc/lirc.script
/etc/mysql.script
xinit &

sw25481
Member
Posts: 10
Joined: Thu Oct 23, 2003 8:46 pm

Worked like a dream

Post by sw25481 » Sat Feb 21, 2004 10:03 am

Worked Like a dream,

thanks Nem

dewpac
Member
Posts: 19
Joined: Thu Nov 13, 2003 9:39 pm

Adding Mplayer Libs?

Post by dewpac » Sun Feb 22, 2004 10:17 am

I may be barking up the wrong tree, but I am hoping not. I noticed that you said you were using NFS because you were adding libraries to mplayer -- how do you do this? I have some XVid files that mplayer will not play (even though other XVid's work fine it seems?) and I'm wondering if I might need to add the XVid library. I compiled it, and put it in /usr/local/lib, but that didn't fix it. What exactly did you do, and what did that fix?

Thanks!

sw25481
Member
Posts: 10
Joined: Thu Oct 23, 2003 8:46 pm

Not quite

Post by sw25481 » Sun Feb 22, 2004 11:10 am

I wanted to use NFS so that I could make changes to the image quickly and easily. In my case I was going to start by adding a Kernel module. The kernel is setup to allow you to add and load modules without recompiling the Kernel, I'm pretty sure mplayer does not work that way. I think you would need to recompile mplayer with support for that library, then replace mplayer as well.

Scott

Post Reply