
This README file describes how to create the filesystem on a VPAC2M card
with OneNAND flash, using the ubifs file system.  This is somewhat
complicated because the bootloader cannot do it... one must boot into a
kernel provided by voipac, which has the necessary binaries in a ramdisk.

John Kelley
July 2010
j.kelley@astro.ru.nl

-----

0. How do I know which type of PC card I have?  Look at the "Product No."
on the DIMM module sticker.  If it starts with "27M", you have a NAND card
and can continue with these instructions.  Another check -- the NAND PC
cards have the letter "M" on the processor (Marvell).

1. First, connect to the board over the serial link.  Reboot the board, and
  press a key to enter the bootloader.  Now, erase everything except the
  bootloader itself:

  > erase 1:2-

2. Next, boot into the kernel provided by Voipac, which must be in the root
TFTP directory:

     > set serverip 192.168.61.161
     > set ipaddr 192.168.61.99
     > save
     > set bootargs console=ttyS0,38400
     > tftp zImage-2.6.27-vpac2-mkubifs.dat
     > wtags; cp.b a0000124 a0000114 80; go

IMPORTANT: the computer you've connected the digitizer to must be running a
DHCP daemon, or the boot process will get stuck waiting for an IP address.
The DHCP server should offer an address in the 192.168.61.0 subnet.

3. Log in as root:root.

4. Place the root filesystem built by buildroot in the TFTP directory
(below we assume it is named "rootfs-vpac1-ubifs-256-2.6.27.48.tar.gz"). 

5. To create the filesystem:

   # flash_eraseall /dev/mtd2
   # ubiattach /dev/ubi_ctrl -m 2
   # ubimkvol /dev/ubi0 -N rootfs -m
   # mount -t ubifs ubi0:rootfs /mnt
   # tftp -r rootfs-vpac1-ubifs-256-2.6.27.48.tar.gz -l /tmp/rootfs.tar.gz -g 192.168.61.161
   # tar xzf /tmp/rootfs.tar.gz -C /mnt
   # sync
   # umount /mnt
   # ubidetach /dev/ubi_ctrl -m 2


6. Reboot back into uBoot, and then load your own custom kernel which is in
the TFTP directory (below we assume this is called
"zImage-2.6.27.48-vpac2m.dat"). 

    > set bootargs root=ubi0:rootfs rootfstype=ubifs ubi.mtd=Filesystem console=ttyS0,38400
    > set bootcmd one read a1000000 40000 160000\; wtags\; go a1000000
    > save
    > tftp zImage-2.6.27.48-vpac2m.dat
    > erase 1:2-12
    > cp.b a1000000 40000 $(filesize)
    > wtags
    > go


