ARM:boot:device tree: Allow the device tree binary to be appended to zImage
PATCH v2 1/1 ARM:boot:device tree: Allow the device tree binary to be appended to zImage
This patch provides the ability to boot using a device tree that is appended to the raw binary zImage (e.g. cat zImage <filename>.dtb > zImage_w_dtb).
---
arch/arm/Kconfig | 7 ++++ arch/arm/boot/compressed/head.S | 78 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 82 insertions(+), 3 deletions(-)
arch/arm/Kconfig +7 -0
@@ -1651,6 +1651,13 @@ config ZBOOT_ROM Say Y here if you intend to execute your compressed kernel image (zImage) directly from ROM or flash. If unsure, say N. +config ARM_APPENDED_DTB + bool "Use appended device tree blob" + depends on OF && !ZBOOT_ROM + help + With this option, the boot code will look for a device tree binary + (dtb) appended to zImage. + config CMDLINE string "Default kernel command string" default ""
arch/arm/boot/compressed/head.S +75 -3
101 lines not on this page · raw message
PATCH v2 1/1 ARM:boot:device tree: Allow the device tree binary to be appended to zImage
Quoted 4 lines · John Bonesio
This patch provides the ability to boot using a device tree that is appended to the raw binary zImage (e.g. cat zImage <filename>.dtb >
zImage_w_dtb).Signed-off-by John Bonesio <[email protected]>
One minor glitch still... ;-)
arch/arm/boot/compressed/head.S wont_overwrite: · line 353
Quoted 13 lines
arch/arm/boot/compressed/head.S +5
-2@@ -288,12 +344,28 @@ wont_overwrite: /* * Relocate all entries in the GOT table. + * Bump bss entries to _edata + dtb size */ 1: ldr r1, [r11, #0] @ relocate entries in the GOT - add r1, r1, r0 @ table. This fixes up the - str r1, [r11], #4 @ C references. + add r1, r1, r0 @ This fixes up C references + cmp r1, r2 @ if entry >= bss_start && + cmphs r3, r1 @ bss_end > entry + addhi r1, lr @ entry += dtb size
Some toolchains won't accept this shortened version unless you compile for Thumb. You should instead use:
addhi r1, r1, lr
Otherwise...
Nicolas
PATCH v2 1/1 ARM:boot:device tree: Allow the device tree binary to be appended to zImage
Hi Nicolas,
Is this addhi instruction the only one, or do I need to go through and find other instructions to update as well?
Thanks for being patient as I learn.
- John
Quoted 34 lines · Nicolas Pitre
Quoted 4 lines · John Bonesio
This patch provides the ability to boot using a device tree that is appended to the raw binary zImage (e.g. cat zImage <filename>.dtb >
zImage_w_dtb).Signed-off-by John Bonesio <[email protected]>One minor glitch still... ;-)
arch/arm/boot/compressed/head.S wont_overwrite: · line 353
Quoted 13 lines
arch/arm/boot/compressed/head.S +5
-2@@ -288,12 +344,28 @@ wont_overwrite: /* * Relocate all entries in the GOT table. + * Bump bss entries to _edata + dtb size */ 1: ldr r1, [r11, #0] @ relocate entries in the GOT - add r1, r1, r0 @ table. This fixes up the - str r1, [r11], #4 @ C references. + add r1, r1, r0 @ This fixes up C references + cmp r1, r2 @ if entry >= bss_start && + cmphs r3, r1 @ bss_end > entry + addhi r1, lr @ entry += dtb sizeSome toolchains won't accept this shortened version unless you compile for Thumb. You should instead use:
addhi r1, r1, lrOtherwise...
Reviewed-by Nicolas Pitre <[email protected]>Nicolas
PATCH v2 1/1 ARM:boot:device tree: Allow the device tree binary to be appended to zImage
Quoted 4 lines · John Bonesio
Hi Nicolas,
Is this addhi instruction the only one, or do I need to go through and find other instructions to update as well?
That was the only one I noticed.
Nicolas