- Using Interfaces (GPIO, UART, SPI, ...)
- Building an initial ramdisk without root permission
- Creating a JFFS2 image from a directory structure
- SAM-BA : Flashing taskit's ARM-based boards
- Flashing new u-boot on Portux920T / Portux Panel-PC
- Implementing an own boot-logo for Panel-Card
- Nano-X with tslib support
- Using Watchdog on Stamp9G20 or PortuxG20
- Development with Eclipse
- Installing Debian/GNU Linux on Stamp9G20 and PortuxG20
- Using Xenomai on PortuxG20/Stamp9G20
- Installing a rootfs on SD card
- Using Power Management Features
- Using the NAND flash on NanosG20
- Using the buzzer on PortuxG20 rev. 2 and NanosG20
Creating a JFFS2 image from a directory structure
Last edited by aehrlich on Thu, 10/29/2009 - 12:31
Introduction
Sometimes creating customized rootfs-images via OpenEmbedded is complicated. When changes are minor it is also possible to create a jffs2-image from any directory. Also when using jffs2 partitions in production systems it is advisable to create the image from scratch, because space requirements will be optimized.
Requirements
You need the following tools:
- mtd-tools
- linux development system with nfs
Procedure
Installation of the needed tools
On Debian and derived distributions just enter
apt-get install mtd-tools
with root rights.
Generating an jffs2-image from a complete directory structure
You have to have all the files you need in a directory. If you for example have a customized rootfs on a sd-card and you now want to create a jffs2-image to store it into flash and boot from it, just mount the sd-card on your development system and create the image hereof. The example given here in this how-to creates an image from the Angstrom tarball distributed with Stamp9g20, store the created image in flash and booting the newly created image. When creating a rootfs, root permissions may be necessary:
mkfs.jffs2 --little-endian --eraseblock=0x20000 -n --pad -d ./jffs2-test -o jffs2-root.img
This creates a jffs2-image image called jffs2-root with the contents of the directory jffs2-test. If you need the root squashing feature (making all files owned by root as described in the Linux guide) add the option --squash. Do not use this feature, if the contents already have the correct ownership.
Next we flash this image to a mtd-partition on our board, here mtd5 on the Stamp9G20:
mount -o nolock,tcp 192.168.4.238:/develop /mnt/net flash_eraseall /dev/mtd5 Erasing 128 Kibyte @ 1fd60000 -- 100 % complete. nandwrite /dev/mtd5 /mnt/net/jffs2-root.img Writing data to block 137 at offset 0x1120000
Done. If you have a NOR-Flash based system use flashcp instead of nandwrite. Now reboot, interrupt booting with u-boot, type run flashboot to boot your newly created image on Stamp9G20 or PortuxG20.
You can also just mount the new partition in your running system: mount -t jffs2 /dev/mtdblock5 /some_mountpoint.
