u-boot : Relocation

前端 未结 3 1924
独厮守ぢ
独厮守ぢ 2021-02-04 06:00

This one is a basic question related to u-boot.

Why does the u-boot code relocate itself ?

Ok, it makes sense if u-boot is executing from NOR-flash or boot ROM s

3条回答
  •  南方客
    南方客 (楼主)
    2021-02-04 06:12

    U-boot has to reserve 3 regions in memory that stores: 1) u-boot itself, 2) uImage (compressed kernel), and 3) uncompressed kernel. These 3 regions must be carefully placed in u-boot to prevent conflict.

    However, the previous stage boot-loader, (BL2 or BL1) that brings u-boot into DRAM memory don\t know u-boot's planing on these 3 regions. So it can only loads u-boot onto a lower address in DRAM memory and jump to it. Then, after u-boot execute some basic initialization and detect current PC is not in planed location, u-boot call relocate function that move u-boot to the planned location and jump to it.

提交回复
热议问题