DDR2 SDRAM 已经初始化成功,是从 uboot 中找到的初始化代码 mem_setup.S 。
### step 1: make the project and get 9-autorun-demo-sd.bin
limingth@ubuntu:~/Work-Dir/Linux-Codes/9-autorun-demo$ make
arm-linux-as -o start.o start.s
arm-linux-gcc -c -o mem_setup.o mem_setup.S
arm-linux-gcc -Wall -c -o command.o command.c
arm-linux-gcc -Wall -c -o led.o led.c
arm-linux-gcc -Wall -c -o lib.o lib.c
arm-linux-gcc -Wall -c -o main.o main.c
arm-linux-gcc -Wall -c -o nand.o nand.c
arm-linux-gcc -Wall -c -o printf.o printf.c
arm-linux-gcc -Wall -c -o shell.o shell.c
arm-linux-gcc -Wall -c -o stdio.o stdio.c
arm-linux-gcc -Wall -c -o uart.o uart.c
arm-linux-gcc -Wall -c -o xmodem.o xmodem.c
arm-linux-ld -Ttext 0xD0030010 start.o mem_setup.o command.o led.o lib.o main.o nand.o printf.o shell.o stdio.o uart.o xmodem.o -o 9-autorun-demo.elf
arm-linux-objcopy -O binary 9-autorun-demo.elf 9-autorun-demo.bin
arm-linux-objdump -d -j .text 9-autorun-demo.elf > 9-autorun-demo.lst
arm-linux-objdump -d -s -j .data -j .rodata 9-autorun-demo.elf >> 9-autorun-demo.lst
../mktiny210spl.exe 9-autorun-demo.bin 9-autorun-demo-sd.bin
ls -l *.bin
-rwxr-xr-x 1 limingth limingth 7400 2012-05-14 23:22 9-autorun-demo.bin
-rw-r--r-- 1 limingth limingth 8192 2012-05-14 23:22 9-autorun-demo-sd.bin
### step 2: Burn 9-autorun-demo-sd.bin to SD card
limingth@ubuntu:~/Work-Dir/Linux-Codes/9-autorun-demo$ make b
sudo dd iflag=dsync oflag=dsync if=9-autorun-demo-sd.bin of=/dev/sdb seek=1
记录了16+0 的读入
记录了16+0 的写出
8192字节(8.2 kB)已复制,0.00023185 秒,35.3 MB/秒
limingth@ubuntu:~/Work-Dir/Linux-Codes/9-autorun-demo$
### step 3: Reset with SDBOOT and load linux kernel from flash 0x4M to sdram 0x20008000 with size 0x8M
LUMIT $ nand read 0x20008000 0x400000 0x800000
your input: <nand read 0x20008000 0x400000 0x800000>
0: <nand>
1: <read>
2: <0x20008000>
3: <0x400000>
4: <0x800000>
command do <nand>
sdram 0x20008000, nand 0x00400000, size 0x00800000
nand read finished!
LUMIT $ md 0x20008000
your input: <md 0x20008000>
0: <md>
1: <0x20008000>
command do <md>
20008000: E1A00000 E1A00000 E1A00000 E1A00000
20008010: E1A00000 E1A00000 E1A00000 E1A00000
20008020: EA000002 016F2818 00000000 004182D8
20008030: E1A07001 E1A08002 E10F2000 E3120003
20008040: 1A000001 E3A00017 EF123456 E10F2000
20008050: E38220C0 E121F002 00000000 00000000
20008060: E28F00D0 E890387E E0500001 0A00000A
20008070: E0855000 E08BB000 E08CC000 E0822000
20008080: E0833000 E08DD000 E59B1000 E0811000
20008090: E48B1004 E15B000C 3AFFFFFA E3A00000
200080A0: E4820004 E4820004 E4820004 E4820004
200080B0: E1520003 3AFFFFF9 EB000028 E1A0100D
200080C0: E28D2801 E1540002 2A000016 E0840006
200080D0: E1500005 9A000013 E1A05002 E1A00005
200080E0: E1A03007 EB00023C E28000FF E3C0007F
200080F0: E0851000 E28F2FA1 E59F305C E0823003
LUMIT $ go 0x20008000
your input: <go 0x20008000>
0: <go>
1: <0x20008000>
command do <go>
go to address 0x20008000
Uncompressing Linux... done, booting the kernel.
### To be continued
应该还需要给 Kernel 传递一些参数就可以自己来加载启动 Linux kernel 了。
See it also in this link:
https://github.com/limingth/LASO/wiki/4-How-to-boot-linux-kernel-from-nand-flash[ 此帖被limingth在2012-05-15 00:06重新编辑 ]