efi: Generalize relocate_kernel() for use by other architectures.
[firefly-linux-kernel-4.4.55.git] / arch / x86 / boot / compressed / eboot.c
index 5bbba868e2bce8576bffa55e84f60ad5a3c28c31..2e997b6fbdb172acd4f8ea0d91735271c5fc480b 100644 (file)
@@ -733,10 +733,16 @@ struct boot_params *efi_main(void *handle, efi_system_table_t *_table,
         * address, relocate it.
         */
        if (hdr->pref_address != hdr->code32_start) {
-               status = relocate_kernel(hdr);
-
+               unsigned long bzimage_addr = hdr->code32_start;
+               status = efi_relocate_kernel(sys_table, &bzimage_addr,
+                                            hdr->init_size, hdr->init_size,
+                                            hdr->pref_address,
+                                            hdr->kernel_alignment);
                if (status != EFI_SUCCESS)
                        goto fail;
+
+               hdr->pref_address = hdr->code32_start;
+               hdr->code32_start = bzimage_addr;
        }
 
        status = exit_boot(boot_params, handle);