nand erase on flash (Angström)

160 views
Skip to first unread message

Lina Daud

unread,
Jun 3, 2010, 10:47:29 AM6/3/10
to Technexion Thunderpack
Hi all,

I'm trying to re-install Angström on my Thunder board. I have
accidentally deleted all the data in NAND by doing nand erase.
Therefore, I need to write back in NAND x-loader, u-boot, kernel and
the file system. I have written succesfully the first three files but
unfortunately I have a rough time writing the file system in NAND.
I've tried using .jffs2 and .ubi files without any success.

Anybody knows how to write the file system in NAND? Other wise, is
there any ways to load back the factory settings?

Thank you in advance :)

Lina

Henri Parmentier

unread,
Jun 7, 2010, 3:40:09 AM6/7/10
to technexion-...@googlegroups.com
nandwrite -p

Lina Daud

unread,
Jun 7, 2010, 7:31:01 AM6/7/10
to Technexion Thunderpack
Hi Henri,

nandwrite -p is use to write in with padding option, right?
Could you elaborate what do you mean by doing "nandwrite -p"?

I finally am able to write in NAND for all partition. However, I still
have a problem during booting. It seems that I have errors "ECC Error"
coming from the File System (eg: mtd->read(0x44 bytes from 0xbc728cc)
returned ECC error)
Anybody has any idea why/where do these error come from?

Thanks in advance :)

Lina

On 7 juin, 09:40, Henri Parmentier <henri....@gmail.com> wrote:
> nandwrite -p
>

Henri Parmentier

unread,
Jun 18, 2010, 2:11:38 AM6/18/10
to technexion-...@googlegroups.com
Normally if you follow below scenario things should work

Assuming that mtd3 is the kernel partition and mtd4 is the root
partition. Further more also assuming that the kernel is located in
/tmp/uImage and the rootfs is in /tmp/rootfs.tar.gz

1.) flash_eraseall /dev/mtd3
2.) flash_eraseall /dev/mtd4

3.) nandwrite -p /dev/mtd3 /tmp/uImage
4.) mkdir /tmp/flash
5.) mount /dev/mtdblock4 /tmp/flash -t jffs2
6.) cd /tmp/flash
7.) tar xvfz /tmp/rootfs.tar.gz
8.) cd ..
9.) umount /tmp/flash
be sure to use the latest files located at www.technexion.org

Lina Daud

unread,
Jun 23, 2010, 3:50:27 AM6/23/10
to Technexion Thunderpack
Henri,

Thank you for your advice :)
However, I still have errorq when trying to write in NAND:

mtd->read(0x44 bytes from 0xbc728cc) returned ECC error

Finally, I only could run Angstrom via the SD card.

Lina

Henri

unread,
Jun 27, 2010, 11:31:52 PM6/27/10
to Technexion Thunderpack
Lina,

does below helps ??... could post the PDF but don't find a way to do
it, so I just copy & paste it

Simple Tutorial to Boot from Nand Flash

Contents
1 Preface
2 Precondition
3 Make Bootable SDCard
4 Make Binaries for TAO-3530
4.1 Setup and Installed the Toolchain
4.2 Setting Environments
4.3 Config Kernel
4.4 Make Binary files
5 Prepare Rootfs and Kernel in SDCARD
6 Boot and Install to Nand Flash
6.1 Flash Bootload and uImage in U-boot
6.2 Flash Root File System
7 DONE
Preface
This document is used to install and boot from nand flash for
TAO-3530.
Precondition
PC Installed with Linux Environment, Ubuntu or Fedora will be good.
U-boot# : Refers to commands executed under TAO-3503 U-boot
Tao# : Refers to commands executed under TAO-3530 Linux
Host# : Refers to commands executed at PC
Make Bootable SDCard
Current Working Directory : /root/tao-3530
Host# sudo su
Host# mkdir /root/tao-3530
Place the tao-20100625-all.tar.bz2 (http://www.technexion.org/images/
stories/downloads/tao-series/tao-20100625-
all.tar.bz2) in /root/tao-3530
Host# cd /root/tao-3530
Host# tar xjvf tao-20100625-all.tar.bz2
Host# cd tao-20100625
Host# chmox +x mkcard.sh
Insert the empty SDCARD to Your Card Reader. If it is not empty, all
the datum inside will be destroyed.
Host# ./mkcard.sh
Choose the one SDCARD that you wanna to install.
Your Bootable SDCard is Ok to use.
Make Binaries for TAO-3530
Currently, our pre-build uImage is for Thunder. If you don't want to
recompile the kernel, please jump to Prepare
Rootfs and Kernel in SDCARD paragraph.
If you need to use WIFI, please choose the kernel in tao-20100625/
kernel/Mainline-2.6.33.4.
If you don't, tao-20100625/kernel/PSP-03.00.00.05 is
preferred(Currently, we got WIFI bug in this kernl, it will be
Simple Tutorial to Boot from Nand Flash - Technexionrd
http://10.20.30.21/mediawiki/index.php/Simple_Tutorial_to_Boot_from_Nan...
1 of 4 06/25/2010 04:26 PM
fixed latter.).
Setup and Installed the Toolchain
We currently use CodeSourcery (http://www.codesourcery.com/) ARM GNU/
Linux tool chain
(http://www.codesourcery.com/gnu_toolchains/arm/download.html) .
There are other toolchain you can choose. For example, BuildRoot
(http://buildroot.uclibc.org/) .
Download and install it.
Setting Environments
We take CodeSourcery toolchain for example.
The installation folder we choose is /opt/Sourcery_G++_Lite
Export the environment parameter:
Host# export PATH=$PATH:/opt/Sourcery_G++_Lite/bin
Host# export ARCH=arm
Host# export CROSS_COMPILE=arm-none-linux-gnueabi-
Config Kernel
Please make sure your environment is setup as described before
Mainline-2.6.33.4:
Host# cd /root/tao-3530/tao-20100625/kernel/Mainline-2.6.33.4/
linux-2.6.33.4/
PSP-03.00.00.05:
Host# cd /root/tao-3530/tao-20100625/kernel/PSP-03.00.00.05/linux-
omap-2.6
Clean old settings,
Host# make distclean
Thunder:
Host# make omap3_thunder_defconfig
Inferno:
Host# make omap3_inferno_defconfig
Tsunami:
Host# make omap3_tsunami_defconfig
Make Binary files
Host# make uImage
If you can't not make uImage, you will need to install uboot-mkimage
package on your PC.
Host# make modules
Host# mkdir tmp
Host# make modules_install INSTALL_MOD_PATH=`pwd`/tmp
We now copy the kernel and modules to /root/tao-3530 folder
Host# cp arch/arm/boot/uImage /root/tao-3530/uImage.user
Host# cd tmp
Host# tar jcvf ko.tar.bz2 lib
Host# cp ko.tar.bz2 /root/tao-3530/
Done.
Simple Tutorial to Boot from Nand Flash - Technexionrd
http://10.20.30.21/mediawiki/index.php/Simple_Tutorial_to_Boot_from_Nan...
2 of 4 06/25/2010 04:26 PM
Prepare Rootfs and Kernel in SDCARD
Insert the Bootable SDCARD in your PC.
It will be mount to /media/boot and /media/roots by default.
We first make a copy of rootfs in SDCARD.
Host# cp -rfa /root/tao-3530/tao-20100625/rootfs/angstrom /media/
rootfs/home/root/
If you didn't recompile the kernel and modules, please jump to Boot
and Install to Nand Flash paragraph.
We copy the kernel to /media/boot
Host# cp /root/tao-3530/uImage.user /media/boot/
We replace the modules in /media/rootfs/home/root/angstrom
Host# rm -rf /media/rootfs/home/root/angstrom/lib/modules/2.6.32
Host# rm -rf /media/rootfs/home/root/angstrom/lib/modules/2.6.33.4
Host# cd /media/rootfs/home/root/angstrom/
Host# tar xjvf /root/tao-3530/ko.tar.bz2
Host# sync
sync to make sure the file are wrote into the SD Card.
Boot and Install to Nand Flash
Insert SDCARD to TAO-3530. Power it on.
Connect RS-232 cable to TAO-3530 Start RS-232 Console
Flash Bootload and uImage in U-boot
press any key to stop boot process before count down.
Now, you are in U-boot(bootloader)
We first clean and set some parameter.
U-boot# nand erase clean
U-boot# setenv bootdelay '2'
U-boot# saveenv
Initial the the MMC to read from SDCARD
U-boot# mmc init
Flashing X-Loader
U-boot# fatload mmc 0:1 $loadaddr NAND_x-load.bin.ift
U-boot# nandecc hw ; nand erase 0 80000
U-boot# nand write $loadaddr 0 80000
Flashing U-Boot
U-boot# fatload mmc 0:1 $loadaddr u-boot.bin
U-boot# nandecc sw ; nand erase 80000 160000
U-boot# nand write $loadaddr 80000 160000
Flashing the kernel that you want to use.
Our prebuild kernel are uImage-2.6.33.4 and uImage-psp, they are built
for Thunder.
If you compile the kernel follow the instruction we gave, then you
will also have a uImage.user
Simple Tutorial to Boot from Nand Flash - Technexionrd
http://10.20.30.21/mediawiki/index.php/Simple_Tutorial_to_Boot_from_Nan...
3 of 4 06/25/2010 04:26 PM
Use the one that you preferred.
U-boot# fatload mmc 0:1 $loadaddr uImage-2.6.33.4
U-boot# nand erase 280000 400000
U-boot# nand write $loadaddr 280000 400000
U-boot parts are finished, we now boot from SDCARD.
U-boot# run bootcmd
Flash Root File System
Wait until the boot sequence complete. Type root to login.
We create a mount point for nand flash.
Tao# mkdir /mnt/nand
We will use JFFS2 file system for nand flash.
Tao# flash_eraseall -j /dev/mtd4
Now we mount it.
Tao# mount -t jffs2 /dev/mtdblock4 /mnt/nand
Install the rootfs into it.
Tao# cd /home/root/angstrom/
Tao# cp -rfa * /mnt/nand/
Tao# sync
Tao# umount /mnt/nand
Tao# poweroff
Wait until System halted.
Unplug the SDCARD and press the RESET BUTTOM
After you boot from nand flash. Don't forget to do depmod -a to make
sure all modules will work.
Tao# depmod -a
DONE
Retrieved from "http://10.20.30.21/mediawiki/index.php/
Simple_Tutorial_to_Boot_from_Nand_Flash"
This page was last modified on 25 June 2010, at 08:23.
Simple Tutorial to Boot from Nand Flash - Technexionrd
http://10.20.30.21/mediawiki/index.php/Simple_Tutorial_to_Boot_from_Nan...
4 of 4 06/25/2010 04:26 PM

nio

unread,
Jun 28, 2010, 1:23:51 AM6/28/10
to Technexion Thunderpack
Hello Henri,

We should be able to upload files here :
http://groups.google.com/group/technexion-thunderpack/files?upload=1

Henri Parmentier

unread,
Jun 29, 2010, 6:34:26 AM6/29/10
to technexion-...@googlegroups.com
This is what I was thinking too... but try for yourself, no upload option

nio

unread,
Jul 2, 2010, 6:27:23 AM7/2/10
to Technexion Thunderpack
My fault, this should be ok now for every group member to upload files
& create pages...

On 29 juin, 12:34, Henri Parmentier <henri....@gmail.com> wrote:
> This is what I was thinking too... but try for yourself, no upload option
>

Henri

unread,
Jul 4, 2010, 9:53:06 PM7/4/10
to Technexion Thunderpack
Uploaded a simple tutorial from our R&D .. let me know if this works
out now !
Reply all
Reply to author
Forward
0 new messages