Booting Linux with rootfs on a JFFS2 File System |
|
Step through the following procedure to enable a JFFS2 root filesystem in the sample networking configuration:
- Modify the Linux kernel configuration to not include the rootfs into the uImage. For this, run make kmenuconfig in the project directory and uncheck (disable) the Initial RAM filesystem... option:
General setup ---> [ ] Initial RAM filesystem and RAM disk (initramfs/initrd) support
- Build the project with the make command.
- Unpack the rootfs.cpio image created during build in the project directory to a directory that can be mounted via NFS from the board:
$ mkdir networking_rfs && cd networking_rfs $ sudo cpio -iv< /rootfs.cpio
Please note the archive must be unpacked with the root privileges as there are device nodes in the archive. Alternatively, you can enable cpio in the project and unpack the archive to the JFFS2 partition from the busybox shell on the board.
- Boot the board with an original networking uImage that includes the root filesystem in uImage.
- Mount the directory with the networking_rfs directory via NFS:
~ # mount -o nolock,rsize=1024 172.17.0.1:/work /mnt
- Create a JFFS2 filesystem on a MTD partition of the QSPI:
~ # flash_eraseall -j /dev/mtd2 Erasing 64 Kibyte @ fc0000 - 100% complete.Cleanmarker written at fb0000.
- Mount the JFFS2 filesystem to a directory:
~ # mkdir /mnt1 ~ # mount -t jffs2 /dev/mtdblock2 /mnt1
- Copy files from the networking_rfs directory to the JFFS2 filesystem:
cp -r /mnt/networking_rfs/* /mnt1
- Reboot the board and stop in U-boot.
- Add a boot command for booting with JFFS2 root filesystem:
Vybrid U-Boot> setenv jboot set bootargs \$\{bootargs\} \ root=/dev/mtdblock2 rw rootwait rootfstype=jffs2\;run bootcmd Vybrid U-Boot> saveenv
- If you boot uImage from QSPI Flash, update the uImage image in Flash with the one built on step 2.
- Run the new boot command to make sure that the JFFS2 filesystem is now used as the root filesystem:
Vybrid U-Boot> run jboot Using FEC0 device TFTP from server 172.17.0.1; our IP address is 172.17.44.46 Filename 'networking.uImage'. Load address: 0x80007fc0 Loading: ################################################################# ########################## done Bytes transferred = 1325828 (143b04 hex) ## Booting kernel from Legacy Image at 80007fc0 ... Image Name: Linux-3.0.15-g60146c8-dirty Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 1325764 Bytes = 1.3 MiB Load Address: 80008000 Entry Point: 80008000 XIP Kernel Image ... OK OK Starting kernel ... ... VFS: Mounted root (jffs2 filesystem) on device 31:2. ...
|