http://www.at91.com/linux4sam/bin/view/Linux4SAM/SDCardBootNotice

Q: How to extract the files of pre-compiled demo (UBI, JFFS2), and copy them to SD card's ext2/4 partition?

To do this, mount the ubi/jffs2 pre-compiled demo p_w_picpath as a loopback device in your PC, and then copy all files to your SD card's partition.

Here are the steps: (tested in Ubuntu 11.04.)

  • Install "mtd-utils" package in PC.

    sudo apt-get install mtd-utils



  • Mount UBIFS p_w_picpaths as a loopback:

    modprobe nandsim first_id_byte=0x2c second_id_byte=0xda third_id_byte=0x00 fourth_id_byte=0x15
    modprobe ubi mtd=0
    ubidetach /dev/ubi_ctrl -m 0
    ubiformat /dev/mtd0 -s 2048 -f Angstrom-x11-at91sam9-p_w_picpath-eglibc-ipk-v20110624-at91sam9x5ek.rootfs.ubi
    ubiattach /dev/ubi_ctrl -m 0 -O 2048
    mkdir /mnt/loop
    mount -t ubifs ubi0 /mnt/loop
    cp -R /mnt/loop/* /new/directory
       



  • Mount JFFS2 p_w_picpaths as a loopback:

    modprobe nandsim first_id_byte=0x2c second_id_byte=0xda third_id_byte=0x00 fourth_id_byte=0x15
    modprobe mtdblock
    modprobe mtdchar
    modprobe mtd mtd=0
    dd if=Angstrom-x11-at91sam9m10-p_w_picpath-glibc-ipk-2009.X-stable-at91sam9m10g45ek.rootfs.jffs2 of=/dev/mtd0
    mkdir /mnt/loop
    mount -t jffs2 /dev/mtdblock0 /mnt/loop
    cp -R /mnt/loop/* /new/directory/