• Home
  • pcDuino
  • WiKi
  • Store
  • Distributors
  • Home
  • pcDuino
  • WiKi
  • Store
  • Distributors
HomepcDuinoQuick StartHow to manupinate NAND when boot from a SD?
Previous Next

How to manupinate NAND when boot from a SD?

Posted by: admin , March 31, 2014

[vc_row][vc_column width=”1/1″][vc_column_text]When boot from a bootable SD, people are asking:

1. How to access the data in NAND?

2. How to flash NAND using the factory provided images?

3. How to restore the data and system from SD to NAND?

In this tutorial, we will address these three questions.

[/vc_column_text][vc_tour][vc_tab title=”Partitions of NAND” tab_id=”1396271603-1-20″][vc_column_text]We will first look at the partitions of NAND. nanda holds the uboot, kernel and configuration parameters, whereas rootfs is stored in nandd. We can check the NAND using command:

$fdisk –l |grep nand
ubuntu@ubuntu:~$ sudo fdisk -l | grep nand

Disk /dev/nand doesn’t contain a valid partition table

Disk /dev/nandb doesn’t contain a valid partition table

Disk /dev/nandc doesn’t contain a valid partition table

Disk /dev/nandd doesn’t contain a valid partition table

Disk /dev/nande doesn’t contain a valid partition table

Disk /dev/nand: 3984 MB, 3984588800 bytes

Disk /dev/nanda: 33 MB, 33554432 bytes

Disk /dev/nandb: 2 MB, 2097152 bytes

Disk /dev/nandc: 16 MB, 16777216 bytes

Disk /dev/nandd: 1887 MB, 1887436800 bytes

Disk /dev/nande: 2027 MB, 2027945984 bytes

Here we can see the structure of the the whole NAND. Ubuntu of pcDuino only uses nanda and nandd.[/vc_column_text][/vc_tab][vc_tab title=”How to access the data in NAND?” tab_id=”1396271603-2-48″][vc_column_text]It will be easy to answer the first question after we know the layout of the partitions.

After boot from SD, we can create new directory to point to nanda and nandd.

$sudo mkdir /media/1

$sudo mkdir /media/2

Now we can continue to mount nanda and nandd:

ubuntu@ubuntu:~$ sudo mount /dev/nanda /media/1

ubuntu@ubuntu:~$ sudo mount /dev/nandd /media/2

We can then check if the content underneath is correct or not:

ubuntu@ubuntu:~$ ls /media/2

boot.axf  drv_de.drv  font32.sft  magic.bin  script.bin   sprite      uImage

boot.ini  font24.sft  linux       os_show    script0.bin  sprite.axf  vendor

ubuntu@ubuntu:~$ ls /media/2

allwinner  boot      dev  home  lost+found  mnt  proc  run   selinux  sys     tmp  var

bin        boot-mmc  etc  lib   media       opt  root  sbin  srv      system  usr

[/vc_column_text][/vc_tab][vc_tab title=”How to flash NAND with factory provided image?” tab_id=”1396272406354-2-2″][vc_column_text]We can flash NAND using production SD method. Here,  we will flash NAND using a different method.

We need the following two files:

  1. pcduino_ubuntu_xxxxxx.img
  2. pcduino_a10_hwpack_xxxxxxx.tar.xz

We can use tool ‘dd’ to flash the rootfs to NAND.

First, we need to copy the two files above to the bootable SD card.

Then, use the following command to dd rootfs to NAND:

$sudo dd if=pcduino_ubuntu_xxxxxx.im of=/dev/nandd bs=4M

To copy the kernel into the NAND, we can do the following:

$ tar xvf pcduino_a10_hwpack_YYYYMMDD.tar.xz -C /tmp
$ sudo mount /dev/nanda /boot
$ sudo cp /tmp/kernel/* /boot -f
$ sudo mv /lib/modules/3.4.29+ /lib/modules/3.4.29_old
$ sudo cp /tmp/rootfs/lib/modules/3.4.29+ /lib/modules/ -ar
$ sudo sync
$ sudo umount /boot/
$ sudo reboot

[/vc_column_text][/vc_tab][vc_tab title=”How to restore data and system from SD to NAND?” tab_id=”1396272938161-3-4″][vc_column_text]If you want to restore the data and system from SD to NAND, we can use the following command after boot from SD card:

$sudo dd if=/dev/mmcblk0 of=/dev/nand bs=4M

[/vc_column_text][/vc_tab][/vc_tour][/vc_column][/vc_row]

Tags: Quick Start

Share!
Tweet

admin

About the author

Leave a Reply Cancel reply

You must be logged in to post a comment.

Category

  • Home
  • pcDuino
  • WiKi
  • Store
  • Distributors