@@ -22,12 +22,22 @@ efi_status_t handle_kernel_image(unsigned long *image_addr,
efi_handle_t image_handle)
{
efi_status_t status;
- unsigned long kernel_addr = 0;
+ unsigned long kernel_addr = 0, tmp_addr = 0;
kernel_addr = (unsigned long)&kernel_offset - kernel_offset;
+ /*
+ * Allocate 2M space at 0x200000(EFI_KIMG_PREFERRED_ADDRESS) for
+ * test, this will lead to the kernel be loaded at 0x4000000.
+ */
+ status = efi_relocate_kernel(&tmp_addr, 0x100000, 0x200000,
+ EFI_KIMG_PREFERRED_ADDRESS, efi_get_kimg_min_align(), 0x0);
+ efi_info("@@@[%s] tmp_addr: 0x%lx\n", __func__, tmp_addr);
+
+ /* kernel_addr == 0x400000 */
status = efi_relocate_kernel(&kernel_addr, kernel_fsize, kernel_asize,
EFI_KIMG_PREFERRED_ADDRESS, efi_get_kimg_min_align(), 0x0);
+ efi_info("@@@[%s] kernel_addr: 0x%lx\n", __func__, kernel_addr);
*image_addr = kernel_addr;
*image_size = kernel_asize;