Root on NFS
Contents
About
An embedded system may not have a disk, an IDE interface, or even a PCI bus. Even if it does, during development it may be too unstable to use the disk, and a ramdisk may be too small to include all of the necessary utilities or too large (as a part of the kernel image) to allow for rapid turnaround during testing and development. An NFS root allows quick kernel downloads, helps ensure filesystem integrity (since the server is basically impervious to crashes by the client), and provides virtually infinite storage.
If we use NFS instead of ROMFS modification to the player's firmware can now be done on the NFS server. No more flash cycles necessary. Switching the player off and on again will activate the changes.
All code examples on this page assume that you are doing this on a system running Linux. Use VmWare Player to run Linux as a guest inside a Windows system.
Preparing KiSS Firmware
KiSS players use the ROMFS filesystem for their flash memory. The boot loader reads and starts the Linux kernel from it. The Linux kernel initiializes the hardware and than mounts the ROMFS as its root filesystem and starts /sbin/init from it. On KiSS players the Linux kernel starts the main DVD player application (we call it kissapp).
The Linux kernel used in KiSS players has not been configured for NFS. Even worse, KiSS developers commented out parts of the NFS code in the source. These changes have to be undone first. Due to a known bug in uCLinux kernel's do_mount.c:mount_root() it will still mount root from flash. The NFS over TCP code is incomplete.
Next step is to configure the Linux kernel to mount its root filesystem from a NFS server. The following options are required to be set
CONFIG_IP_PNP=y CONFIG_IP_PNP_DHCP=y CONFIG_ROOT_NFS=y CONFIG_CMDLINE="root=/dev/nfs rootfstype=nfs ip=dhcp"
Next step is to rebuild the kernel, copy the resulting linux.bin.gz to the ROMFS, rebuild and flash firmware.
Next time the player is powered on it will ask for an IP address via DHCP. After it got its IP address, it will mount its root filesystem from the NFS server instead of the flash.
ATTENTION: from now on your player will not work without the NFS server. But you can anytime flash original firmware to get rid of the NFS root.
Preparing DHCP
# vi /etc/dhcpd.conf host kiss { hardware ethernet 00:d0:e0:01:02:03; fixed-address 10.0.0.100; option host-name "kiss"; ddns-hostname "kiss"; next-server 10.0.0.1; option root-path "/home/kiss/root,v3,hard,nolock,tcp,timeo=15,retrans=10"; } # sh /etc/init.d/dhcpd restart
Adapt the values to your needs. It is recommended to configure your player with fixed IP address since the DHCP request issued by the kissapp will break your NFS connection for a short time. Often this is enough to panic the player.
Preparing NFS
# vi /etc/exports /home/kiss/root 10.0.0.100(rw,async,no_root_squash,no_subtree_check) # exportfs -rv
Preparing Root
Extract the romfs from the firmware ISO firmware.iso to /home/kiss/root. Superuser (root) rights are required to do this.
# export DIR=/tmp/kiss # mkdir -p ${DIR} ${DIR}/mount ${DIR}/cdrom # mount -t iso9660 -o ro,loop firmware.iso ${DIR}/mount # (cd ${DIR}/mount; tar cf - .) | (cd ${DIR}/cdrom; tar xf -) # umount ${DIR}/mount # mount -t romfs -o ro,loop ${DIR}/cdrom/romfs.bin ${DIR}/mount # (cd ${DIR}/mount; tar cf - .) | (cd /home/kiss/root; tar xf -) # umount ${DIR}/mount # rm -rf {DIR}
Troubleshooting
Download
Here you will find firmware ISO images with NFS pre-configured. Report any problem with it in Stage2 bug reporting thread at the Stage2 forum.
Player | Comment | Download |
---|---|---|
DP508 | based on original stage2 1.0 | dp508_stage2_nfsroot.zip |