add uboot and vanet
@@ -0,0 +1,36 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-08-11T19:15:34+08:00
|
||||
|
||||
====== jffs2 scan eraseblock() Magic bitmask 0x1985 not found at ======
|
||||
Created Saturday 11 August 2012
|
||||
|
||||
如果在mount一个 jffs2文件系统到目录中出现:
|
||||
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000024: 0x2b10 instead ...
|
||||
Further such events for this erase block will not be printed
|
||||
类似的错误时,可能的原因是:
|
||||
1. 该设备文件(/dev/mtdblock1)对应的存储单元并没有存放一个有效的jffs2文件系统,这时可以用LTIB或mtd-utils软件包中的mkfs.jffs2工具制作
|
||||
该jffs2文件系统映像,然后用uboot命令行着那个的nand或cp.b等命令或系统启动后用mtd-utils软件包中的nanderase,nandwrite工具烧写。
|
||||
|
||||
2. 如果设备对应的是一个有效的jffs2文件系统,那么很可能是在制作jffs2文件系统映像时 erase block size option not matches the one you have in your NAND. 对于LTIB而言,默认的擦出块大小是64KB,对于K9F5608的该值为16KB(参考其datasheet), 所以需要将下面该的值改为16.
|
||||
--- Choose your root filesystem image type │ │
|
||||
│ │ Target image: (jffs2) ---> │ │
|
||||
│ │ [ ] Run a command after building the target image │ │
|
||||
│ │ (**64**) jffs2 erase block size in KB │ │
|
||||
│ │ [ ] read-only root filesystem
|
||||
|
||||
|
||||
如果使用mkfs.jffs2命令行选项,则参数(针对K9F1G08U08 256MB NAND Flash)含义如下:
|
||||
http://hi.baidu.com/_%CB%BC%CF%EB%B5%C4%D0%A1%D3%E3_/blog/item/ccb2d2d69c8bf9ca50da4b59.html
|
||||
|
||||
mkfs.jffs2 -n -s 2048 -e 128KiB --pad=0x800000 -d root_fs -o kevin.jffs2
|
||||
|
||||
参数注释:
|
||||
|
||||
-s 页大小,试验可以不特别要求,512亦可
|
||||
|
||||
__-e 擦除块大小(Block Erase)__,需和手册相匹配,此处为128(由手册可知),1 Block = (2K + 64)B + 64 Pages = (__128K__ + 4K)bytes
|
||||
|
||||
此处如果设置过大(如 256),将出现jffs2_scan_eraseblock():Magic bitmask......问题, 如果设置过小(如 64),将出现Empth flash at .......问题
|
||||
|
||||
--pad 设置**生成文件大小**,其实此处也不算是设置,因为此选项是填充的意思,当生成文件比参数规定大小大时, 此选项不起作用。只有当生成文件小于规定大小才会进行填充。
|
||||
20
Zim/Research/Error_Notes/下载错误/minicom乱码.txt
Normal file
@@ -0,0 +1,20 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-08-10T14:08:29+08:00
|
||||
|
||||
====== minicom乱码 ======
|
||||
Created Friday 10 August 2012
|
||||
|
||||
错误的可能原因:
|
||||
1. 波特率不对,应该设置为115200
|
||||
2.串口的位数为8,无奇偶校验,停止位为1位,即:8N1
|
||||
3.**软件、硬件流控不设置**。
|
||||
|
||||
设置结果应该如下:
|
||||
A - Serial Device : /dev/ttyUSB0 |
|
||||
B - Lockfile Location : /var/lock |
|
||||
C - Callin Program : |
|
||||
D - Callout Program : |
|
||||
E - Bps/Par/Bits : **115200 8N1** |
|
||||
F - Hardware Flow Control : **No** |
|
||||
G - Software Flow Control : **No**
|
||||
7
Zim/Research/Error_Notes/启动相关/VFS错误.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-08-11T21:15:04+08:00
|
||||
|
||||
====== VFS错误 ======
|
||||
Created Saturday 11 August 2012
|
||||
如果内核可以正常地启动,但是当执行到挂载root时出错,这可能与bootargs的ramdisk_size的值与ltib输出的不一致有关。
|
||||
@@ -8,5 +8,5 @@ Created Wednesday 22 February 2012
|
||||
这可能与uboot的环境变量bootargs中console设置错误有关,正确的应该为:
|
||||
setenv bootargs root=/dev/ram rw console=ttyS0,115200 ramdisk_size=xxxx
|
||||
|
||||
注意:ramdisk_size大小要和ltib输出的一致,但可以比后者大,否则kernel启动的最后
|
||||
在mount该文件时,会出错。
|
||||
注意:ramdisk_size大小要和ltib输出的一致,但可以比后者大(有时设置较大时会出错,所以最好设为ltib的输出值),否则kernel启动的最后
|
||||
在mount该文件时,VFS子系统会出错。
|
||||
|
||||
19
Zim/Research/Error_Notes/启动相关/内核提示找不到rc.S文件.txt
Normal file
@@ -0,0 +1,19 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-08-11T15:57:47+08:00
|
||||
|
||||
====== 内核提示找不到rc.S文件 ======
|
||||
Created Saturday 11 August 2012
|
||||
|
||||
内核启动后输出如下内容:
|
||||
RAMDISK: gzip image found at block 0
|
||||
VFS: Mounted root (ext2 filesystem) on device 1:0.
|
||||
Freeing unused kernel memory: 152k freed
|
||||
can't run '/etc/rc.d/rcS': No such file or directory
|
||||
--------------------------------------------
|
||||
rcS是一个shell脚本文件,使用的解释器是/bin/sh,而该文件在ramdisk中并没由存在。
|
||||
这可能是busybox中的配置有误:
|
||||
Choose which shell is aliased to 'sh' name (ash) ---> │ │
|
||||
Choose which shell is aliased to 'bash' name (ash) --->
|
||||
|
||||
选中上面两个选项即可。
|
||||
@@ -17,4 +17,22 @@ Created Friday 03 August 2012
|
||||
4.执行/usr/sbin/visudo命令,在打开的文件中添加
|
||||
geekard ALL = NOPASSWD: /bin/rpm, /opt/freescale/ltib/usr/bin/rpm
|
||||
|
||||
5.
|
||||
5. 修改jffs2的erase block size 为16(按照K9F5608 datasheet上的Erase Block参数指定)
|
||||
--- Choose your root filesystem image type │ │
|
||||
│ │ Target image: __(jffs2)__ ---> │ │
|
||||
│ │ [ ] Run a command after building the target image │ │
|
||||
│ │ __(16)__ jffs2 erase block size in KB │ │
|
||||
│ │ [ ] read-only root filesystem │ │
|
||||
│ │ (512k) tmpfs size │ │
|
||||
│ │ (/tmp /var) Place these dirs in writable RAM │ │
|
||||
│ │ () rootfs target directory
|
||||
|
||||
6. ltib在编译某个软件包如busybox前,会先到rpm/RPMS/ppc/目录下查看busybox rpm软件包是否存在已经存在,如果存在的话将不会再
|
||||
编译它,而是在最后直接将其安装到rootfs目录下,所以如果想配置busybox则除了在package list中选中configure busybox before compile外
|
||||
还要删除rpm/RPMS/ppc目录下的busybox rpm包。如果该软件包的rpm包不存在,则ltib会到rpm/BUILD目录中查看该软件包的源代码目录是否存在
|
||||
如果存在则直接编译(编译完后并不删除该源代码目录),如果不存子则会从/opt/freescale/pkg目录下解压该软件包到BUILD目录中,编译完后会自动删除
|
||||
BUILD中的源代码目录,所以如果用户希望ltib在编译时使用自己的源代码,可以使用一下方法:
|
||||
1. #./ltib -m prep -p busybox #将/opt/freescale/pkg目录中的busybox软件包解压到BUILD目录中,同时打补丁和配置源代码。
|
||||
2. # cp -rv MY-busybox/* rpm/BUILD/busybox #用户的代码替换就代码
|
||||
3. # ./ltib -m scbuild -p busybox
|
||||
4. #./ltib -m scdeploy -p busybox
|
||||
|
||||
37
Zim/Research/Error_Notes/编译错误/mtd-utils.txt
Normal file
@@ -0,0 +1,37 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-08-11T20:46:27+08:00
|
||||
|
||||
====== mtd-utils ======
|
||||
Created Saturday 11 August 2012
|
||||
|
||||
**编译时出现下列错误:**
|
||||
gcc -I./include -DWITHOUT_XATTR -O2 -g -Wall -c -o ftl_format.o ftl_format.c -g -Wp,-MD,./.ftl_format.c.dep
|
||||
In file included from /home/geekard/PPC/sysroot/usr/include/endian.h:60:0,
|
||||
from /home/geekard/PPC/sysroot/usr/include/sys/types.h:216,
|
||||
from ftl_format.c:37:
|
||||
./include/bits/byteswap.h:21:3: error: __#error "Never use <bits/byteswap.h> directly; include <byteswap.h> instead."__
|
||||
make: *** [ftl_format.o] Error 1
|
||||
error: Bad exit status from /home/geekard/PPC/ltib-mpc8315erdb-20100719/tmp/rpm-tmp.69478 (%build)
|
||||
---------------------------
|
||||
解决的方法是打开byteswap.h文件,将下面几行注释掉:
|
||||
20 #if !defined _BYTESWAP_H && !defined _NETINET_IN_H
|
||||
21 # error "Never use <bits/byteswap.h> directly; include <byteswap.h> instead."
|
||||
22 #endif
|
||||
------------------------------------------------------------
|
||||
make -C ./ubi-utils
|
||||
make[1]: Entering directory `/home/geekard/PPC/ltib-mpc8315erdb-20100719/rpm/BUILD/mtd-utils/ubi-utils'
|
||||
gcc -I./inc -I./src -I../include -std=gnu99 -DPACKAGE_VERSION=\"1.0\" -O2 -g -Werror -Wall -Wwrite-strings -W -c -o pfiflash.o ./src/pfiflash.c -g -Wp,-MD,.pfiflash.c.dep
|
||||
gcc -I./inc -I./src -I../include -std=gnu99 -DPACKAGE_VERSION=\"1.0\" -O2 -g -Werror -Wall -Wwrite-strings -W -c -o libpfiflash.o ./src/libpfiflash.c -g -Wp,-MD,.libpfiflash.c.dep
|
||||
gcc -I./inc -I./src -I../include -std=gnu99 -DPACKAGE_VERSION=\"1.0\" -O2 -g -Werror -Wall -Wwrite-strings -W -c -o list.o ./src/list.c -g -Wp,-MD,.list.c.dep
|
||||
gcc -I./inc -I./src -I../include -std=gnu99 -DPACKAGE_VERSION=\"1.0\" -O2 -g -Werror -Wall -Wwrite-strings -W -c -o reader.o ./src/reader.c -g -Wp,-MD,.reader.c.dep
|
||||
gcc -I./inc -I./src -I../include -std=gnu99 -DPACKAGE_VERSION=\"1.0\" -O2 -g -Werror -Wall -Wwrite-strings -W -c -o error.o ./src/error.c -g -Wp,-MD,.error.c.dep
|
||||
./src/error.c: In function 'info_msg':
|
||||
./src/error.c:77:6: error: **variable 'n' set but not used [-Werror=unused-but-set-variable]**
|
||||
cc1: all warnings being treated as errors
|
||||
------------------
|
||||
解决方法是:将ubi-utils/Makefile中的-Werror去掉:
|
||||
11 CC := $(CROSS)gcc
|
||||
12 CFLAGS ?= -O2 -g __-Werror__
|
||||
13 CFLAGS += -Wall -Wwrite-strings -W
|
||||
|
||||
@@ -5,7 +5,16 @@ Creation-Date: 2012-08-02T15:31:27+08:00
|
||||
====== uboot ======
|
||||
Created Thursday 02 August 2012
|
||||
|
||||
1. ltib在编译uboot时长时间地停在下面的命令行上:
|
||||
|
||||
1.编译时提示
|
||||
make[1]: Leaving directory `/home/geekard/PPC/ltib-mpc8315erdb-20100719/rpm/BUILD/u-boot-2009.03-rc2/cpu/mpc83xx'
|
||||
make[1]: Entering directory `/home/geekard/PPC/ltib-mpc8315erdb-20100719/rpm/BUILD/u-boot-2009.03-rc2/cpu/mpc83xx'
|
||||
.depend:117: *** multiple target patterns. Stop.
|
||||
错误。
|
||||
---------------
|
||||
解决方法是将cpu/mpc83xx/.depend文件删除即可。
|
||||
|
||||
2. ltib在编译uboot时长时间地停在下面的命令行上:
|
||||
powerpc-e300c3-linux-gnu-objcopy -O srec u-boot u-boot.srec
|
||||
powerpc-e300c3-linux-gnu-objcopy --gap-fill=0xff -O binary u-boot u-boot.bin
|
||||
而且生成的uboot.bin文件非常大:
|
||||
|
||||
37
Zim/Research/Error_Notes/编译错误/uboot/uboot-nand.txt
Normal file
@@ -0,0 +1,37 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-08-10T16:52:25+08:00
|
||||
|
||||
====== uboot-nand ======
|
||||
Created Friday 10 August 2012
|
||||
|
||||
如果在编译nand型的uboot时提示如下错误:
|
||||
[geekard@kb310 u-boot-2009.03-rc2]$ make distclean
|
||||
[geekard@kb310 u-boot-2009.03-rc2]$ make MPC8315ERDB_NAND_config
|
||||
... NAND Configuring for MPC8315ERDB board...
|
||||
[geekard@kb310 u-boot-2009.03-rc2]$ make
|
||||
-o /home/geekard/PPC/ltib-mpc8315erdb-20100719/rpm/BUILD/u-boot-2009.03-rc2/nand_spl/u-boot-spl
|
||||
mpc8315erdb.o: In function `putc':
|
||||
/home/geekard/PPC/ltib-mpc8315erdb-20100719/rpm/BUILD/u-boot-2009.03-rc2/nand_spl/board/freescale/mpc8315erdb/mpc8315erdb.c:324: undefined reference to __`_savegpr_31'__
|
||||
/home/geekard/PPC/ltib-mpc8315erdb-20100719/rpm/BUILD/u-boot-2009.03-rc2/nand_spl/board/freescale/mpc8315erdb/mpc8315erdb.c:332: undefined reference to __`_restgpr_31_x'__
|
||||
sdram.o: In function `initdram':
|
||||
/home/geekard/PPC/ltib-mpc8315erdb-20100719/rpm/BUILD/u-boot-2009.03-rc2/nand_spl/board/freescale/mpc8315erdb/sdram.c:129: undefined reference to `_restgpr_29_x'
|
||||
nand_init.o: In function `puts':
|
||||
/home/geekard/PPC/ltib-mpc8315erdb-20100719/rpm/BUILD/u-boot-2009.03-rc2/nand_spl/board/freescale/mpc8315erdb/nand_init.c:112: undefined reference to `_restgpr_30_x'
|
||||
time.o: In function `usec2ticks':
|
||||
/home/geekard/PPC/ltib-mpc8315erdb-20100719/rpm/BUILD/u-boot-2009.03-rc2/nand_spl/board/freescale/mpc8315erdb/time.c:38: undefined reference to `_savegpr_31'
|
||||
/home/geekard/PPC/ltib-mpc8315erdb-20100719/rpm/BUILD/u-boot-2009.03-rc2/nand_spl/board/freescale/mpc8315erdb/time.c:48: undefined reference to `_restgpr_31_x'
|
||||
time.o: In function `udelay':
|
||||
/home/geekard/PPC/ltib-mpc8315erdb-20100719/rpm/BUILD/u-boot-2009.03-rc2/nand_spl/board/freescale/mpc8315erdb/time.c:67: undefined reference to `_restgpr_28_x'
|
||||
make[1]: *** [/home/geekard/PPC/ltib-mpc8315erdb-20100719/rpm/BUILD/u-boot-2009.03-rc2/nand_spl/u-boot-spl] Error 1
|
||||
make[1]: Leaving directory `/home/geekard/PPC/ltib-mpc8315erdb-20100719/rpm/BUILD/u-boot-2009.03-rc2/nand_spl/board/freescale/mpc8315erdb'
|
||||
make: *** [nand_spl] Error 2
|
||||
[geekard@kb310 u-boot-2009.03-rc2]$
|
||||
|
||||
------------------------------
|
||||
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43810#c4
|
||||
calls to _savegpr_32 and _restgpr_r31_x are only generated when compiling libgcc with -Os , but same compiled with -O2 does not emit the calls
|
||||
所以解决的方法是,编辑uboot顶层目录中的config.mk文件将
|
||||
119 DBGFLAGS= -g # -DDEBUG
|
||||
120 OPTFLAGS= -Os #-fomit-frame-pointer
|
||||
上面的-Os改为-O2即可。
|
||||
@@ -126,3 +126,6 @@ setenv bootargs root=/dev/ram rw ramdisk_size=24508
|
||||
|
||||
== ================== ==
|
||||
setenv bootargs root=/dev/ram rw ramdisk_size=24508
|
||||
|
||||
== ============================== ==
|
||||
setenv bootargs root=/dev/ram rw ramdisk_size=20015
|
||||
|
||||
7
Zim/Research/u-boot/U-boot源代码全分析系列.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-01-15T19:23:01+08:00
|
||||
|
||||
====== U-boot源代码全分析系列 ======
|
||||
Created Sunday 15 January 2012
|
||||
|
||||
164
Zim/Research/u-boot/U-boot源代码全分析系列/1.txt
Normal file
@@ -0,0 +1,164 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-01-15T19:23:20+08:00
|
||||
|
||||
====== 1 ======
|
||||
Created Sunday 15 January 2012
|
||||
http://blog.csdn.net/juana1/article/details/6699785
|
||||
一、概述
|
||||
|
||||
U-Boot,全称Universal Boot Loader,是遵循GPL条款的开放源码项目,是从FADSROM、8xxROM、PPCBOOT逐步发展演化而来的。其源码目录、编译形式与Linux内核很相似,事实上,不少U-Boot源码就是相应的Linux内核源程序的简化,尤其是一些设备的驱动程序,这从U-Boot源码的注释中能体现这一点。但是U-Boot不仅仅支持嵌入式Linux系统的引导,当前,它还支持NetBSD, VxWorks, QNX, RTEMS, ARTOS, LynxOS嵌入式操作系统。其目前要支持的目标操作系统是OpenBSD, NetBSD, FreeBSD,4.4BSD, Linux, SVR4, Esix, Solaris, Irix, SCO, Dell, NCR, VxWorks, LynxOS, pSOS, QNX, RTEMS, ARTOS。这是U-Boot中Universal的一层含义,另外一层含义则是U-Boot除了支持PowerPC系列的处理器外,还能支持MIPS、 x86、ARM、NIOS、XScale等诸多常用系列的处理器。这两个特点正是U-Boot项目的开发目标,即支持尽可能多的嵌入式处理器和嵌入式操作系统。
|
||||
|
||||
就目前来看,U-Boot对PowerPC系列处理器支持最为丰富,对Linux的支持最完善。其它系列的处理器和操作系统基本是在2002年11 月PPCBOOT改名为U-Boot后逐步扩充的。从PPCBOOT向U-Boot的顺利过渡,很大程度上归功于U-Boot的维护人德国DENX软件工程中心Wolfgang Denk[以下简称W.D]本人精湛专业水平和持着不懈的努力。当前,U-Boot项目正在他的领军之下,众多有志于开放源码BOOT LOADER移植工作的嵌入式开发人员正如火如荼地将各个不同系列嵌入式处理器的移植工作不断展开和深入,以支持更多的嵌入式操作系统的装载与引导。
|
||||
|
||||
选择U-Boot的理由如下:
|
||||
|
||||
1、开放源码;
|
||||
|
||||
2、支持多种嵌入式操作系统内核,如Linux、NetBSD, VxWorks, QNX, RTEMS, ARTOS, LynxOS;
|
||||
|
||||
3、支持多个处理器系列,如PowerPC、ARM、x86、MIPS、XScale;
|
||||
|
||||
4、较高的可靠性和稳定性;
|
||||
|
||||
5、较高的可靠性和稳定性;
|
||||
|
||||
6、高度灵活的功能设置,适合U-Boot调试、操作系统不同引导要求、产品发布等;
|
||||
|
||||
7、丰富的设备驱动源码,如串口、以太网、SDRAM、FLASH、LCD、NVRAM、EEPROM、RTC、键盘等;
|
||||
|
||||
8、较为丰富的开发调试文档与强大的网络技术支持;
|
||||
|
||||
本文将从整体架构出发,尽自己的理解分析u-boot源码及其启动原理,之后再介绍下移植u-boot时的一些技巧,最后将以叙述移植的实例的方式来阐述其使用方法。
|
||||
二、程序架构
|
||||
|
||||
要使用u-boot,首先需要搞清楚它的程序架构,要实现启动开发板需要修改哪些文件,下面列举了uboot的主要目录结构:
|
||||
|
||||
- board:目标板相关文件,主要包含SDRAM、Flash的驱动;
|
||||
|
||||
- common:独立于处理器体系结构的通用代码,如内存大小探测与故障检测等,它实现了u-boot的所有命令,其中内置了一个shell脚本解释器(hush.c,a prototype bourne shell grammar parser),busybox中也使用了它;
|
||||
|
||||
- cpu:与处理器相关的文件,如mpc8xx子目录下有串口、网口、LCD驱动及中断初始化等文件。其中cpu.c负责初始化CPU、设置指令cache和数据cache等,interrupt.c负责设置系统的各种中断和异常,如快速中断、开关中断、时钟中断、软件中断、预取中止和未定义指令等,start.S负责u-boot启动时执行的第一个文件,它主要设置系统堆栈和工作方式,为跳转到C程序入口点做准备;
|
||||
|
||||
- driver:通用设备驱动,如CFI Flash驱动(目前对INTEL Flash支持较好)
|
||||
|
||||
- doc:U-Boot的说明文档;
|
||||
|
||||
- examples:可在U-Boot下运行的示例程序,如hello_world.c、timer.c;
|
||||
|
||||
- include:U-Boot头文件,注意:configs子目录下与目标板相关的配置头文件是移植过程中经常要修改的文件;
|
||||
|
||||
- lib_xxx:处理器体系相关的文件,如lib_ppc, lib_arm目录分别包含与PowerPC、ARM体系结构相关的文件,lib_generic为通用的库函数实现;
|
||||
|
||||
- net:与网络功能相关的文件目录,如bootp、nfs、sntp、tftp;
|
||||
|
||||
- post:上电自检文件目录,目前仍有待于进一步完善;
|
||||
|
||||
- rtc:RTC驱动程序;
|
||||
|
||||
- tools:用于创建U-Boot S-RECORD和BIN镜像文件的工具;
|
||||
|
||||
-fs:文件系统程序,包括ext2、Jffs2等;
|
||||
|
||||
-disk:硬盘接口程序。
|
||||
|
||||
在board目录下的每个子平台目录内,都有一个连接脚本文件u-boot.lds,从中可以找到u-boot的函数入口。另外,该目录下还有一个config.mk文件,用于设置TEXT_BASE的地址,该地址就是希望运行的地址、链接地址。
|
||||
|
||||
u-boot 是一个层次式结构,要让它跑起来,应当至少提供串口驱动(UART Driver)、以太网驱动(Ethernet Driver)、Flash 驱动(Flash 驱动)以及USB 驱动(USB Driver)。目前,通过USB 口下载程序显得不是十分必要,所以暂时没有移植USB 驱动。驱动层之上是u-boot 的应用,command 通过串口提供人机界面。
|
||||
三、代码分析
|
||||
|
||||
本文的代码分析主要针对freescale的PowerPC芯片mpc83系列,从u-boot启动的过程来分析其源代码,目前大多数的bootloader都分为了Stage1和Stage2两个部分启动,依赖于CPU体系结构的代码常放在Stage1且常用汇编语言实现,在u-boot中功能代码集中在cpu/mpc83xx/start.S中,它包括从系统上电后在基地址开始执行的部分,它运行在flash中,包括对cpu寄存器的初始化和将Stage2的代码拷贝到SDRAM中的代码。而Stage2则用于实现复杂的应用,用C也有更好的可读性和移植性,主要功能代码集中在lib_ppc/board.c中,通过指定一系列的初始化函数表,实现对系统的初始化工作。一般情况下,u-boot编译后的程序不超过100k,且Stage1的代码编译后的大小一般不超过10k,。
|
||||
|
||||
以下内容属转载,虽是ARM,但PowerPC与之类似:
|
||||
|
||||
*************************************************************************
|
||||
*/
|
||||
|
||||
注:ARM微处理器支持字节(8位)、半字(16位)、字(32位)3种数据类型
|
||||
@向量跳转表,每条占四个字节(一个字),地址范围为0x0000 0000~@0x0000 0020
|
||||
@ARM体系结构规定在上电复位后的起始位置,必须有8条连续的跳
|
||||
|
||||
@转指令,通过硬件实现。他们就是异常向量表。ARM在上电复位后,@是从0x00000000开始启动的,其实如果bootloader存在,在执行
|
||||
|
||||
@下面第一条指令后,就无条件跳转到start_code,下面一部分并没@执行。设置异常向量表的作用是识别bootloader。以后系统每当有@异常出现,则CPU会根据异常号,从内存的0x00000000处开始查表@做相应的处理
|
||||
|
||||
/******************************************************
|
||||
|
||||
;当一个异常出现以后,ARM会自动执行以下几个步骤:
|
||||
;1.把下一条指令的地址放到连接寄存器LR(通常是R14).---保存位置
|
||||
;2.将相应的CPSR(当前程序状态寄存器)复制到SPSR(备份的程序状态寄存器)中---保存CPSR
|
||||
;3.根据异常类型,强制设置CPSR的运行模式位
|
||||
;4.强制PC(程序计数器)从相关异常向量地址取出下一条指令执行,从而跳转到相应的异常处理程序中
|
||||
*****************************************************************************/
|
||||
|
||||
首先来看下Stage1的过程,系统主要实现了一下的功能:
|
||||
|
||||
1、指定入口函数
|
||||
|
||||
一个可执行的镜像必须要有且只有一个全局入口,通常情况下,这个入口函数是放在ROM的起始位置,而它是由处理器中断复位向量来决定的,代码如下:
|
||||
[cpp] view plaincopy
|
||||
|
||||
. = EXC_OFF_SYS_RESET
|
||||
|
||||
.globl _start
|
||||
_start: /* time t 0 */
|
||||
li r21, BOOTFLAG_COLD /* Normal Power-On: Boot from FLASH*/
|
||||
nop
|
||||
b boot_cold
|
||||
|
||||
. = EXC_OFF_SYS_RESET + 0x10
|
||||
|
||||
.globl _start_warm
|
||||
_start_warm:
|
||||
li r21, BOOTFLAG_WARM /* Software reboot */
|
||||
b boot_warm
|
||||
|
||||
需要注意的是,我们必须自己告诉编译器这个入口,而这个工作就是修改链接脚本文件(lds)。由上可见,函数执行开始后,一个立即读取指令后就是一个跳转语句。一般情况下(上电、复位等),程序都会执行boot_cold,通过调用系统复位中断从System reset偏移向量0x100来获取指令,每个中断向量有256个字节的空间。另外,与start.s文件在一起的也有一个config.mk文件,该文件用于定义编译选项。通过链接地址TEXT_BASE和运行地址.start的不同决定是否要复制代码。
|
||||
|
||||
2、设置异常向量(Exception Vector)
|
||||
|
||||
异常向量表也可称为中断向量表,在mpc83xx中,它是以0x100的偏移量连续分布的,基地址的值取决于MSR[IP],当它为0是,基地址为0x00000000,为1时,基地址为0xfff00000。该值是由启动方式决定的。源码如下:
|
||||
[cpp] view plaincopy
|
||||
|
||||
/*
|
||||
* Vector Table
|
||||
*/
|
||||
|
||||
.globl _start_of_vectors
|
||||
_start_of_vectors:
|
||||
|
||||
/* Machine check */
|
||||
STD_EXCEPTION(0x200, MachineCheck, MachineCheckException)
|
||||
|
||||
/* Data Storage exception. */
|
||||
STD_EXCEPTION(0x300, DataStorage, UnknownException)
|
||||
|
||||
/* Instruction Storage exception. */
|
||||
STD_EXCEPTION(0x400, InstStorage, UnknownException)
|
||||
|
||||
/* External Interrupt exception. */
|
||||
#ifndef FIXME
|
||||
STD_EXCEPTION(0x500, ExtInterrupt, external_interrupt)
|
||||
#endif
|
||||
|
||||
/* Alignment exception. */
|
||||
. = 0x600
|
||||
Alignment:
|
||||
EXCEPTION_PROLOG(SRR0, SRR1)
|
||||
mfspr r4,DAR
|
||||
stw r4,_DAR(r21)
|
||||
mfspr r5,DSISR
|
||||
stw r5,_DSISR(r21)
|
||||
addi r3,r1,STACK_FRAME_OVERHEAD
|
||||
li r20,MSR_KERNEL
|
||||
rlwimi r20,r23,0,16,16 /* copy EE bit from saved MSR */
|
||||
rlwimi r20,r23,0,25,25 /* copy IP bit from saved MSR */
|
||||
lwz r6,GOT(transfer_to_handler)
|
||||
mtlr r6
|
||||
blrl
|
||||
.L_Alignment:
|
||||
.long AlignmentException - _start + EXC_OFF_SYS_RESET
|
||||
.long int_return - _start + EXC_OFF_SYS_RESET
|
||||
….
|
||||
|
||||
这里的代码太长了,就没再粘贴,有兴趣的可以下载源码看一下,上面的只包括了机器校验、数据存储异常、指令存储异常等异常处理函数,由上也可以看到其连续存储的特性。
|
||||
300
Zim/Research/u-boot/U-boot源代码全分析系列/2.txt
Normal file
@@ -0,0 +1,300 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-01-15T19:23:41+08:00
|
||||
|
||||
====== 2 ======
|
||||
Created Sunday 15 January 2012
|
||||
|
||||
3、初始化CPU相关
|
||||
|
||||
下面为初始化CPU的代码,实现的功能依次为屏蔽watchdog、初始化中断控制寄存器、清空Cache、关闭MMU等。
|
||||
[cpp] view plaincopy
|
||||
|
||||
.globl init_e300_core
|
||||
init_e300_core: /* time t 10 */
|
||||
/* Initialize machine status; enable machine check interrupt */
|
||||
|
||||
li r3, MSR_KERNEL /*设置MSR,允许数据\指令复制以及Machine check*/
|
||||
rlwimi r3, r5, 0, 25, 25 /* preserve IP bit set by HRCW */
|
||||
#ifdef DEBUG
|
||||
rlwimi r3, r5, 0, 21, 22 /* debugger might set SE & BE bits */
|
||||
#endif
|
||||
SYNC /* Some chip revs need this... */
|
||||
mtmsr r3
|
||||
SYNC
|
||||
mtspr SRR1, r3 /* Make SRR1 match MSR 中断相关*/
|
||||
|
||||
lis r3, CFG_IMMR@h
|
||||
#if defined(CONFIG_WATCHDOG)
|
||||
/* Initialise the Wathcdog values and reset it (if req) */
|
||||
lis r4, CFG_WATCHDOG_VALUE
|
||||
ori r4, r4, (SWCRR_SWEN | SWCRR_SWRI | SWCRR_SWPR)
|
||||
stw r4, SWCRR(r3)
|
||||
|
||||
/* and reset it */
|
||||
|
||||
li r4, 0x556C
|
||||
sth r4, SWSRR@l(r3)
|
||||
li r4, -0x55C7
|
||||
sth r4, SWSRR@l(r3)
|
||||
#else
|
||||
/* 关闭Wathcdog */
|
||||
lwz r4, SWCRR(r3)
|
||||
/* Check to see if its enabled for disabling
|
||||
once disabled by SW you can't re-enable */
|
||||
andi. r4, r4, 0x4
|
||||
beq 1f
|
||||
xor r4, r4, r4
|
||||
stw r4, SWCRR(r3)
|
||||
1:
|
||||
#endif /* CONFIG_WATCHDOG */
|
||||
|
||||
/* Initialize the Hardware Implementation-dependent Registers */
|
||||
/* HID0 also contains cache control */
|
||||
/*------------------------------------------------------*/
|
||||
|
||||
lis r3, CFG_HID0_INIT@h
|
||||
ori r3, r3, CFG_HID0_INIT@l
|
||||
SYNC
|
||||
mtspr HID0, r3
|
||||
|
||||
lis r3, CFG_HID0_FINAL@h
|
||||
ori r3, r3, CFG_HID0_FINAL@l
|
||||
SYNC
|
||||
mtspr HID0, r3
|
||||
|
||||
lis r3, CFG_HID2@h
|
||||
ori r3, r3, CFG_HID2@l
|
||||
SYNC
|
||||
mtspr HID2, r3
|
||||
|
||||
/* 关闭MMU功能,先清空所有BAT (块地址转换)*/
|
||||
|
||||
xor r0, r0, r0
|
||||
mtspr DBAT0U, r0
|
||||
mtspr DBAT0L, r0
|
||||
mtspr DBAT1U, r0
|
||||
mtspr DBAT1L, r0
|
||||
mtspr DBAT2U, r0
|
||||
mtspr DBAT2L, r0
|
||||
mtspr DBAT3U, r0
|
||||
mtspr DBAT3L, r0
|
||||
mtspr IBAT0U, r0
|
||||
mtspr IBAT0L, r0
|
||||
mtspr IBAT1U, r0
|
||||
mtspr IBAT1L, r0
|
||||
mtspr IBAT2U, r0
|
||||
mtspr IBAT2L, r0
|
||||
mtspr IBAT3U, r0
|
||||
mtspr IBAT3L, r0
|
||||
SYNC
|
||||
|
||||
/* 禁用tlb(快表) */
|
||||
|
||||
li r3, 32
|
||||
mtctr r3
|
||||
li r3, 0
|
||||
1: tlbie r3
|
||||
addi r3, r3, 0x1000
|
||||
bdnz 1b
|
||||
SYNC
|
||||
|
||||
/* Done! */
|
||||
Blr
|
||||
|
||||
这里需要注意的是,当程序在Flash中运行时,执行程序跳转时使用了跳转指令,但是不是使用绝对地址的跳转(即直接对PC操作)。因为若使用绝对地址,那么程序的取址就是相对于当前PC位置向前或向后的一段空间,而不会跳进SDRAM中。
|
||||
|
||||
4、初始化内存控制器
|
||||
|
||||
PowerPC处理器初识化内存控制器就是通过操作BAT以及TLB来实现的,将IBAT0~7以及DBAT0~7初始化,并禁用TLB,代码如下:
|
||||
[cpp] view plaincopy
|
||||
|
||||
/* setup_bats - set them up to some initial state */
|
||||
.globl setup_bats
|
||||
setup_bats:
|
||||
addis r0, r0, 0x0000
|
||||
|
||||
/* IBAT 0 */
|
||||
addis r4, r0, CFG_IBAT0L@h
|
||||
ori r4, r4, CFG_IBAT0L@l
|
||||
addis r3, r0, CFG_IBAT0U@h
|
||||
ori r3, r3, CFG_IBAT0U@l
|
||||
mtspr IBAT0L, r4
|
||||
mtspr IBAT0U, r3
|
||||
isync
|
||||
|
||||
/* DBAT 0 */
|
||||
addis r4, r0, CFG_DBAT0L@h
|
||||
ori r4, r4, CFG_DBAT0L@l
|
||||
addis r3, r0, CFG_DBAT0U@h
|
||||
ori r3, r3, CFG_DBAT0U@l
|
||||
mtspr DBAT0L, r4
|
||||
mtspr DBAT0U, r3
|
||||
isync
|
||||
|
||||
#ifdef CONFIG_HIGH_BATS
|
||||
/* IBAT 4 */
|
||||
addis r4, r0, CFG_IBAT4L@h
|
||||
ori r4, r4, CFG_IBAT4L@l
|
||||
addis r3, r0, CFG_IBAT4U@h
|
||||
ori r3, r3, CFG_IBAT4U@l
|
||||
mtspr IBAT4L, r4
|
||||
mtspr IBAT4U, r3
|
||||
isync
|
||||
|
||||
/* DBAT 4 */
|
||||
addis r4, r0, CFG_DBAT4L@h
|
||||
ori r4, r4, CFG_DBAT4L@l
|
||||
addis r3, r0, CFG_DBAT4U@h
|
||||
ori r3, r3, CFG_DBAT4U@l
|
||||
mtspr DBAT4L, r4
|
||||
mtspr DBAT4U, r3
|
||||
isync
|
||||
|
||||
#endif
|
||||
|
||||
/* Invalidate TLBs.
|
||||
* -> for (val = 0; val < 0x20000; val+=0x1000)
|
||||
* -> tlbie(val);
|
||||
*/
|
||||
lis r3, 0
|
||||
lis r5, 2
|
||||
|
||||
1:
|
||||
tlbie r3
|
||||
addi r3, r3, 0x1000
|
||||
cmp 0, 0, r3, r5
|
||||
blt 1b
|
||||
|
||||
blr
|
||||
|
||||
上面只贴出了高低位各一个BAT的操作代码,其他的类似。
|
||||
|
||||
5、复制程序到RAM
|
||||
|
||||
PowerPC中此段程序并不返回,在将程序代码全部复制到ROM中后,将会直接继续在RAM中运行:
|
||||
[cpp] view plaincopy
|
||||
|
||||
/*完成了代码复制,不返回,直接调用in_ram执行*/
|
||||
addi r0, r10, in_ram - _start + EXC_OFF_SYS_RESET
|
||||
mtlr r0
|
||||
blr
|
||||
.globl relocate_code
|
||||
relocate_code:
|
||||
mr r1, r3 /* 创建一个新的栈指针 */
|
||||
mr r9, r4 /* 备份 */
|
||||
mr r10, r5
|
||||
|
||||
mr r3, r5 /* r3:拷贝的终点 */
|
||||
lis r4, CFG_MONITOR_BASE@h /* r4:拷贝的起点 */
|
||||
ori r4, r4, CFG_MONITOR_BASE@l
|
||||
lwz r5, GOT(__init_end)
|
||||
sub r5, r5, r4 /* r5:拷贝的长度 */
|
||||
li r6, CFG_CACHELINE_SIZE /* Cache Line Size */
|
||||
|
||||
/* New GOT-PTR = (old GOT-PTR - CFG_MONITOR_BASE) + Destination Address */
|
||||
sub r15, r10, r4
|
||||
|
||||
/* First our own GOT */
|
||||
add r14, r14, r15
|
||||
/* then the one used by the C code */
|
||||
add r30, r30, r15
|
||||
|
||||
/* Now relocate code */
|
||||
cmplw cr1,r3,r4
|
||||
addi r0,r5,3
|
||||
srwi. r0,r0,2
|
||||
beq cr1,4f /* In place copy is not necessary */
|
||||
beq 7f /* Protect against 0 count */
|
||||
mtctr r0
|
||||
bge cr1,2f
|
||||
la r8,-4(r4)
|
||||
la r7,-4(r3)
|
||||
|
||||
/* copy */
|
||||
1: lwzu r0,4(r8)
|
||||
stwu r0,4(r7)
|
||||
bdnz 1b
|
||||
|
||||
addi r0,r5,3
|
||||
srwi. r0,r0,2
|
||||
mtctr r0
|
||||
la r8,-4(r4)
|
||||
la r7,-4(r3)
|
||||
|
||||
/* and compare */
|
||||
20: lwzu r20,4(r8)
|
||||
lwzu r21,4(r7)
|
||||
xor. r22, r20, r21
|
||||
bne 30f
|
||||
bdnz 20b
|
||||
b 4f
|
||||
|
||||
/* compare failed */
|
||||
30: li r3, 0
|
||||
blr
|
||||
|
||||
2: slwi r0,r0,2 /* re copy in reverse order ... y do we needed it? */
|
||||
add r8,r4,r0
|
||||
add r7,r3,r0
|
||||
3: lwzu r0,-4(r8)
|
||||
stwu r0,-4(r7)
|
||||
bdnz 3b
|
||||
|
||||
/*
|
||||
* Now flush the cache: note that we must start from a cache aligned
|
||||
* address. Otherwise we might miss one cache line.
|
||||
*/
|
||||
4: cmpwi r6,0
|
||||
add r5,r3,r5
|
||||
beq 7f /* Always flush prefetch queue in any case */
|
||||
subi r0,r6,1
|
||||
andc r3,r3,r0
|
||||
mr r4,r3
|
||||
5: dcbst 0,r4
|
||||
add r4,r4,r6
|
||||
cmplw r4,r5
|
||||
blt 5b
|
||||
sync /* Wait for all dcbst to complete on bus */
|
||||
mr r4,r3
|
||||
6: icbi 0,r4
|
||||
add r4,r4,r6
|
||||
cmplw r4,r5
|
||||
blt 6b
|
||||
7: sync /* Wait for all icbi to complete on bus */
|
||||
isync
|
||||
|
||||
6、初始化堆栈
|
||||
|
||||
对于mpc83xx系列,初始化堆栈代码如下:
|
||||
[cpp] view plaincopy
|
||||
|
||||
/* set up the stack pointer in our newly created cache-ram (r1) */
|
||||
lis r1, (CFG_INIT_RAM_ADDR + CFG_GBL_DATA_OFFSET)@h
|
||||
ori r1, r1, (CFG_INIT_RAM_ADDR + CFG_GBL_DATA_OFFSET)@l
|
||||
|
||||
li r0, 0 /* Make room for stack frame header and */
|
||||
stwu r0, -4(r1) /* clear final stack frame so that */
|
||||
stwu r0, -4(r1) /* stack backtraces terminate cleanly */
|
||||
|
||||
7、跳转到Stage2入口处
|
||||
|
||||
这也是Stage1的最后一步,程序在执行到这一步后,基本的硬件初始化工作也就完成了,下面是跳转的代码:
|
||||
[cpp] view plaincopy
|
||||
|
||||
GET_GOT /* initialize GOT access */
|
||||
/* r3: IMMR */
|
||||
lis r3, CFG_IMMR@h
|
||||
/* run low-level CPU init code (in Flash)*/
|
||||
bl cpu_init_f
|
||||
|
||||
/* r3: BOOTFLAG */
|
||||
mr r3, r21
|
||||
/* run 1st part of board init code (in Flash)*/
|
||||
bl board_init_f
|
||||
|
||||
其中board_init_f就是Stage2的函数入口。
|
||||
|
||||
由上可以看出start.S的流程为:异常向量——上电复位后进入复位异常向量——跳到启动代码处——设置处理器进入管理模式——关闭看门狗——关闭中断——设置时钟分频——关闭MMU和CACHE——进入lowlever_init.S——检查当前代码所处的位置,如果在FLASH中就将代码搬移到RAM中。至此,Stage1分析到此结束。
|
||||
|
||||
跳转到board_init_f后,程序开始执行Stage2阶段,代码多为C。
|
||||
174
Zim/Research/u-boot/U-boot源代码全分析系列/3.txt
Normal file
@@ -0,0 +1,174 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-01-15T19:24:09+08:00
|
||||
|
||||
====== 3 ======
|
||||
Created Sunday 15 January 2012
|
||||
|
||||
这里首先更正下上一篇中的一个错误,最后一步中的跳转代码当时一时仓促贴错了,先改正如下:
|
||||
|
||||
7、跳转到Stage2入口处
|
||||
|
||||
这也是Stage1的最后一步,程序在执行到这一步后,基本的硬件初始化工作也就完成了,下面是跳转的代码:
|
||||
[cpp] view plaincopy
|
||||
|
||||
clear_bss:
|
||||
/* 执行清空bss操作 */
|
||||
lwz r3,GOT(__bss_start)
|
||||
#if defined(CONFIG_HYMOD)
|
||||
/*
|
||||
* For HYMOD - the environment is the very last item in flash.
|
||||
* The real .bss stops just before environment starts, so only
|
||||
* clear up to that point.
|
||||
* taken from mods for FADS board
|
||||
* 检查当前代码位置
|
||||
*/
|
||||
lwz r4,GOT(environment)
|
||||
#else
|
||||
lwz r4,GOT(_end)
|
||||
#endif
|
||||
|
||||
/* 计算跳转 */
|
||||
cmplw 0, r3, r4
|
||||
beq 6f
|
||||
|
||||
li r0, 0
|
||||
5:
|
||||
stw r0, 0(r3)
|
||||
addi r3, r3, 4
|
||||
cmplw 0, r3, r4
|
||||
bne 5b
|
||||
6:
|
||||
|
||||
mr r3, r9 /* Global Data pointer */
|
||||
mr r4, r10 /* Destination Address */
|
||||
bl board_init_r
|
||||
|
||||
其中board_init_r就是Stage2的函数入口。
|
||||
|
||||
由上可以看出start.S的流程为:异常向量——上电复位后进入复位异常向量——跳到启动代码处——设置处理器进入管理模式——关闭看门狗——关闭中断——设置时钟分频——关闭MMU和CACHE——进入low level初始化代码——检查当前代码所处的位置,如果在FLASH中就将代码搬移到RAM中。至此,Stage1分析到此结束。
|
||||
|
||||
跳转到board_init_r后,程序开始执行Stage2阶段,代码多为C。
|
||||
|
||||
望谅解。
|
||||
|
||||
在上篇分析完Stage1的汇编代码后,又细看了两个C函数,也是属于很重要的初始化函数,所以,在分析Stage2的代码前,先还要看下Stage1的两个C代码程序,分别为cpu_init_f和board_init_f,二者在汇编程序in_flash中被调用,虽是C代码,但实现的仍是基本的初始化功能,且运行在ROM中,属于Stage1的范畴。
|
||||
|
||||
先看cpu_init_f函数,它是用来初始化low-level CPU的,主要功能包括建立内存映射map、初始化一些寄存器和UPM(User-Programmable Machine)。
|
||||
首先初始化一个结构体:
|
||||
[cpp] view plaincopy
|
||||
|
||||
gd = (gd_t *) (CFG_INIT_RAM_ADDR + CFG_GBL_DATA_OFFSET);
|
||||
|
||||
/* Clear initial global data */
|
||||
memset ((void *) gd, 0, sizeof (gd_t));
|
||||
|
||||
此处的结构体gd_t是一个放在启动后很早就可用的内存中的,就像mpc8xx、mpc82xx的DPRAM,或者是数据cache的locked parts,主要用于存放一小部分系统初始化时要用的全局变量,直到初始化内存控制器可用RAM之前,这是我们唯一能用的全局变量。这个区间是很小的,在本区间中只有256个字节。之后就开始配置各种设备的时钟模式,下面是对PCI和DMA的配置:
|
||||
[cpp] view plaincopy
|
||||
|
||||
#ifdef CFG_SCCR_PCICM
|
||||
/* PCI & DMA clock mode */
|
||||
im->clk.sccr = (im->clk.sccr & ~SCCR_PCICM) |
|
||||
(CFG_SCCR_PCICM << SCCR_PCICM_SHIFT);
|
||||
#endif
|
||||
|
||||
这个配置的选项是要根据datasheet里的SCCR寄存器来定的,下面是mpc83xx的一个系统时钟控制寄存器的各位:
|
||||
|
||||
|
||||
根据说明来对应uboot中include/Mpc83xx.h中的相关配置,不过大多数的CPU型号都已经配置好了,一般无需改动。
|
||||
|
||||
接下来初始化一些寄存器,如复位控制寄存器,DDR控制驱动寄存器等:
|
||||
[cpp] view plaincopy
|
||||
|
||||
/* RSR - Reset Status Register - clear all status */
|
||||
gd->reset_status = im->reset.rsr;
|
||||
im->reset.rsr = ~(RSR_RES);
|
||||
|
||||
/* RMR - Reset Mode Register contains checkstop reset enable*/
|
||||
im->reset.rmr = (RMR_CSRE & (1<<RMR_CSRE_SHIFT));
|
||||
|
||||
/* LCRR - Clock Ratio Register */
|
||||
im->lbus.lcrr = CFG_LCRR;
|
||||
|
||||
/* Enable Time Base & Decrimenter ( so we will have udelay() )*/
|
||||
im->sysconf.spcr |= SPCR_TBEN;
|
||||
|
||||
/* System General Purpose Register */
|
||||
im->sysconf.sicrh = CFG_SICRH;
|
||||
|
||||
这些都需要对照着Datasheet里的第四章:Reset,Clockig,and Initialization一一比对着看,这样才能加深印象(尽管大多数实际应用中都不用修改)。
|
||||
|
||||
最后是初始化内存映射,下面代码作用为将bank0映射到Flash的bank0的初始地址,后面还有部分代码,将根据需要映射bank1~7的:
|
||||
[cpp] view plaincopy
|
||||
|
||||
im->lbus.bank[0].br = CFG_BR0_PRELIM;
|
||||
im->lbus.bank[0].or = CFG_OR0_PRELIM;
|
||||
im->sysconf.lblaw[0].bar = CFG_LBLAWBAR0_PRELIM;
|
||||
im->sysconf.lblaw[0].ar = CFG_LBLAWAR0_PRELIM;
|
||||
|
||||
再来看下board_init_f函数,它主要用于在启动时尽快的提供一个控制台接口(串口)用于输出错误信息,并且初始化内存以便于复制代码。这段代码的编写需要注意:全局变量是只读的,BSS还未初始化,堆栈空间也很小(尽量不要有复杂操作)。最开始先进行一系列的初始化操作,和ARM系列类似,将初始化函数列表放在结构体init_sequence中:
|
||||
[cpp] view plaincopy
|
||||
|
||||
for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) {
|
||||
if ((*init_fnc_ptr) () != 0) {
|
||||
hang ();
|
||||
}
|
||||
}
|
||||
|
||||
主要包括板件前期初始化、获取CPU及总线时钟、初始化SDRAM时钟、初始化串口等操作。此时内存已经映射好了,就可以在DRAM中运行程序了,接下来我们需要在RAM的末端保存一些数据,包括uboot和Linux不能操作的区域、内核日志缓存、PRAM(被保护的RAM)、LCD帧缓存、监听代码、板件信息等。
|
||||
[cpp] view plaincopy
|
||||
|
||||
/*通过修改gd->ram_size可以使uboot无法访问指定区间*/
|
||||
gd->ram_size -= CFG_MEM_TOP_HIDE;
|
||||
addr = CFG_SDRAM_BASE + get_effective_memsize();
|
||||
|
||||
#ifdef CONFIG_LOGBUFFER
|
||||
#ifndef CONFIG_ALT_LB_ADDR
|
||||
/*保存内核日志*/
|
||||
addr -= (LOGBUFF_RESERVE);
|
||||
debug ("Reserving %dk for kernel logbuffer at %08lx\n", LOGBUFF_LEN, addr);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PRAM
|
||||
/* reserve protected RAM */
|
||||
i = getenv_r ("pram", (char *)tmp, sizeof (tmp));
|
||||
reg = (i > 0) ? simple_strtoul ((const char *)tmp, NULL, 10) : CONFIG_PRAM;
|
||||
addr -= (reg << 10); /* size is in kB */
|
||||
debug ("Reserving %ldk for protected RAM at %08lx\n", reg, addr);
|
||||
#endif /* CONFIG_PRAM */
|
||||
|
||||
#ifdef CONFIG_LCD
|
||||
/* reserve memory for LCD display (always full pages) */
|
||||
addr = lcd_setmem (addr);
|
||||
gd->fb_base = addr;
|
||||
#endif /* CONFIG_LCD */
|
||||
|
||||
#if defined(CONFIG_VIDEO) && defined(CONFIG_8xx)
|
||||
/* reserve memory for video display (always full pages) */
|
||||
addr = video_setmem (addr);
|
||||
gd->fb_base = addr;
|
||||
#endif /* CONFIG_VIDEO */
|
||||
|
||||
#ifdef CONFIG_AMIGAONEG3SE
|
||||
gd->relocaddr = addr;
|
||||
#endif
|
||||
|
||||
/* reserve memory for malloc() arena */
|
||||
addr_sp = addr - TOTAL_MALLOC_LEN;
|
||||
debug ("Reserving %dk for malloc() at: %08lx\n",
|
||||
TOTAL_MALLOC_LEN >> 10, addr_sp);
|
||||
|
||||
/* (permanently) allocate a Board Info struct and a permanent copy of the "global" dat*/
|
||||
addr_sp -= sizeof (bd_t);
|
||||
bd = (bd_t *) addr_sp;
|
||||
gd->bd = bd;
|
||||
debug ("Reserving %zu Bytes for Board Info at: %08lx\n",sizeof (bd_t), addr_sp);
|
||||
addr_sp -= sizeof (gd_t);
|
||||
id = (gd_t *) addr_sp;
|
||||
debug ("Reserving %zu Bytes for Global Data at: %08lx\n",
|
||||
sizeof (gd_t), addr_sp);
|
||||
|
||||
接下来的代码比较容易理解,就是将板件信息存储到结构体board_info里,包括串口信息、PHY芯片信息、启动参数、RAM参数、flash信息等。
|
||||
|
||||
分析完这两个C函数后,Stage1的分析就全部结束了。接下来跳入board_init_r函数中开始Stage2。
|
||||
@@ -0,0 +1,302 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-01-15T19:29:55+08:00
|
||||
|
||||
====== MPC8314 (e300核) uboot 调试 一 ======
|
||||
Created Sunday 15 January 2012
|
||||
http://blog.csdn.net/gorilla0123/article/details/5899452
|
||||
|
||||
历经2个多月,完成了MPC8314最小系统(uboot)及Linux内核和根文件系统的调试。这是我第一次从头开始做小系统和内核的移植工作,虽然调试的比较辛苦,但是收获还是很多的。下面就介绍一下调试的过程和一些原理性的东西。
|
||||
|
||||
1 MPC8314 上电流程
|
||||
|
||||
系统上电后,经过若干个时钟后,MPC8314会检测复位配置输入信号CFG_RESET_SOURCE[0:3]来确定硬件配置字源选择,在目标板上可以设置跳线来改变CFG_RESET_SOURCE[0:3],选择硬件配置字源。本系统中的硬件配置字存放在CPLD模拟的Flash空间中。
|
||||
{{./1.gif}}
|
||||
从相应的地方读取硬件配置字(RCWL,RCWH)后,会设置相应的寄存器。其中RCWH中的BMS位值为1,定义了e300核心的MSR[IP]位初始值,如上图所示,MSR[IP]为1决定中断向量的前缀为0xFFF,启动存储空间的位置为0xFF80_0000~0xFFFF_FFFF;SWEN位为0,禁止软件看门狗;ROMLOC位为0b110,RLEXT位为0b00确定了选择local bus GPCM-16bit ROM为启动ROM。复位向量和本地地址映射的默认启动ROM访问将直接指向ROMLOC指定的接口。选中的启动ROM的本地访问窗口(LBLAW0)将被使能,并初始化基地址LBLAWBAR0为0xFF80_0000,窗口大小为8M。这时,Local Bus上的片选CS0的寄存器值为BR0:0000_0000,OR0:0000_0000。整个4G空间全是ROM,每16M重复一次。
|
||||
|
||||
中断向量的前缀为0xFFF,复位向量为100,决定了系统复位后的第一条指令从0xFFF0_0100处获得。
|
||||
|
||||
/cpu/mpc83xx/u-boot.lds文件时连接器脚本文件,其中
|
||||
|
||||
.text :
|
||||
|
||||
{
|
||||
|
||||
cpu/mpc83xx/start.o (.text)
|
||||
|
||||
。 。 。 。 。
|
||||
|
||||
}
|
||||
|
||||
。 。 。 。 。 。
|
||||
|
||||
ENTRY(_start)
|
||||
|
||||
规定了代码段从/cpu/mpc83xx/start.s开始。而ENTRY(_start)这一句告诉编译器uboot.bin的镜像入口点为start.s中的_start标号。
|
||||
|
||||
所以,我们要将UBOOT的代码烧写到16M Flash中偏移15M的地方,保证了从0xFFF0_0100的空间取到的指令为uboot代码。并且还需要保证0xFFF0_0100为start标号。
|
||||
|
||||
|
||||
2 uboot启动流程
|
||||
2.1 uboot启动概述
|
||||
|
||||
Uboot的启动是从/cpu/mpc83xx/start.s中的_start标号开始的,经历了 /cpu/mpc83xx/start.s,/cpu/mpc83xx/cpu_init.c ,/lib_ppc/Board.c等几个文件中的多个汇编和C函数,最后会在/lib_ppc/Board.c中的board_init_r函数中进入命令死循环,等待执行键入的命令。其具体的流程如下图所示:
|
||||
{{./2.gif}}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
2.2 init_e300_core 函数
|
||||
|
||||
|
||||
|
||||
初始化e300核心,禁止中断响应,只允许machine check中断和system reset中断,禁止指令和数据地址转换,即关闭MMU,进行实地址转换,设置为supervisor级别,禁止看门狗,无效指令和数据cache,等,为系统创建一个干净可靠的初始环境。
|
||||
|
||||
|
||||
|
||||
2.3 窗口重映射
|
||||
|
||||
|
||||
|
||||
从前面MPC8314上电流程可以看出,上电之后,第一条代码是从0xFFF0_0100的地方开始执行的,但是flash并不一定会分配在0xFF00_0000到0xFFFF_FFFF的地方(以我们16M的为例)。在本系统中,Flash的地址就被分配到了0xFE00_0000到0xFEFF_FFFF的地方。所以这其中需要做一个跳转,这正是这段代码中map_flash_by_law1,remap_flash_by_law0等函数要做的,具体的流程可以由下面的五张图来说明:
|
||||
|
||||
|
||||
|
||||
1 开始时,BR0,OR0为全零,4G全是重复的Flash,CPU通过LBLAW0访问Flash
|
||||
|
||||
空间 FF80_0000到 FFFF_FFFF。
|
||||
|
||||
{{./3.gif}}
|
||||
|
||||
|
||||
|
||||
2 map_flash_by_law1函数使用LBLAW1映射FE00_0000到FEFF_FFFF这段空间。
|
||||
{{./4.gif}}
|
||||
|
||||
|
||||
|
||||
|
||||
3 跳转到FE00_0000这段空间执行代码,由于4G空间重复,只要偏移地址计算正确就
|
||||
|
||||
会顺序执行。
|
||||
{{./5.gif}}
|
||||
|
||||
|
||||
|
||||
|
||||
4 remap_flash_by_law0函数设置BR0为FE00_0000,OR0大小为16M。
|
||||
{{./6.gif}}
|
||||
5 remap_flash_by_law0函数设置LBLAW0窗口映射FE00_0000到FE7F_FFFF区域,并
|
||||
|
||||
{{./7.gif}}
|
||||
|
||||
清除LBLAW1。
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
2.4 Dcache 中分配空间做堆栈
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
程序跑到这里,就要进入第一个C函数了,C函数的运行需要堆栈空间,但这时,RAM还没有初始化,只能在Dcache中锁定一定的空间,用于C的堆栈空间。
|
||||
|
||||
lock_ram_in_cache函数在Dcache中锁定4k的空间。
|
||||
|
||||
下面的几行代码将堆栈指针指向刚刚分配好的Dcache空间。
|
||||
|
||||
lis r1, (CFG_INIT_RAM_ADDR + CFG_GBL_DATA_OFFSET)@h
|
||||
|
||||
ori r1, r1, (CFG_INIT_RAM_ADDR + CFG_GBL_DATA_OFFSET)@l
|
||||
|
||||
li r0, 0
|
||||
|
||||
stwu r0, -4(r1)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
2.5 cpu_init_f 函数
|
||||
|
||||
|
||||
|
||||
该函数是系统执行的第一个C语言的函数,主要是做一些CPU 寄存器的初始化,其中最重要的部分是初始化Local Access Windows的值和Local Bus上的片选BR,OR的值。这些值需要在/include/configs/MPC8315ERDB.h中配置好。
|
||||
|
||||
|
||||
|
||||
2.6 board_init_f 函数
|
||||
|
||||
|
||||
|
||||
该函数为板级初始化的第一个函数,会对板子上很多硬件外设做初始化,其中最重要的为init_sequence数组,该数组里面包含了很多板级的硬件初始化函数,在board_init_f函数中会依次的调用该数组中的函数去初始化各个硬件,该数组如下:
|
||||
|
||||
init_fnc_t *init_sequence[] = {
|
||||
|
||||
|
||||
|
||||
#if defined(CONFIG_BOARD_EARLY_INIT_F)
|
||||
|
||||
board_early_init_f,
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if !defined(CONFIG_8xx_CPUCLK_DEFAULT)
|
||||
|
||||
get_clocks, /* get CPU and bus clocks (etc.) */
|
||||
|
||||
#if defined(CONFIG_TQM8xxL) && !defined(CONFIG_TQM866M) /
|
||||
|
||||
&& !defined(CONFIG_TQM885D)
|
||||
|
||||
adjust_sdram_tbs_8xx,
|
||||
|
||||
#endif
|
||||
|
||||
init_timebase,
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef CFG_ALLOC_DPRAM
|
||||
|
||||
#if !defined(CONFIG_CPM2)
|
||||
|
||||
dpram_init,
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_BOARD_POSTCLK_INIT)
|
||||
|
||||
board_postclk_init,
|
||||
|
||||
#endif
|
||||
|
||||
env_init,
|
||||
|
||||
#if defined(CONFIG_8xx_CPUCLK_DEFAULT)
|
||||
|
||||
get_clocks_866, /* get CPU and bus clocks according to the environment variable */
|
||||
|
||||
sdram_adjust_866, /* adjust sdram refresh rate according to the new clock */
|
||||
|
||||
init_timebase,
|
||||
|
||||
#endif
|
||||
|
||||
init_baudrate,
|
||||
|
||||
serial_init,
|
||||
|
||||
console_init_f,
|
||||
|
||||
display_options,
|
||||
|
||||
#if defined(CONFIG_8260)
|
||||
|
||||
prt_8260_rsr,
|
||||
|
||||
prt_8260_clks,
|
||||
|
||||
#endif /* CONFIG_8260 */
|
||||
|
||||
#if defined(CONFIG_MPC83XX)
|
||||
|
||||
prt_83xx_rsr,
|
||||
|
||||
#endif
|
||||
|
||||
checkcpu,
|
||||
|
||||
#if defined(CONFIG_MPC5xxx)
|
||||
|
||||
prt_mpc5xxx_clks,
|
||||
|
||||
#endif /* CONFIG_MPC5xxx */
|
||||
|
||||
#if defined(CONFIG_MPC8220)
|
||||
|
||||
prt_mpc8220_clks,
|
||||
|
||||
#endif
|
||||
|
||||
checkboard,
|
||||
|
||||
INIT_FUNC_WATCHDOG_INIT
|
||||
|
||||
#if defined(CONFIG_MISC_INIT_F)
|
||||
|
||||
misc_init_f,
|
||||
|
||||
#endif
|
||||
|
||||
INIT_FUNC_WATCHDOG_RESET
|
||||
|
||||
#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C)
|
||||
|
||||
init_func_i2c,
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_DTT) /* Digital Thermometers and Thermostats */
|
||||
|
||||
dtt_init,
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_POST
|
||||
|
||||
post_init_f,
|
||||
|
||||
#endif
|
||||
|
||||
INIT_FUNC_WATCHDOG_RESET
|
||||
|
||||
init_func_ram,
|
||||
|
||||
#if defined(CFG_DRAM_TEST)
|
||||
|
||||
testdram,
|
||||
|
||||
#endif /* CFG_DRAM_TEST */
|
||||
|
||||
INIT_FUNC_WATCHDOG_RESET
|
||||
|
||||
|
||||
|
||||
NULL, /* Terminate this list */
|
||||
|
||||
};
|
||||
|
||||
可以看到时钟,内存,串口,控制台等初始化函数的调用,其中串口的初始化要先于内存初始化。
|
||||
|
||||
|
||||
|
||||
2.7 relocate_code 函数
|
||||
|
||||
|
||||
|
||||
到目前为止,boot代码都是在Flash中运行,但是代码最终是要到RAM中运行的,在上面的board_init_f函数中已经将RAM初始化好了,具备了在RAM中运行程序的能力,现在relocate_code函数需要做两个事情:
|
||||
|
||||
1 从Flash中拷贝uboot的代码到RAM
|
||||
|
||||
2 记下现在执行代码的偏移,跳转到RAM中相应的位置执行。
|
||||
|
||||
|
||||
|
||||
2.8 board_init_r 函数
|
||||
|
||||
|
||||
|
||||
该函数为板级初始化的第二阶段,主要是初始化PCI,PCIE,网口,Flash等设备,关闭看门狗,把前面借dcache做堆栈的空间解锁,还给cache。在一切设备都初始化好后,便会进去main_loop的死循环中。
|
||||
|
||||
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 8.9 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 7.8 KiB |
|
After Width: | Height: | Size: 6.7 KiB |
261
Zim/Research/u-boot/U-boot源代码全分析系列/U-Boot源码分析之Makefile.txt
Normal file
@@ -0,0 +1,261 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-01-15T19:25:07+08:00
|
||||
|
||||
====== U-Boot源码分析之Makefile ======
|
||||
Created Sunday 15 January 2012
|
||||
|
||||
之前用过两个版本u-boot,分析过它的Start.S文件(PowerPC、ARM)源代码,也移植过内部的各部分硬件驱动及组件(串口、I2C、SPI、Flash文件系统、USB、DMA等)源码,自我感觉比较熟悉了。但最近逛CSDN论坛发现有不少人在问U-Boot中的Makefile的一些参数含义及配置方法,这才觉得忽视了U-Boot源码中最重要的组织者。正好,又在ChinaUnix上看见了一篇http://blog.chinaunix.net/u3/90973/showart_1815948.html,解析的是1.1.6版本,2410平台的Makefile。参考了一下,这里分析2011.6版,FreeScale的mpc83xx系列处理器平台。
|
||||
|
||||
u-boot的源代码包含了对几十种处理器、数百种开发板的支持,可是对于特定的开发板,配置编译过程只需要其中部分程序。这里就需要用到Makefile了。
|
||||
编译
|
||||
以mpc8313erdb板为例,编译的过程分两部:
|
||||
# make mpc8313erdb_config
|
||||
# make
|
||||
顶层Makefile分析
|
||||
要了解一个LINUX工程的结构必须看懂Makefile,尤其是顶层的,没办法,UNIX世界就是这么无奈,什么东西都用文档去管理、配置。还是以mpc8313为例,顺序分析Makefile大致的流程及结构如下:
|
||||
1) Makefile中定义了源码及生成的目标文件存放的目录,目标文件存放目录BUILD_DIR可以通过make O=dir或者export BUILD_DIR=dir两种方式指定。如果没有指定,则设定为源码的根目录,一般编译的时候都建议指定输出目录,这样可以不影响其他的源码结构,便于管理,至于它的控制流程,每一步指令都有详细注释,感兴趣的可以看一下,再看下其它目录变量的定义:
|
||||
|
||||
OBJTREE和LNDIR为存放生成文件的目录,TOPDIR与SRCTREE为源码所在目录
|
||||
OBJTREE := $(if $(BUILD_DIR),$(BUILD_DIR),$(CURDIR))
|
||||
SRCTREE := $(CURDIR)
|
||||
TOPDIR := $(SRCTREE)
|
||||
LNDIR := $(OBJTREE)
|
||||
export TOPDIR SRCTREE OBJTREE
|
||||
2)定义变量MKCONFIG:这个变量指向一个脚本,即顶层目录的mkconfig。
|
||||
MKCONFIG := $(SRCTREE)/mkconfig
|
||||
export MKCONFIG
|
||||
在编译U-BOOT之前,先要执行
|
||||
#make mpc8313erdb_33_config(u-boot中有两种主频的8313处理器,所以也要添加配置)
|
||||
mpc8313erdb_33_config是Makefile的一个目标,定义如下:
|
||||
mpc8313erdb_33_config : unconfig
|
||||
@$(MKCONFIG) -a MPC8313ERDB ppc mpc8313 mpc8313erdb freescale
|
||||
unconfig::
|
||||
@mkdir -p $(obj)include
|
||||
|
||||
@if [ "$(findstring _33_,$@)" ] ; then \
|
||||
|
||||
$(XECHO) -n "...33M ..." ; \
|
||||
|
||||
echo "#define CFG_33MHZ" >>$(obj)include/config.h ; \
|
||||
|
||||
fi ; \
|
||||
|
||||
if [ "$(findstring _66_,$@)" ] ; then \
|
||||
|
||||
$(XECHO) -n "...66M..." ; \
|
||||
|
||||
echo "#define CFG_66MHZ" >>$(obj)include/config.h ; \
|
||||
|
||||
fi ;
|
||||
|
||||
显然,在执行# make mpc8313erdb_33__config时,先执行unconfig目标,注意不指定输出目标时,obj,src变量均为空,unconfig下面的命令清理上一次执行make *_config时生成的头文件和makefile的包含文件。主要是include/config.h和include/config.tmp文件。
|
||||
然后才执行命令@$(MKCONFIG) -a MPC8313ERDB ppc mpc8313 mpc8313erdb freescale
|
||||
MKCONFIG 是顶层目录下的mkcofig脚本文件,后面五个是传入的参数。
|
||||
对于mpc8313erdb_33_config而言,mkconfig主要做三件事:
|
||||
在include文件夹下建立相应的文件(夹)软连接,如果是PowerPC体系将执行以下操作:
|
||||
#ln -s asm-ppc asm
|
||||
#ln -s arch-mpc8313erdb asm-ppc
|
||||
|
||||
生成Makefile包含文件include/config.mk,内容很简单,定义了四个变量:
|
||||
ARCH = ppc
|
||||
CPU = mpc83xx
|
||||
BOARD = mpc8313erdb
|
||||
|
||||
VENDOR = freescale
|
||||
生成include/config.h头文件,只有一行:
|
||||
/* Automatically generated - do not edit */
|
||||
#include "config/ mpc8313erdb.h"
|
||||
|
||||
mkconfig脚本文件的执行至此结束,继续分析Makefile剩下部分。
|
||||
3)包含include/config.mk,其实也就相当于在Makefile里定义了上面四个变量而已。
|
||||
4) 指定交叉编译器前缀:
|
||||
ifeq ($(ARCH),ppc)#这里根据ARCH变量,指定编译器前缀。
|
||||
CROSS_COMPILE = ppc-8xx-
|
||||
endif
|
||||
5)包含config.mk:
|
||||
#包含顶层目录下的config.mk,这个文件里面主要定义了交叉编译器及选项和编译规则
|
||||
# load other configuration
|
||||
include $(TOPDIR)/config.mk
|
||||
下面分析config.mk的内容:
|
||||
@包含体系,开发板,CPU特定的规则文件:
|
||||
ifdef ARCH #指定预编译体系结构选项
|
||||
sinclude $(TOPDIR)/$(ARCH)_config.mk # include architecture dependend rules
|
||||
endif
|
||||
ifdef CPU #定义编译时对齐,浮点等选项
|
||||
sinclude $(TOPDIR)/cpu/$(CPU)/config.mk # include CPU specific rules
|
||||
endif
|
||||
ifdef SOC #没有这个文件
|
||||
sinclude $(TOPDIR)/cpu/$(CPU)/$(SOC)/config.mk # include SoC specific rules
|
||||
endif
|
||||
ifdef BOARD #指定特定板子的镜像连接时的内存基地址,重要!
|
||||
sinclude $(TOPDIR)/board/$(BOARDDIR)/config.mk # include board specific rules
|
||||
endif
|
||||
@定义交叉编译链工具
|
||||
# Include the make variables (CC, etc...)
|
||||
#
|
||||
AS = $(CROSS_COMPILE)as
|
||||
LD = $(CROSS_COMPILE)ld
|
||||
CC = $(CROSS_COMPILE)gcc
|
||||
CPP = $(CC) -E
|
||||
AR = $(CROSS_COMPILE)ar
|
||||
NM = $(CROSS_COMPILE)nm
|
||||
STRIP = $(CROSS_COMPILE)strip
|
||||
OBJCOPY = $(CROSS_COMPILE)objcopy
|
||||
OBJDUMP = $(CROSS_COMPILE)objdump
|
||||
RANLIB = $(CROSS_COMPILE)RANLIB
|
||||
@定义AR选项ARFLAGS,调试选项DBGFLAGS,优化选项OPTFLAGS
|
||||
预处理选项CPPFLAGS,C编译器选项CFLAGS,连接选项LDFLAGS
|
||||
LDFLAGS += -Bstatic -T $(LDSCRIPT) -Ttext $(TEXT_BASE) $(PLATFORM_LDFLAGS)
|
||||
|
||||
指定了起始地址TEXT_BASE
|
||||
@指定编译规则:
|
||||
$(obj)%.s: %.S
|
||||
$(CPP) $(AFLAGS) -o $@ $
|
||||
回到顶层makefile文件:
|
||||
6)U-boot需要的目标文件。
|
||||
OBJS = cpu/$(CPU)/start.o # 顺序很重要,start.o必须放第一位
|
||||
|
||||
OBJS := $(addprefix $(obj),$(OBJS))
|
||||
7)需要的库文件:
|
||||
LIBS = lib_generic/libgeneric.a
|
||||
LIBS += $(shell if [ -f board/$(VENDOR)/common/Makefile ]; then echo \
|
||||
|
||||
"board/$(VENDOR)/common/lib$(VENDOR).a"; fi) 上面的意思是根据厂商选择编译通用文件,这里为freescale
|
||||
LIBS += cpu/$(CPU)/lib$(CPU).a
|
||||
LIBS += lib_$(ARCH)/lib$(ARCH).a
|
||||
LIBS += fs/cramfs/libcramfs.a fs/fat/libfat.a fs/fdos/libfdos.a fs/jffs2/libjffs2.a \
|
||||
|
||||
fs/reiserfs/libreiserfs.a fs/ext2/libext2fs.a
|
||||
|
||||
LIBS += net/libnet.a
|
||||
|
||||
LIBS += disk/libdisk.a
|
||||
|
||||
LIBS += drivers/bios_emulator/libatibiosemu.a
|
||||
|
||||
LIBS += drivers/block/libblock.a
|
||||
|
||||
LIBS += drivers/dma/libdma.a
|
||||
|
||||
LIBS += drivers/hwmon/libhwmon.a
|
||||
|
||||
LIBS += drivers/i2c/libi2c.a
|
||||
|
||||
LIBS += drivers/input/libinput.a
|
||||
|
||||
LIBS += drivers/misc/libmisc.a
|
||||
|
||||
LIBS += drivers/mmc/libmmc.a
|
||||
|
||||
LIBS += drivers/mtd/libmtd.a
|
||||
|
||||
LIBS += drivers/mtd/nand/libnand.a
|
||||
|
||||
LIBS += drivers/mtd/nand_legacy/libnand_legacy.a
|
||||
|
||||
LIBS += drivers/mtd/onenand/libonenand.a
|
||||
|
||||
LIBS += drivers/mtd/spi/libspi_flash.a
|
||||
|
||||
LIBS += drivers/net/libnet.a
|
||||
|
||||
LIBS += drivers/net/sk98lin/libsk98lin.a
|
||||
|
||||
LIBS += drivers/pci/libpci.a
|
||||
|
||||
LIBS += drivers/pcmcia/libpcmcia.a
|
||||
|
||||
LIBS += drivers/spi/libspi.a
|
||||
|
||||
ifeq ($(CPU),mpc83xx)
|
||||
|
||||
LIBS += drivers/qe/qe.a
|
||||
|
||||
endif
|
||||
LIBS += drivers/rtc/librtc.a
|
||||
|
||||
LIBS += drivers/serial/libserial.a
|
||||
|
||||
LIBS += drivers/usb/libusb.a
|
||||
|
||||
LIBS += drivers/video/libvideo.a
|
||||
|
||||
LIBS += common/libcommon.a
|
||||
|
||||
LIBS += libfdt/libfdt.a
|
||||
|
||||
LIBS += api/libapi.a
|
||||
|
||||
LIBS += post/libpost.a
|
||||
|
||||
LIBS := $(addprefix $(obj),$(LIBS))
|
||||
|
||||
.PHONY : $(LIBS) $(VERSION_FILE)
|
||||
|
||||
LIBBOARD = board/$(BOARDDIR)/lib$(BOARD).a
|
||||
|
||||
LIBBOARD := $(addprefix $(obj),$(LIBBOARD))
|
||||
|
||||
根据上面的include/config.mk文件定义的ARCH、CPU、BOARD、SOC这些变量。硬件平台依赖的目录文件可以根据这些定义来确定。
|
||||
8)最终生成的各种镜像文件:
|
||||
ALL = $(obj)u-boot.srec $(obj)u-boot.bin $(obj)System.map $(U_BOOT_NAND) $(U_BOOT_ONENAND)
|
||||
all: $(ALL)
|
||||
$(obj) u-boot.bin: $(obj)u-boot
|
||||
|
||||
$(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
|
||||
分析一下最关键的u-boot ELF文件镜像的生成:
|
||||
|
||||
依赖目标depend :生成各个子目录的.depend文件,.depend列出每个目标文件的依赖文件。生成方法,调用每个子目录的make _depend。
|
||||
depend dep: $(VERSION_FILE)
|
||||
|
||||
for dir in $(SUBDIRS) ; do $(MAKE) -C $$dir _depend ; done
|
||||
@依赖目标version:生成版本信息到版本文件VERSION_FILE中。
|
||||
$(VERSION_FILE):
|
||||
|
||||
@( printf '#define U_BOOT_VERSION "U-Boot %s%s"\n' "$(U_BOOT_VERSION)" \
|
||||
|
||||
'$(shell $(CONFIG_SHELL) $(TOPDIR)/tools/setlocalversion $(TOPDIR))' \
|
||||
|
||||
) > $@.tmp
|
||||
|
||||
@cmp -s $@ $@.tmp && rm -f $@.tmp || mv -f $@.tmp $@
|
||||
@伪目标SUBDIRS: 执行tools ,examples ,post,post\cpu 子目录下面的make文件。
|
||||
SUBDIRS = tools \
|
||||
examples \
|
||||
post \
|
||||
post/cpu
|
||||
.PHONY : $(SUBDIRS)
|
||||
$(SUBDIRS):
|
||||
$(MAKE) -C $@ all
|
||||
@依赖目标$(OBJS),即cpu/start.o
|
||||
$(OBJS):
|
||||
$(MAKE) -C cpu/$(CPU) $(if $(REMOTE_BUILD),$@,$(notdir $@))
|
||||
@依赖目标$(LIBS),这个目标太多,都是每个子目录的库文件*.a ,通过执行相应子目录下的make来完成:
|
||||
$(LIBS):
|
||||
$(MAKE) -C $(dir $(subst $(obj),,$@))
|
||||
@依赖目标$(LDSCRIPT):
|
||||
$(LDSCRIPT): depend $(obj)include/autoconf.mk
|
||||
|
||||
$(MAKE) -C $(dir $@) $(notdir $@)
|
||||
LDFLAGS += -Bstatic -T $(LDSCRIPT) -Ttext $(TEXT_BASE) $(PLATFORM_LDFLAGS)
|
||||
对于mpc8313,LDSCRIPT即连接脚本文件是board/freescale/mpc8313erdb/u-boot.lds,定义了连接时各个目标文件是如何组织的。
|
||||
|
||||
@执行连接命令:
|
||||
cd $(LNDIR) && $(LD) $(LDFLAGS) $$UNDEF_SYM $(__OBJS) \
|
||||
--start-group $(__LIBS) --end-group $(PLATFORM_LIBS) \
|
||||
-Map u-boot.map -o u-boot
|
||||
其实就是把start.o和各个子目录makefile生成的库文件按照LDFLAGS连接在一起,生成ELF文件u-boot 和连接时内存分配图文件u-boot.map。
|
||||
9)对于各子目录的makefile文件,主要是生成*.o文件然后执行AR生成对应的库文件。如lib_generic文件夹Makefile:
|
||||
LIB = $(obj)libgeneric.a
|
||||
COBJS = bzlib.o bzlib_crctable.o bzlib_decompress.o \
|
||||
bzlib_randtable.o bzlib_huffman.o \
|
||||
crc32.o ctype.o display_options.o ldiv.o \
|
||||
string.o vsprintf.o zlib.o
|
||||
SRCS := $(COBJS:.o=.c)
|
||||
OBJS := $(addprefix $(obj),$(COBJS))
|
||||
$(LIB): $(obj).depend $(OBJS) #项层Makefile执行make libgeneric.a
|
||||
$(AR) $(ARFLAGS) $@ $(OBJS)
|
||||
整个makefile剩下的内容全部是各种不同的开发板的*_config:目标的定义了。
|
||||
概括起来,工程的编译流程也就是通过执行执行一个make *_config传入ARCH,CPU,BOARD,VENDOR参数,mkconfig根据参数将include头文件夹相应的头文件夹连接好,生成config.h。然后执行make分别调用各子目录的makefile 生成所有的obj文件和obj库文件*.a,最后连接所有目标文件,生成镜像。不同格式的镜像都是调用相应工具由elf镜像直接或者间接生成的。
|
||||
剩下的工作就是分析U-Boot源代码了,有兴趣的可以看下我对Start.S分析的文章。
|
||||
7
Zim/Research/vanet.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-08-10T13:58:34+08:00
|
||||
|
||||
====== vanet ======
|
||||
Created Friday 10 August 2012
|
||||
|
||||
268
Zim/Research/vanet/MPC8315E-RDB启动输出.txt
Normal file
@@ -0,0 +1,268 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-06-25T19:48:32+08:00
|
||||
|
||||
====== MPC8315E-RDB启动输出 ======
|
||||
Created Monday 25 June 2012
|
||||
|
||||
|
||||
U-Boot 2009.03-rc2 (Aug 04 2012 - 17:31:28) MPC83XX
|
||||
|
||||
Reset Status:
|
||||
|
||||
CPU: e300c3, MPC8315, Rev: 1.2 at 400 MHz, CSB: 133.333 MHz
|
||||
Board: Freescale MPC8315ERDB Rev <unknown>
|
||||
I2C: ready
|
||||
DRAM: 512 MB
|
||||
FLASH: 8 MB
|
||||
NAND: 32 MiB
|
||||
PCIE0: No link
|
||||
PCIE1: No link
|
||||
In: serial
|
||||
Out: serial
|
||||
Err: serial
|
||||
Net: eTSEC0
|
||||
Hit any key to stop autoboot: 0
|
||||
=> tftp 1000000 uImage
|
||||
Speed: 100, full duplex
|
||||
Using eTSEC0 device
|
||||
TFTP from server 192.168.2.102; our IP address is 192.168.2.33
|
||||
Filename 'uImage'.
|
||||
Load address: 0x1000000
|
||||
Loading: #################################################################
|
||||
#################################################################
|
||||
done
|
||||
Bytes transferred = 1902018 (1d05c2 hex)
|
||||
=> tftp 2000000 rootfs.ext2.gz.uboot
|
||||
Speed: 100, full duplex
|
||||
Using eTSEC0 device
|
||||
TFTP from server 192.168.2.102; our IP address is 192.168.2.33
|
||||
Filename 'rootfs.ext2.gz.uboot'.
|
||||
Load address: 0x2000000
|
||||
Loading: #################################################################
|
||||
#################################################################
|
||||
#################################################################
|
||||
#################################################################
|
||||
#################################################################
|
||||
#################################################################
|
||||
#################################################################
|
||||
#################################################################
|
||||
#########
|
||||
done
|
||||
Bytes transferred = 7761685 (766f15 hex)
|
||||
=> tftp c00000 mpc8315.dtb
|
||||
Speed: 100, full duplex
|
||||
Using eTSEC0 device
|
||||
TFTP from server 192.168.2.102; our IP address is 192.168.2.33
|
||||
Filename 'mpc8315.dtb'.
|
||||
Load address: 0xc00000
|
||||
Loading: ##
|
||||
done
|
||||
Bytes transferred = 20000 (4e20 hex)
|
||||
=> bootm 1000000 2000000 c00000
|
||||
## Booting kernel from Legacy Image at 01000000 ...
|
||||
Image Name: Linux-3.2.4-g390c4dd
|
||||
Created: 2012-08-08 8:44:26 UTC
|
||||
Image Type: PowerPC Linux Kernel Image (gzip compressed)
|
||||
Data Size: 1901954 Bytes = 1.8 MB
|
||||
Load Address: 00000000
|
||||
Entry Point: 00000000
|
||||
Verifying Checksum ... OK
|
||||
## Loading init Ramdisk from Legacy Image at 02000000 ...
|
||||
Image Name: uboot ext2 ramdisk rootfs
|
||||
Created: 2012-08-08 9:29:42 UTC
|
||||
Image Type: PowerPC Linux RAMDisk Image (gzip compressed)
|
||||
Data Size: 7761621 Bytes = 7.4 MB
|
||||
Load Address: 00000000
|
||||
Entry Point: 00000000
|
||||
Verifying Checksum ... OK
|
||||
## Flattened Device Tree blob at 00c00000
|
||||
Booting using the fdt blob at 0xc00000
|
||||
Uncompressing Kernel Image ... OK
|
||||
Loading Ramdisk to 1f7c2000, end 1ff28ed5 ... OK
|
||||
Loading Device Tree to 007f8000, end 007ffe1f ... OK
|
||||
Using MPC831x RDB machine description
|
||||
Cannot reserve gpages without hugetlb enabled
|
||||
Linux version 3.2.4-g390c4dd (geekard@kb310) (gcc version 4.7.1 (GCC) ) #2 Wed Aug 8 16:44:25 CST 2012
|
||||
Found initrd at 0xdf7c2000:0xdff28ed5
|
||||
bootconsole [udbg0] enabled
|
||||
setup_arch: bootmem
|
||||
mpc831x_rdb_setup_arch()
|
||||
Found FSL PCI host bridge at 0x00000000e0008500. Firmware bus number: 0->0
|
||||
PCI host bridge /pci@e0008500 (primary) ranges:
|
||||
MEM 0x0000000090000000..0x000000009fffffff -> 0x0000000090000000
|
||||
MEM 0x0000000080000000..0x000000008fffffff -> 0x0000000080000000 Prefetch
|
||||
IO 0x00000000e0300000..0x00000000e03fffff -> 0x0000000000000000
|
||||
arch: exit
|
||||
Zone PFN ranges:
|
||||
DMA 0x00000000 -> 0x00020000
|
||||
Normal empty
|
||||
Movable zone start PFN for each node
|
||||
early_node_map[1] active PFN ranges
|
||||
0: 0x00000000 -> 0x00020000
|
||||
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 130048
|
||||
Kernel command line: root=/dev/ram rw console=ttyS0,115200 ramdisk_size=22242
|
||||
PID hash table entries: 2048 (order: 1, 8192 bytes)
|
||||
Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
|
||||
Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
|
||||
Memory: 508204k/524288k available (3692k kernel code, 16084k reserved, 136k data, 80k bss, 164k init)
|
||||
Kernel virtual memory layout:
|
||||
* 0xfffdf000..0xfffff000 : fixmap
|
||||
* 0xfdefb000..0xfe000000 : early ioremap
|
||||
* 0xe1000000..0xfdefb000 : vmalloc & ioremap
|
||||
NR_IRQS:512 nr_irqs:512 16
|
||||
IPIC (128 IRQ sources) at e1000700
|
||||
clocksource: timebase mult[7800001] shift[22] registered
|
||||
pid_max: default: 32768 minimum: 301
|
||||
Mount-cache hash table entries: 512
|
||||
NET: Registered protocol family 16
|
||||
|
||||
PCI: Probing PCI hardware
|
||||
bio: create slab <bio-0> at 0
|
||||
vgaarb: loaded
|
||||
SCSI subsystem initialized
|
||||
Switching to clocksource timebase
|
||||
NET: Registered protocol family 2
|
||||
IP route cache hash table entries: 4096 (order: 2, 16384 bytes)
|
||||
TCP established hash table entries: 16384 (order: 5, 131072 bytes)
|
||||
TCP bind hash table entries: 16384 (order: 4, 65536 bytes)
|
||||
TCP: Hash tables configured (established 16384 bind 16384)
|
||||
TCP reno registered
|
||||
UDP hash table entries: 256 (order: 0, 4096 bytes)
|
||||
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
|
||||
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 transport module.
|
||||
Trying to unpack rootfs image as initramfs...
|
||||
rootfs image is not initramfs (no cpio magic); looks like an initrd
|
||||
Freeing initrd memory: 7580k freed
|
||||
WDT driver for MPC8xxx initialized. mode:reset timeout=65535 (32 seconds)
|
||||
JFFS2 version 2.2. (NAND) <20>© 2001-2006 Red Hat, Inc.
|
||||
msgmni has been set to 1007
|
||||
io scheduler noop registered
|
||||
io scheduler deadline registered
|
||||
io scheduler cfq registered (default)
|
||||
Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
|
||||
serial8250.0: ttyS0 at MMIO 0xe0004500 (irq = 16) is a 16550A
|
||||
console [ttyS0] enabled, bootconsole disabled
|
||||
console [ttyS0] enabled, bootconsole disabled
|
||||
serial8250.0: ttyS1 at MMIO 0xe0004600 (irq = 17) is a 16550A
|
||||
brd: module loaded
|
||||
loop: module loaded
|
||||
fsl-sata e0018000.sata: Sata FSL Platform/CSB Driver init
|
||||
scsi0 : sata_fsl
|
||||
ata1: SATA max UDMA/133 irq 44
|
||||
fsl-sata e0019000.sata: Sata FSL Platform/CSB Driver init
|
||||
scsi1 : sata_fsl
|
||||
ata2: SATA max UDMA/133 irq 45
|
||||
fe000000.flash: Found 1 x16 devices at 0x0 in 16-bit bank. Manufacturer ID 0x000001 Chip ID 0x000c01
|
||||
Amd/Fujitsu Extended Query Table at 0x0040
|
||||
Amd/Fujitsu Extended Query version 1.3.
|
||||
number of CFI chips: 1
|
||||
4 ofpart partitions found on MTD device fe000000.flash
|
||||
Creating 4 MTD partitions on "fe000000.flash":
|
||||
0x000000000000-0x000000100000 : "u-boot"
|
||||
0x000000100000-0x000000500000 : "fs"
|
||||
0x000000500000-0x000000700000 : "kernel"
|
||||
0x000000700000-0x000000800000 : "dtb"
|
||||
NAND device: Manufacturer ID: 0xec, Chip ID: 0x75 (Samsung NAND 32MiB 3,3V 8-bit)
|
||||
Bad block table found at page 65504, version 0x01
|
||||
Bad block table found at page 65472, version 0x01
|
||||
nand_read_bbt: bad block at 0x0000000a8000
|
||||
nand_read_bbt: bad block at 0x0000000ac000
|
||||
nand_read_bbt: bad block at 0x0000000b0000
|
||||
nand_read_bbt: bad block at 0x0000000b4000
|
||||
6 ofpart partitions found on MTD device e0600000.flash
|
||||
Creating 6 MTD partitions on "e0600000.flash":
|
||||
0x000000000000-0x000000100000 : "U-Boot-NAND"
|
||||
0x000000100000-0x000000900000 : "JFFS2-NAND"
|
||||
0x000000900000-0x000000d00000 : "Ramdisk-NAND"
|
||||
0x000000d00000-0x000001d00000 : "Reserved-NAND"
|
||||
0x000001d00000-0x000001f00000 : "Kernel-NAND"
|
||||
0x000001f00000-0x000002000000 : "DTB-NAND"
|
||||
eLBC NAND device at 0xe0600000, bank 1
|
||||
Freescale PowerQUICC MII Bus: probed
|
||||
mdio_bus mdio@e0024520: error probing PHY at address 0
|
||||
Freescale PowerQUICC MII Bus: probed
|
||||
fsl-gianfar e0024000.ethernet: eth0: mac: 04:00:00:00:00:0a
|
||||
fsl-gianfar e0024000.ethernet: eth0: Running with NAPI enabled
|
||||
fsl-gianfar e0024000.ethernet: eth0: RX BD ring size for Q[0]: 256
|
||||
fsl-gianfar e0024000.ethernet: eth0: TX BD ring size for Q[0]: 256
|
||||
fsl-gianfar e0025000.ethernet: eth1: mac: 04:00:00:00:00:0b
|
||||
fsl-gianfar e0025000.ethernet: eth1: Running with NAPI enabled
|
||||
fsl-gianfar e0025000.ethernet: eth1: RX BD ring size for Q[0]: 256
|
||||
fsl-gianfar e0025000.ethernet: eth1: TX BD ring size for Q[0]: 256
|
||||
i2c /dev entries driver
|
||||
mpc-i2c e0003000.i2c: timeout 1000000 us
|
||||
rtc-ds1307 0-0068: SET TIME!
|
||||
rtc-ds1307 0-0068: rtc core: registered ds1339 as rtc0
|
||||
TCP cubic registered
|
||||
NET: Registered protocol family 17
|
||||
Registering the dns_resolver key type
|
||||
rtc-ds1307 0-0068: setting system clock to 2000-01-01 00:00:00 UTC (946684800)
|
||||
ata1: No Device OR PHYRDY change,Hstatus = 0xa0000000
|
||||
ata1: SATA link down (SStatus 0 SControl 300)
|
||||
ata2: No Device OR PHYRDY change,Hstatus = 0xa0000000
|
||||
ata2: SATA link down (SStatus 0 SControl 300)
|
||||
RAMDISK: gzip image found at block 0
|
||||
VFS: Mounted root (ext2 filesystem) on device 1:0.
|
||||
Freeing unused kernel memory: 164k freed
|
||||
Mounting /proc and /sys
|
||||
Starting the hotplug events dispatcher udevd
|
||||
Synthesizing initial hotplug eveudevd (859): /proc/859/oom_adj is deprecated, please use /proc/859/oom_score_adj instead.
|
||||
nts
|
||||
cfg80211: Calling CRDA to update world regulatory domain
|
||||
cfg80211: World regulatory domain updated:
|
||||
cfg80211: (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
|
||||
cfg80211: (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
|
||||
cfg80211: (2457000 KHz - 2482000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
|
||||
cfg80211: (2474000 KHz - 2494000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
|
||||
cfg80211: (5170000 KHz - 5250000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
|
||||
cfg80211: (5735000 KHz - 5835000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
|
||||
ath5k 0000:00:0e.0: registered as 'phy0'
|
||||
ath5k channel bandwidth setting 10MHz default
|
||||
VANET-debug: ieee80211_register_hw
|
||||
VANET-debug: ieee80211_rate_control_ops_get select minstrel_ht
|
||||
VANET-debug: register vanet network interface
|
||||
VANET-debug: ieee80211_if_add, name: ath5k%d
|
||||
ath5k phy0: Atheros AR5414 chip found (MAC: 0xa5, PHY: 0x61)
|
||||
cfg80211: Calling CRDA for country: US
|
||||
cfg80211: Regulatory domain changed to country: US
|
||||
cfg80211: (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
|
||||
cfg80211: (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2700 mBm)
|
||||
cfg80211: (5170000 KHz - 5250000 KHz @ 40000 KHz), (300 mBi, 1700 mBm)
|
||||
cfg80211: (5250000 KHz - 5330000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
|
||||
cfg80211: (5490000 KHz - 5600000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
|
||||
cfg80211: (5650000 KHz - 5710000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
|
||||
cfg80211: (5735000 KHz - 5835000 KHz @ 40000 KHz), (300 mBi, 3000 mBm)
|
||||
Setting the hostname to mpc8315erdb
|
||||
Mounting filesystems
|
||||
mount: mounting usbfs on /proc/bus/usb failed: No such file or directory
|
||||
Starting syslogd and klogd
|
||||
Running sysctl
|
||||
Setting up networking on loopback device:
|
||||
|
||||
Warning: no IPADDR is set, please set this from the ltib
|
||||
config screen, or directly in /etc/rc.d/rc.conf.
|
||||
IP address setup bypassed
|
||||
|
||||
Setting up networking on eth1:
|
||||
Starting inetd:
|
||||
|
||||
|
||||
Welcome to the LTIB Embedded Linux Environment
|
||||
|
||||
!!!!! WARNING !!!!!!!
|
||||
|
||||
The default password for the root account is: root
|
||||
please change this password using the 'passwd' command
|
||||
and then edit this message (/etc/issue) to remove this message
|
||||
|
||||
mpc8315erdb login: PHY: mdio@e0024520:01 - Link is Up - 100/Full
|
||||
root
|
||||
Password:
|
||||
[root@mpc8315erdb root]# uname -a
|
||||
Linux mpc8315erdb 3.2.4-g390c4dd #2 Wed Aug 8 16:44:25 CST 2012 ppc GNU/Linux
|
||||
[root@mpc8315erdb root]#
|
||||
85
Zim/Research/vanet/uboot打印的板子信息.txt
Normal file
@@ -0,0 +1,85 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-08-10T13:58:44+08:00
|
||||
|
||||
====== uboot打印的板子信息 ======
|
||||
Created Friday 10 August 2012
|
||||
|
||||
**=> clocks**
|
||||
Clock configuration:
|
||||
Core: 400 MHz
|
||||
Coherent System Bus: 133.333 MHz
|
||||
Local Bus Controller:133.333 MHz
|
||||
Local Bus: 66.667 MHz
|
||||
DDR: 266.667 MHz
|
||||
SEC: 133.333 MHz
|
||||
I2C1: 133.333 MHz
|
||||
I2C2: 133.333 MHz
|
||||
TDM: 133.333 MHz
|
||||
TSEC1: 133.333 MHz
|
||||
TSEC2: 133.333 MHz
|
||||
USB DR: 133.333 MHz
|
||||
SATA: 133.333 MHz
|
||||
=>
|
||||
**=> coninfo**
|
||||
List of available devices:
|
||||
serial 80000003 SIO stdin stdout stderr
|
||||
=>
|
||||
|
||||
**=> flinfo #NOR flash信息**
|
||||
|
||||
Bank # 1: CFI conformant FLASH (16 x 16) Size: 8 MB in 128 Sectors
|
||||
AMD Standard command set, Manufacturer ID: 0x01, Device ID: 0x227E
|
||||
Erase timeout: 16384 ms, write timeout: 2 ms
|
||||
Buffer write timeout: 5 ms, buffer size: 32 bytes
|
||||
|
||||
Sector Start Addresses:
|
||||
FE000000 RO FE010000 RO FE020000 RO FE030000 RO FE040000 RO
|
||||
FE050000 FE060000 RO FE070000 FE080000 FE090000
|
||||
FE0A0000 FE0B0000 FE0C0000 FE0D0000 FE0E0000
|
||||
FE0F0000 FE100000 FE110000 FE120000 FE130000
|
||||
FE140000 FE150000 FE160000 FE170000 FE180000
|
||||
FE190000 FE1A0000 FE1B0000 FE1C0000 FE1D0000
|
||||
FE1E0000 FE1F0000 FE200000 FE210000 FE220000
|
||||
FE230000 FE240000 FE250000 FE260000 FE270000
|
||||
FE280000 FE290000 FE2A0000 FE2B0000 FE2C0000
|
||||
FE2D0000 FE2E0000 FE2F0000 FE300000 FE310000
|
||||
FE320000 FE330000 FE340000 FE350000 FE360000
|
||||
FE370000 FE380000 FE390000 FE3A0000 FE3B0000
|
||||
FE3C0000 FE3D0000 FE3E0000 FE3F0000 FE400000
|
||||
FE410000 FE420000 FE430000 FE440000 FE450000
|
||||
FE460000 FE470000 FE480000 FE490000 FE4A0000
|
||||
FE4B0000 FE4C0000 FE4D0000 FE4E0000 FE4F0000
|
||||
FE500000 FE510000 FE520000 FE530000 FE540000
|
||||
FE550000 FE560000 FE570000 FE580000 FE590000
|
||||
FE5A0000 FE5B0000 FE5C0000 FE5D0000 FE5E0000
|
||||
FE5F0000 FE600000 FE610000 FE620000 FE630000
|
||||
FE640000 FE650000 FE660000 FE670000 FE680000
|
||||
FE690000 FE6A0000 FE6B0000 FE6C0000 FE6D0000
|
||||
FE6E0000 FE6F0000 FE700000 FE710000 FE720000
|
||||
FE730000 FE740000 FE750000 FE760000 FE770000
|
||||
FE780000 FE790000 FE7A0000 FE7B0000 FE7C0000
|
||||
FE7D0000 FE7E0000 FE7F0000
|
||||
=>
|
||||
**=> tftp 1000000 uImage**
|
||||
Speed: 100, full duplex
|
||||
Using eTSEC0 device
|
||||
TFTP from server 192.168.2.101; our IP address is 192.168.2.33
|
||||
Filename 'uImage'.
|
||||
Load address: 0x1000000
|
||||
Loading: #################################################################
|
||||
#################################################################
|
||||
done
|
||||
Bytes transferred = 1902018 (1d05c2 hex)
|
||||
**=> iminfo 1000000 #查看Image的header info。**
|
||||
|
||||
## Checking Image at 01000000 ...
|
||||
Legacy image found
|
||||
Image Name: Linux-3.2.4-g390c4dd
|
||||
Created: 2012-08-08 8:44:26 UTC
|
||||
Image Type: PowerPC Linux Kernel Image (gzip compressed)
|
||||
Data Size: 1901954 Bytes = 1.8 MB
|
||||
Load Address: 00000000
|
||||
Entry Point: 00000000
|
||||
Verifying Checksum ... OK
|
||||
=>
|
||||
10
Zim/Research/vanet/从nor自动启动.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-08-11T18:06:55+08:00
|
||||
|
||||
====== 从nor自动启动 ======
|
||||
Created Saturday 11 August 2012
|
||||
|
||||
从NOR Flash启动的话,需要将uboot, uImage,rootfs和dtb分别烧写到flash中。
|
||||
启动时,只需将后面三者在flash中的起始地址传给bootm即可。具体过程如下:
|
||||
|
||||
16
Zim/Research/vanet/使用minicom向uboot下载文件.txt
Normal file
@@ -0,0 +1,16 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-08-10T14:24:46+08:00
|
||||
|
||||
====== 使用minicom向uboot下载文件 ======
|
||||
Created Friday 10 August 2012
|
||||
|
||||
1. 设置好minicom的环境,如[[../../Error_Notes/下载错误/minicom乱码.txt]]
|
||||
2. 复位开发板,启动uboot,在命令行界面输入loady命令,这是uboot处于文件下载等待状态。注意,必须先在minicom环境中与uboot相连而且使uboot处于
|
||||
等待状态后才进行第三步.
|
||||
3. 如下配置minicom的文件传输:
|
||||
a. Ctrl + a进入minicom的配置环境。
|
||||
b. 按s, 进入send file配置界面。
|
||||
c. 选择列表中的ymodem协议模式
|
||||
d. 这时出现“待上传的文件选择列表”菜单,使用上下键在目录项中移动,按两次空格进入光标所在的目录,然后按一次空格选中文件,确保[Okey]被选中
|
||||
然后按回车。 这时会出现文件上传的进度窗口。
|
||||
91
Zim/Research/vanet/制作jffs2根文件系统.txt
Normal file
@@ -0,0 +1,91 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-08-11T18:43:56+08:00
|
||||
|
||||
====== 制作jffs2根文件系统 ======
|
||||
Created Saturday 11 August 2012
|
||||
|
||||
http://www.embedu.org/Column/Column17.htm
|
||||
|
||||
JFFS2是Flash上应用最广的一个日志结构文件系统。它提供的垃圾回收机制,不需要马上对擦写越界的块进行擦写,而只需要将其设置一个标志,标明为脏块,当可用的块数不足时,垃圾回收机制才开始回收这些节点。同时,由于JFFS2基于日志结构,在意外掉电后仍然可以保持数据的完整性,而不会丢失数据。
|
||||
|
||||
本文阐述如何在nand flash上实现JFFS2根文件文件系统。实验环境是:FS2410开发平台及ubantu7.04主机环境。
|
||||
|
||||
**1.下载MTD工具包**
|
||||
制作jffs2根文件系统需要使用__mtd-utils__软件包提供的**mkfs.jffs2**命令,所以先要安装该软件包。完成此步骤后,系统中就有了mkfs.jffs2的工具。注意:这个工具不同于mkfs.ext2工具,它只能制作相应的JFFS2文件系统的镜像,__而不具有进行格式化的功能__,而mkfs.ext2具备这以上两种功能。然后用这个工具就可以制作JFFS2文件系统的镜像了。
|
||||
|
||||
**2、制作JFFS2文件镜像**
|
||||
|
||||
实验平台用到的nand flash 是K9F1208,在制作镜像过程添加的参数需要和它对应。
|
||||
|
||||
farsight#mkfs.jffs2 -r /source/rootfs -o rootfs.jffs2 **-e 0x4000** **--pad=0x800000** -n
|
||||
|
||||
这样就会生成一个8M大小的rootfs.jffs2的镜像,它也正是JFFS2文件系统的镜像,关于这个命令行里的选项的内容,可以用man a mkfs.jffs2命令来查看内容。
|
||||
也可以参考:[[../../Error_Notes/jffs2_scan_eraseblock()_Magic_bitmask_0x1985_not_found_at.txt]]
|
||||
|
||||
JFFS2 维护了几个链表来管理擦写块,根据擦写块上的内容,一个擦写块会在不同的链表上。具体来说,当一个擦写块上都是合法(valid)的节点时,它会在 clean_list 上;当一个擦写块包含至少一个过时(obsolete)的节点时,它会在 dirty_list 上;当一个擦写块被擦写完毕,并被写入 CLEANMARKER 节点后,它会在 free_list 上。而当你在挂载这个文件系统的时候,如果出现CLEANMARKER node found at 0x0042c000 has totlen 0xc != normal 0x0的警告的时候,可以加一个“-n”的选项,这个主要是由于针对Nand Flash不需要在每个擦除块的开始写入CLEANMARKER 节点。
|
||||
|
||||
**3、设置内核启动参数**
|
||||
|
||||
本处用的bootloader是U-BOOT.所以在U-BOOT的命令终端设置如下:
|
||||
|
||||
FS2410#setenv bootargs __root=/dev/mtdblock2 rootfstype=jffs2__ rw console=ttySAC0,115200
|
||||
|
||||
__注意:bootargs参数是传给kernel的启动参数,设备分区mtdblock2所对应的flash空间是通过设备树文件指定的,在内核启动前要通过uboot等工具将制作的__
|
||||
__jffs2文件系统映像烧写到该空间中。__
|
||||
|
||||
|
||||
**4、配置内核支持JFFS2文件系统**
|
||||
|
||||
File systems ---> Miscellaneous filesystems --->
|
||||
|
||||
<*>JournallingFlash File System v2 (JFFS2) support
|
||||
|
||||
[*]JFFS2write-bufferingsupport
|
||||
|
||||
[*]AdvancedcompressionoptionsforJFFS2
|
||||
|
||||
[*]JFFS2ZLIBcompressionsupport
|
||||
|
||||
[*]JFFS2RTIMEcompressionsupport
|
||||
|
||||
[*] JFFS2 RUBIN compression support
|
||||
|
||||
**5、下载rootfs.jffs2镜像**
|
||||
|
||||
通过uboot命令行,将jffs2映像__下载到Nand Flash第二个分区(Flash分区情况是由dtb文件指明的)__。
|
||||
|
||||
FS2410#nand erase 200000 800000
|
||||
|
||||
FS2410#nand write.jffs2 300008000 200000 800000
|
||||
|
||||
这里说明下关于nand flash操作的几个常用命令的含义
|
||||
|
||||
nand write:向Nand Flash写入数据,如果NandFlash相应的区域有坏块,则直接报错。
|
||||
nand write.jffs2:向Nand Flash写入数据,如果NandFlash相应的区域有坏块,可以跳过坏块。
|
||||
nand read:读取Nand Flash相应区域的数据,如果NandFlash相应的区域有坏块,则直接报错。
|
||||
nand read.jffs2s:读取Nand Flash相应区域的数据,如果NandFlash相应的区域有坏块,将对应坏块区域的缓冲填充0xff,然后跳过此坏块继续读取。
|
||||
nand read.jffs2:读取Nand Flash相应区域的数据,如果NandFlash相应的区域有坏块,直接跳过坏块。
|
||||
|
||||
具体的参考代码参看U-BOOT源码:common/cmd_nand.c文件。
|
||||
|
||||
下载完JFFS2文件系统镜像后,需要把Linux内核NandFlash的驱动关于第二个分区的大小改为8M(和镜像一样大,__对于MPC8315而言,由于使用了设备树文件,所以不需要修改内核__),否则会出现类似如下错误:
|
||||
|
||||
Freeing init memory: 124K
|
||||
Warning: unable to open an initial console.
|
||||
Argh. Special inode #171 with mode 0xa1ff had more than one node
|
||||
Kernel panic: No init found. Try passing init= option to kernel.
|
||||
Argh. Specia inode #63 with mode 0xa1ff had more than one node
|
||||
Returned error for crccheck of ino #63. Expect badness...
|
||||
Argh. Special inode #67 with mode 0xa1ff had more than one node
|
||||
Returned error for crccheck of ino #67. Expect badness...
|
||||
Argh. Special inode #68 with mode 0xa1ff had more than one node
|
||||
|
||||
到此,一个JFFS2文件系统的镜像制作成功。可以启动系统并测试JFFS2的性能了。还有一种制作JFFS2文件系统镜像的方法,在制作镜像的参数中可以不加—pad选项,过程如下:
|
||||
|
||||
farsight#mkfs.jffs2 -r /source/rootfs -o rootfs.jffs2 -e 0x4000 -n
|
||||
|
||||
启动开发板烧写rootfs.jffs2镜像
|
||||
|
||||
FS2410#**nand erase 200000 800000/**/(注意把整个存放文件系统的分区全部给擦除)。
|
||||
FS2410#**nand write.jffs2 30008000 200000 31a28c**//(必须是rootfs.jffs2的实际大小。如果是你写成了4M,那么分区的其余部分JFFS2文件系统将无法识别)。
|
||||
334
Zim/Research/vanet/制作jffs2根文件系统并将其烧写到flash中.txt
Normal file
@@ -0,0 +1,334 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-08-11T19:45:03+08:00
|
||||
|
||||
====== 制作jffs2根文件系统并将其烧写到flash中 ======
|
||||
Created Saturday 11 August 2012
|
||||
|
||||
1. **配置ltib**,指定生成的目标文件系统映像类型为__jffs2__,同时__erase block 大小与Flash datasheet上指定的一致__(这里为16KB):
|
||||
--- Choose your root filesystem image type │ │
|
||||
│ │ Target image: __(jffs2)__ ---> │ │
|
||||
│ │ [ ] Run a command after building the target image │ │
|
||||
│ │ __(16)__ jffs2 erase block size in KB │ │
|
||||
│ │ [ ] read-only root filesystem │ │
|
||||
│ │ (512k) tmpfs size │ │
|
||||
│ │ (/tmp /var) Place these dirs in writable RAM │ │
|
||||
│ │ () rootfs target directory
|
||||
|
||||
2. **复位开发板,进入uboot命令行状态**
|
||||
|
||||
**3. 将生成的rootfs.jffs2映像下载到内存中**
|
||||
|
||||
=> tftp 1000000 rootfs.jffs2
|
||||
Speed: 100, full duplex
|
||||
Using eTSEC0 device
|
||||
TFTP from server 192.168.2.105; our IP address is 192.168.2.100
|
||||
Filename 'rootfs.jffs2'.
|
||||
Load address: 0x1000000
|
||||
Loading: #################################################################
|
||||
#################################################################
|
||||
#################################################################
|
||||
#################################################################
|
||||
##################################
|
||||
done
|
||||
Bytes transferred = 4308992 (41c000 hex)
|
||||
|
||||
**4.按照dtb中的Flash分区配置,擦出将要保存rootfs.jffs2文件的flash存储区域**
|
||||
例如对于mpc8315dtb-defaults.dts中的配置如下:
|
||||
flash@0,0 { #NOR flash
|
||||
#address-cells = <0x1>;
|
||||
#size-cells = <0x1>;
|
||||
compatible = "cfi-flash";
|
||||
reg = <0x0 0x0 0x800000>;
|
||||
bank-width = <0x2>;
|
||||
device-width = <0x1>;
|
||||
|
||||
u-boot@0 {
|
||||
reg = <0x0 0x100000>;
|
||||
read-only;
|
||||
};
|
||||
|
||||
fs@100000 {
|
||||
reg = <0x100000 0x400000>;
|
||||
};
|
||||
|
||||
kernel@500000 {
|
||||
reg = <0x500000 0x200000>;
|
||||
};
|
||||
|
||||
dtb@700000 {
|
||||
reg = <0x700000 0x100000>;
|
||||
};
|
||||
};
|
||||
|
||||
nand@1,0 {
|
||||
#address-cells = <0x1>;
|
||||
#size-cells = <0x1>;
|
||||
compatible = "fsl,mpc8315-fcm-nand", "fsl,elbc-fcm-nand";
|
||||
reg = <0x1 0x0 0x2000>;
|
||||
|
||||
u-boot@0 {
|
||||
reg = <0x0 0x100000>;
|
||||
read-only;
|
||||
label = "U-Boot-NAND";
|
||||
};
|
||||
|
||||
__jffs2@100000 {__
|
||||
reg = <0x100000 0x800000>;
|
||||
label = "JFFS2-NAND";
|
||||
};
|
||||
|
||||
ramdisk@900000 {
|
||||
reg = <0x900000 0x400000>;
|
||||
label = "Ramdisk-NAND";
|
||||
};
|
||||
|
||||
reserved@d00000 {
|
||||
reg = <0xd00000 0x1000000>;
|
||||
label = "Reserved-NAND";
|
||||
};
|
||||
|
||||
kernel@1d00000 {
|
||||
reg = <0x1d00000 0x200000>;
|
||||
read-only;
|
||||
label = "Kernel-NAND";
|
||||
};
|
||||
|
||||
dtb@1f00000 {
|
||||
reg = <0x1f00000 0x100000>;
|
||||
read-only;
|
||||
label = "DTB-NAND";
|
||||
};
|
||||
};
|
||||
当我们想将rootfs.jffs2烧写到label为"JFFS2-NAND"的NAND Flash区域时,可以使用下列的擦出命令:
|
||||
**=> nand erase 100000 800000**
|
||||
|
||||
NAND erase: device 0 offset 0x100000, size 0x800000
|
||||
Bad block table found at page 65504, version 0x01
|
||||
Bad block table found at page 65472, version 0x01
|
||||
nand_read_bbt: Bad block at 0x000a8000
|
||||
nand_read_bbt: Bad block at 0x000ac000
|
||||
nand_read_bbt: Bad block at 0x000b0000
|
||||
nand_read_bbt: Bad block at 0x000b4000
|
||||
Erasing at 0x8fc000 -- 100% complete.
|
||||
OK
|
||||
=>
|
||||
|
||||
5. **将下载到内存0x1000000开始的大小为$filesize的rootfs.jffs2文件烧写到NAND Flash 0x100000开始的地方。**
|
||||
=> nand write 1000000 100000 $filesize
|
||||
|
||||
NAND write: device 0 offset 0x100000, size 0x41c000
|
||||
4308992 bytes written: OK
|
||||
=>
|
||||
|
||||
6. **设置kernel命令行参数,指定root为刚才烧写到的nand partition。**
|
||||
=> setenv bootargs __root=/dev/mtdblock5 rw rootfstype=jffs2__ console=ttyS0,115200
|
||||
|
||||
7. **设置uboot自动启动时的bootcmd参数,注意fe500000和fe700000两个flash内存区域事先已经用uboot命令行写入了uImage和mpc8315.dtb文件。**
|
||||
=> setenv bootcmd bootm fe500000 - fe700000
|
||||
=> saveenv __#这样下次启动时,如果过了6秒时间uboot会按照bootcmd环境变量的值启动。__
|
||||
=>boot
|
||||
## Booting kernel from Legacy Image at fe500000 ...
|
||||
Image Name: Linux-3.2.4-gfd2812f
|
||||
Created: 2012-08-10 7:58:18 UTC
|
||||
Image Type: PowerPC Linux Kernel Image (gzip compressed)
|
||||
Data Size: 1551548 Bytes = 1.5 MB
|
||||
Load Address: 00000000
|
||||
Entry Point: 00000000
|
||||
Verifying Checksum ... OK
|
||||
## Flattened Device Tree blob at fe700000
|
||||
Booting using the fdt blob at 0xfe700000
|
||||
Uncompressing Kernel Image ... OK
|
||||
Loading Device Tree to 007f8000, end 007ffe1f ... OK
|
||||
Using MPC831x RDB machine description
|
||||
Cannot reserve gpages without hugetlb enabled
|
||||
Linux version 3.2.4-gfd2812f (geekard@kb310) (gcc version 4.7.1 (GCC) ) #4 Fri Aug 10 15:58:17 CST 2012
|
||||
bootconsole [udbg0] enabled
|
||||
setup_arch: bootmem
|
||||
mpc831x_rdb_setup_arch()
|
||||
Found FSL PCI host bridge at 0x00000000e0008500. Firmware bus number: 0->0
|
||||
PCI host bridge /pci@e0008500 (primary) ranges:
|
||||
MEM 0x0000000090000000..0x000000009fffffff -> 0x0000000090000000
|
||||
MEM 0x0000000080000000..0x000000008fffffff -> 0x0000000080000000 Prefetch
|
||||
IO 0x00000000e0300000..0x00000000e03fffff -> 0x0000000000000000
|
||||
arch: exit
|
||||
Zone PFN ranges:
|
||||
DMA 0x00000000 -> 0x00020000
|
||||
Normal empty
|
||||
Movable zone start PFN for each node
|
||||
early_node_map[1] active PFN ranges
|
||||
0: 0x00000000 -> 0x00020000
|
||||
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 130048
|
||||
Kernel command line: root=/dev/mtdblock5 rw rootfstype=jffs2 console=ttyS0,115200
|
||||
PID hash table entries: 2048 (order: 1, 8192 bytes)
|
||||
Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
|
||||
Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
|
||||
Memory: 516520k/524288k available (2992k kernel code, 7768k reserved, 124k data, 59k bss, 152k init)
|
||||
Kernel virtual memory layout:
|
||||
* 0xfffdf000..0xfffff000 : fixmap
|
||||
* 0xfdefb000..0xfe000000 : early ioremap
|
||||
* 0xe1000000..0xfdefb000 : vmalloc & ioremap
|
||||
NR_IRQS:512 nr_irqs:512 16
|
||||
IPIC (128 IRQ sources) at e1000700
|
||||
clocksource: timebase mult[7800001] shift[22] registered
|
||||
pid_max: default: 32768 minimum: 301
|
||||
Mount-cache hash table entries: 512
|
||||
NET: Registered protocol family 16
|
||||
|
||||
PCI: Probing PCI hardware
|
||||
bio: create slab <bio-0> at 0
|
||||
vgaarb: loaded
|
||||
SCSI subsystem initialized
|
||||
Switching to clocksource timebase
|
||||
NET: Registered protocol family 2
|
||||
IP route cache hash table entries: 4096 (order: 2, 16384 bytes)
|
||||
TCP established hash table entries: 16384 (order: 5, 131072 bytes)
|
||||
TCP bind hash table entries: 16384 (order: 4, 65536 bytes)
|
||||
TCP: Hash tables configured (established 16384 bind 16384)
|
||||
TCP reno registered
|
||||
UDP hash table entries: 256 (order: 0, 4096 bytes)
|
||||
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
|
||||
NET: Registered protocol family 1
|
||||
WDT driver for MPC8xxx initialized. mode:reset timeout=65535 (32 seconds)
|
||||
JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
|
||||
msgmni has been set to 1008
|
||||
io scheduler noop registered
|
||||
io scheduler deadline registered
|
||||
io scheduler cfq registered (default)
|
||||
Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
|
||||
serial8250.0: ttyS0 at MMIO 0xe0004500 (irq = 16) is a 16550A
|
||||
console [ttyS0] enabled, bootconsole disabled
|
||||
console [ttyS0] enabled, bootconsole disabled
|
||||
serial8250.0: ttyS1 at MMIO 0xe0004600 (irq = 17) is a 16550A
|
||||
brd: module loaded
|
||||
loop: module loaded
|
||||
fe000000.flash: Found 1 x16 devices at 0x0 in 16-bit bank. Manufacturer ID 0x000001 Chip ID 0x000c01
|
||||
Amd/Fujitsu Extended Query Table at 0x0040
|
||||
Amd/Fujitsu Extended Query version 1.3.
|
||||
number of CFI chips: 1
|
||||
__4 ofpart partitions found on MTD device fe000000.flash #NOR Flash和NAND Flash中的分区情况是由dtb文件配置的。这只是一个指示,该分区是否含有jffs2文件系统映像则不确定(需要实现用上面的步骤烧入)。下面的分区标号从mtdblock0开始。__
|
||||
__Creating 4 MTD partitions on "fe000000.flash":__
|
||||
0x000000000000-0x000000100000 : "u-boot"
|
||||
0x000000100000-0x000000500000 : "fs"
|
||||
0x000000500000-0x000000700000 : "kernel"
|
||||
0x000000700000-0x000000800000 : "dtb"
|
||||
|
||||
NAND device: Manufacturer ID: 0xec, Chip ID: 0x75 (Samsung NAND 32MiB 3,3V 8-bit)
|
||||
Bad block table found at page 65504, version 0x01
|
||||
Bad block table found at page 65472, version 0x01
|
||||
nand_read_bbt: bad block at 0x0000000a8000
|
||||
nand_read_bbt: bad block at 0x0000000ac000
|
||||
nand_read_bbt: bad block at 0x0000000b0000
|
||||
nand_read_bbt: bad block at 0x0000000b4000
|
||||
6 ofpart partitions found on MTD device e0600000.flash
|
||||
Creating 6 MTD partitions on "e0600000.flash":
|
||||
0x000000000000-0x000000100000 : "U-Boot-NAND"
|
||||
0x000000100000-0x000000900000 : __"JFFS2-NAND" #对应的是mtdblock5__
|
||||
0x000000900000-0x000000d00000 : "Ramdisk-NAND"
|
||||
0x000000d00000-0x000001d00000 : "Reserved-NAND"
|
||||
0x000001d00000-0x000001f00000 : "Kernel-NAND"
|
||||
0x000001f00000-0x000002000000 : "DTB-NAND"
|
||||
eLBC NAND device at 0xe0600000, bank 1
|
||||
Freescale PowerQUICC MII Bus: probed
|
||||
mdio_bus mdio@e0024520: error probing PHY at address 0
|
||||
Freescale PowerQUICC MII Bus: probed
|
||||
fsl-gianfar e0024000.ethernet: eth0: mac: 04:00:00:00:00:0a
|
||||
fsl-gianfar e0024000.ethernet: eth0: Running with NAPI enabled
|
||||
fsl-gianfar e0024000.ethernet: eth0: RX BD ring size for Q[0]: 256
|
||||
fsl-gianfar e0024000.ethernet: eth0: TX BD ring size for Q[0]: 256
|
||||
fsl-gianfar e0025000.ethernet: eth1: mac: 04:00:00:00:00:0b
|
||||
fsl-gianfar e0025000.ethernet: eth1: Running with NAPI enabled
|
||||
fsl-gianfar e0025000.ethernet: eth1: RX BD ring size for Q[0]: 256
|
||||
fsl-gianfar e0025000.ethernet: eth1: TX BD ring size for Q[0]: 256
|
||||
i2c /dev entries driver
|
||||
mpc-i2c e0003000.i2c: timeout 1000000 us
|
||||
rtc-ds1307 0-0068: SET TIME!
|
||||
rtc-ds1307 0-0068: rtc core: registered ds1339 as rtc0
|
||||
TCP cubic registered
|
||||
NET: Registered protocol family 17
|
||||
Registering the dns_resolver key type
|
||||
rtc-ds1307 0-0068: setting system clock to 2000-01-01 00:00:00 UTC (946684800)
|
||||
__VFS: Mounted root (jffs2 filesystem) on device 31:5. #可以看到正确地挂载了mtdblock5设备为root。__
|
||||
Freeing unused kernel memory: 152k freed
|
||||
Mounting /proc and /sys
|
||||
Starting the hotplug events dispatcher mdev
|
||||
Setting the hostname to mpc8315erdb
|
||||
Mounting filesystems
|
||||
mount: mounting usbfs on /proc/bus/usb failed: No such file or directory
|
||||
Starting syslogd and klogd
|
||||
Running sysctl
|
||||
Setting up networking on loopback device:
|
||||
|
||||
Warning: no IPADDR is set, please set this from the ltib
|
||||
config screen, or directly in /etc/rc.d/rc.conf.
|
||||
IP address setup bypassed
|
||||
|
||||
Setting up networking on eth1:
|
||||
|
||||
|
||||
Welcome to the LTIB Embedded Linux Environment
|
||||
|
||||
!!!!! WARNING !!!!!!!
|
||||
|
||||
The default password for the root account is: root
|
||||
please change this password using the 'passwd' command
|
||||
and then edit this message (/etc/issue) to remove this message
|
||||
|
||||
mpc8315erdb login: PHY: mdio@e0024520:01 - Link is Up - 100/Full
|
||||
|
||||
|
||||
Welcome to the LTIB Embedded Linux Environment
|
||||
|
||||
!!!!! WARNING !!!!!!!
|
||||
|
||||
The default password for the root account is: root
|
||||
please change this password using the 'passwd' command
|
||||
and then edit this message (/etc/issue) to remove this message
|
||||
|
||||
mpc8315erdb login: root
|
||||
Password:
|
||||
[root@mpc8315erdb /root]#
|
||||
[root@mpc8315erdb /root]# __ls /dev/mtd __
|
||||
mtd0 mtd2ro mtd5 mtd7ro mtdblock0 mtdblock5
|
||||
mtd0ro mtd3 mtd5ro mtd8 mtdblock1 mtdblock6
|
||||
mtd1 mtd3ro mtd6 mtd8ro mtdblock2 mtdblock7
|
||||
mtd1ro mtd4 mtd6ro mtd9 mtdblock3 mtdblock8
|
||||
mtd2 mtd4ro mtd7 mtd9ro mtdblock4 mtdblock9
|
||||
[root@mpc8315erdb /root]# cat [[/proc/mtd]] __#查看系统中所有的mtd分区情况__
|
||||
dev: size erasesize name
|
||||
mtd0: 00100000 00010000 "u-boot" __#name和size是在dtb文件中配置的而eraseize是在制作jffs2映像时用-e参数指定的(LTIB有相应的配置选项)。__
|
||||
mtd1: 00400000 00010000 "fs"
|
||||
mtd2: 00200000 00010000 "kernel"
|
||||
mtd3: 00100000 00010000 "dtb"
|
||||
mtd4: 00100000 00004000 "U-Boot-NAND"
|
||||
__mtd5__: 00800000 __00004000__ "JFFS2-NAND" #注意,这里的erasesize并不准确,实际大小由相应的jffs2映像决定。
|
||||
mtd6: 00400000 00004000 "Ramdisk-NAND"
|
||||
mtd7: 01000000 00004000 "Reserved-NAND"
|
||||
mtd8: 00200000 00004000 "Kernel-NAND"
|
||||
mtd9: 00100000 00004000 "DTB-NAND"
|
||||
[root@mpc8315erdb /root]# cat /proc/filesystems
|
||||
nodev sysfs
|
||||
nodev rootfs
|
||||
nodev bdev
|
||||
nodev proc
|
||||
nodev tmpfs
|
||||
nodev sockfs
|
||||
nodev pipefs
|
||||
nodev anon_inodefs
|
||||
nodev devpts
|
||||
ext2
|
||||
nodev ramfs
|
||||
vfat
|
||||
msdos
|
||||
iso9660
|
||||
__nodev jffs2 #内核的确支持jffs2文件系统__
|
||||
__nodev mtd_inodefs__
|
||||
[root@mpc8315erdb /root]#
|
||||
[root@mpc8315erdb /root]# mkdir jffs2
|
||||
[root@mpc8315erdb /root]# mount -t jffs2 /dev/mtdblock5 jffs2/ __#将jffs2分区挂载到文件系统中。__
|
||||
[root@mpc8315erdb /root]# ls jffs2/ __#可见列出的内容即为我们制作的root分区。__
|
||||
bin etc lib mnt proc sbin sys usr
|
||||
dev home linuxrc opt root smbshare tmp var
|
||||
[root@mpc8315erdb /root]#
|
||||
|
||||
然后就可以项jffs2目录中读写文件了,在掉电后这些文件的更改并不会丢失。
|
||||
390
Zim/Research/vanet/烧写固件到NAND然后启动时读取.txt
Normal file
@@ -0,0 +1,390 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-08-11T18:10:24+08:00
|
||||
|
||||
====== 烧写固件到NAND然后启动时读取 ======
|
||||
Created Saturday 11 August 2012
|
||||
|
||||
经过实验,板子的NOR Flash可以正常启动,但是从NAND Flash中启动失败。但是NAND Flash可以正常工作。
|
||||
所以,可以将NOR Flash作为启动设备,只保留uboot(或再加上uImage),而将其余的固件内容放到NAND中,
|
||||
由uboot启动时读取到内存中。具体步骤如下:
|
||||
|
||||
1. **查看uboot提供的nand命令语法**
|
||||
=> help nand
|
||||
nand info - show available NAND devices
|
||||
nand device [dev] - show or set current device
|
||||
nand read - addr off|partition size
|
||||
nand write - addr off|partition size
|
||||
read/write 'size' bytes starting at offset 'off'
|
||||
to/from memory address 'addr', skipping bad blocks.
|
||||
nand erase [clean] [off size] - erase 'size' bytes from
|
||||
offset 'off' (entire device if not specified)
|
||||
nand bad - show bad blocks
|
||||
nand dump[.oob] off - dump page
|
||||
nand scrub - really clean NAND erasing bad blocks (UNSAFE)
|
||||
nand markbad off - mark bad block at offset (UNSAFE)
|
||||
nand biterr off - make a bit error at offset (UNSAFE)
|
||||
|
||||
**=> nand info** #查看nand设备信息
|
||||
Device 0: NAND 32MiB 3,3V 8-bit, sector size 16 KiB
|
||||
|
||||
**=> nand erase #擦出整个设备(也可以指定擦出范围)**
|
||||
NAND erase: device 0 whole chip
|
||||
Bad block table found at page 65504, version 0x01
|
||||
Bad block table found at page 65472, version 0x01
|
||||
nand_read_bbt: Bad block at 0x000a8000
|
||||
nand_read_bbt: Bad block at 0x000ac000
|
||||
nand_read_bbt: Bad block at 0x000b0000
|
||||
nand_read_bbt: Bad block at 0x000b4000
|
||||
Skipping bad block at 0x000a8000
|
||||
Skipping bad block at 0x000ac000
|
||||
Skipping bad block at 0x000b0000
|
||||
Skipping bad block at 0x000b4000
|
||||
Skipping bad block at 0x01ff0000
|
||||
Skipping bad block at 0x01ff4000
|
||||
Skipping bad block at 0x01ff8000
|
||||
Skipping bad block at 0x01ffc000
|
||||
|
||||
OK
|
||||
**=> nand dump 0 #dump第一个page(512Bytes)的内容,确认全为1.**
|
||||
Page 00000000 dump:
|
||||
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
|
||||
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
|
||||
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
|
||||
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
|
||||
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
|
||||
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
|
||||
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
|
||||
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
|
||||
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
|
||||
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
|
||||
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
|
||||
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
|
||||
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
|
||||
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
|
||||
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
|
||||
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
|
||||
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
|
||||
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
|
||||
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
|
||||
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
|
||||
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
|
||||
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
|
||||
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
|
||||
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
|
||||
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
|
||||
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
|
||||
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
|
||||
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
|
||||
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
|
||||
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
|
||||
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
|
||||
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
|
||||
OOB:
|
||||
ff ff ff ff ff ff ff ff
|
||||
ff ff ff ff ff ff ff ff
|
||||
**=> tftp 1000000 uImage #将**__内核__**下载到内存中**
|
||||
Speed: 100, full duplex
|
||||
Using eTSEC0 device
|
||||
TFTP from server 192.168.2.101; our IP address is 192.168.2.100
|
||||
Filename 'uImage'.
|
||||
Load address: 0x1000000
|
||||
Loading: #################################################################
|
||||
#########################################
|
||||
done
|
||||
**Bytes transferred = 1551612 (17acfc hex)**
|
||||
|
||||
**=> nand write 1000000 0 $filesize #写flash前必须要对相应区域擦出过,最后一个参数指定写入的**__字节数__**。**
|
||||
|
||||
NAND write: device 0 offset 0x0, size 0x17acfc
|
||||
Attempt to write __non page aligned data #Flash写入时以page为单位(即512Bytes为单位)所以写入的大小不是页对齐时会出错。__
|
||||
1551612 bytes written: ERROR
|
||||
|
||||
**=> nand write 1000000 0 200000** **#指定一个比实际要写的内容稍大(可由tftp命令的最后一行输出指示)且页对齐的大小。**
|
||||
NAND write: device 0 offset 0x0, size 0x200000
|
||||
Skip bad block 0x000a8000
|
||||
Skip bad block 0x000ac000
|
||||
Skip bad block 0x000b0000
|
||||
Skip bad block 0x000b4000
|
||||
2097152 bytes written: OK
|
||||
|
||||
=> tftp 2000000 rootfs.ext2.gz.uboot **#将根文件系统ramdisk下载到内存中**
|
||||
Speed: 100, full duplex
|
||||
Using eTSEC0 device
|
||||
TFTP from server 192.168.2.101; our IP address is 192.168.2.100
|
||||
Filename 'rootfs.ext2.gz.uboot'.
|
||||
Load address: 0x2000000
|
||||
Loading: #################################################################
|
||||
#################################################################
|
||||
#################################################################
|
||||
########################################
|
||||
done
|
||||
Bytes transferred = **3447604** (349b34 hex)
|
||||
|
||||
**=> nand write 2000000 300000 400000**
|
||||
NAND write: device 0 offset 0x300000, size 0x400000
|
||||
4194304 bytes written: OK
|
||||
|
||||
**=> tftp c00000 mpc8315.dtb #设备树下载到内存中**
|
||||
Speed: 100, full duplex
|
||||
Using eTSEC0 device
|
||||
TFTP from server 192.168.2.101; our IP address is 192.168.2.100
|
||||
Filename 'mpc8315.dtb'.
|
||||
Load address: 0xc00000
|
||||
Loading: ##
|
||||
done
|
||||
Bytes transferred = 20000 (4e20 hex)
|
||||
=> nand write c00000 800000 100000
|
||||
|
||||
NAND write: device 0 offset 0x800000, size 0x100000
|
||||
1048576 bytes written: OK
|
||||
|
||||
=> setenv bootcmd nand read 1000000 0 200000;nand read 2000000 300000 400000;nand read c00000 800000 100000;bootm 1000000 2000000 c00000
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
=>
|
||||
=>
|
||||
=> printenv
|
||||
ramboot=setenv bootargs root=/dev/ram rw console=$consoledev,$baudrate $othbootargs;tftp $ramdiskaddr $ramdiskfile;tftp $loadaddr $bootfile;tftp $fdtaddr $fdtfile;bootm $loadaddr $ramdiskaddr $fdtr
|
||||
nfsboot=setenv bootargs root=/dev/nfs rw nfsroot=$serverip:$rootpath ip=$ipaddr:$serverip:$gatewayip:$netmask:$hostname:$netdev:off console=$consoledev,$baudrate $othbootargs;tftp $loadaddr $bootfr
|
||||
bootdelay=6
|
||||
baudrate=115200
|
||||
loads_echo=1
|
||||
ethaddr=04:00:00:00:00:0A
|
||||
eth1addr=04:00:00:00:00:0B
|
||||
loadaddr=500000
|
||||
netdev=eth0
|
||||
consoledev=ttyS0
|
||||
ramdiskaddr=1000000
|
||||
ramdiskfile=ramfs.83xx
|
||||
fdtaddr=400000
|
||||
fdtfile=mpc8315erdb.dtb
|
||||
pciconfighost=yes
|
||||
ethact=eTSEC0
|
||||
bootargs=root=/dev/ram rw console=ttyS0,115200 ramdisk_size=65535
|
||||
stdin=serial
|
||||
stdout=serial
|
||||
stderr=serial
|
||||
filesize=4E20
|
||||
fileaddr=C00000
|
||||
ipaddr=192.168.2.100
|
||||
serverip=192.168.2.101
|
||||
bootcmd=nand read 1000000 0 2
|
||||
|
||||
Environment size: 915/8188 bytes
|
||||
=> setenv bootcmd nand read 1000000 0 200000;nand read 2000000 300000 400000;nand read c00000 800000 100000;bootm 1000000 2000000 c00000
|
||||
|
||||
NAND read: device 0 offset 0x300000, size 0x400000
|
||||
4194304 bytes read: OK
|
||||
|
||||
NAND read: device 0 offset 0x800000, size 0x100000
|
||||
1048576 bytes read: OK
|
||||
## Booting kernel from Legacy Image at 01000000 ...
|
||||
Image Name: Linux-3.2.4-gfd2812f
|
||||
Created: 2012-08-10 7:58:18 UTC
|
||||
Image Type: PowerPC Linux Kernel Image (gzip compressed)
|
||||
Data Size: 1551548 Bytes = 1.5 MB
|
||||
Load Address: 00000000
|
||||
Entry Point: 00000000
|
||||
Verifying Checksum ... OK
|
||||
## Loading init Ramdisk from Legacy Image at 02000000 ...
|
||||
Image Name: uboot ext2 ramdisk rootfs
|
||||
Created: 2012-08-11 8:00:23 UTC
|
||||
Image Type: PowerPC Linux RAMDisk Image (gzip compressed)
|
||||
Data Size: 3447540 Bytes = 3.3 MB
|
||||
Load Address: 00000000
|
||||
Entry Point: 00000000
|
||||
Verifying Checksum ... OK
|
||||
## Flattened Device Tree blob at 00c00000
|
||||
Booting using the fdt blob at 0xc00000
|
||||
Uncompressing Kernel Image ... OK
|
||||
Loading Ramdisk to 1fbdf000, end 1ff28af4 ... OK
|
||||
Loading Device Tree to 007f8000, end 007ffe1f ... OK
|
||||
Using MPC831x RDB machine description
|
||||
Cannot reserve gpages without hugetlb enabled
|
||||
Linux version 3.2.4-gfd2812f (geekard@kb310) (gcc version 4.7.1 (GCC) ) #4 Fri Aug 10 15:58:17 CST 2012
|
||||
Found initrd at 0xdfbdf000:0xdff28af4
|
||||
bootconsole [udbg0] enabled
|
||||
setup_arch: bootmem
|
||||
mpc831x_rdb_setup_arch()
|
||||
Found FSL PCI host bridge at 0x00000000e0008500. Firmware bus number: 0->0
|
||||
PCI host bridge /pci@e0008500 (primary) ranges:
|
||||
MEM 0x0000000090000000..0x000000009fffffff -> 0x0000000090000000
|
||||
MEM 0x0000000080000000..0x000000008fffffff -> 0x0000000080000000 Prefetch
|
||||
IO 0x00000000e0300000..0x00000000e03fffff -> 0x0000000000000000
|
||||
arch: exit
|
||||
Zone PFN ranges:
|
||||
DMA 0x00000000 -> 0x00020000
|
||||
Normal empty
|
||||
Movable zone start PFN for each node
|
||||
early_node_map[1] active PFN ranges
|
||||
0: 0x00000000 -> 0x00020000
|
||||
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 130048
|
||||
Kernel command line: root=/dev/ram rw console=ttyS0,115200 ramdisk_size=65535
|
||||
PID hash table entries: 2048 (order: 1, 8192 bytes)
|
||||
Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
|
||||
Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
|
||||
Memory: 513152k/524288k available (2992k kernel code, 11136k reserved, 124k data, 59k bss, 152k init)
|
||||
Kernel virtual memory layout:
|
||||
* 0xfffdf000..0xfffff000 : fixmap
|
||||
* 0xfdefb000..0xfe000000 : early ioremap
|
||||
* 0xe1000000..0xfdefb000 : vmalloc & ioremap
|
||||
NR_IRQS:512 nr_irqs:512 16
|
||||
IPIC (128 IRQ sources) at e1000700
|
||||
clocksource: timebase mult[7800001] shift[22] registered
|
||||
pid_max: default: 32768 minimum: 301
|
||||
Mount-cache hash table entries: 512
|
||||
NET: Registered protocol family 16
|
||||
|
||||
PCI: Probing PCI hardware
|
||||
bio: create slab <bio-0> at 0
|
||||
vgaarb: loaded
|
||||
SCSI subsystem initialized
|
||||
Switching to clocksource timebase
|
||||
NET: Registered protocol family 2
|
||||
IP route cache hash table entries: 4096 (order: 2, 16384 bytes)
|
||||
TCP established hash table entries: 16384 (order: 5, 131072 bytes)
|
||||
TCP bind hash table entries: 16384 (order: 4, 65536 bytes)
|
||||
TCP: Hash tables configured (established 16384 bind 16384)
|
||||
TCP reno registered
|
||||
UDP hash table entries: 256 (order: 0, 4096 bytes)
|
||||
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
|
||||
NET: Registered protocol family 1
|
||||
Trying to unpack rootfs image as initramfs...
|
||||
rootfs image is not initramfs (no cpio magic); looks like an initrd
|
||||
Freeing initrd memory: 3368k freed
|
||||
WDT driver for MPC8xxx initialized. mode:reset timeout=65535 (32 seconds)
|
||||
JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
|
||||
msgmni has been set to 1008
|
||||
io scheduler noop registered
|
||||
io scheduler deadline registered
|
||||
io scheduler cfq registered (default)
|
||||
Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
|
||||
serial8250.0: ttyS0 at MMIO 0xe0004500 (irq = 16) is a 16550A
|
||||
console [ttyS0] enabled, bootconsole disabled
|
||||
console [ttyS0] enabled, bootconsole disabled
|
||||
serial8250.0: ttyS1 at MMIO 0xe0004600 (irq = 17) is a 16550A
|
||||
brd: module loaded
|
||||
loop: module loaded
|
||||
fe000000.flash: Found 1 x16 devices at 0x0 in 16-bit bank. Manufacturer ID 0x000001 Chip ID 0x000c01
|
||||
Amd/Fujitsu Extended Query Table at 0x0040
|
||||
Amd/Fujitsu Extended Query version 1.3.
|
||||
number of CFI chips: 1
|
||||
4 ofpart partitions found on MTD device fe000000.flash
|
||||
Creating 4 MTD partitions on "fe000000.flash":
|
||||
0x000000000000-0x000000100000 : "u-boot"
|
||||
0x000000100000-0x000000500000 : "fs"
|
||||
0x000000500000-0x000000700000 : "kernel"
|
||||
0x000000700000-0x000000800000 : "dtb"
|
||||
NAND device: Manufacturer ID: 0xec, Chip ID: 0x75 (Samsung NAND 32MiB 3,3V 8-bit)
|
||||
Bad block table found at page 65504, version 0x01
|
||||
Bad block table found at page 65472, version 0x01
|
||||
nand_read_bbt: bad block at 0x0000000a8000
|
||||
nand_read_bbt: bad block at 0x0000000ac000
|
||||
nand_read_bbt: bad block at 0x0000000b0000
|
||||
nand_read_bbt: bad block at 0x0000000b4000
|
||||
6 ofpart partitions found on MTD device e0600000.flash
|
||||
Creating 6 MTD partitions on "e0600000.flash":
|
||||
0x000000000000-0x000000100000 : "U-Boot-NAND"
|
||||
0x000000100000-0x000000900000 : "JFFS2-NAND"
|
||||
0x000000900000-0x000000d00000 : "Ramdisk-NAND"
|
||||
0x000000d00000-0x000001d00000 : "Reserved-NAND"
|
||||
0x000001d00000-0x000001f00000 : "Kernel-NAND"
|
||||
0x000001f00000-0x000002000000 : "DTB-NAND"
|
||||
eLBC NAND device at 0xe0600000, bank 1
|
||||
Freescale PowerQUICC MII Bus: probed
|
||||
mdio_bus mdio@e0024520: error probing PHY at address 0
|
||||
Freescale PowerQUICC MII Bus: probed
|
||||
fsl-gianfar e0024000.ethernet: eth0: mac: 04:00:00:00:00:0a
|
||||
fsl-gianfar e0024000.ethernet: eth0: Running with NAPI enabled
|
||||
fsl-gianfar e0024000.ethernet: eth0: RX BD ring size for Q[0]: 256
|
||||
fsl-gianfar e0024000.ethernet: eth0: TX BD ring size for Q[0]: 256
|
||||
fsl-gianfar e0025000.ethernet: eth1: mac: 04:00:00:00:00:0b
|
||||
fsl-gianfar e0025000.ethernet: eth1: Running with NAPI enabled
|
||||
fsl-gianfar e0025000.ethernet: eth1: RX BD ring size for Q[0]: 256
|
||||
fsl-gianfar e0025000.ethernet: eth1: TX BD ring size for Q[0]: 256
|
||||
i2c /dev entries driver
|
||||
mpc-i2c e0003000.i2c: timeout 1000000 us
|
||||
rtc-ds1307 0-0068: rtc core: registered ds1339 as rtc0
|
||||
TCP cubic registered
|
||||
NET: Registered protocol family 17
|
||||
Registering the dns_resolver key type
|
||||
rtc-ds1307 0-0068: setting system clock to 2000-01-01 00:00:00 UTC (946684800)
|
||||
RAMDISK: gzip image found at block 0
|
||||
VFS: Mounted root (ext2 filesystem) on device 1:0.
|
||||
Freeing unused kernel memory: 152k freed
|
||||
Mounting /proc and /sys
|
||||
Starting the hotplug events dispatcher mdev
|
||||
Setting the hostname to mpc8315erdb
|
||||
Mounting filesystems
|
||||
mount: mounting usbfs on /proc/bus/usb failed: No such file or directory
|
||||
Starting syslogd and klogd
|
||||
Running sysctl
|
||||
Setting up networking on loopback device:
|
||||
|
||||
7
Zim/Research/vanet/部署.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-08-11T21:48:28+08:00
|
||||
|
||||
====== 部署 ======
|
||||
Created Saturday 11 August 2012
|
||||
|
||||
7
Zim/Research/vanet/部署/jffs2_flash方式.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-08-11T21:48:46+08:00
|
||||
|
||||
====== jffs2 flash方式 ======
|
||||
Created Saturday 11 August 2012
|
||||
|
||||
7
Zim/Research/vanet/部署/jffs2_flash方式/jffs2部署.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-08-11T21:47:58+08:00
|
||||
|
||||
====== jffs2部署 ======
|
||||
Created Saturday 11 August 2012
|
||||
|
||||
7
Zim/Research/vanet/部署/ramdisk方式.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-08-11T21:48:35+08:00
|
||||
|
||||
====== ramdisk方式 ======
|
||||
Created Saturday 11 August 2012
|
||||
|
||||
369
Zim/Research/vanet/部署/ramdisk方式/ramdisk部署--通过flash.txt
Normal file
@@ -0,0 +1,369 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-08-11T21:21:44+08:00
|
||||
|
||||
====== ramdisk部署--通过flash ======
|
||||
Created Saturday 11 August 2012
|
||||
|
||||
一、NOR Flash方式:
|
||||
这种部署方式是将ramdisk格式的根文件系统、内核、设备树烧写到flash中,然后复位后摘bootcmd中指定三个文件在flash中起始地址即可。适合与较小的固件。
|
||||
|
||||
首先要规划NOR Flash的空间安排,在mpc8315dtb-default.dts文件中,安排如下:
|
||||
flash@0,0 {
|
||||
#address-cells = <0x1>;
|
||||
#size-cells = <0x1>;
|
||||
compatible = "cfi-flash";
|
||||
reg = <0x0 0x0 0x800000>;
|
||||
bank-width = <0x2>;
|
||||
device-width = <0x1>;
|
||||
|
||||
u-boot@0 {
|
||||
reg = <0x0 0x100000>;
|
||||
read-only;
|
||||
};
|
||||
|
||||
fs@100000 {
|
||||
reg = <0x100000 0x400000>;
|
||||
};
|
||||
|
||||
kernel@500000 {
|
||||
reg = <0x500000 0x200000>;
|
||||
};
|
||||
|
||||
dtb@700000 {
|
||||
reg = <0x700000 0x100000>;
|
||||
};
|
||||
};
|
||||
由于MPC831ERDB上的NOR Flash只有8MB空间,因此三个文件的大小加起来不能超过8MB。由于使用ramdisk方式时,是使用SDRAM作为根文件系统,所以
|
||||
实际为这三个文件分配空间时可以任意,只要够用就行。
|
||||
|
||||
二、 NAND Flash方式:
|
||||
当固件较大时,可以将其烧写到容量较大的NAND Flash中,然后启动时将这三个文件读取到内存中(通过nand read命令)启动。__注意如果是NOR Flash则bootm的三个参数可以直接是文件在NOR Flash中烧写的首地址,因为NOR Flash支持在芯片执行(XIP).__
|
||||
|
||||
可以将NOR Flash和NAND Flash烧写相结合的方式启动,如将较小的uImage和dtb烧写到NOR中,将较大的rootfs烧写到NAND中,然后在bootm前将NAND 中的文件读到内存中即可。
|
||||
|
||||
**=> help nand**
|
||||
nand info - show available NAND devices
|
||||
nand device [dev] - show or set current device
|
||||
nand read - addr off|partition size
|
||||
nand write - addr off|partition size
|
||||
read/write 'size' bytes starting at offset 'off'
|
||||
to/from memory address 'addr', skipping bad blocks.
|
||||
nand erase [clean] [off size] - erase 'size' bytes from
|
||||
offset 'off' (entire device if not specified)
|
||||
nand bad - show bad blocks
|
||||
nand dump[.oob] off - dump page
|
||||
nand scrub - really clean NAND erasing bad blocks (UNSAFE)
|
||||
nand markbad off - mark bad block at offset (UNSAFE)
|
||||
nand biterr off - make a bit error at offset (UNSAFE)
|
||||
|
||||
**=> nand erase #擦出整个NAND Flash**
|
||||
|
||||
NAND erase: device 0 whole chip
|
||||
Bad block table found at page 65504, version 0x01
|
||||
Bad block table found at page 65472, version 0x01
|
||||
nand_read_bbt: Bad block at 0x000a8000
|
||||
nand_read_bbt: Bad block at 0x000ac000
|
||||
nand_read_bbt: Bad block at 0x000b0000
|
||||
nand_read_bbt: Bad block at 0x000b4000
|
||||
Skipping bad block at 0x000a8000
|
||||
Skipping bad block at 0x000ac000
|
||||
Skipping bad block at 0x000b0000
|
||||
Skipping bad block at 0x000b4000
|
||||
Skipping bad block at 0x01ff0000
|
||||
Skipping bad block at 0x01ff4000
|
||||
Skipping bad block at 0x01ff8000
|
||||
Skipping bad block at 0x01ffc000
|
||||
|
||||
OK
|
||||
**=> nand write 1000000 0 $filesize**
|
||||
|
||||
NAND write: device 0 offset 0x0, size 0x17acfc
|
||||
Attempt to write __non page aligned data #K9F5608的page大小为512Bytes__
|
||||
1551612 bytes written: ERROR
|
||||
|
||||
**=> nand write 1000000 0 200000**
|
||||
|
||||
NAND write: '$200000' is not a number
|
||||
=> nand write 1000000 0 200000
|
||||
|
||||
NAND write: device 0 offset 0x0, size 0x200000
|
||||
Skip bad block 0x000a8000
|
||||
Skip bad block 0x000ac000
|
||||
Skip bad block 0x000b0000
|
||||
Skip bad block 0x000b4000
|
||||
2097152 bytes written: OK
|
||||
**=> tftp 2000000 rootfs.ext2.gz.uboot**
|
||||
Speed: 100, full duplex
|
||||
Using eTSEC0 device
|
||||
TFTP from server 192.168.2.105; our IP address is 192.168.2.100
|
||||
Filename 'rootfs.ext2.gz.uboot'.
|
||||
Load address: 0x2000000
|
||||
Loading: #################################################################
|
||||
#################################################################
|
||||
#################################################################
|
||||
#################################################################
|
||||
#################################################################
|
||||
#################################################################
|
||||
####################################
|
||||
done
|
||||
Bytes transferred = 6252712 (5f68a8 hex)
|
||||
**=> nand write 2000000 300000 700000**
|
||||
|
||||
NAND write: device 0 offset 0x300000, size 0x700000
|
||||
7340032 bytes written: OK
|
||||
**=> tftp c00000 mpc8315.dtb**
|
||||
Speed: 100, full duplex
|
||||
Using eTSEC0 device
|
||||
TFTP from server 192.168.2.105; our IP address is 192.168.2.100
|
||||
Filename 'mpc8315.dtb'.
|
||||
Load address: 0xc00000
|
||||
Loading: ##
|
||||
done
|
||||
Bytes transferred = 20000 (4e20 hex)
|
||||
**=> nand write c00000 a00000 100000**
|
||||
|
||||
NAND write: device 0 offset 0xa00000, size 0x100000
|
||||
1048576 bytes written: OK
|
||||
**=> setenv bootargs root=/dev/ram rw console=ttyS0,115200 ramdisk_size=19034**
|
||||
**=> setenv bootcmd "nand read 1000000 0 200000;nand read 2000000 300000 700000;nand read c00000 a00000 100000;bootm 1000000 2000000 c00000" #设置环境变量bootcmd的参数,注意前后的引号和命令间的分号。**
|
||||
**=> saveenv #将环境变量保存,这样下次重启时6秒后将自动自行bootcmd环境变量对应的命令**
|
||||
Saving Environment to Flash...
|
||||
. done
|
||||
Un-Protected 1 sectors
|
||||
Erasing Flash...
|
||||
. done
|
||||
Erased 1 sectors
|
||||
Writing to Flash... done
|
||||
. done
|
||||
Protected 1 sectors
|
||||
=>
|
||||
__=> boot__
|
||||
|
||||
NAND read: device 0 offset 0x0, size 0x200000
|
||||
Bad block table found at page 65504, version 0x01
|
||||
Bad block table found at page 65472, version 0x01
|
||||
nand_read_bbt: Bad block at 0x000a8000
|
||||
nand_read_bbt: Bad block at 0x000ac000
|
||||
nand_read_bbt: Bad block at 0x000b0000
|
||||
nand_read_bbt: Bad block at 0x000b4000
|
||||
Skipping bad block 0x000a8000
|
||||
Skipping bad block 0x000ac000
|
||||
Skipping bad block 0x000b0000
|
||||
Skipping bad block 0x000b4000
|
||||
2097152 bytes read: OK
|
||||
|
||||
NAND read: device 0 offset 0x300000, size 0x700000
|
||||
7340032 bytes read: OK
|
||||
|
||||
NAND read: device 0 offset 0xa00000, size 0x100000
|
||||
1048576 bytes read: OK
|
||||
## Booting kernel from Legacy Image at 01000000 ...
|
||||
Image Name: Linux-3.2.4-gfd2812f
|
||||
Created: 2012-08-10 7:58:18 UTC
|
||||
Image Type: PowerPC Linux Kernel Image (gzip compressed)
|
||||
Data Size: 1551548 Bytes = 1.5 MB
|
||||
Load Address: 00000000
|
||||
Entry Point: 00000000
|
||||
Verifying Checksum ... OK
|
||||
## Loading init Ramdisk from Legacy Image at 02000000 ...
|
||||
Image Name: uboot ext2 ramdisk rootfs
|
||||
Created: 2012-08-11 12:56:37 UTC
|
||||
Image Type: PowerPC Linux RAMDisk Image (gzip compressed)
|
||||
Data Size: 6252648 Bytes = 6 MB
|
||||
Load Address: 00000000
|
||||
Entry Point: 00000000
|
||||
Verifying Checksum ... OK
|
||||
## Flattened Device Tree blob at 00c00000
|
||||
Booting using the fdt blob at 0xc00000
|
||||
Uncompressing Kernel Image ... OK
|
||||
Loading Ramdisk to 1f932000, end 1ff28868 ... OK
|
||||
Loading Device Tree to 007f8000, end 007ffe1f ... OK
|
||||
Using MPC831x RDB machine description
|
||||
Cannot reserve gpages without hugetlb enabled
|
||||
Linux version 3.2.4-gfd2812f (geekard@kb310) (gcc version 4.7.1 (GCC) ) #4 Fri Aug 10 15:58:17 CST 2012
|
||||
Found initrd at 0xdf932000:0xdff28868
|
||||
bootconsole [udbg0] enabled
|
||||
setup_arch: bootmem
|
||||
mpc831x_rdb_setup_arch()
|
||||
Found FSL PCI host bridge at 0x00000000e0008500. Firmware bus number: 0->0
|
||||
PCI host bridge /pci@e0008500 (primary) ranges:
|
||||
MEM 0x0000000090000000..0x000000009fffffff -> 0x0000000090000000
|
||||
MEM 0x0000000080000000..0x000000008fffffff -> 0x0000000080000000 Prefetch
|
||||
IO 0x00000000e0300000..0x00000000e03fffff -> 0x0000000000000000
|
||||
arch: exit
|
||||
Zone PFN ranges:
|
||||
DMA 0x00000000 -> 0x00020000
|
||||
Normal empty
|
||||
Movable zone start PFN for each node
|
||||
early_node_map[1] active PFN ranges
|
||||
0: 0x00000000 -> 0x00020000
|
||||
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 130048
|
||||
Kernel command line: root=/dev/ram rw console=ttyS0,115200 ramdisk_size=19034
|
||||
PID hash table entries: 2048 (order: 1, 8192 bytes)
|
||||
Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
|
||||
Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
|
||||
Memory: 510412k/524288k available (2992k kernel code, 13876k reserved, 124k data, 59k bss, 152k init)
|
||||
Kernel virtual memory layout:
|
||||
* 0xfffdf000..0xfffff000 : fixmap
|
||||
* 0xfdefb000..0xfe000000 : early ioremap
|
||||
* 0xe1000000..0xfdefb000 : vmalloc & ioremap
|
||||
NR_IRQS:512 nr_irqs:512 16
|
||||
IPIC (128 IRQ sources) at e1000700
|
||||
clocksource: timebase mult[7800001] shift[22] registered
|
||||
pid_max: default: 32768 minimum: 301
|
||||
Mount-cache hash table entries: 512
|
||||
NET: Registered protocol family 16
|
||||
|
||||
PCI: Probing PCI hardware
|
||||
bio: create slab <bio-0> at 0
|
||||
vgaarb: loaded
|
||||
SCSI subsystem initialized
|
||||
Switching to clocksource timebase
|
||||
NET: Registered protocol family 2
|
||||
IP route cache hash table entries: 4096 (order: 2, 16384 bytes)
|
||||
TCP established hash table entries: 16384 (order: 5, 131072 bytes)
|
||||
TCP bind hash table entries: 16384 (order: 4, 65536 bytes)
|
||||
TCP: Hash tables configured (established 16384 bind 16384)
|
||||
TCP reno registered
|
||||
UDP hash table entries: 256 (order: 0, 4096 bytes)
|
||||
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
|
||||
NET: Registered protocol family 1
|
||||
Trying to unpack rootfs image as initramfs...
|
||||
rootfs image is not initramfs (no cpio magic); looks like an initrd
|
||||
Freeing initrd memory: 6108k freed
|
||||
WDT driver for MPC8xxx initialized. mode:reset timeout=65535 (32 seconds)
|
||||
JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
|
||||
msgmni has been set to 1008
|
||||
io scheduler noop registered
|
||||
io scheduler deadline registered
|
||||
io scheduler cfq registered (default)
|
||||
Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
|
||||
serial8250.0: ttyS0 at MMIO 0xe0004500 (irq = 16) is a 16550A
|
||||
console [ttyS0] enabled, bootconsole disabled
|
||||
console [ttyS0] enabled, bootconsole disabled
|
||||
serial8250.0: ttyS1 at MMIO 0xe0004600 (irq = 17) is a 16550A
|
||||
brd: module loaded
|
||||
loop: module loaded
|
||||
fe000000.flash: Found 1 x16 devices at 0x0 in 16-bit bank. Manufacturer ID 0x000001 Chip ID 0x000c01
|
||||
Amd/Fujitsu Extended Query Table at 0x0040
|
||||
Amd/Fujitsu Extended Query version 1.3.
|
||||
number of CFI chips: 1
|
||||
4 ofpart partitions found on MTD device fe000000.flash
|
||||
Creating 4 MTD partitions on "fe000000.flash":
|
||||
0x000000000000-0x000000100000 : "u-boot"
|
||||
0x000000100000-0x000000500000 : "fs"
|
||||
0x000000500000-0x000000700000 : "kernel"
|
||||
0x000000700000-0x000000800000 : "dtb"
|
||||
NAND device: Manufacturer ID: 0xec, Chip ID: 0x75 (Samsung NAND 32MiB 3,3V 8-bit)
|
||||
Bad block table found at page 65504, version 0x01
|
||||
Bad block table found at page 65472, version 0x01
|
||||
nand_read_bbt: bad block at 0x0000000a8000
|
||||
nand_read_bbt: bad block at 0x0000000ac000
|
||||
nand_read_bbt: bad block at 0x0000000b0000
|
||||
nand_read_bbt: bad block at 0x0000000b4000
|
||||
6 ofpart partitions found on MTD device e0600000.flash
|
||||
Creating 6 MTD partitions on "e0600000.flash":
|
||||
0x000000000000-0x000000100000 : "U-Boot-NAND"
|
||||
0x000000100000-0x000000900000 : "JFFS2-NAND"
|
||||
0x000000900000-0x000000d00000 : "Ramdisk-NAND"
|
||||
0x000000d00000-0x000001d00000 : "Reserved-NAND"
|
||||
0x000001d00000-0x000001f00000 : "Kernel-NAND"
|
||||
0x000001f00000-0x000002000000 : "DTB-NAND"
|
||||
eLBC NAND device at 0xe0600000, bank 1
|
||||
Freescale PowerQUICC MII Bus: probed
|
||||
mdio_bus mdio@e0024520: error probing PHY at address 0
|
||||
Freescale PowerQUICC MII Bus: probed
|
||||
fsl-gianfar e0024000.ethernet: eth0: mac: 04:00:00:00:00:0a
|
||||
fsl-gianfar e0024000.ethernet: eth0: Running with NAPI enabled
|
||||
fsl-gianfar e0024000.ethernet: eth0: RX BD ring size for Q[0]: 256
|
||||
fsl-gianfar e0024000.ethernet: eth0: TX BD ring size for Q[0]: 256
|
||||
fsl-gianfar e0025000.ethernet: eth1: mac: 04:00:00:00:00:0b
|
||||
fsl-gianfar e0025000.ethernet: eth1: Running with NAPI enabled
|
||||
fsl-gianfar e0025000.ethernet: eth1: RX BD ring size for Q[0]: 256
|
||||
fsl-gianfar e0025000.ethernet: eth1: TX BD ring size for Q[0]: 256
|
||||
i2c /dev entries driver
|
||||
mpc-i2c e0003000.i2c: timeout 1000000 us
|
||||
rtc-ds1307 0-0068: rtc core: registered ds1339 as rtc0
|
||||
TCP cubic registered
|
||||
NET: Registered protocol family 17
|
||||
Registering the dns_resolver key type
|
||||
rtc-ds1307 0-0068: setting system clock to 2000-01-01 00:00:00 UTC (946684800)
|
||||
RAMDISK: gzip image found at block 0
|
||||
VFS: Mounted root (ext2 filesystem) on device 1:0.
|
||||
Freeing unused kernel memory: 152k freed
|
||||
Mounting /proc and /sys
|
||||
Starting the hotplug events dispatcher udevd
|
||||
Synthesizing initial hotplug eveudevd (807): /proc/807/oom_adj is deprecated, please use /proc/807/oom_score_adj instead.
|
||||
nts
|
||||
cfg80211: Calling CRDA to update world regulatory domain
|
||||
cfg80211: World regulatory domain updated:
|
||||
cfg80211: (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
|
||||
cfg80211: (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
|
||||
cfg80211: (2457000 KHz - 2482000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
|
||||
cfg80211: (2474000 KHz - 2494000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
|
||||
cfg80211: (5170000 KHz - 5250000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
|
||||
cfg80211: (5735000 KHz - 5835000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
|
||||
ath5k 0000:00:0e.0: registered as 'phy0'
|
||||
ath5k channel bandwidth setting 10MHz default
|
||||
VANET-debug: ieee80211_register_hw
|
||||
VANET-debug: ieee80211_rate_control_ops_get select minstrel_ht
|
||||
VANET-debug: register vanet network interface
|
||||
VANET-debug: ieee80211_if_add, name: ath5k%d
|
||||
ath5k phy0: Atheros AR5414 chip found (MAC: 0xa5, PHY: 0x61)
|
||||
cfg80211: Calling CRDA for country: US
|
||||
cfg80211: Regulatory domain changed to country: US
|
||||
cfg80211: (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
|
||||
cfg80211: (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2700 mBm)
|
||||
cfg80211: (5170000 KHz - 5250000 KHz @ 40000 KHz), (300 mBi, 1700 mBm)
|
||||
cfg80211: (5250000 KHz - 5330000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
|
||||
cfg80211: (5490000 KHz - 5600000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
|
||||
cfg80211: (5650000 KHz - 5710000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
|
||||
cfg80211: (5735000 KHz - 5835000 KHz @ 40000 KHz), (300 mBi, 3000 mBm)
|
||||
Setting the hostname to mpc8315erdb
|
||||
Mounting filesystems
|
||||
mount: mounting usbfs on /proc/bus/usb failed: No such file or directory
|
||||
Starting syslogd and klogd
|
||||
Running sysctl
|
||||
Setting up networking on loopback device:
|
||||
|
||||
Warning: no IPADDR is set, please set this from the ltib
|
||||
config screen, or directly in /etc/rc.d/rc.conf.
|
||||
IP address setup bypassed
|
||||
|
||||
Setting up networking on eth1:
|
||||
|
||||
|
||||
Welcome to the LTIB Embedded Linux Environment
|
||||
|
||||
!!!!! WARNING !!!!!!!
|
||||
|
||||
The default password for the root account is: root
|
||||
please change this password using the 'passwd' command
|
||||
and then edit this message (/etc/issue) to remove this message
|
||||
|
||||
mpc8315erdb login: PHY: mdio@e0024520:01 - Link is Up - 100/Full
|
||||
|
||||
|
||||
Welcome to the LTIB Embedded Linux Environment
|
||||
|
||||
!!!!! WARNING !!!!!!!
|
||||
|
||||
The default password for the root account is: root
|
||||
please change this password using the 'passwd' command
|
||||
and then edit this message (/etc/issue) to remove this message
|
||||
|
||||
mpc8315erdb login: root
|
||||
Password:
|
||||
root
|
||||
Login incorrect
|
||||
mpc8315erdb login: root
|
||||
Password:
|
||||
[root@mpc8315erdb root]# uname -a
|
||||
Linux mpc8315erdb 3.2.4-gfd2812f #4 Fri Aug 10 15:58:17 CST 2012 ppc GNU/Linux
|
||||
[root@mpc8315erdb root]#
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
267
Zim/Research/vanet/部署/ramdisk方式/ramdisk部署--通过tftp.txt
Normal file
@@ -0,0 +1,267 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-08-11T21:16:50+08:00
|
||||
|
||||
====== ramdisk部署--通过tftp ======
|
||||
Created Saturday 11 August 2012
|
||||
|
||||
这种部署方式适合开发环境,通过tftp将内核、根文件系统和设备树下载到内存中,然后使用bootm命令从内存中启动。
|
||||
步骤如下:
|
||||
|
||||
U-Boot 2009.03-rc2 (Aug 11 2012 - 13:22:34) MPC83XX
|
||||
|
||||
Reset Status:
|
||||
|
||||
CPU: e300c3, MPC8315, Rev: 1.2 at 400 MHz, CSB: 133.333 MHz
|
||||
Board: Freescale MPC8315ERDB Rev <unknown>
|
||||
I2C: ready
|
||||
DRAM: 512 MB
|
||||
FLASH: 8 MB
|
||||
NAND: 32 MiB
|
||||
PCIE0: No link
|
||||
PCIE1: No link
|
||||
In: serial
|
||||
Out: serial
|
||||
Err: serial
|
||||
Net: eTSEC0
|
||||
Hit any key to stop autoboot: 0
|
||||
=> setenv **serverip** 192.168.2.105
|
||||
=> setenv **ipaddr** 192.168.2.100
|
||||
**=> setenv bootargs **__root=/dev/ram__** rw console=ttyS0,115200 **__ramdisk_size=19034 #注意ramdisk_size要与ltib的输出一致。__
|
||||
**=> tftp 1000000 uImage**
|
||||
Speed: 100, full duplex
|
||||
Using eTSEC0 device
|
||||
TFTP from server 192.168.2.105; our IP address is 192.168.2.100
|
||||
Filename 'uImage'.
|
||||
Load address: 0x1000000
|
||||
Loading: #################################################################
|
||||
#########################################
|
||||
done
|
||||
Bytes transferred = 1551612 (17acfc hex)
|
||||
**=> tftp 2000000 rootfs.ext2.gz.uboot**
|
||||
Speed: 100, full duplex
|
||||
Using eTSEC0 device
|
||||
TFTP from server 192.168.2.105; our IP address is 192.168.2.100
|
||||
Filename 'rootfs.ext2.gz.uboot'.
|
||||
Load address: 0x2000000
|
||||
Loading: #################################################################
|
||||
#################################################################
|
||||
#################################################################
|
||||
#################################################################
|
||||
#################################################################
|
||||
#################################################################
|
||||
####################################
|
||||
done
|
||||
Bytes transferred = 6252712 (5f68a8 hex)
|
||||
**=> tftp c00000 mpc8315.dtb**
|
||||
Speed: 100, full duplex
|
||||
Using eTSEC0 device
|
||||
TFTP from server 192.168.2.105; our IP address is 192.168.2.100
|
||||
Filename 'mpc8315.dtb'.
|
||||
Load address: 0xc00000
|
||||
Loading: ##
|
||||
done
|
||||
Bytes transferred = 20000 (4e20 hex)
|
||||
**=> bootm 1000000 2000000 c00000**
|
||||
|
||||
## Booting kernel from Legacy Image at 01000000 ...
|
||||
Image Name: Linux-3.2.4-gfd2812f
|
||||
Created: 2012-08-10 7:58:18 UTC
|
||||
Image Type: PowerPC Linux Kernel Image (gzip compressed)
|
||||
Data Size: 1551548 Bytes = 1.5 MB
|
||||
Load Address: 00000000
|
||||
Entry Point: 00000000
|
||||
Verifying Checksum ... OK
|
||||
## Loading init Ramdisk from Legacy Image at 02000000 ...
|
||||
Image Name: uboot ext2 ramdisk rootfs
|
||||
Created: 2012-08-11 12:56:37 UTC
|
||||
Image Type: PowerPC Linux RAMDisk Image (gzip compressed)
|
||||
Data Size: 6252648 Bytes = 6 MB
|
||||
Load Address: 00000000
|
||||
Entry Point: 00000000
|
||||
Verifying Checksum ... OK
|
||||
## Flattened Device Tree blob at 00c00000
|
||||
Booting using the fdt blob at 0xc00000
|
||||
Uncompressing Kernel Image ... OK
|
||||
Loading Ramdisk to 1f933000, end 1ff29868 ... OK
|
||||
Loading Device Tree to 007f8000, end 007ffe1f ... OK
|
||||
Using MPC831x RDB machine description
|
||||
Cannot reserve gpages without hugetlb enabled
|
||||
Linux version 3.2.4-gfd2812f (geekard@kb310) (gcc version 4.7.1 (GCC) ) #4 Fri Aug 10 15:58:17 CST 2012
|
||||
Found initrd at 0xdf933000:0xdff29868
|
||||
bootconsole [udbg0] enabled
|
||||
setup_arch: bootmem
|
||||
mpc831x_rdb_setup_arch()
|
||||
Found FSL PCI host bridge at 0x00000000e0008500. Firmware bus number: 0->0
|
||||
PCI host bridge /pci@e0008500 (primary) ranges:
|
||||
MEM 0x0000000090000000..0x000000009fffffff -> 0x0000000090000000
|
||||
MEM 0x0000000080000000..0x000000008fffffff -> 0x0000000080000000 Prefetch
|
||||
IO 0x00000000e0300000..0x00000000e03fffff -> 0x0000000000000000
|
||||
arch: exit
|
||||
Zone PFN ranges:
|
||||
DMA 0x00000000 -> 0x00020000
|
||||
Normal empty
|
||||
Movable zone start PFN for each node
|
||||
early_node_map[1] active PFN ranges
|
||||
0: 0x00000000 -> 0x00020000
|
||||
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 130048
|
||||
Kernel command line: root=/dev/ram rw console=ttyS0,115200 ramdisk_size=19034
|
||||
PID hash table entries: 2048 (order: 1, 8192 bytes)
|
||||
Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
|
||||
Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
|
||||
Memory: 510412k/524288k available (2992k kernel code, 13876k reserved, 124k data, 59k bss, 152k init)
|
||||
Kernel virtual memory layout:
|
||||
* 0xfffdf000..0xfffff000 : fixmap
|
||||
* 0xfdefb000..0xfe000000 : early ioremap
|
||||
* 0xe1000000..0xfdefb000 : vmalloc & ioremap
|
||||
NR_IRQS:512 nr_irqs:512 16
|
||||
IPIC (128 IRQ sources) at e1000700
|
||||
clocksource: timebase mult[7800001] shift[22] registered
|
||||
pid_max: default: 32768 minimum: 301
|
||||
Mount-cache hash table entries: 512
|
||||
NET: Registered protocol family 16
|
||||
|
||||
PCI: Probing PCI hardware
|
||||
bio: create slab <bio-0> at 0
|
||||
vgaarb: loaded
|
||||
SCSI subsystem initialized
|
||||
Switching to clocksource timebase
|
||||
NET: Registered protocol family 2
|
||||
IP route cache hash table entries: 4096 (order: 2, 16384 bytes)
|
||||
TCP established hash table entries: 16384 (order: 5, 131072 bytes)
|
||||
TCP bind hash table entries: 16384 (order: 4, 65536 bytes)
|
||||
TCP: Hash tables configured (established 16384 bind 16384)
|
||||
TCP reno registered
|
||||
UDP hash table entries: 256 (order: 0, 4096 bytes)
|
||||
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
|
||||
NET: Registered protocol family 1
|
||||
Trying to unpack rootfs image as initramfs...
|
||||
rootfs image is not initramfs (no cpio magic); looks like an initrd
|
||||
Freeing initrd memory: 6108k freed
|
||||
WDT driver for MPC8xxx initialized. mode:reset timeout=65535 (32 seconds)
|
||||
JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
|
||||
msgmni has been set to 1008
|
||||
io scheduler noop registered
|
||||
io scheduler deadline registered
|
||||
io scheduler cfq registered (default)
|
||||
Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
|
||||
serial8250.0: ttyS0 at MMIO 0xe0004500 (irq = 16) is a 16550A
|
||||
console [ttyS0] enabled, bootconsole disabled
|
||||
console [ttyS0] enabled, bootconsole disabled
|
||||
serial8250.0: ttyS1 at MMIO 0xe0004600 (irq = 17) is a 16550A
|
||||
brd: module loaded
|
||||
loop: module loaded
|
||||
fe000000.flash: Found 1 x16 devices at 0x0 in 16-bit bank. Manufacturer ID 0x000001 Chip ID 0x000c01
|
||||
Amd/Fujitsu Extended Query Table at 0x0040
|
||||
Amd/Fujitsu Extended Query version 1.3.
|
||||
number of CFI chips: 1
|
||||
4 ofpart partitions found on MTD device fe000000.flash
|
||||
Creating 4 MTD partitions on "fe000000.flash":
|
||||
0x000000000000-0x000000100000 : "u-boot"
|
||||
0x000000100000-0x000000500000 : "fs"
|
||||
0x000000500000-0x000000700000 : "kernel"
|
||||
0x000000700000-0x000000800000 : "dtb"
|
||||
NAND device: Manufacturer ID: 0xec, Chip ID: 0x75 (Samsung NAND 32MiB 3,3V 8-bit)
|
||||
Bad block table found at page 65504, version 0x01
|
||||
Bad block table found at page 65472, version 0x01
|
||||
nand_read_bbt: bad block at 0x0000000a8000
|
||||
nand_read_bbt: bad block at 0x0000000ac000
|
||||
nand_read_bbt: bad block at 0x0000000b0000
|
||||
nand_read_bbt: bad block at 0x0000000b4000
|
||||
6 ofpart partitions found on MTD device e0600000.flash
|
||||
Creating 6 MTD partitions on "e0600000.flash":
|
||||
0x000000000000-0x000000100000 : "U-Boot-NAND"
|
||||
0x000000100000-0x000000900000 : "JFFS2-NAND"
|
||||
0x000000900000-0x000000d00000 : "Ramdisk-NAND"
|
||||
0x000000d00000-0x000001d00000 : "Reserved-NAND"
|
||||
0x000001d00000-0x000001f00000 : "Kernel-NAND"
|
||||
0x000001f00000-0x000002000000 : "DTB-NAND"
|
||||
eLBC NAND device at 0xe0600000, bank 1
|
||||
Freescale PowerQUICC MII Bus: probed
|
||||
mdio_bus mdio@e0024520: error probing PHY at address 0
|
||||
Freescale PowerQUICC MII Bus: probed
|
||||
fsl-gianfar e0024000.ethernet: eth0: mac: 04:00:00:00:00:0a
|
||||
fsl-gianfar e0024000.ethernet: eth0: Running with NAPI enabled
|
||||
fsl-gianfar e0024000.ethernet: eth0: RX BD ring size for Q[0]: 256
|
||||
fsl-gianfar e0024000.ethernet: eth0: TX BD ring size for Q[0]: 256
|
||||
fsl-gianfar e0025000.ethernet: eth1: mac: 04:00:00:00:00:0b
|
||||
fsl-gianfar e0025000.ethernet: eth1: Running with NAPI enabled
|
||||
fsl-gianfar e0025000.ethernet: eth1: RX BD ring size for Q[0]: 256
|
||||
fsl-gianfar e0025000.ethernet: eth1: TX BD ring size for Q[0]: 256
|
||||
i2c /dev entries driver
|
||||
mpc-i2c e0003000.i2c: timeout 1000000 us
|
||||
rtc-ds1307 0-0068: rtc core: registered ds1339 as rtc0
|
||||
TCP cubic registered
|
||||
NET: Registered protocol family 17
|
||||
Registering the dns_resolver key type
|
||||
rtc-ds1307 0-0068: setting system clock to 2000-01-01 00:00:00 UTC (946684800)
|
||||
RAMDISK: gzip image found at block 0
|
||||
VFS: Mounted root (ext2 filesystem) on device 1:0.
|
||||
Freeing unused kernel memory: 152k freed
|
||||
Mounting /proc and /sys
|
||||
Starting the hotplug events dispatcher udevd
|
||||
Synthesizing initial hotplug events
|
||||
udevd (807): /proc/807/oom_adj is deprecated, please use /proc/807/oom_score_adj instead.
|
||||
cfg80211: Calling CRDA to update world regulatory domain
|
||||
cfg80211: World regulatory domain updated:
|
||||
cfg80211: (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
|
||||
cfg80211: (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
|
||||
cfg80211: (2457000 KHz - 2482000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
|
||||
cfg80211: (2474000 KHz - 2494000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
|
||||
cfg80211: (5170000 KHz - 5250000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
|
||||
cfg80211: (5735000 KHz - 5835000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
|
||||
ath5k 0000:00:0e.0: registered as 'phy0'
|
||||
ath5k channel bandwidth setting 10MHz default
|
||||
VANET-debug: ieee80211_register_hw
|
||||
VANET-debug: ieee80211_rate_control_ops_get select minstrel_ht
|
||||
VANET-debug: register vanet network interface
|
||||
VANET-debug: ieee80211_if_add, name: ath5k%d
|
||||
ath5k phy0: Atheros AR5414 chip found (MAC: 0xa5, PHY: 0x61)
|
||||
cfg80211: Calling CRDA for country: US
|
||||
cfg80211: Regulatory domain changed to country: US
|
||||
cfg80211: (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
|
||||
cfg80211: (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2700 mBm)
|
||||
cfg80211: (5170000 KHz - 5250000 KHz @ 40000 KHz), (300 mBi, 1700 mBm)
|
||||
cfg80211: (5250000 KHz - 5330000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
|
||||
cfg80211: (5490000 KHz - 5600000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
|
||||
cfg80211: (5650000 KHz - 5710000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
|
||||
cfg80211: (5735000 KHz - 5835000 KHz @ 40000 KHz), (300 mBi, 3000 mBm)
|
||||
Setting the hostname to mpc8315erdb
|
||||
Mounting filesystems
|
||||
mount: mounting usbfs on /proc/bus/usb failed: No such file or directory
|
||||
Starting syslogd and klogd
|
||||
Running sysctl
|
||||
Setting up networking on loopback device:
|
||||
|
||||
Warning: no IPADDR is set, please set this from the ltib
|
||||
config screen, or directly in /etc/rc.d/rc.conf.
|
||||
IP address setup bypassed
|
||||
|
||||
Setting up networking on eth1:
|
||||
|
||||
|
||||
Welcome to the LTIB Embedded Linux Environment
|
||||
|
||||
!!!!! WARNING !!!!!!!
|
||||
|
||||
The default password for the root account is: root
|
||||
please change this password using the 'passwd' command
|
||||
and then edit this message (/etc/issue) to remove this message
|
||||
|
||||
mpc8315erdb login: PHY: mdio@e0024520:01 - Link is Up - 100/Full
|
||||
|
||||
|
||||
Welcome to the LTIB Embedded Linux Environment
|
||||
|
||||
!!!!! WARNING !!!!!!!
|
||||
|
||||
The default password for the root account is: root
|
||||
please change this password using the 'passwd' command
|
||||
and then edit this message (/etc/issue) to remove this message
|
||||
|
||||
mpc8315erdb login: root
|
||||
Password:
|
||||
[root@mpc8315erdb root]# ls
|
||||
diskinit-1.1.sh recv setIPv6Addr
|
||||
joinvanet send xath5k
|
||||
[root@mpc8315erdb root]#
|
||||