Embedded Linux for ARM9-ARM926
Duy-Ky Nguyen 2012-04-30
Replace the given root filesystem (rootFS) by new busybox with full feature to support NTPD (get NTP time), UDHCPC (get dynamic IP) Make sure
* Set FANCY_PROMPT for PS1
* Network
+ udhcp : /etc/udhcp/simple.script
Make sure permission of / must be 755 for WWW access
Every Linux BSP come with toolchain used to create the rootFS, so this toolchain must be used in using rootFS/lib
~ Networking Options : [*] IP : DHCP support (NOT BOOTP) NFS Boot
Every CPU has its own boot engine to define what kind of device it supports : parallel / serial interface, NOR / NAND flash, SPI flash, SD card, PC UART,
TI CPU requires u-boot.bin converted into its own format for proper booting : interface (NAND, SPI, ), entry point, sanity check,
There are, unfortunately, no such tools for Linux, so TFTP should be used to send back and forth between Linux and PC. Im not able to run PC tool on Linux using Mono-Framework, unfortunately!
To get u-boot.bin from Linux
tftp -i
10.0.0.15 get u-boot.bin
To put u-boot.ais on Linux
tftp -i
10.0.0.15 put u-boot.ais
TI AISGen converts u-boot.bin into u-boot.ais to boot from SPI, NAND,
HexAIS_OMAP-L138.exe -ini OMAP-L138.ini -o
u-boot-spi.ais -entrypoint 0xc1080000 u-boot.bin@0xc1080000
HexAIS_OMAP-L138.exe -ini OMAP-L138_nand_D800K002.ini
-o u-boot-nand.ais -entrypoint 0xc1080000 u-boot.bin@0xc1080000
TI has a AISGen tool, while Atmel has Sam-Ba
For TI board AM1808 and OMAP-L138, the bootable image u-boot.ais is flashed via PC serial comm. Using the TI utility sfh_OMAP-L138.exe.
The board must be set to boot in UART mode, so on-board DIP-switch must be set in UART-boot.
sfh_OMAP-L138.exe -flash_noubl u-boot-spi.ais
sfh_OMAP-L138.exe -targetType AM1808 -flashType
NAND -flash_noubl u-boot-nand.ais
NOTE
If AM1808 has SPI flash, the flashing uses SPI Boot Device method
TI OMAP EVB has SPI flash as boot device. A GZ INITRD could be used as RO filesystem stored on SPI flash due to its limited size of 8 MB. Its SD card could be used to store a full filesystem.
OMAP-L138 EVM
SBC8018
SBC6000X
U-Boot cmd : ?, help nand, run ,
Logic-PD OMAP-L138 |
SBC8018 AM1808 |
SBC6000X AT91SAM9261 |
arm-2009q1-203-arm-none-linux-gnueabi.bin |
arm-2009q1-203-arm-none-linux-gnueabi.bin |
arm-linux-gcc-3.4.5-glibc-2.3.6-linux.tar.bz2 |
uboot-03.21.00.04 make da850evm_config |
uboot-03.20.00.14 make da850evm_config |
u-boot-1.3.4 at91sam9261ek_nandflash_config |
linux-03.21.00.04 make da850_omapl138_defconfig > diff PHY |
linux-03.20.00.14 make sbc8018_defconfig > diff PHY |
linux-2.6.24 arch/arm/configs/sbc6000x_defconfig |
SPI Flash @ 0 000000 : Ubt (+40000) 040000 : Ubt-Env (+10000) 050000 : kernel (+230000) 280000 : RFS - initrd |
NAND Flash @ 20000 000000 : Ubt-Env 020000 : Ubt 200000 : kernel 600000 : rootFS |
NAND Flash 0000000 : Raw boot 0020000 : Uboot 0080000 : Env 01A0000 : uImage 31A0000 : rootFS |
HexAIS of SPI with uboot.bin |
HexAIS of NAND with uboot.bin |
SamBa |
Sf probe 0 Tftp addr file Sf erase 0 100000 Sf write addr 0 $filesize |
Tftp addr file Nand erase 20000 40000 Nand write.i addr 20000 $filesize |
Nand write.yaffs
|
|
Logic-PD OMAP-L138 |
SBC8018 AM1808 |
|
LEDs |
I2C IO-Expander |
LED[1,2,3] GPIO5[9,8,7] |
|
Button |
|
Button[1,2,3] GPIO5[12,11,10] |
|
|
|
|
|
UART Boot
SPI Boot
Emulation
UART-Boot is used to burn bootloader in case failure of boot using network for system update
SPI-Boot is used for Linux system
NFS boot : both kernel and rootfs on Linux host
SPI boot : both kernel and initrd rootfs on SPI flash
SD boot : kernel on SPI flash, while rootfs on SD
UBt > pri
baudrate=115200
bootargs=mem=32M console=ttyS2,115200n8 root=/dev/mmcblk0p2 rw rootwait ip=off
bootcmd=run spi.boot
bootdelay=3
consDev=ttyS2,115200n8
ethact=DaVinci-EMAC
ethaddr=00:12:34:56:78:92
lnxBase=0x50000
ubtSize=0x50000
lnxSize=0x230000
rfsBase=0x280000
rfsSize=0x570000
loadaddr=0xC0000000
rfsAddr=0xC1180000
ipaddr=10.1.1.122
serverip=10.1.1.5
mmc.args=setenv bootargs root=/dev/mmcblk0p2 rw console=$consDev rootwait
mmc.boot=run mmc.args; sf probe 0; sf read $loadaddr $lnxBase $lnxSize; bootm $loadaddr
bootfile="_uImg_"
rfspath=/home/duyky/_NFS/_RFS
rootpath="/home/duyky/TFTP"
moreBtArgs=ignore_loglevel
nfsOpts=wsize=1500,rsize=1500
nfs.args=setenv bootargs console=$consDev root=/dev/nfs rw nfsroot=$serverip:$rfspath,$nfsOpts ip=dhcp $moreBtArgs
nfs.boot=run nfs.args; tftp $loadaddr $bootfile; bootm $loadaddr
spi.rfs=sf probe 0; sf erase $rfsBase $rfsSize; tftp $loadaddr _rfs_GZ; sf write $loadaddr $rfsBase $filesize
spi.lnx=sf probe 0; sf erase $lnxBase $lnxSize; tftp $loadaddr $bootfile; sf write $loadaddr $lnxBase $filesize
spi.ubt=sf probe 0; sf erase 0 $ubtSize; tftp $loadaddr _ubt_S_AIS; sf write $loadaddr 0 $filesize
spi.args=setenv bootargs mem=32M console=$consDev rootfs=/dev/ram0 rw initrd=$rfsAddr,6M
spi.mfs=sf probe 0; sf read $rfsAddr $rfsBase $rfsSize; sf read $loadaddr $lnxBase $lnxSize; bootm $loadaddr
spi.boot=run spi.args; run spi.mfs
stderr=serial
stdin=serial
stdout=serial
ver=U-Boot 2010.12 (May 11 2012 - 19:15:53)
Environment size: 1553/65532 bytes
UBt >
bootfile="_uImg_"
rootpath="/home/duyky/TFTP"
nfsOpts=wsize=1500,rsize=1500
rfspath=/home/duyky/_NFS/_RFS
moreBtArgs=ignore_loglevel
nfsroot=$serverip:$rfspath,$nfsOpts ip=dhcp $moreBtArgs
nfs.args=setenv bootargs console=$consDev root=/dev/nfs rw
nfs.lnx=tftp $loadaddr $bootfile
nfs.boot=run nfs.args; run nfs.lnx; bootm $loadaddr
UBt > run nfs.boot
Based on SPI flash map, were able to store initrd.ext2.gz up to 5.8 MB, so roughly 3x size for regular .initrd.ext2, so lets create an ext2 image of 16 MB
RDSIZE=16000
BLKSIZE=1024
# Create a file of 16M
dd if=/dev/zero of=./initrd.ext2 bs=$BLKSIZE count=$RDSIZE
# format it with EXT2
/sbin/mke2fs -F -m 0 -b $BLKSIZE ./initrd.ext2 $RDSIZE
# Mount it as a block device with -o loop
mount -t ext2 -o loop ./initrd.ext2 ./_Init_RD
Create a minimum filesystem with busybox and populate into this folder ./_Init_RD
# Back-Populate to the file
Umount ./_Init_RD
# Zip the file (gzip/gunzip for a file, tar for a folder)
Gzip ./initrd.ext2
spi.args=setenv bootargs mem=32M console=$consDev rootfs=/dev/ram0 rw initrd=$rfsAddr,6M
spi.mfs=sf probe 0; sf read $rfsAddr $rfsBase $rfsSize; sf read $loadaddr $lnxBase $lnxSize; bootm $loadaddr
spi.boot=run spi.args; run spi.mfs
UBt > run spi.boot
mmc.args=setenv bootargs root=/dev/mmcblk0p2 rw console=$consDev rootwait
mmc.boot=run mmc.args; sf probe 0; sf read $loadaddr $lnxBase $lnxSize; bootm $loadaddr
UBt > run mmc.boot
Do MAKE to compile and get binary raw boot below
Bootstrap-v1.11/board/at91sam9261ek/nandflash/nandflash_at91sam9261ek.bin
Use SAMBA/NAND to burn @ 0, Enable NAND first
Replace the given rootFS with new busybox with config below
* Set FANCY_PROMPT for PS1
* Network
+ udhcp : /etc/udhcp/simple.script
Remove some features not supported by old GCC-3.4.5, like nice, ubi*
Use SAMBA/NAND to burn @ 0x20000, Enable NAND first
U-Boot>
U-Boot> pri
bootargs=console=ttyS0,115200 console=tty0 tft=320x240 root=/dev/mtdblock6 mtdparts=at91_nand:128k(bootstrap)ro,256k(uboot)ro,128k(e
nv1)ro,128k(env2)ro,1M(logo)ro,2M(linux),-(root) rw rootfstype=yaffs2
bootcmd=nand read 0x22000000 0x1A0000 0x200000; bootm 0x22000000
bootdelay=3
baudrate=115200
ethaddr=00:12:34:56:78:94
ipaddr=10.1.1.236
serverip=10.1.1.5
gatewayip=10.1.1.1
netmask=255.255.255.0
loadaddr=0x22000000
ubtAddr=20000
ubtEnv=80000
ubtSize=40000
lnxAddr=1a0000
lnxSize=200000
rfsAddr=3a0000
mfsAddr=21100000
conDev=ttyS0,115200
moreBtArgs=ignore_loglevel
nfsOpts=wsize=1500,rsize=1500
rfspath=/home/duyky/_NFS/AT_RFS
nfs.args=setenv bootargs console=${conDev} root=/dev/nfs rw nfsroot=${serverip}:${rfspath},${nfsOpts} ip=dhcp ${moreBtArgs}
nfs.lnx=tftp ${loadaddr} AT_ARM/_AT_uImg
nfs.boot=run nfs.args; run nfs.lnx; bootm ${loadaddr}
rd.mfs=tftp ${mfsAddr} AT_ARM/_AT_MFS
rd.args=setenv bootargs initrd=${mfsAddr},6M root=/dev/ram0 rw console=${conDev}
rd.boot=run rd.args; rd.mfs; tftp 20400000 AT_ARM/_AT_uImg; bootm 20400000
mtdparts=mtdparts=at91_nand:128k(bootstrap)ro,256k(uboot)ro,128k(env1)ro,128k(env2)ro,1M(logo)ro,2M(linux),-(root)
nd.env=nand erase ${ubtEnv} 10000
nd.ubt=nand erase ${ubtAddr} ${ubtSize}; tftp ${loadaddr} AT_ARM/_AT_ubt; nand write ${loadaddr} ${ubtAddr} ${ubtSize}
nd.lnx=nand erase ${lnxAddr} ${lnxSize}; tftp ${loadaddr} AT_ARM/_AT_uImg; nand write ${loadaddr} ${lnxAddr} ${lnxSize}
nd.rfs=nand erase ${rfsAddr}; tftp ${loadaddr} AT_ARM/_AT_RFS; nand write.yaffs ${loadaddr} ${rfsAddr} ${filesize}
nd.args=setenv bootargs console=${conDev} root=/dev/mtdblock6 ${mtdparts} rw rootfstype=yaffs2
sd.args=setenv bootargs root=/dev/mmcblk0p1 rw console=${conDev} rootwait
nd.krnl=nand read ${loadaddr} ${lnxAddr} ${lnxSize}
nd.boot=run nd.args; run nd.krnl; bootm ${loadaddr}
sd.boot=run sd.args; run nd.krnl; bootm ${loadaddr}
uutt=tftp 40000 _ub_tst_; go 40004
bootcmd=run nfs.boot
Environment size: 1935/131067 bytes
U-Boot>
Kernel mod
Networking Options : [*] IP : DHCP support -> NFS boot gets IP via DHCP
conDev=ttyS0,115200
moreBtArgs=ignore_loglevel
nfsOpts=wsize=1500,rsize=1500
rfspath=/home/duyky/_NFS/AT_RFS
nfs.args=setenv bootargs console=${conDev} root=/dev/nfs rw nfsroot=${serverip}:${rfspath},${nfsOpts} ip=dhcp ${moreBtArgs}
nfs.lnx=tftp ${loadaddr} AT_ARM/_AT_uImg
nfs.boot=run nfs.args; run nfs.lnx; bootm ${loadaddr}
U-Boot> run nfs.boot
nd.env=nand erase ${ubtEnv} 10000
nd.ubt=nand erase ${ubtAddr} ${ubtSize}; tftp ${loadaddr} AT_ARM/_AT_ubt; nand write ${loadaddr} ${ubtAddr} ${ubtSize}
nd.lnx=nand erase ${lnxAddr} ${lnxSize}; tftp ${loadaddr} AT_ARM/_AT_uImg; nand write ${loadaddr} ${lnxAddr} ${lnxSize}
nd.rfs=nand erase ${rfsAddr}; tftp ${loadaddr} AT_ARM/_AT_RFS; nand write.yaffs ${loadaddr} ${rfsAddr} ${filesize}
nd.args=setenv bootargs console=${conDev} root=/dev/mtdblock6 ${mtdparts} rw rootfstype=yaffs2
sd.args=setenv bootargs root=/dev/mmcblk0p1 rw console=${conDev} rootdelay=5
nd.krnl=nand read ${loadaddr} ${lnxAddr} ${lnxSize}
nd.boot=run nd.args; run nd.krnl; bootm ${loadaddr}
U-Boot> run nd.boot
Make sure permission of / is 755 for HTM access
sd.args=setenv bootargs root=/dev/mmcblk0p1 rw console=${conDev} rootwait
nd.krnl=nand read ${loadaddr} ${lnxAddr} ${lnxSize}
sd.boot=run sd.args; run nd.krnl; bootm ${loadaddr}
U-Boot> run sd.boot
Serial boot NAND boot
TI AISGen tool cis used to add raw boot into u-boot.bin to make it bootable. AISGen allows us to do chip init, like PLL, DDR, boot mode,
set BaseName=ubt-nnd-0a1
HexAIS_OMAP-L138.exe -ini OMAP-L138_nand_D800K002.ini -o %BaseName%.ais -entrypoint 0xc1080000 %BaseName%.bin@0xc1080000
set BaseName=ubt-nnd-0a0
sfh_OMAP-L138.exe -targetType AM1808 -flashType NAND -flash_noubl %BaseName%.ais
U-Boot > nand erase (the whole NAND)
U-Boot> nandecc sw (SW instead of HW)
Setenv ipaddr
Setenv serverip
Ping
Tftp m_addr FileName
Nand erase N_addr size
Nand write.i m_addr n_addr $filesize
UBT > nand erase ;; all NAND
UBT > tftp c0700000 ubt-nd.ais; nandecc sw; nand write.i c0700000 20000 $filesize ;; u-boot-nd.ais
UBT > tftp c0700000 uImage; nandecc sw; nand write.i c0700000 200000 $filesize ;; kernel
UBT > tftp c0700000 jffs2.img; nandecc sw; nand write.i c2000000 6000000 $filesize ;; kernel
U-Boot >
bootdelay=3
baudrate=115200
ethaddr=00:12:34:56:78:01
ipaddr=10.1.1.122
serverip=10.1.1.5
rootpath="/home/duyky/TFTP"
loadaddr=0xC2000000
ubtAddr=20000
lnxAddr=200000
rfsAddr=600000
mtdids=nand0=nand0
mtdparts=mtdparts=nand0:128K(u-env),1920K(u-boot),4M(kernel),-(jffs2)
consDev=ttyS2,115200n8
bootfile="_uImg_nnd"
rfspath=/home/duyky/_NFS/_RFS
nfs.lnx=tftp $loadaddr $bootfile
nfsOpts=wsize=1500,rsize=1500
moreBtArgs=ignore_loglevel
nfs.args=setenv bootargs console=$consDev root=/dev/nfs rw nfsroot=$serverip:$rfspath,$nfsOpts ip=dhcp $moreBtArgs
nfs.boot=run nfs.args; run nfs.lnx; bootm $loadaddr
nd.ubt=nand erase 0 60000; tftp $loadaddr _ubt_AIS; nandecc sw; nand write.i $loadaddr $ubtAddr $filesize
nd.lnx=nand erase $lnxAddr 300000; tftp $loadaddr _uImg_ND; nandecc sw; nand write.i $loadaddr $lnxAddr $filesize
nd.rfs=nand erase $rfsAddr 600000; tftp $loadaddr _nd_RFS; nandecc sw; nand write.i $loadaddr $rfsAddr $filesize
nd.args=setenv bootargs root=/dev/mtdblock4 rootfstype=jffs2 rw $consDev $mtdparts
nd.krnl=nandecc sw; nand read $loadaddr $lnxAddr 0x280000
nd.boot=run nd.args; run nd.krnl; bootm $loadaddr
sd.boot=run sd.args; run nd.krnl; bootm $loadaddr
sd.args=setenv bootargs root=/dev/mmcblk0p1 rw $consDev rootwait
bootcmd=run nd.boot
uutt=tftp 40000 _ub_tst_; go 40004
stdin=serial
stdout=serial
stderr=serial
ver=U-Boot 2009.11 (May 07 2012 - 21:44:27)
Environment size: 1411/131068 bytes
U-Boot >
U-Boot > run nd.boot
SW ECC selected
nd.args=setenv bootargs root=/dev/mtdblock4 rootfstype=jffs2 rw $consDev $mtdparts
nd.krnl=nandecc sw; nand read $loadaddr $lnxAddr 0x280000
nd.boot=run nd.args; run nd.krnl; bootm $loadaddr
root@sbc8018:~#
bootfile="_uImg_nnd"
rfspath=/home/duyky/_NFS/_RFS
nfs.lnx=tftp $loadaddr $bootfile
nfsOpts=wsize=1500,rsize=1500
moreBtArgs=ignore_loglevel
nfs.args=setenv bootargs console=$consDev root=/dev/nfs rw nfsroot=$serverip:$rfspath,$nfsOpts ip=dhcp $moreBtArgs
nfs.boot=run nfs.args; run nfs.lnx; bootm $loadaddr
U-Boot > run nfs.boot
sd.boot=run sd.args; run nd.krnl; bootm $loadaddr
sd.args=setenv bootargs root=/dev/mmcblk0p1 rw $consDev rootwait
U-Boot > run sd.boot
SW ECC selected