S3C6410的SD卡UBOOT启动的实现过程

手头上有飞凌的OK6410开发板,想通过sd uboot 启动linuxyaffs根文件系统,考虑过几种实现方式

1.     通过S3C6410sd启动功能,把带下载功能的uboot烧录到sd卡的启动扇区中,当uboot启动时,通过它的网络下载或者usb下载功能把linux内核下载到内存中,再把根文件系统下载并烧录到nand flash中,接着启动内核从而启动整个系统。

2.     通过S3C6410sd启动功能,把带下载功能以及文件系统读取功能的uboot烧录到sd卡的启动扇区,当uboot启动时,把放入sd卡的ubootlinux内核和文件系统写入nand flash中,再转成用nand flash 启动,然后启动linux系统。

3.     通过S3C6410sd启动功能,把带下载功能的uboot烧录到sd卡的启动扇区中,再把linux内核也写入sd卡的对应扇区中,接着通过usb或者网络下载功能把yaffs文件系统下载到nand flash中,接着就从sd卡直接启动linux系统。

 

这里只使用了方法3,但也由于某些问题,还借助了飞凌的一键烧录的方式来烧录yaffs2文件系统到nand flash中。

使用三星的sd uboot源码,对sd uboot进行修改:

a.     在include目录中的configsS3C6410.h文件中,打开sd boot的选项如下图。

b.增加sd卡的copy功能并设置正确的zImage的读取位置:把下面的PART_ROOTFS_OFFSET 改成0X400000 ,因为我使用的是飞凌的linux内核,大小已经超过3M,所以就指定为4M

把下面的ofsinfo.zimage改成1973148672/512,注意这个位置也是zImage写入sd卡的位置。

c. 增加nand flash的功能,参考《uboot支持NAND部分代码》这个目录里面的文件,或者飞凌的uboot的源代码中的nand flash部分的内容。

d.增加网络的功能,直接参考移植后的dm9000x文件就可以了,但注意在smdk6410.h文件中增加如下的宏:

//added for achieving the OK6410 netfunction

#define CONFIG_DRIVER_DM9000 1

#define CONFIG_DM9000_BASE 0x18000000

#define DM9000_IO CONFIG_DM9000_BASE

#define DM9000_DATA (CONFIG_DM9000_BASE+4)

#define CONFIG_DM9000_USE_16BIT

e.增加usb的功能,其实usb的功能只要把usbd-otg-hs.c文件按如下修改:

f.设置bootargs 如下:

setenv bootargs "init=/linuxrcroot=/dev/mtdblock2 rootfstype=yaffs2 console=ttySAC0,115200"

 

g. 注意nandflash的分区如下:

 

0x000000000000-0x000000100000: "Bootloader"

0x000000100000-0x000000600000: "Kernel"

0x000000600000-0x000080000000 : "FileSystem"

 

hsd卡上如何烧写内核和sd uboot请参考《SD&SDHC 下载UBOOT注意事项》和《WINHEX的使用手册》。

 

i. zImage yaffs文件系统使用飞凌现成的文件rootfs.yaffs2-nand2gzImage,请查看此文件夹中的该文件。

 

j.如果使用USB下载的话,还需要在主机端装USB的驱动,请查看此文件夹的USB驱动并按照到你的主机上。

k.nand flash的读取命令和写命令有时候会执行不了,可以多写几遍。另外,在写之前好像一定要擦除。

 

注意:

1.     不管是用USB还是用TFTP功能,下载rootfs.yaffs2-nand2g文件的时候都会下载到90%左右死机,因此,我还是借助了一键安装的功能先把文件系统写到nand flash中的。否则目前还没有办法把 yaffs文件系统放到NAND FLASH的指定分区中。

 

2.另外,我使用的是sandisk 2G sd卡,其他的sd卡我没有试过,但sdhc卡一定是不行的,因为sd uboot里面的驱动只针对sd卡。下载镜像到sd卡我使用的工具是WINHEX软件(记得要用破解版,否则无法写入)。

 

下面贴上串口输出的整个启动过程:

 

U-Boot 1.1.6 (Sep 17 2012 - 18:32:43) for SMDK6410

CPU:    S3C6410@532MHz

         Fclk =532MHz, Hclk = 133MHz, Pclk = 66MHz, Serial = CLKUART (SYNC Mode)

Board:  SMDK6410

DRAM:    128 MB

Flash:   0 kB

NAND:    2048 MB

SanDisk MMC:    =>  rca=0x0000e624

1887 MB

In:      serial

Out:     serial

Err:     serial

Hit any key to stop autoboot:  0

Reading zImage from block 3853806.. Completed!

 

Boot with zImage

 

Starting kernel ...

 

Uncompressing Linux... done, booting the kernel.

Linux version 3.0.1 (root@forlinx) (gcc version 4.3.2(Sourcery G++ Lite 2008q3-72) ) #425 Mon May 7 16:56:20 CST 2012

S3C24XX Clocks, Copyright 2004 Simtec Electronics

camera: no parent clock specified

S3C64XX: PLL settings, A=532000000, M=532000000,E=24000000

S3C64XX: HCLK2=266000000, HCLK=133000000,PCLK=66500000

mout_apll: source is fout_apll (1), rate is 532000000

mout_epll: source is epll (1), rate is 24000000

mout_mpll: source is mpll (1), rate is 532000000

mmc_bus: source is mout_epll (0), rate is 24000000

mmc_bus: source is mout_epll (0), rate is 24000000

mmc_bus: source is mout_epll (0), rate is 24000000

usb-bus-host: source is clk_48m (0), rate is 48000000

uclk1: source is dout_mpll (1), rate is 66500000

spi-bus: source is mout_epll (0), rate is 24000000

spi-bus: source is mout_epll (0), rate is 24000000

audio-bus: source is mout_epll (0), rate is 24000000

audio-bus: source is mout_epll (0), rate is 24000000

audio-bus: source is mout_epll (0), rate is 24000000

irda-bus: source is mout_epll (0), rate is 24000000

camera: no parent clock specified

Kernel command line: init=/linuxrc root=/dev/mtdblock2rootfstype=yaffs2 console=ttySAC0,115200

PID hash table entries: 512 (order: -1, 2048 bytes)

Dentry cache hash table entries: 16384 (order: 4,65536 bytes)

Inode-cache hash table entries: 8192 (order: 3, 32768bytes)

Memory: 128MB = 128MB total

Memory: 67672k/67672k available, 63400k reserved, 0Khighmem

Virtual kernel memory layout:

    vector  : 0xffff0000 - 0xffff1000   (   4kB)

    fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)

    DMA     : 0xff600000 - 0xffe00000   (   8MB)

    vmalloc :0xc8800000 - 0xf4000000   ( 696 MB)

    lowmem  : 0xc0000000 - 0xc8000000   ( 128 MB)

    pkmap   : 0xbfe00000 - 0xc0000000   (   2MB)

    modules :0xbf000000 - 0xbfe00000   (  14 MB)

      .init : 0xc0008000- 0xc0034000   ( 176 kB)

      .text :0xc0034000 - 0xc0701080   (6965 kB)

      .data :0xc0702000 - 0xc0744330   ( 265 kB)

       .bss :0xc0744354 - 0xc07c1ce0   ( 503 kB)

SLUB: Genslabs=13, HWalign=32, Order=0-3,MinObjects=0, CPUs=1, Nodes=1

NR_IRQS:246 nr_irqs:246 246

VIC @f4000000: id 0x00041192, vendor 0x41

VIC @f4010000: id 0x00041192, vendor 0x41

Console: colour dummy device 80x30

console [ttySAC0] enabled

Calibrating delay loop... 528.79 BogoMIPS(lpj=2643968)

pid_max: default: 32768 minimum: 301

Mount-cache hash table entries: 512

CPU: Testing write buffer coherency: ok

hw perfevents: enabled with v6 PMU driver, 3 countersavailable

devtmpfs: initialized

NET: Registered protocol family 16

hw-breakpoint: found 6 breakpoint and 1 watchpointregisters.

hw-breakpoint: maximum watchpoint size is 4 bytes.

s3c64xx_dma_init: Registering DMA channels

PL080: IRQ 73, at c8804000, channels 0..8

PL080: IRQ 74, at c8806000, channels 8..16

bio: create slab at 0

SCSI subsystem initialized

------------[ cut here ]------------

WARNING: at drivers/gpio/gpiolib.c:101gpio_ensure_requested+0x58/0x124()

---[ end trace da227214a82491b7 ]---

usbcore: registered new interface driver usbfs

usbcore: registered new interface driver hub

usbcore: registered new device driver usb

s3c-i2c s3c2440-i2c.0: slave address 0x10

s3c-i2c s3c2440-i2c.0: bus frequency set to 64 KHz

s3c-i2c s3c2440-i2c.0: i2c-0: S3C I2C adapter

Advanced Linux Sound Architecture Driver Version1.0.23.

cfg80211: Calling CRDA to update world regulatorydomain

NET: Registered protocol family 2

IP route cache hash table entries: 1024 (order: 0,4096 bytes)

TCP established hash table entries: 4096 (order: 3,32768 bytes)

TCP bind hash table entries: 4096 (order: 2, 16384bytes)

TCP: Hash tables configured (established 4096 bind4096)

TCP reno registered

UDP hash table entries: 256 (order: 0, 4096 bytes)

UDP-Lite hash table entries: 256 (order: 0, 4096bytes)

NET: Registered protocol family 1

RPC: Registered named UNIX socket transport module.

RPC: Registered udp transport module.

RPC: Registered tcp transport module.

RPC: Registered tcp NFSv4.1 backchannel transportmodule.

audit: initializing netlink socket (disabled)

type=2000 audit(0.270:1): initialized

msgmni has been set to 132

alg: No test for stdrng (krng)

Block layer SCSI generic (bsg) driver version 0.4loaded (major 253)

io scheduler noop registered

io scheduler deadline registered

io scheduler cfq registered (default)

LCD TYPE :: LTE480WV will be initialized

Console: switching to colour frame buffer device 60x34

fb0: s3cfb frame buffer device

fb1: s3cfb frame buffer device

fb2: s3cfb frame buffer device

fb3: s3cfb frame buffer device

s3c6400-uart.0: ttySAC0 at MMIO 0x7f005000 (irq = 16)is a S3C6400/10

s3c6400-uart.1: ttySAC1 at MMIO 0x7f005400 (irq = 20)is a S3C6400/10

s3c6400-uart.2: ttySAC2 at MMIO 0x7f005800 (irq = 24)is a S3C6400/10

s3c6400-uart.3: ttySAC3 at MMIO 0x7f005c00 (irq = 28)is a S3C6400/10

Hello, world

NAND device: Manufacturer ID: 0xec, Chip ID: 0xd5(Samsung NAND 2GiB 3,3V 8-bit)

Creating 3 MTD partitions on "NAND 2GiB 3,3V8-bit":

0x000000000000-0x000000100000 : "Bootloader"

0x000000100000-0x000000600000 : "Kernel"

0x000000600000-0x000080000000 : "FileSystem"

vcan: Virtual CAN interface driver

slcan: serial line CAN interface driver

slcan: 10 dynamic interface channels.

CAN device driver interface

mcp251x: setup gpio pins CS and External Int

mcp2515 spi1.0: MCP251x didn't enter in conf modeafter reset

mcp2515 spi1.0: Probe failed

mcp2515 spi1.0: probe failed

PPP generic driver version 2.4.2

PPP Deflate Compression module registered

PPP BSD Compression module registered

PPP MPPE Compression module registered

NET: Registered protocol family 24

dm9000 Ethernet Driver, V1.31

eth0: dm9000a at c881c000,c8c00004 IRQ 108 MAC:08:90:00:a0:90:90 (platform data)

libertas_sdio: Libertas SDIO driver

libertas_sdio: Copyright Pierre Ossman

usbcore: registered new interface driver rt73usb

ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver

s3c2410-ohci s3c2410-ohci: S3C24XX OHCI

s3c2410-ohci s3c2410-ohci: new USB bus registered,assigned bus number 1

s3c2410-ohci s3c2410-ohci: irq 79, io mem 0x74300000

usb usb1: New USB device found, idVendor=1d6b,idProduct=0001

usb usb1: New USB device strings: Mfr=3, Product=2,SerialNumber=1

usb usb1: Product: S3C24XX OHCI

usb usb1: Manufacturer: Linux 3.0.1 ohci_hcd

usb usb1: SerialNumber: s3c24xx

hub 1-0:1.0: USB hub found

hub 1-0:1.0: 2 ports detected

usbcore: registered new interface driver cdc_acm

cdc_acm: USB Abstract Control Model driver for USBmodems and ISDN adapters

Initializing USB Mass Storage driver...

usbcore: registered new interface driver usb-storage

USB Mass Storage support registered.

usbcore: registered new interface driver usbserial

USB Serial support registered for generic

usbcore: registered new interface driverusbserial_generic

usbserial: USB Serial Driver core

USB Serial support registered for GSM modem (1-port)

usbcore: registered new interface driver option

option: v0.7.2:USB Driver for GSM modems

USB Serial support registered for pl2303

usbcore: registered new interface driver pl2303

pl2303: Prolific PL2303 USB to serial adaptor driver

dummy_hcd dummy_hcd: USB Host+Gadget Emulator, driver02 May 2005

dummy_hcd dummy_hcd: Dummy host controller

dummy_hcd dummy_hcd: new USB bus registered, assignedbus number 2

usb usb2: New USB device found, idVendor=1d6b,idProduct=0002

usb usb2: New USB device strings: Mfr=3, Product=2,SerialNumber=1

usb usb2: Product: Dummy host controller

usb usb2: Manufacturer: Linux 3.0.1 dummy_hcd

usb usb2: SerialNumber: dummy_hcd

hub 2-0:1.0: USB hub found

hub 2-0:1.0: 1 port detected

mousedev: PS/2 mouse device common for all mice

input: gpio-keys as/devices/platform/gpio-keys/input/input0

input: s3c-keypad as/devices/platform/s3c-keypad/input/input1

S3C Touchscreen driver, (c) 2008 Samsung Electronics

S3C TouchScreen got loaded successfully : 12 bits

input: S3C TouchScreen as/devices/virtual/input/input2

s3c-rtc s3c64xx-rtc: rtc disabled, re-enabling

s3c-rtc s3c64xx-rtc: rtc core: registered s3c as rtc0

i2c /dev entries driver

Linux video capture interface: v2.00

gspca: main v2.10.0 registered

usbcore: registered new interface driver benq

benq: registered

usbcore: registered new interface driver conex

conex: registered

usbcore: registered new interface driver cpia1

cpia1: registered

usbcore: registered new interface driver etoms

etoms: registered

usbcore: registered new interface driver finepix

finepix: registered

usbcore: registered new interface driver jeilinj

jeilinj: registered

usbcore: registered new interface driver mars

mars: registered

usbcore: registered new interface driver mr97310a

mr97310a: registered

usbcore: registered new interface driver ov519

ov519: registered

usbcore: registered new interface driver ov534

ov534: registered

usbcore: registered new interface driver ov534_9

ov534_9: registered

usbcore: registered new interface driver pac207

pac207: registered

usbcore: registered new interface driver pac7302

pac7302: registered

usbcore: registered new interface driver pac7311

pac7311: registered

usbcore: registered new interface driver sn9c2028

sn9c2028: registered

usbcore: registered new interface driver sn9c20x

sn9c20x: registered

usbcore: registered new interface driver sonixb

sonixb: registered

usbcore: registered new interface driver sonixj

sonixj: registered

usbcore: registered new interface driver spca500

spca500: registered

usbcore: registered new interface driver spca501

spca501: registered

usbcore: registered new interface driver spca505

spca505: registered

usbcore: registered new interface driver spca506

spca506: registered

usbcore: registered new interface driver spca508

spca508: registered

usbcore: registered new interface driver spca561

spca561: registered

usbcore: registered new interface driver spca1528

spca1528: registered

usbcore: registered new interface driver sq905

sq905: registered

usbcore: registered new interface driver sq905c

sq905c: registered

usbcore: registered new interface driver sq930x

sq930x: registered

usbcore: registered new interface driver sunplus

sunplus: registered

usbcore: registered new interface driver stk014

stk014: registered

usbcore: registered new interface driver stv0680

stv0680: registered

usbcore: registered new interface driver t613

t613: registered

usbcore: registered new interface driver tv8532

tv8532: registered

usbcore: registered new interface driver vc032x

vc032x: registered

usbcore: registered new interface driver zc3xx

zc3xx: registered

usbcore: registered new interface driver ALi m5602

ALi m5602: registered

usbcore: registered new interface driver STV06xx

STV06xx: registered

gspca_gl860: driver startup - version 0.9d10

usbcore: registered new interface driver gspca_gl860

gspca_gl860: driver registered

s3c-fimc: controller 0 registered successfully

s3c-fimc: controller 1 registered successfully

s3c-fimc: info ov965x_init

cym s3c_mfc_mememap: addr:55af9000 size:1138688

S3C6400 MFC Driver, (c) 2007 Samsung Electronics

S3C PostProcessor Driver v3.12, (c) 2009 SamsungElectronics

S3C6410 TV encoder Driver, (c) 2008 SamsungElectronics

S3C6410 TV scaler Driver, (c) 2008 Samsung Electronics

S3C Rotator Driver, (c) 2008 Samsung Electronics

s3c_rotator_probe called

S3C JPEG Driver, (c) 2007 Samsung Electronics

s3c_g2d_probe called

 s3c_g2d_probeSuccess

S3C G3D Driver, (c) 2007-2009 Samsung Electronics

S3C CMM Driver, (c) 2008 Samsung Electronics

usbcore: registered new interface driver uvcvideo

USB Video Class driver (v0.1.0)

S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics

s3c2410-wdt s3c2410-wdt: watchdog inactive, resetdisabled, irq enabled

sdhci: Secure Digital Host Controller Interface driver

sdhci: Copyright(c) Pierre Ossman

s3c-sdhci s3c-sdhci.0: clock source 0: hsmmc(133000000 Hz)

s3c-sdhci s3c-sdhci.0: clock source 1: hsmmc (133000000Hz)

s3c-sdhci s3c-sdhci.0: clock source 2: mmc_bus(24000000 Hz)

mmc0: SDHCI controller on samsung-hsmmc [s3c-sdhci.0]using ADMA

s3c-sdhci s3c-sdhci.1: clock source 0: hsmmc(133000000 Hz)

s3c-sdhci s3c-sdhci.1: clock source 1: hsmmc(133000000 Hz)

s3c-sdhci s3c-sdhci.1: clock source 2: mmc_bus(24000000 Hz)

mmc1: SDHCI controller on samsung-hsmmc [s3c-sdhci.1]using ADMA

usbcore: registered new interface driver usbhid

usbhid: USB HID core driver

mmc0: new SD card at address e624

mmcblk0: mmc0:e624 SU02G 1.84 GiB

 mmcblk0: p1

asoc: wm9713-hifi <-> samsung-ac97 mapping ok

ALSA device list:

  #0: smdk6410

TCP cubic registered

NET: Registered protocol family 17

can: controller area network core (rev 20090105 abi 8)

NET: Registered protocol family 29

can: raw protocol (rev 20090105)

can: broadcast manager protocol (rev 20090105 t)

lib80211: common routines for IEEE802.11 drivers

Registering the dns_resolver key type

s3c-rtc s3c64xx-rtc: setting system clock to2000-03-08 17:26:07 UTC (952536367)

yaffs: dev is 32505858 name is "mtdblock2"rw

yaffs: passed flags ""

VFS: Mounted root (yaffs2 filesystem) on device 31:2.

devtmpfs: mounted

Freeing init memory: 176K

FAT-fs (mmcblk0p1): utf8 is not a recommended IOcharset for FAT filesystems, filesystem will be case sensitive!

 

Try to bring eth0 interface up......dm9000 dm9000.0:eth0: link down

Done

                                 

Starting Qtopia2, please waiting...

 

Please press Enter to activate thisconsole. touch...

 

 

 

你可能感兴趣的:(嵌入式)