2008年6月26日 星期四

從u-boot傳bootargs給kernel

1. rebuild u-boot with CONFIG_CMDLINE_TAG defined in include/configs/XXX.h
2. in u-boot:

setenv bootargs xxx=xxx;
Refer to uImage + u-boot的啟動方式 任一方法,用go的不行
setenv flashaddr 10040000;setenv kfile uImage; setenv ramaddr 1500000;tftp $(ramaddr) $(kfile); bootm $(ramaddr);
結果

Star Dorado2 # setenv bootargs xxx=xxx;
Star Dorado2 # setenv flashaddr 10040000;setenv kfile uImage; setenv
ramaddr 1500000;tftp $(ramaddr) $(kfile); bootm $(ramaddr);
config VSC7385
MAC0 PHY Link Status : UP!
INIT VSC8601
VSC8601 Type B Chip
TFTP from server 172.20.5.185; our IP address is 172.20.150.151
Filename 'uImage'.
Load address: 0x1500000
Loading: #################################################################
#################################################################
#################################################################
#################################################################
###################################################
done
Bytes transferred = 1590076 (18433c hex)
## Booting image at 01500000 ...
Image Name: Linux-2.6.16-star
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 1590012 Bytes = 1.5 MB
Load Address: 01500000
Entry Point: 01500040
Verifying Checksum ... OK
XIP Kernel Image ... OK

Starting kernel ...

Uncompressing
Linux................................................................................................ done, booting the kernel.
Linux version 2.6.16-star (root@test-laptop) (gcc version 3.4.6) #7 Tue Jun
3 14:41:53 CST 2008
CPU: FA526id(wb) [66015261] revision 1 (ARMv4)
Machine: STAR STR9100
Memory policy: ECC disabled, Data cache writeback
CPU0: D VIVT write-back cache
CPU0: I cache: 16384 bytes, associativity 2, 16 byte lines, 512 sets
CPU0: D cache: 16384 bytes, associativity 2, 16 byte lines, 512 sets
CPU clock at 250MHz
AHB clock at 125MHz
APB clock at 62MHz
Enable I-ScratchPad Address Start : c002c000
Built 1 zonelists
Kernel command line: xxx=xxx
(..............................................)





转载:非常不错的u-boot ppt
http://blog.chinaunix.net/u/22617/showart_466018.html



bootm命令浅析
http://blog.chinaunix.net/u1/47239/showart_377972.html

http://blog.csdn.net/menuconfig/archive/2008/04/09/2270429.aspx
http://www.sudu.cn/info/html/edu/linux/20070102/291441.html


使用initrd文件系统 U-boot引导Linux方法
http://linux.chinaitlab.com/administer/753535.html

bootm 0x100000 0x240000
(其中:0x100000是linux内核在flash中的地址,0x240000是initrd在flash中的地
址)

setenv bootargs console=ttyS0,115200n8 root=/dev/ram rw mem=32M
当u-boot使用上面的设置时,能够正常引导linux加载initrd !


http://www.hhcn.com/cgi-bin/topic.cgi?forum=3&topic=735
14.3.5. Linux Kernel Ignores my bootargs

Question:
Why doesn't the kernel use the command-line options I set in the "bootargs"
environment variable in U-Boot when I boot my target system?

Answer:
This problem is typical for ARM systems only. The following discussion is
ARM-centric:

First, check to ensure that you have configured your U-Boot build so that
CONFIG_CMDLINE_TAG is enabled. (Other tags like CONFIG_SETUP_MEMORY_TAGS or
CONFIG_INITRD_TAG may be needed, too.)
This ensures that u-boot will boot
the kernel with a command-line tag that incorporates the kernel options you
set in the "bootargs" environment variable.

If you have the CONFIG_CMDLINE_TAG option configured, the problem is almost
certainly with your kernel build. You have to instruct the kernel to pick up
the boot tags at a certain address
. This is done in the machine descriptor
macros, which are found in the processor start-up C code for your
architecture. For the Intel DBPXA250 "Lubbock" development board, the
machine descriptor macros are located at the bottom of the file
arch/arm/mach-pxa/lubbock.c, and they look like this:

MACHINE_START(LUBBOCK, "Intel DBPXA250 Development Platform")
MAINTAINER("MontaVista Software Inc.")
BOOT_MEM(0xa0000000, 0x40000000, io_p2v(0x40000000))
FIXUP(fixup_lubbock)
MAPIO(lubbock_map_io)
INITIRQ(lubbock_init_irq)
MACHINE_END

The machine descriptor macros for your machine will be located in a similar
file in your kernel source tree. Having located your machine descriptor
macros, the next step is to find out where U-Boot puts the kernel boot tags
in memory for your architecture
. On the Lubbock, this address turns out to
be the start of physical RAM plus 0x100, or 0xa0000100. Add the
"BOOT_PARAMS" macro with this address to your machine descriptor macros; the
result should look something like this:

MACHINE_START(LUBBOCK, "Intel DBPXA250 Development Platform")
MAINTAINER("MontaVista Software Inc.")
BOOT_PARAMS(0xa0000100)
BOOT_MEM(0xa0000000, 0x40000000, io_p2v(0x40000000))
FIXUP(fixup_lubbock)
MAPIO(lubbock_map_io)
INITIRQ(lubbock_init_irq)
MACHINE_END

If there is already a BOOT_PARAMS macro in your machine descriptor macros,
modify it so that it has the correct address. Then, rebuild your kernel and
re-install it on your target. Now the kernel should be able to pick up the
kernel options you have set in the "bootargs" environment variable.



uboot启动zImage(go)和uImage(bootm)分析
http://linux.chinaunix.net/techdoc/install/2009/03/15/1101440.shtml
可见go和bootm差异就是 go只是改写pc值,而bootm传递r0,r1,r2还有bootargs

Linux启动bootargs参数分析(转)
http://hi.baidu.com/sdvch/blog/item/26e20586ef9a8aa66d811978.html

Add customized ATAG in U-Boot and Linux
http://blog.xuite.net/bunny/blog/20594102

沒有留言: