(Created page with '== Requirements == * Environment for building ARM binaries * USB networking == Steps for NFS-root == First, you have to get/make a MeeGo rootfs image. You can download a pre-bu…')
First, you have to get/make a MeeGo rootfs image. You can download a pre-built image (Meego_images_for_N900) or create your own (Creating_ARM_image_using_MIC2). Then you must make the (unpacked) rootfs available in a suitable location on your host system (e.g. /home/nfs/rootfs).
Next, make sure you have NFS server installed on your host and export the rootfs. In Ubuntu:
apt-get install nfs-kernel-server echo '/home/nfs 192.168.*(rw,no_root_squash,no_subtree_check)' >> /etc/exports exportfs -v -a
Then, you have to recompile kernel for N900. You must enable (built inside kernel, thus select '*', not 'M'):
* USB Gadget support (Device drivers -> USB Support -> USB Gadget support) * USB Gadget drivers (Device drivers -> USB Support -> USB Gadget support -> USB Gadget drivers) * Ethernet gadget * RNDIS Support (Device drivers -> USB support -> USB Gadget support -> RNDIS support) * NFS support (File systems -> Network File systems -> NFS client support) * NFS-Root support (File systems -> Network File systems -> NFS client support -> Root file system on NFS) * IP kernel autoconf (Networking support -> Networking options -> IP: kernel level autoconfiguration) * all sub-options
Compile and install modules
make make modules_install INSTALL_MOD_PATH=/home/nfs/rootfs
After compilation is finished you can boot the new kernel with (assuming 192.168.2.14 is your host)
flasher -k arch/arm/boot/zImage -l -b"init=/sbin/preinit ip=192.168.2.15::192.168.2.14 root=/dev/nfs nfsroot=192.168.2.14:/home/nfs/rootfs rootdelay=2 rw console=ttyMTD console=tty0"
You can also hard code the kernel command line options as default when recompiling the kernel (Boot options -> default kernel command string). And further, you can of course flash the new kernel to the device. But still, you have to override the Nolo command line options with flasher
OBS: the switch_root step in the script in the end does not seem to work with the latest kernel, you could try it though. Pivot root seems to work.
This method involves using busybox and does not require kernel recompilation. You can more easily keep in sync with the MeeGo kernel.
The easiest way to make it working is to build a static binary. Get Busybox sources:
git clone git://git.busybox.net/busybox
Unpack/go to busybox source directory. And edit configuration and compile.
cd busybox make defconfig make menuconfig # Enable static build (Busybox settings -> Build options -> Buidld BusyBox as a static binary) make CROSS_COMPILE=arm-linux- make install CROSS_COMPILE=arm-linux- CONFIG_PREFIX=./initrd
Now you have an initial busybox environment installed in busybox/initrd.
To make the initrd bootable and usable you need some preparations. First, make some Initial directories:
cd initrd mkdir proc mkdir sys mkdir dev mkdir mnt mkdir -p lib/modules
Some device nodes are needed by the kernel (note, these must be run as root to preserve device node properties):
cp -a /dev/console dev/ cp -a /dev/null dev/ cp -a /dev/ram0 dev cp -a /dev/tty dev/ cp -a /dev/tty0 dev/ cp -a /dev/zero dev/
Copy kernel modules from your rootfs to the initrd (be sure to use correct kernel version):
cp -r /home/nfs/rootfs/lib/modules/2.6.28-19.1-n900/ lib/modules/
Next, make a script for doing the actual NFS-rooting and :
vim autonfsroot.sh # edit the script, an example is found below chmod a+x autonfsroot.sh rm sbin/init ln -s ../autonfsroot.sh sbin/init
Here's my autonfsroot.sh
#!/bin/sh echo "Doing mounts..." mount -t proc proc /proc mount -t sysfs sysfs /sys echo "Loading modules..." modprobe sunrpc modprobe auth_rpcgss modprobe rpcsec_gss_krb5 modprobe nfs modprobe phonet modprobe g_nokia sleep 2 echo "Configuring network interface..." ifconfig usb0 192.168.2.15 echo "Mounting NFS..." mount -t nfs -o nolock 192.168.2.14:/home/nfs/rootfs /mnt echo "Unmounting proc and sys..." umount /proc umount /sys echo "Switching to nfsroot..." # MLE: switch_root not working for me currently, for some reason #exec switch_root /mnt /sbin/init cd /mnt pivot_root . mnt exec chroot . /sbin/init
N900 requires cramfs initrd images. This is a bootloader restriction. Go back to the directory containing the initrd dir and then:
cd .. mkfs.cramfs -b 4096 -n meego_initrd ./initrd/ initrd.img
Now you can load your initrd with flasher and boot to nfs-root:
flasher -n initrd.img -l -b"root=/dev/ram0"
Voilá, you should see MeeGo booting.