There are quite a few people using (or would like to use) OpenEmbedded on the Compulab cm-x270. The cm-x270 is a high performance, low cost computer module that can be used with a custom baseboard in embedded systems (see http://bec-systems.com/web/content/view/62/9/ for a review). I get a lot of questions on how to load OpenEmbedded on this system, so this howto attempts to detail a procedure that can be used to load OpenEmbedded.
The NAND Flash wrinkle
The Linux solution provided by compulab includes a proprietary NAND flash driver. Most developers are interested in using standard Linux MTD drivers with the JFFS2 filesystem, but its not readily obvious how to flash a JFFS2 NAND image using the cm-x270 bootloader. Fortunately, you can boot a small Linux image stored in NOR flash, and then use standard MTD utilities to then flash the NAND jffs2 image.
Creating the needed images
For this method, you need to generate two images: a small image to run from NOR flash, and a larger full featured image that will run from NAND flash. Because you only have about 2.3MB of NOR flash, you want to use uclibc in the NOR image as it is much smaller. A base Linux image that will boot into a shell using uclibc and contains a few utilities is about 1MB in size, which leaves plenty of space for custom apps should you need them in this partition. The local.conf settings to build this image are:
MACHINE = "cm-x270" DISTRO = "angstrom-2008.1" ANGSTROM_MODE = "uclibc" IMAGE_FSTYPES = "jffs2 tar cpio.gz"
At this point, “bitbake angstrom-minimal-image-with-mtd-utils”, and OE will generate a “minimalist-image-mtdutils-cm-x270.cpio.gz” image that can be programmed into the NOR ramdisk partition using the cm-x270 bootloader, and tftp download. A kernel will also be built that should be programmed into the kernel partition.
To build the NAND image, simply remove the ANGSTROM_MODE line, and “bitbake angstrom-console-image”. This will generate a “console-image-cm-x270.rootfs-summary.jffs2” that can be programmed into NAND flash.
Loading the software onto the cm-x270 is a multi-step process. The first step is to the load the kernel image and the minimalist-image into NOR flash using the cm-x270 bootloader and tftp. After this is accomplished, run the following commands to boot into the NOR flash rootfs:
- ramdisk on
If successful, you will be presented with a prompt — log in as user root, and no password.
You now need to download the jffs2 NAND image into RAM on the cm-x270. One way to do this is to use the tftp download feature in busybox:
tftp -g -r console-image-cm-x270.rootfs-summary.jffs2 <tftp server IP>
At this point you can program the jffs2 image into NAND flash:
- flash_eraseall -j /dev/mtd3
- nandwrite /dev/mtd3 console-image-cm-x270.rootfs-summary.jffs2
After programming completes, reboot the system and enter the following in the cm-x270 bootloader:
- ramdisk off (this will disable the initramfs in NOR flash)
At this point, your system should boot into the main NAND rootfs. With a little imagination, it should be obvious that you can do a lot of neat things with this type of setup by extending the functionality in the NOR rootfs including field upgrades and system recovery.