Embedded Linux for ARM11 - Tiny6410 Eva-Board
Duy-Ky Nguyen 2012-05-05
There’re 2 switches : Power & Boot : NAND(Outward) SD(Inward)
The main limitation of the current Tiny6410 FriendlyARM Linux is its usage of proprietary boot loader called “superboot” to boot from SD
Now we’ll use open-source u-boot for the job. In doing so, we would have to
· Disable FriendlyARMMenu() in common/main.c
· Enable CFG_CMD_RUN (run) & CFG_CMD_BOOTD (boot) in CONFIG_COMMANDS in include/configs/mini6410.h
· Create 2 GB Sandisk with 2 partitions : 20MB-FAT and the rest with Ext2. Only Sandisk appears bootable and 2 GB is max allowed. The FAT partition is created just for SD-Flasher to see it and burn boot image. The Ext2 one is used for root filesystem. The Ext3 and Ext4 are not recommended as they update writing to mush, so wear out the flash too quick
· Enable some necessary cmds by add or move from ~() to () within CONFIG_COMMANDS in include/configs/mini6410.h
o run CFG_CMD_RUN
o boot CFG_CMD_BOOTD
· Add cmd “getenv” to load default env to save for update env in newly built u-boot.bin
o common/env_movi.c
§ #include <command.h> // add cmd
§ int do_getenv=0;
§ static void use_default() : do_getenv = 1;
§ U_BOOT_CMD(
§ getenv, 1, 0, use_default,
§ "getenv - load default environment variables\n",
§ "\n"
§ );
o common/hush.c : to avoid complaint “exit not allowed from main input shell”
§ if (do_getenv)
§ do_getenv = 0;
§ else
§ printf("exit not allowed from main input shell.\n");
· Disable FriendlyARMMenu() in common/main.c
o Add cmd “menu” for FriendlyARMMenu(), instaed
make distclean
make mini6410_nand_config-ram256
make CROSS_COMPILE=arm-linux-
The original config includes initRamFs for awareness of fiflesystem in mounting filesystem
Linux kernel supports all types of filesystem, so the requirement above is redundant. So I remove it in Initramfs source file(s)
(script/FriendlyARM.cpio) -> ()
Copy config_mini6410_n43 as .config
make menuconfig
General setup à
Cross-compiler :
arm-linux-
Initial RAM fiflesystem and RAM disk (initramfs/initrd) support
() Initramfs source file(s)
Use SD-Flasher to load u-boot.bin to SD card. Once it on the card, u-boot can load itself over network.
CONFIG_LOADADDR 0xC0008000 // a virtual addr of 0x50008000, this not allowed to use
To burn u-boot
tftp $loadaddr _ubt_SD; movi write u-boot $loadaddr;
To burn kernel
tftp $loadaddr _lnx_SD; movi write zImage $loadaddr;
To load and run kernel
movi read zImage $loadaddr; bootm $loadaddr
Remark 1
No need to do movi erase
To run NFS boot
"rfspath=/home/duyky/_NFS/_RFS\0" \
nfsOpts=,wsize=1500,rsize=1500
moreBtArgs=ignore_loglevel
"nfs.args=setenv bootargs noinitrd console=${consoledev} root=/dev/nfs rw nfsroot=${serverip}:${rfspath}${nfsOpts} ip=dhcp ${moreOptArgs}\0" \
"nfs.lnx=tftp $loadaddr $bootfile\0" \
"nfs.boot=run nfs.args; run nfs.lnx; bootm $loadaddr\0" \
U-Boot 1.1.6 (May 6 2012 - 13:01:16) - Tiny6410
CPU: S3C6410@532MHz
Fclk = 532MHz, Hclk = 133MHz, Pclk = 66MHz, Serial = CLKUART (SYNC Mode)
Board: MINI6410
DRAM: 256 MB
Flash: 0 kB
NAND: No NAND device found!!!
0 MB
MMC: 1887 MB
In: serial
Out: serial
Err: serial
MAC: 00:12:34:56:78:93
Hit any key to stop autoboot: 0
Tiny6410 > pri
bootargs=root=/dev/mtdblock2 console=ttySAC0,115200
bootdelay=3
baudrate=115200
ethaddr=00:12:34:56:78:93
ipaddr=10.1.1.123
serverip=10.1.1.5
rootpath="/home/duyky/TFTP"
gatewayip=10.1.1.1
netmask=255.255.255.0
bootfile="_zImg_SD"
loadaddr=0xC0008000
consoledev=ttySAC0,115200
sd.ubt=tftp $loadaddr _ubt_SD; movi write u-boot $loadaddr
sd.lnx=tftp $loadaddr $bootfile; movi write zImage $loadaddr
nd.ubt=nand erase 0 60000; tftp $loadaddr _ubt_nnd; nand write.i $loadaddr $ubtAddr $filesize
nd.lnx=nand erase $lnxAddr 300000; tftp $loadaddr _uImg_nnd; nand write.i $loadaddr $lnxAddr $filesize
nd.rfs=nand erase $rfsAddr 600000; tftp $loadaddr _nn_rfs_; nand write.i $loadaddr $rfsAddr $filesize
nd.args=setenv bootargs root=/dev/mtdblock2 rootfstype=jffs2 rw $consoledev $mtdparts
nd.krnl=nand read.i $loadaddr 80000 500000
rfspath=/home/duyky/_NFS/_RFS
nfs.lnx=tftp $loadaddr $bootfile
uutt=tftp 40000 _ub_tst_; go 40004
nfs.boot=run nfs.args; run nfs.lnx; bootm $loadaddr
nd.boot=run nd.args; run nd.krnl; bootm $loadaddr
sd.boot=run sd.args; movi read zImage $loadaddr; bootm $loadaddr
moreBtArgs=ignore_loglevel
sd.args=setenv bootargs root=/dev/mmcblk0p2 rw console=$consoledev rootwait
nfsOpts=wsize=1500,rsize=1500
nfs.args=setenv bootargs console=$consoledev root=/dev/nfs rw nfsroot=$serverip:$rfspath,$nfsOpts ip=dhcp $moreBtArgs
bootcmd=run sd.boot
stdin=serial
stdout=serial
stderr=serial
Environment size: 1402/131068 bytes
Tiny6410 >
Tiny6410 >
U-Boot 1.1.6 (May 3 2012 - 22:54:42) for FriendlyARM MINI6410
[root@FriendlyARM /]#
NAND mux addr and data so there’s NAND controller to demux them, as SDRAM, so u-boot is composed of 2 stages. First booting stage will run from NAND controller to load the main 2nd stage into RAM. The first stage is known as bootstrap or raw boot.
When uboot-nand.bin is created, it is 2nd booting image. FriendlyARM tool will include first booting image into this image and burn into NAND. Unfortunately, FriendlyARM hides this kind of info
The easiest way to use FriendlyARM tool to burn the whole lot : u-boot, kernel and filesystem, is to copy the wanted files onto SD and let superboot do the rest
1) Use SD-Flasher.exe to load superboot-6410.bin onto FAT-formated SD card
2) Create folder “images”
images
FriendlyARM.ini
Linux
rootfs_qtopia_qt4.ext3
rootfs_qtopia_qt4-mlc2.ubi
u-boot_nand-ram256.bin
zImage_n43
where FriendlyARM.ini content is
#This line cannot be removed. by FriendlyARM(www.arm9.net)
CheckOneButton=No
Action=install
OS= Linux
#################### Linux #####################
Linux-BootLoader = Linux/u-boot_nand-ram256.bin
Linux-Kernel = Linux/zImage_h43
Linux-CommandLine = root=ubi0:FriendlyARM-root ubi.mtd=2 rootfstype=ubifs init=/linuxrc console=ttySAC0,115200
Linux-RootFs-InstallImage = linux/rootfs_qtopia_qt4-mlc2.ubi
Linux-RootFs-RunImage = Linux/rootfs_qtopia_qt4.ext3
XSELNAN D |
OM[4:0] |
GPN[15:13 ] |
Boot Device |
Function |
Clock Source |
1 |
0000X |
XXX |
RESERVED |
RESERVED |
XXTIpll if OM[0] is 0. XEXTCLK if OM[0] is 1.
|
1 |
0001X |
RESERVED |
|||
1 |
0010X |
RESERVED |
|||
1 |
0011X |
RESERVED |
|||
X |
0100X |
SROM(8bit) |
- |
||
X |
0101X |
SROM(16bit) |
- |
||
0 |
0110X |
OneNAND1) |
Don’t use NAND Device |
||
X |
0111X |
MODEM |
Don’t use Xm0CSn2 for SROMC |
||
X |
1111X |
0 |
IROM2) |
SD/MMC(CH0) |
|
0 |
1 |
OneNAND |
|||
1 |
10 |
NAND(512Byte, 3-Cycle) |
|||
1 |
11 |
NAND(512Byte, 4-Cycle) |
|||
1 |
100 |
NAND(2048Byte, 4-Cycle) |
|||
1 |
101 |
NAND(2048Byte, 5-Cycle) |
|||
1 |
110 |
NAND(4096Byte, 5-Cycle) |
|||
X |
111 |
SD/MMC(CH1) |
Note 1) Only 6410X PoP D type doesn’t support OneNAND booting.
Note 2) 6410X PoP A type doesn’t support IROM booting based on NAND Flash. 6410X PoP D type doesn’t
support IROM booting based on OneNAND Flash.