[[bc10]]~
[[bc10-router]] ~

#contents

* bc10-router/arago-project(danny)/NAND boot [#d90c50be]
>
This article explains how to boot arago-console-image from NAND of bc10.  The details of how to create arago-console-image is listed at [[bc10-router/arago-project(danny)/Ubuntu12.04LTS]].~
~
There are roughly three steps to crate and to configure the image for NAND boot.~
~
The different steps for creating and configuring processes require different development environments. These development environments are already used and Their details are discussed at [[bc10-router/arago-projct(danny)/Ubunt12.04LTS]].
- Ubuntu 12.04 LTS
- bc10 arago-console image
- bc10 u-boot

** Ubuntu 12.04 LTS part [#b5b15667]
>
The processes shown below are done on Ubuntu 12.04LTS.~
~
The ubi file should be configured and recreated for booting from NAND. The creating process of the ubi file is described at at [[bc10-router/arago-project(danny)/Ubuntu12.04LTS]].~
~
The reason why recreating the ubi file is that the original ubi file, which has been build at at [bc10-router/arago-project(danny)/Ubuntu12.04LTS]], does not have certain data and cannot allow bc10 to boot from NAND.~
~
To recreating the uni file, mtd-utils is added.~
 $ sudo apt-get install mtd-utils
The ubi file of arago-console-image is renamed to rootfs.ubi.~
 $ cd /home/beat/tisdk/build/arago-tmp-external-linaro-toolchain/deploy/images
 $ cp arago-console-image-beagleboard-20140131034334.rootfs.ubi rootfs.ubi
To recreate the ubi file, ubinize.cfg is modified as shown below. Then, the new ubi file is recreated. The recreated ubi file is copied to Ext4 area ( its directory is /media/EXT3) of a SD card, which is already formatted for working with bc10.~
 $ diff -upN __ubinize.cfg_orig ubinize.cfg
 --- __ubinize.cfg_orig  2014-02-06 14:52:27.473188696 +0900
 +++ ubinize.cfg 2014-02-06 14:52:48.297189782 +0900
 @@ -3,5 +3,5 @@ mode=ubi
  image=/home/beat/tisdk/build/arago-tmp-external-linaro-toolchain/deploy/images/arago-console-image-beagleboard-20140131034334.rootfs.ubifs
  vol_id=0
  vol_type=dynamic
 -vol_name=beagleboard-rootfs
 +vol_name=rootfs
  vol_flags=autoresize
 
 $ sudo ubinize -v -o rootfs.ubi -m 2048 -p 128KiB -s 512 ubinize.cfg
 $ sudo cp rootfs.ubi /media/EXT3/.

** bc10 arago-console-image part [#n02194e8]
>
Boot bc10 with the SD card, which rootfs.ubi has already been copied to. Check the size of NAND partition, then copy uImage and rootfs.ubi into NAND.~
 Checking NAND Partition
 # cat /proc/mtd
 dev:    size   erasesize  name
 mtd0: 00080000 00020000 "X-Loader"
 mtd1: 001e0000 00020000 "U-Boot"
 mtd2: 00020000 00020000 "U-Boot Env"
 mtd3: 00400000 00020000 "Kernel"
 mtd4: 1f980000 00020000 "File System"
 
 Copying uImage
 # cd /boot/
 root@beagleboard:/boot# ls
 uImage        uImage-3.3.7
 root@beagleboard:/boot# flash_erase /dev/mtd3 0 0
 Erasing 128 Kibyte @ 3e0000 -- 100 % complete
 # nandwrite -p /dev/mtd3 uImage
 Writing data to block 0 at offset 0x0
 Writing data to block 1 at offset 0x20000
 ...<snip>
 Writing data to block 26 at offset 0x340000
 
 Copying rootfs.ubi
 # ubiformat -y /dev/mtd4 -f rootfs.ubi
 ubiformat: mtd4 (nand), size 530055168 bytes (505.5 MiB), 4044 eraseblocks of 131072 bytes (128.0 KiB), min. I/O size 2048 bytes
 libscan: scanning eraseblock 4043 -- 100 % complete
 ubiformat: 4039 eraseblocks are supposedly empty
 ubiformat: 5 bad eraseblocks found, numbers: 89, 107, 731, 881, 2852
 ubiformat: flashing eraseblock 321 -- 100 % complete
 ubiformat: formatting eraseblock 4043 -- 100 % complete
 After this process is completed, bc10 is rebooted and the prompts of u-boot are started.~

** bc10 u-boot part [#ecd306bf]
>
To use the prompts of u-boot, write down MLO and uboot.img on NAND.~
 Copying MLO
 OMAP3 beagleboard.org # mmc rescan 0
 OMAP3 beagleboard.org # fatload mmc 0 ${loadaddr} MLO
 reading MLO
 
 44580 bytes read
 OMAP3 beagleboard.org # nandecc hw
 HW ECC selected
 OMAP3 beagleboard.org # nand erase 0 80000
 
 NAND erase: device 0 offset 0x0, size 0x80000
 Erasing at 0x60000 -- 100% complete.
 OK
 OMAP3 beagleboard.org # nand write ${loadaddr} 0 ${filesize}
 
 NAND write: device 0 offset 0x0, size 0xae24
  44580 bytes written: OK
 OMAP3 beagleboard.org # nand write ${loadaddr} 20000 ${filesize}
 
 NAND write: device 0 offset 0x20000, size 0xae24
  44580 bytes written: OK
 OMAP3 beagleboard.org # nand write ${loadaddr} 40000 ${filesize}
 
 NAND write: device 0 offset 0x40000, size 0xae24
  44580 bytes written: OK
 OMAP3 beagleboard.org # nand write ${loadaddr} 60000 ${filesize}
 
 NAND write: device 0 offset 0x60000, size 0xae24
  44580 bytes written: OK
 
 Copying u-boot.img
 OMAP3 beagleboard.org # mmc rescan 0
 OMAP3 beagleboard.org # fatload mmc 0 ${loadaddr} u-boot.img
 reading u-boot.img
 
 336184 bytes read
 OMAP3 beagleboard.org # nandecc hw
 HW ECC selected
 OMAP3 beagleboard.org # nand erase 80000 1c0000
 
 NAND erase: device 0 offset 0x80000, size 0x1c0000
 Erasing at 0x220000 -- 100% complete.
 OK
 OMAP3 beagleboard.org # nand write ${loadaddr} 80000 ${filesize}
 
 NAND write: device 0 offset 0x80000, size 0x52138
  336184 bytes written: OK
 OMAP3 beagleboard.org #
This is the end of writing down NAND Boot to bc10.~
~
Turn off bc10 and to remove the SD card, then, restart bc10.~
Make sure that bc10 can be booted without the SD card, which does contain NAND Boot.~
~
Caution: If the file is copied to NAND correctly, the error massage appears when it is booted.~
 uncorrectable error :
When the error message shows up, restart bc10. Or, turn off the power of bc10 once, then turn on and start bc10 again.~

*** Failure of writing down to NAND and How to turn back to SD boot [#w432e5b3]
>
If you fail to write down to NAND or if you wish to turn back to boot from a SD Card, please remove the data, which has been stored in the NAND. Please use the u-boot prompt below.~
  # nand erase.chip
To check whether the data in NAND is successfully removed or not, first turn off the power of bc10 and bc10, then, restart bc10. If the data is erased from NAND, the following message appears.~
 40w

* bc10 NAND Boot Log [#h06e9e11]
>
These is a part of log, which is created when bc10 is booted form NAND Boot.~
 U-Boot SPL 2012.04.01 (Jan 28 2014 - 19:49:35)
 ...<snip>...
 Booting from nand ...
 
 NAND read: device 0 offset 0x280000, size 0x400000
  4194304 bytes read: OK
 ## Booting kernel from Legacy Image at 80007fc0 ...
    Image Name:   Linux-3.3.7
    Image Type:   ARM Linux Kernel Image (uncompressed)
    Data Size:    3413048 Bytes = 3.3 MiB
    Load Address: 80008000
    Entry Point:  80008000
    Verifying Checksum ... OK
    XIP Kernel Image ... OK
 OK
 
 Starting kernel ...
 ...<snip>...
 [    0.944183] NAND device: Manufacturer ID: 0x2c, Chip ID: 0xbc (Micron NAND 512MiB 1,8V 16-bit)
 [    0.954223] Creating 5 MTD partitions on "omap2-nand.0":
 [    0.959808] 0x000000000000-0x000000080000 : "X-Loader"
 [    0.966796] 0x000000080000-0x000000260000 : "U-Boot"
 [    0.974029] 0x000000260000-0x000000280000 : "U-Boot Env"
 [    0.980926] 0x000000280000-0x000000680000 : "Kernel"
 [    0.989013] 0x000000680000-0x000020000000 : "File System"
 [    1.199310] UBI: attaching mtd4 to ubi0
 [    1.203338] UBI: physical eraseblock size:   131072 bytes (128 KiB)
 [    1.209960] UBI: logical eraseblock size:    129024 bytes
 [    1.215667] UBI: smallest flash I/O unit:    2048
 [    1.220642] UBI: sub-page size:              512
 [    1.225494] UBI: VID header offset:          512 (aligned 512)
 [    1.231628] UBI: data offset:                2048
 [    2.183929] UBI: max. sequence number:       10
 [    2.202484] UBI: attached mtd4 to ubi0
 [    2.206512] UBI: MTD device name:            "File System"
 [    2.212310] UBI: MTD device size:            505 MiB
 [    2.217529] UBI: number of good PEBs:        4039
 [    2.222473] UBI: number of bad PEBs:         5
 [    2.227142] UBI: number of corrupted PEBs:   0
 [    2.231842] UBI: max. allowed volumes:       128
 [    2.236694] UBI: wear-leveling threshold:    4096
 [    2.241638] UBI: number of internal volumes: 1
 [    2.246337] UBI: number of user volumes:     1
 [    2.251007] UBI: available PEBs:             0
 [    2.255676] UBI: total number of reserved PEBs: 4039
 [    2.260925] UBI: number of PEBs reserved for bad PEB handling: 40
 [    2.267333] UBI: max/mean erase counter: 1/0
 [    2.271820] UBI: image sequence number:  86612789
 [    2.277465] usbcore: registered new interface driver catc 
 ...<snip>...
 [    5.085510] drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
 [    5.126647] UBIFS: recovery needed
 [    5.227508] UBIFS: recovery completed
 [    5.231384] UBIFS: mounted UBI device 0, volume 0, name "rootfs"
 [    5.237731] UBIFS: file system size:   256112640 bytes (250110 KiB, 244 MiB, 1985 LEBs)
 [    5.246185] UBIFS: journal size:       9033728 bytes (8822 KiB, 8 MiB, 71 LEBs)
 [    5.253875] UBIFS: media format:       w4/r0 (latest is w4/r0)
 [    5.260040] UBIFS: default compressor: lzo
 [    5.264343] UBIFS: reserved for root:  0 bytes (0 KiB)
 [    5.270599] VFS: Mounted root (ubifs filesystem) on device 0:14.
 [    5.277740] devtmpfs: mounted
 [    5.281372] Freeing init memory: 216K
 INIT: version 2.88 booting
 ...<snip>...
 Stopping Bootlog daemon: bootlogd.
 
  _____                    _____           _         _
 |  _  |___ ___ ___ ___   |  _  |___ ___  |_|___ ___| |_
 |     |  _| .'| . | . |  |   __|  _| . | | | -_|  _|  _|
 |__|__|_| |__,|_  |___|  |__|  |_| |___|_| |___|___|_|
               |___|                    |___| 
 
 Arago Project http://arago-project.org beagleboard ttyO2
 
 Arago 2013.06 beagleboard ttyO2
 
 beagleboard login:

* Revision History [#q253018b]
> 
- 2014/02/06 This article is initially published
- 2014/02/17 This article is initially published

Front page   Edit Diff Backup Upload Copy Rename Reload   New List of pages Search Recent changes   RSS of recent changes