Commit 55e7cff4 authored by Russell King's avatar Russell King

ARM: verify size of zImage

The linker can sometimes add additional sections to the zImage ELF file
which results in the zImage binary being larger than expected.  This
causes appended DT blobs to fail.

Verify that the zImage binary is the expected size, and fail the build
if this is not the case.

We need to include the .data.rel.ro section in the image as the RiscPC
build includes font data that contains a small amount of data in this
section.
Tested-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
Tested-by: default avatarGregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
parent 4fbd8d19
...@@ -56,6 +56,7 @@ SECTIONS ...@@ -56,6 +56,7 @@ SECTIONS
.rodata : { .rodata : {
*(.rodata) *(.rodata)
*(.rodata.*) *(.rodata.*)
*(.data.rel.ro)
} }
.piggydata : { .piggydata : {
*(.piggydata) *(.piggydata)
...@@ -101,6 +102,12 @@ SECTIONS ...@@ -101,6 +102,12 @@ SECTIONS
* this symbol allows further debug in the near future. * this symbol allows further debug in the near future.
*/ */
.image_end (NOLOAD) : { .image_end (NOLOAD) : {
/*
* EFI requires that the image is aligned to 512 bytes, and appended
* DTB requires that we know where the end of the image is. Ensure
* that both are satisfied by ensuring that there are no additional
* sections emitted into the decompressor image.
*/
_edata_real = .; _edata_real = .;
} }
...@@ -128,3 +135,4 @@ SECTIONS ...@@ -128,3 +135,4 @@ SECTIONS
.stab.indexstr 0 : { *(.stab.indexstr) } .stab.indexstr 0 : { *(.stab.indexstr) }
.comment 0 : { *(.comment) } .comment 0 : { *(.comment) }
} }
ASSERT(_edata_real == _edata, "error: zImage file size is incorrect");
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment