4 How to boot linux kernel from nand flash - limingth/LASO GitHub Wiki
DDR2 SDRAM 已经初始化成功,是从 uboot 中找到的初始化代码 mem_setup.S 。
limingth@ubuntu:~/Work-Dir/Linux-Codes/9-linux-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-linux-demo.elf
arm-linux-objcopy -O binary 9-linux-demo.elf 9-linux-demo.bin
arm-linux-objdump -d -j .text 9-linux-demo.elf > 9-linux-demo.lst
arm-linux-objdump -d -s -j .data -j .rodata 9-linux-demo.elf >> 9-linux-demo.lst
../mktiny210spl.exe 9-linux-demo.bin 9-linux-demo-sd.bin
ls -l *.bin
-rwxr-xr-x 1 limingth limingth 8148 2012-05-15 14:54 9-linux-demo.bin
-rw-r--r-- 1 limingth limingth 8192 2012-05-15 14:54 9-linux-demo-sd.bin
limingth@ubuntu:~/Work-Dir/Linux-Codes/9-linux-demo$
limingth@ubuntu:~/Work-Dir/Linux-Codes/9-linux-demo$ make b
mount | grep sdb
/dev/sdb1 on /media/FRIENDLYARM type vfat (rw,nosuid,nodev,uhelper=udisks,uid=1001,gid=1001,shortname=mixed,dmask=0077,utf8=1,flush)
sudo dd iflag=dsync oflag=dsync if=9-linux-demo-sd.bin of=/dev/sdb seek=1
记录了16+0 的读入
记录了16+0 的写出
8192字节(8.2 kB)已复制,0.0831595 秒,98.5 kB/秒
limingth@ubuntu:~/Work-Dir/Linux-Codes/9-linux-demo$
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.
ECDA109544
May 15 2012 14:54:50
welcome to my boot v1.0
LUMIT $ bootm
your input: <bootm>
0: <bootm>
command do <bootm>
loading linux from NandFlash 4M to SDRAM 0x20008000...
lumit boot linux now...
Uncompressing Linux... done, booting the kernel.
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Linux version 2.6.35.7-FriendlyARM (root@jensen) (gcc version 4.5.1 (ctng-1.8.1-FA) ) #1 PREEMPT Thu Mar 1 17:38:57 HKT 2012
[ 0.000000] CPU: ARMv7 Processor [412fc082] revision 2 (ARMv7), cr=10c53c7f
[ 0.000000] CPU: VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
[ 0.000000] Machine: MINI210
[ 0.000000] Memory policy: ECC disabled, Data cache writeback
[ 0.000000] Normal zone: 1 pages exceeds realsize 0
[ 0.000000] Normal zone: 1 pages exceeds realsize 0
[ 0.000000] Normal zone: 1 pages exceeds realsize 0
[ 0.000000] MINI210: H43 selected
[ 0.000000] CPU S5PV210/S5PC110 (id 0x43110220)
[ 0.000000] S3C24XX Clocks, Copyright 2004 Simtec Electronics
[ 0.000000] S5PV210: PLL settings, A=1000000000, M=667000000, E=80000000 V=108000000
[ 0.000000] S5PV210: ARMCLK=1000000000, HCLKM=200000000, HCLKD=166750000
[ 0.000000] HCLKP=133400000, PCLKM=100000000, PCLKD=83375000, PCLKP=66700000
[ 0.000000] sclk_dmc: source is sclk_a2m (0), rate is 200000000
[ 0.000000] sclk_onenand: source is hclk_dsys (1), rate is 83375000
[ 0.000000] sclk: source is mout_mpll (6), rate is 66700000
[ 0.000000] sclk: source is mout_mpll (6), rate is 66700000
[ 0.000000] sclk: source is mout_mpll (6), rate is 66700000
[ 0.000000] sclk: source is mout_mpll (6), rate is 66700000
[ 0.000000] sclk_mixer: source is sclk_dac (0), rate is 108000000
[ 0.000000] sclk_spdif: source is sclk_audio (0), rate is 24000000
[ 0.000000] sclk_fimc: source is ext_xtal (0), rate is 24000000
[ 0.000000] sclk_fimc: source is ext_xtal (0), rate is 24000000
[ 0.000000] sclk_fimc: source is ext_xtal (0), rate is 24000000
[ 0.000000] sclk_cam0: source is ext_xtal (0), rate is 24000000
[ 0.000000] sclk_cam1: source is ext_xtal (0), rate is 24000000
[ 0.000000] sclk_fimd: source is ext_xtal (0), rate is 24000000
[ 0.000000] sclk_mmc: source is mout_epll (7), rate is 80000000
[ 0.000000] sclk_mmc: source is mout_epll (7), rate is 80000000
[ 0.000000] sclk_mmc: source is mout_epll (7), rate is 80000000
[ 0.000000] sclk_mmc: source is mout_epll (7), rate is 80000000
[ 0.000000] sclk_mfc: source is sclk_a2m (0), rate is 200000000
[ 0.000000] sclk_g2d: source is sclk_a2m (0), rate is 200000000
[ 0.000000] sclk: source is sclk_a2m (0), rate is 200000000
[ 0.000000] sclk_csis: source is ext_xtal (0), rate is 24000000
[ 0.000000] sclk_spi: source is ext_xtal (0), rate is 24000000
[ 0.000000] sclk_spi: source is ext_xtal (0), rate is 24000000
[ 0.000000] sclk_pwi: source is ext_xtal (0), rate is 24000000
[ 0.000000] sclk_pwm: source is ext_xtal (0), rate is 24000000
[ 0.000000] sclk_mdnie: source is ext_xtal (0), rate is 24000000
[ 0.000000] sclk_mdnie_pwm: source is ext_xtal (0), rate is 24000000
[ 0.000000] s5pv210: 37748736 bytes system memory reserved for mfc at 0x20b75000
[ 0.000000] s5pv210: 37748736 bytes system memory reserved for mfc at 0x22f75000
[ 0.000000] s5pv210: 25165824 bytes system memory reserved for fimc0 at 0x25375000
[ 0.000000] s5pv210: 10137600 bytes system memory reserved for fimc1 at 0x26b75000
[ 0.000000] s5pv210: 25165824 bytes system memory reserved for fimc2 at 0x27520000
[ 0.000000] s5pv210: 8388608 bytes system memory reserved for jpeg at 0x28d20000
[ 0.000000] s5pv210: 1044480 bytes system memory reserved for fimd at 0x29520000
[ 0.000000] s5pv210: 4194304 bytes system memory reserved for texstream at 0x2961f000
[ 0.000000] s5pv210: 5683200 bytes system memory reserved for pmem at 0x29a1f000
[ 0.000000] s5pv210: 3379200 bytes system memory reserved for pmem_gpu1 at 0x29f8b000
[ 0.000000] s5pv210: 1536000 bytes system memory reserved for pmem_adsp at 0x2a2c4000
[ 0.000000] s5pv210: 8388608 bytes system memory reserved for g2d at 0x2a43b000
[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 65024
[ 0.000000] Kernel command line: root=/dev/mtdblock4 console=ttySAC0,115200 init=/linuxrc lcd=H43
[ 0.000000] PID hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.000000] Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
[ 0.000000] Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
[ 0.000000] Memory: 256MB = 256MB total
[ 0.000000] Memory: 85600k/85600k available, 176544k reserved, 0K highmem
[ 0.000000] Virtual kernel memory layout:
[ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB)
[ 0.000000] fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
[ 0.000000] DMA : 0xff000000 - 0xffe00000 ( 14 MB)
[ 0.000000] vmalloc : 0xd0800000 - 0xfc000000 ( 696 MB)
[ 0.000000] lowmem : 0xc0000000 - 0xd0000000 ( 256 MB)
[ 0.000000] modules : 0xbf000000 - 0xc0000000 ( 16 MB)
[ 0.000000] .init : 0xc0008000 - 0xc016e000 (1432 kB)
[ 0.000000] .text : 0xc016e000 - 0xc07c0000 (6472 kB)
[ 0.000000] .data : 0xc07c0000 - 0xc0907b40 (1311 kB)
[ 0.000000] SLUB: Genslabs=9, HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=4
[ 0.000000] Hierarchical RCU implementation.
[ 0.000000] RCU-based detection of stalled CPUs is disabled.
[ 0.000000] Verbose stalled-CPUs detection is disabled.
[ 0.000000] NR_IRQS:393
[ 0.000000] VIC @fd000000: id 0x00041192, vendor 0x41
[ 0.000000] VIC @fd010000: id 0x00041192, vendor 0x41
[ 0.000000] VIC @fd020000: id 0x00041192, vendor 0x41
[ 0.000000] VIC @fd030000: id 0x00041192, vendor 0x41
[ 0.000000] mult[140737]
[ 0.000000] max_delta_ns[2937815369]
[ 0.000000] min_delta_ns[30517]
[ 0.000000] rate[32768]
[ 0.000000] HZ[256]
[ 0.000000] Console: colour dummy device 80x30
[ 0.000000] console [ttySAC0] enabled
[ 0.490865] Calibrating delay loop... 998.15 BogoMIPS (lpj=1949696)
[ 0.574142] pid_max: default: 32768 minimum: 301
[ 0.574234] Mount-cache hash table entries: 512
[ 0.574560] Initializing cgroup subsys debug
[ 0.574604] Initializing cgroup subsys cpuacct
[ 0.574646] Initializing cgroup subsys freezer
[ 0.576741] CPU: Testing write buffer coherency: ok
[ 0.583678] regulator: core version 0.5
[ 0.585512] NET: Registered protocol family 16
[ 0.595878] MINI210: H43 selected
[ 0.595915] S3C Power Management, Copyright 2004 Simtec Electronics
[ 0.599357] pmstats at 00000000
[ 0.602627] mini210_setup_clocks: sclk_mmc: source is mout_mpll, rate is 47642857
[ 0.609946] mini210_setup_clocks: sclk_mmc: source is mout_mpll, rate is 47642857
[ 0.617393] mini210_setup_clocks: sclk_mmc: source is mout_mpll, rate is 47642857
[ 0.624844] mini210_setup_clocks: sclk_mmc: source is mout_mpll, rate is 47642857
[ 0.632749] S[ 1.400606] usb usb2: New USB device found, idVendor=1d6b, idProduct=0001
[ 1.400666] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[ 1.400728] usb usb2: Product: s5pv210 OHCI
[ 1.400766] usb usb2: Manufacturer: Linux 2.6.35.7-FriendlyARM ohci_hcd
[ 1.403050] usb usb2: SerialNumber: s5pv210
[ 1.407612] hub 2-0:1.0: USB hub found
[ 1.410964] hub 2-0:1.0: 1 port detected
[ 1.415340] usbcore: registered new interface driver usbserial
[ 1.420711] USB Serial support registered for generic
[ 1.425742] usbcore: registered new interface driver usbserial_generic
[ 1.432180] usbserial: USB Serial Driver core
[ 1.436553] USB Serial support registered for aircable
[ 1.441685] usbcore: registered new interface driver aircable
[ 1.447385] USB Serial support registered for ark3116
[ 1.452434] usbcore: registered new interface driver ark3116
[ 1.458002] ark3116:v0.6:USB ARK3116 serial/IrDA driver
[ 1.463241] USB Serial support registered for Belkin / Peracom / GoHubs USB Serial Adapter
[ 1.471500] usbcore: registered new interface driver belkin
[ 1.476980] belkin_sa: v1.3:USB Belkin Serial converter driver
[ 1.482828] USB Serial support registered for ch341-uart
[ 1.488133] usbcore: registered new interface driver ch341
[ 1.493576] USB Serial support registered for cp210x
[ 1.498546] usbcore: registered new interface driver cp210x
[ 1.504017] cp210x: v0.09:Silicon Labs CP210x RS232 serial adaptor driver
[ 1.510823] USB Serial support registered for Reiner SCT Cyberjack USB card reader
[ 1.518379] usbcore: registered new interface driver cyberjack
[ 1.524121] cyberjack: v1.01 Matthias Bruestle
[ 1.528541] cyberjack: REINER SCT cyberJack pinpad/e-com USB Chipcard Reader Driver
[ 1.536206] USB Serial support registered for DeLorme Earthmate USB
[ 1.542461] USB Serial support registered for HID->COM RS232 Adapter
[ 1.548775] USB Serial support registered for Nokia CA-42 V2 Adapter
[ 1.55 i2c /dev entries driver
[ 2.450004] Linux video capture interface: v2.00
[ 2.454216] 3 - TCNTB = 00000d90, TCNTO = 000001f1
[ 2.458977] TINT_CSTAT = 00000008
[ 2.462439] s3c-csis: Samsung MIPI-CSI2 driver probed successfully
[ 2.468475] mfc_init: <6>S5PC110 MFC Driver, (c) 2009 Samsung Electronics
[ 2.468481]
[ 2.476658] 4 - TCNTB = 00000d90, TCNTO = 00000891
[ 2.481416] TINT_CSTAT = 00000008
[ 2.485102] S3C JPEG Driver, (c) 2007 Samsung Electronics
[ 2.490092] JPEG driver for S5PV210
[ 2.494156] i2c i2c-1: attached s5p_ddc into i2c adapter successfully
[ 2.500001] S5PC11X HPD Driver, (c) 2009 Samsung Electronics
[ 2.505825] S5PC11X CEC Driver, (c) 2009 Samsung Electronics
[ 2.511789] usbcore: registered new interface driver uvcvideo
[ 2.516955] USB Video Class driver (v0.1.0)
[ 2.521108] s3c_bat_init
[ 2.523663] sec-fake-battery sec-fake-battery: s3c_bat_probe
[ 2.529665] S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics
[ 2.535394] s3c2410-wdt s3c2410-wdt: watchdog inactive, reset disabled, irq enabled
[ 2.542877] device-mapper: uevent: version 1.0.3
[ 2.551074] device-mapper: ioctl: 4.17.0-ioctl (2010-03-05) initialised: [email protected]
[ 2.555809] Bluetooth: HCI UART driver ver 2.2
[ 2.560195] Bluetooth: HCI H4 protocol initialized
[ 2.564956] Bluetooth: HCILL protocol initialized
[ 2.569635] Bluetooth: Generic Bluetooth USB driver ver 0.6
[ 2.575324] usbcore: registered new interface driver btusb
[ 2.580707] cpuidle: using governor ladder
[ 2.584792] cpuidle: using governor menu
[ 2.588665] sdhci: Secure Digital Host Controller Interface driver
[ 2.594768] sdhci: Copyright(c) Pierre Ossman
[ 2.599217] s3c-sdhci s3c-sdhci.0: clock source 0: hsmmc (133400000 Hz)
[ 2.605700] s3c-sdhci s3c-sdhci.0: clock source 1: hsmmc (133400000 Hz)
[ 2.612290] s3c-sdhci s3c-sdhci.0: clock source 2: sclk_mmc (47642857 Hz)
[ 2.619335] mmc0: SDHCI controller on samsung-hsmmc [s3c-sdhci.0[ 17.395828] smdkc110-rtc smdkc110-rtc: rtc disabled, re-enabling
[09/Mar/2011:00:41:50 +0000] boa: server version Boa/0.94.13
[09/Mar/2011:00:41:50 +0000] boa: server built Dec 30 2010 at 11:18:35.
[09/Mar/2011:00:41:50 +0000] boa: starting server pid=84, port 80
[ 20.658783] s3c_idma_preallocate_buffer: VA-d08c0000 PA-C0000000 163840bytes
[ 20.659341] asoc: WM8960 <-> s5pc1xx-i2s mapping ok
[ 21.221590]
[ 21.221596] rtw driver version=v3.0.1590.20110511
[ 21.226590] usbcore: registered new interface driver rtl8192cu
Try to bring eth0 interface up......[ 21.287007] eth0: link up, 100Mbps, full-duplex, lpa 0x4DE1
Done
Please press Enter to activate this console.
Please press Enter to activate this console.
[root@FriendlyARM /]# ls
a.out linuxrc sdcard
bin lost+found sys
dev mnt tmp
etc opt usr
fa-network-service proc var
home root www
lib sbin
[root@FriendlyARM /]#