Hi,

I want to make High Assurance Boot (HAB) for the Freescale i.MX28 with U-Boot 04/2012 work. To do that I have to link an Image Vector Table (IVT, consists of some boot image addresses which I insert by using linker symbols in the C-code) to the u-boot binary. My problem is, that the linker symbols are not inserted into the binary correctly (they always have the value 0).

Here is my code - I include the following to board/denx/m28evk/m28evk.c

/*IVT DEFINITION */
#define BASE_ADDRESS 0x00000100
extern unsigned int __hab_uboot_data; // defined in u-boot.lds
extern int __hab_uboot_end;           // defined in u-boot.lds
extern void* _start;
struct my_ivt {                       // IVT structur according to
    uint32_t header;                  // some Freescale manuals
    uint32_t *entry;
    uint32_t reserved1;
    uint32_t *dcd;
    uint32_t *boot_data;
    uint32_t *self;
    uint32_t *csf;
    uint32_t reserved2;
    uint32_t img_len;
};
const struct my_ivt input_ivt __attribute__((section(".ivt"),aligned(4))) = {
    0x402000d1                       //header
    (uint32_t*) (&_start),           //entry
    0,                               //reserved
    NULL,                            //DCD
    NULL,                            //boot data
    (uint32_t*) (&input_ivt),        //IVT address
    (uint32_t*) (&__hab_uboot_data), //CSF
    0,                               //reserved
    (uint32_t) (&__hab_uboot_end) - BASE_ADDRESS   //image length
};
/*END OF IVT DEFINITION*/

and I modify the linker file (arch/arm/cpu/u-boot.lds)

/*INSERTED RIGHT BEFORE THE BSS SECTION */
  . = ALIGN(4);
  __uboot_ivt = .;
  .ivt : { *(.ivt) }
  __hab_uboot_data = .;
  . = . + 0x2000;
  __hab_uboot_end = .;

With this code, the IVT should be written to the end of u-boot.bin. When looking at it with a hex-Editor I do see the IVT (e.g. the hard-coded header is there - in little-endian), but the values for the linker symbols (e.g. __hab_uboot_data) are 0.
D1002040 00010040 00000000 00000000
00000000 00900640 00000000 00000000
00FFFFFF

However, I think that the linker symbols are correctly included in the C-source, because the compiler does not complain that he cannot find the extern __hab_uboot_data variable and in all the forums/tutorials I googled I found the syntax I use. Also if I put
  printf("HAB-DEBUG: %x \n",(uint32_t)(&__hab_uboot_end));
somewhere in the code (e.g. into the board_init() in m28evk.c), I do get an address which is not 0 (although it is also not the address I expect – I get the expected address + the U-Boot relocation offset)

I appreciate any kind of help very much!

Best regards,
Christopher
_______________________________________________
U-Boot mailing list
[email protected]
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to