加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

x-loader 以及 如何向nand中写入x-loader

发布时间:2020-12-15 06:39:11 所属栏目:百科 来源:网络整理
导读:x-loader is the primary boot loader. It is loaded by ROM boot loader into the internal RAM. x-loader is responsiblefor initializing the external memory and loading the u-boot from the selected boot device.?x-loader supports boot from NAND,

x-loader is the primary boot loader. It is loaded by ROM boot loader into the internal RAM. x-loader is responsiblefor initializing the external memory and loading the u-boot from the selected boot device.?x-loader supports boot from NAND,MMC/SD and OneNAND.

The generated x-loader.bin needs to be signed before it can be used by the ROM bootloader.?

x-loader是一个初级的bootloader,它被ROM boot loader加载到内部的RAM,x-loader用来初始化外部memory,以及从用户选择的启动项中加载u-boot,x-loader支持从nand、mmc/sd和三星的OneNand启动。

编译产生的x-loader.bin需要被转换成x-loader.bin.ift,这样才可以作用ROM bootloader。

这个文件和x-loader.bin的区别在于增加了一个4个字节的header。header的内容是4个字节的x-loader的长度和x-loader被load到什么地方的地址(4个字节)。由内部的ROM boot loader决定。

x-loader是在OMAP3的内部RAM中运行的(OMAP3530内部有64K SRAM、112K ROM),并没有被拷贝到外部的ddr中运行,当x-loader初始化完memory controler后,加载正式的bootloader: u-boot 来进一步初始化外围硬件,并且启动linux kernel。

启动顺序:bootrom:ROM boot loader(内部ram) -> ?x-loader(内部ram) -> uboot(外部ddr) ->kernel(外部ddr)


问题:怎样将x-loaer写入nandflash?

X-loader is the first stage boot loader and is primarily responsible for initializing the DRAM controller and a few other essential hardware blocks.? Because x-loader is loaded by the OMAP ROM boot loader,it has some special requirements in how it is written.

The OMAP ROM boot loader expects to find x-loader in the first block of NAND.? If the first block is detective,the OMAP ROM boot loader will skip it and attempt to read x-loader from the second block.? If that block is defective,the third block will be read,and if that block is defective,the fourth block.? If all four are defective,a very rare occurance,the boot wil fail.

Another OMAP ROM boot loader requirement is the method of computing ECC.? Hardware ECC is required for these first 4 blocks.

These unique requirements can currently only be met by using u-boot to write x-loader to NAND.

The following instructions assume that you are using a bootable SD card prepared from the GNOME or console images available on this site.

Power up or reset your OMAP board and break into u-boot by pressing a key on your serial console when you see the message:

Hit any key to stop autoboot:
Next have u-boot scan to find your bootable SD card and load the x-load binary from the FAT partition of the bootable SD card. The x-loader binary is called MLO.

# mmc rescan 0
# fatload mmc 0 ${loadaddr} MLO
reading MLO
22540 bytes read

At this point the x-loader binary has been copied into RAM. We now specify the use of hwecc and erase the first 4 blocks of NAND:

# nandecc hw
HW ECC selected
# nand erase 0 80000
NAND erase: device 0 offset 0x0,size 0x80000
Erasing at 0x60000 -- 100% complete.
OK
And as the final step we write the x-loader binary to each of the first 4 blocks in NAND:
# nand write ${loadaddr} 0 ${filesize}
NAND write: device 0 offset 0x0,size size 0x580c
 22540 bytes written: OK
# nand write ${loadaddr} 20000 ${filesize}
NAND write: device 0 offset 0x20000,size size 0x580c
 22540 bytes written: OK
# nand write ${loadaddr} 40000 ${filesize}
NAND write: device 0 offset 0x40000,size size 0x580c
 22540 bytes written: OK
# nand write ${loadaddr} 60000 ${filesize}
NAND write: device 0 offset 0x60000,size size 0x580c
 22540 bytes written: OK

因为x-loader是被ROM boot loader 加载的,所以flash它需要一些特别的条件,TI的OMAP ROM boot loader 期待在nandflash的第一个block中发现x-loader(x-loader很小,一般十几k),如果第一个block中未发现,则继续在第二个block中找,一直到第四个block,如果仍为发现,则标记启动失败,上面的code部分展示了如何向nandflash中写入x-loader,这里的前提是,板子可以从sd启动。

假如nandfalsh中的数据坏掉了,并且无法从sd卡启动,咋办?

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读