diff --git a/util/grub-mkimagexx.c b/util/grub-mkimagexx.c index a79034e7b..470fbf4dd 100644 --- a/util/grub-mkimagexx.c +++ b/util/grub-mkimagexx.c @@ -2197,6 +2197,21 @@ SUFFIX (locate_sections) (Elf_Ehdr *e, const char *kernel_path, } } +#ifdef MKIMAGE_ELF32 + if (image_target->elf_target == EM_ARM) + { + grub_size_t tramp; + + layout->kernel_size = ALIGN_UP (layout->kernel_size, 16); + + tramp = arm_get_trampoline_size (e, smd->sections, smd->section_entsize, + smd->num_sections, image_target); + + layout->tramp_off = layout->kernel_size; + layout->kernel_size += ALIGN_UP (tramp, 16); + } +#endif + layout->kernel_size = ALIGN_UP (layout->kernel_size + image_target->vaddr_offset, image_target->section_align) - image_target->vaddr_offset; @@ -2210,23 +2225,6 @@ SUFFIX (locate_sections) (Elf_Ehdr *e, const char *kernel_path, layout->kernel_size = SUFFIX (put_section) (s, i, layout->kernel_size, smd, image_target); -#ifdef MKIMAGE_ELF32 - if (image_target->elf_target == EM_ARM) - { - grub_size_t tramp; - layout->kernel_size = ALIGN_UP (layout->kernel_size + image_target->vaddr_offset, - image_target->section_align) - image_target->vaddr_offset; - - layout->kernel_size = ALIGN_UP (layout->kernel_size, 16); - - tramp = arm_get_trampoline_size (e, smd->sections, smd->section_entsize, - smd->num_sections, image_target); - - layout->tramp_off = layout->kernel_size; - layout->kernel_size += ALIGN_UP (tramp, 16); - } -#endif - layout->bss_start = layout->kernel_size; layout->end = layout->kernel_size;