hv: add multiboot2 tags to load relocatable raw binary

GRUB multiboot2 doesn't support relocation for ELF, which means it can't
load acrn.32.out to other address other than the one specified in ELF
header. Thus we need to use the raw binary file acrn.bin, and add
address/entry address/relocatable tags to instruct multiboot2 loader
how to load the raw binary.

Tracked-On: #4441
Reviewed-by: Fengwei Yin <fengwei.yin@intel.com>
Signed-off-by: Zide Chen <zide.chen@intel.com>
This commit is contained in:
Chen, Zide
2020-03-02 18:16:49 +00:00
committed by wenlingz
parent 97fc0efe20
commit 2aa8c9e5d4
3 changed files with 58 additions and 6 deletions

View File

@@ -53,7 +53,16 @@ static inline bool boot_from_multiboot1(void)
#ifdef CONFIG_MULTIBOOT2
static inline bool boot_from_multiboot2(void)
{
return ((boot_regs[0] == MULTIBOOT2_INFO_MAGIC) && (boot_regs[1] != 0U));
/*
* Multiboot spec states that the Multiboot information structure may be placed
* anywhere in memory by the boot loader.
*
* Seems both SBL and GRUB won't place multiboot1 MBI structure at 0 address,
* but GRUB could place Multiboot2 MBI structure at 0 address until commit
* 0f3f5b7c13fa9b67 ("multiboot2: Set min address for mbi allocation to 0x1000")
* which dates on Dec 26 2019.
*/
return (boot_regs[0] == MULTIBOOT2_INFO_MAGIC);
}
int32_t multiboot2_to_acrn_mbi(struct acrn_multiboot_info *mbi, void *mb2_info);