- 论坛徽章:
- 0
|
本帖最后由 crifan 于 2015-02-10 14:22 编辑
回复 6# xuxiaohu572
1.
uboot.map文件中 “ 0x80800000”是虚拟的地址还是物理地址?
-----这个问题,我目前的理解是 虚拟地址,但是在tftp addr这个地址,我认为是物理的寻址地址(或者被影射成数值对等的虚拟地址了)
A:据我所知,uboot中涉及的内存的地址,也都是物理地址,而不是虚拟地址。
虚拟地址一般是等到操作系统,Linux,启动之后,开启了内存映射才会涉及到的。
2.
“第二个是烧写uImage的时候就已经烧写入指定的分区了,读取的时候就是从指定的分区 ...[/quote]”
---这个问题我很感兴趣,也很希望能得到斑竹的指导与提示,也许我换一个问法更好些:
“如果我把内核镜像uImage烧写在不同的norflash分区中,uboot的代码应该如何的调整”(即在uboot中哪边的代码定义的这个“指定的分区”)
A:
如果你把内核镜像uImage烧写在不同的NorFlash分区中:
(1)uboot代码中,不需要调整代码,只需要改变启动参数。
比如:
原先是uImage是在xxxx的地址,对应的是mtdblock2
你想要改为yyyy的地址,对应的是mtdblock3
那么就只是去uboot中把:
类似于
【解答】内核kernel以及根文件系统rootfs是如何映射到对应的nand flash的地址的
http://www.crifan.com/answer_kernel_kernel_and_root_file_system_rootfs_is_mapped_to_the_corresponding_address_of_the_nand_flash/
中的:
#define CONFIG_BOOTARGS "root=/dev/mtdblock2 rw init=/linuxrc console=ttyS0,115200 mem=16M rootfstype=yafffs2"
改为:
#define CONFIG_BOOTARGS "root=/dev/mtdblock3 rw init=/linuxrc console=ttyS0,115200 mem=16M rootfstype=yafffs2"
即可。
而无需改动其他的uboot代码。
(2)Linux内核源码中的Flash分区的定义,也要同步修改。
但是对应的Linux中的Flash的分区,需要同步修改。
比如之前是
http://www.denx.de/wiki/publish/DULG/to-delete/FlashFilesystemsMTD.html
中的:
- /* partition definition for first flash bank
- * also ref. to "drivers/char/flash_config.c"
- */
- static struct mtd_partition incaip_partitions[] = {
- {
- name: "U-Boot", /* U-Boot firmware */
- offset: 0x00000000,
- size: 0x00030000, /* 192KB */
- /* mask_flags: MTD_WRITEABLE, force read-only */
- },
- {
- name: "Environment", /* default kernel image */
- offset: 0x00030000,
- size: 0x00010000,
- /* mask_flags: MTD_WRITEABLE, force read-only */
- },
- {
- name: "Linux", /* default kernel image */
- offset: 0x00040000,
- size: 0x000C0000,
- /* mask_flags: MTD_WRITEABLE, force read-only */
- },
- {
- name: "rootfs", /* default root filesystem */
- offset: 0x00100000,
- size: 0x00300000,
- /* mask_flags: MTD_WRITEABLE, force read-only */
- },
- {
- name: "Linux 2", /* alternate kernel image */
- offset: 0x00400000,
- size: 0x000C0000,
- /* mask_flags: MTD_WRITEABLE, force read-only */
- },
- {
- name: "rootfs 2", /* alternate root filesystem */
- offset: 0x00500000,
- size: 0x00300000,
- /* mask_flags: MTD_WRITEABLE, force read-only */
- },
- };
复制代码
改为:
- /* partition definition for first flash bank
- * also ref. to "drivers/char/flash_config.c"
- */
- static struct mtd_partition incaip_partitions[] = {
- {
- name: "U-Boot", /* U-Boot firmware */
- offset: 0x00000000,
- size: 0x00030000, /* 192KB */
- /* mask_flags: MTD_WRITEABLE, force read-only */
- },
- {
- name: "Environment", /* default kernel image */
- offset: 0x00030000,
- size: 0x00010000,
- /* mask_flags: MTD_WRITEABLE, force read-only */
- },
- {
- name: "LinuxNotUseThis", /* old kernel image */
- offset: 0x00040000,
- size: 0x000C0000,
- /* mask_flags: MTD_WRITEABLE, force read-only */
- },
- {
- name: "Linux", /* new kernel image partition */
- offset: 0x00100000,
- size: 0x000C0000,
- /* mask_flags: MTD_WRITEABLE, force read-only */
- },
- {
- name: "rootfs", /* default root filesystem */
- offset: 0x001C0000,
- size: 0x004C0000,
- /* mask_flags: MTD_WRITEABLE, force read-only */
- },
- 。。。(后续起始地址相应的也要增加C0000)
- };
复制代码 (注:此处假定废弃不要之前旧的分区LinuxNotUseThis了。
这样,新的流程就变成:
启动uboot时候,uboot最后去
存放了Linux内核uImage的分区:
/dev/mtdblock3
(对应着新地址:0x00100000)
加载内核
(而废弃,不用了之前的旧地址 0x00040000对应的旧分区/dev/mtdblock2)
了。
更多相关内容可参考:
1.【解答】内核kernel以及根文件系统rootfs是如何映射到对应的nand flash的地址的
http://www.crifan.com/answer_kernel_kernel_and_root_file_system_rootfs_is_mapped_to_the_corresponding_address_of_the_nand_flash/
2.以及:
在Linux运行期间升级Linux系统(Uboot+kernel+Rootfs)
http://www.crifan.com/files/doc/docbook/runtime_upgrade_linux/release/html/runtime_upgrade_linux.html
尤其是其中的:
3.这个也可以看看:
【详解】嵌入式开发中固件的烧录方式
http://www.crifan.com/files/doc/docbook/firmware_download/release/html/firmware_download.html
|
|