Because of legacy issue, pcDuino2 only uses 2GB of its 4GB flash as a factory default installation. Users can use the ‘expand_nand’ option in ‘$sudo board-config.sh’ to expand to 4GB. In cases, the rootfs image made by users is larger than 2GB, and it shows up as NAND is not enough. In this post, we explain the steps to flash an image that is larger than 2GB.
1. Download the 2GB version of roots from pcDuino.com (https://s3.amazonaws.com/pcduino/Images/v3/20140430/pcduino3_ubuntu_20140430.7z). Let’s assume that the file name of the 2GB version is pcduino_ubuntu_20131126.img, and there is another file named update.sh.
2. Download a new update.sh (update) to replace the previous update.sh in step 1.
3. Copy the new update.sh and img file to a Ubuntu 12.04 64-bit X86 host pc.
4. On the X86 ubuntu, type the following command:
# dd if=/dev/zero of=pcduino_ubuntu_20140820.img bs=1M count=3500
For convenient, we name the newly created image as pcduino_ubuntu_20140820. The following message shows that the image was created successfully.
3500+0 records in 3500+0 records out 3670016000 bytes (3.7 GB) copied, 59.7535 s, 61.4 MB/s
5. Format the newly created image to be EXT3:
#mke2fs -t ext3 pcduino_ubuntu_20140820.img
The system will prompt that ‘pcduino_ubuntu_20140820.img is not a block special device’. It will ask if you want to continue. Press ‘Y’ to continue. The following message will indicate that it was a success:
Allocating group tables: complete Writing inode list: complete Creating journal (16384 blocks):complete Writing superblocks and filesystem accounting information: complete
6. Create a directory named ‘pcduino0802’ under ‘mnt’ and mount the image0820:
# cd /mnt/ # mkdir pcduino0820 # sudo mount -t ext3 -o loop /home/jiyuequn/pcduino/pcduino_ubuntu_20140820.img /mnt/pcduino0820
7. Create a directory named ‘pcduino1126’ under ‘mnt’ and mount the image 1126:
# cd /mnt/ # mkdir pcduino1126 # sudo mount -t ext3 -o loop /home/jiyuequn/pcduino/pcduino_ubuntu_20131126.img /mnt/pcduino1126
As image0820 is a newly created blank image, there is only a directory named lost+found. The content of image1126 will be as following after mounting:
# ls /mnt/pcduino1126/ allwinner dev lost+found proc selinux tmp bin etc media root srv usr boot home mnt run sys var boot-mmc lib opt sbin system
8. Copy the contents of image 1126 to image 0820:
# sudo cp -ar /mnt/pcduino1126/* /mnt/pcduino0820/
9. Unmount the two images:
# sudo umount /mnt/pcduino1126 # sudo umount /mnt/pcduino0820 # sync
10. Modify the file of update.sh, and change the filename following ‘IMG=’ to be ‘pcduino_ubuntu_20140820.img’:
11. Copy the finished 0820 image and modified update.sh and expand_nand, and we can use this to flash 4GB flash.
You can download expand_nand here: expand_nand.