Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions elfloader-tool/src/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,9 @@ int load_images(
return -1;
}

/* Reserve space for the kernel, keep next start address page aligned. */
next_phys_addr = ROUND_UP(kernel_phys_end, PAGE_BITS);

void const *dtb = NULL;

#ifdef CONFIG_ELFLOADER_INCLUDE_DTB
Expand Down Expand Up @@ -467,9 +470,7 @@ int load_images(
* Move the DTB out of the way, if it's present.
*/
if (dtb) {
/* keep it page aligned */
next_phys_addr = dtb_phys_start = ROUND_UP(kernel_phys_end, PAGE_BITS);

dtb_phys_start = next_phys_addr;
size_t dtb_size = fdt_size(dtb);
if (0 == dtb_size) {
printf("ERROR: Invalid device tree blob supplied\n");
Expand All @@ -493,8 +494,6 @@ int load_images(
printf(" paddr=[%p..%p]\n", dtb_phys_start, dtb_phys_end - 1);
*chosen_dtb = (void *)dtb_phys_start;
*chosen_dtb_size = dtb_size;
} else {
next_phys_addr = ROUND_UP(kernel_phys_end, PAGE_BITS);
}

/* Load the kernel */
Expand Down