Booting Linux with rootfs on a JFFS2 File System Print

 

Step through the following procedure to enable a JFFS2 root filesystem in the sample networking configuration:

  1. 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:
  2. General setup --->
    [ ] Initial RAM filesystem and RAM disk (initramfs/initrd) support

  3. Build the project with the make command.
  4. Unpack the rootfs.cpio image created during build in the project directory to a directory that can be mounted via NFS from the board:
  5. $ 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.

  6. Boot the board with an original networking uImage that includes the root filesystem in uImage.
  7. Mount the directory with the networking_rfs directory via NFS:
  8. ~ # mount -o nolock,rsize=1024 172.17.0.1:/work /mnt

  9. Create a JFFS2 filesystem on a MTD partition of the QSPI:
  10. ~ # flash_eraseall -j /dev/mtd2
    Erasing 64 Kibyte @ fc0000 - 100% complete.Cleanmarker written at fb0000.

  11. Mount the JFFS2 filesystem to a directory:
  12. ~ # mkdir /mnt1
    ~ # mount -t jffs2 /dev/mtdblock2 /mnt1

  13. Copy files from the networking_rfs directory to the JFFS2 filesystem:
  14. cp -r /mnt/networking_rfs/* /mnt1

  15. Reboot the board and stop in U-boot.
  16. Add a boot command for booting with JFFS2 root filesystem:
  17. Vybrid U-Boot> setenv jboot set bootargs \$\{bootargs\} \
    root=/dev/mtdblock2 rw rootwait rootfstype=jffs2\;run bootcmd
    Vybrid U-Boot> saveenv

  18. If you boot uImage from QSPI Flash, update the uImage image in Flash with the one built on step 2.
  19. Run the new boot command to make sure that the JFFS2 filesystem is now used as the root filesystem:
  20. 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.
    ...