From a8c48ea7b788d88e57762c564ace4cbe14bb55ed Mon Sep 17 00:00:00 2001 From: Ido Yariv Date: Mon, 4 Jan 2016 14:59:09 -0500 Subject: [PATCH] Workaround QEMU's multiboot loading issue When QEMU loads a multiboot image based on the ELF headers, it calculates the total memory size subtracting the minimum address from the maximum address in the program header. While the IDT section is removed from the ELF, an empty segment in the program header is still kept at IDT_LIST base address. Since the IDT segment isn't contiguous with the loadable code segment, QEMU is tricked into thinking the total memory size is larger than it really is. To workaround this, change the address of the IDT section to the address of the text section. This will make objcopy remove the extra segment entirely when the IDT section is removed. This could have been fixed in QEMU since this isn't a bug in Zephyr per-se, but it will be easier to avoid specific QEMU versions requirements. Change-Id: I062b7d0fb8fccfe4d0d0b4cb0afc4667bbb7f7dd Signed-off-by: Ido Yariv Signed-off-by: Anas Nashif Signed-off-by: Ido Yariv --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 1de359f9488..091bb0b82ce 100644 --- a/Makefile +++ b/Makefile @@ -802,7 +802,7 @@ quiet_cmd_lnk_elf = LINK $@ ( \ $(LD) -T final-linker.cmd @$(KERNEL_NAME).lnk staticIdt.o int_vector_alloc.o \ irq_int_vector_map.o -o $@; \ - $(OBJCOPY) --set-section-flags intList=noload $@ elf.tmp; \ + ${OBJCOPY} --change-section-address intList=${CONFIG_PHYS_LOAD_ADDR} $@ elf.tmp;\ $(OBJCOPY) -R intList elf.tmp $@; \ rm elf.tmp \ )