[U-Boot] mips-relocs tool conflicts with CONFIG_OF_SEPRATE

袁建鹏 yuanjp at hust.edu.cn
Sat Nov 17 13:18:27 UTC 2018


Hi




I'm adding a new board support to u-boot-2018.09. When I boot the device,I got an error msg:

    No valid device tree binary found - please append one to U-Boot binary, use u-boot-dtb.bin or define CONFIG_OF_EMBED. For sandbox, use -d <file.dtb>




After some debugging, I found the reason:

the device tree blob is cat to u-boot-nodtb.bin. the dtb is referenced by `_end` symbol which is defined at arch/mips/cpu/u-boot.lds

    /*  
     * .rel must come last so that the mips-relocs tool can shrink
     * the section size & the PT_LOAD program header filesz.
     */  
    .rel : {
        __rel_start = .;
        BYTE(0x0)
        . += (32 * 1024) - 1;                                                                                                                                                                                       
    }   

    _end = .;




But mips-relocs tool shrink the .rel section, that make filesz smaller than memsz:







Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  ABIFLAGS       0x02c2a8 0x8102c228 0x8102c228 0x00018 0x00018 R   0x8
  LOAD           0x000080 0x81000000 0x81000000 0x30906 0x3638c RWE 0x10




the _end is 0x3638c, but the actual offset of dtb is changed to 0x30906. so we can't read the dtb correctly.

I disable shrink then works fine. but a better solution is to change the _end symbol in u-boot elf accordingly.







Best Regards.


More information about the U-Boot mailing list