aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/boot
diff options
context:
space:
mode:
authorJonas Gorski <jogo@openwrt.org>2016-06-20 05:27:36 -0400
committerRalf Baechle <ralf@linux-mips.org>2016-08-02 08:00:16 -0400
commitb8f54f2cde788623f41d11327688c75aed34092f (patch)
tree533384a8b26c0d9297911cc403c5fa10765dda15 /arch/mips/boot
parent799778946157283b374559a0640bea22e6821656 (diff)
MIPS: ZBOOT: copy appended dtb to the end of the kernel
Instead of rewriting the arguments, just move the appended dtb to where the decompressed kernel expects it. This eliminates the need for special casing vmlinuz.bin appended dtb files. Signed-off-by: Jonas Gorski <jogo@openwrt.org> Cc: Kevin Cernekee <cernekee@gmail.com> Cc: Florian Fainelli <f.fainelli@gmail.com> Cc: John Crispin <john@phrozen.org> Cc: Paul Burton <paul.burton@imgtec.com> Cc: James Hogan <james.hogan@imgtec.com> Cc: Alban Bedel <albeu@free.fr> Cc: Daniel Gimpelevich <daniel@gimpelevich.san-francisco.ca.us> Cc: Antony Pavlov <antonynpavlov@gmail.com> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/13698/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/boot')
-rw-r--r--arch/mips/boot/compressed/decompress.c17
-rw-r--r--arch/mips/boot/compressed/head.S16
2 files changed, 17 insertions, 16 deletions
diff --git a/arch/mips/boot/compressed/decompress.c b/arch/mips/boot/compressed/decompress.c
index 080cd53bac36..fdf99e9dd4c3 100644
--- a/arch/mips/boot/compressed/decompress.c
+++ b/arch/mips/boot/compressed/decompress.c
@@ -14,6 +14,7 @@
14#include <linux/types.h> 14#include <linux/types.h>
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/string.h> 16#include <linux/string.h>
17#include <linux/libfdt.h>
17 18
18#include <asm/addrspace.h> 19#include <asm/addrspace.h>
19 20
@@ -36,6 +37,8 @@ extern void puthex(unsigned long long val);
36#define puthex(val) do {} while (0) 37#define puthex(val) do {} while (0)
37#endif 38#endif
38 39
40extern char __appended_dtb[];
41
39void error(char *x) 42void error(char *x)
40{ 43{
41 puts("\n\n"); 44 puts("\n\n");
@@ -114,6 +117,20 @@ void decompress_kernel(unsigned long boot_heap_start)
114 __decompress((char *)zimage_start, zimage_size, 0, 0, 117 __decompress((char *)zimage_start, zimage_size, 0, 0,
115 (void *)VMLINUX_LOAD_ADDRESS_ULL, 0, 0, error); 118 (void *)VMLINUX_LOAD_ADDRESS_ULL, 0, 0, error);
116 119
120 if (IS_ENABLED(CONFIG_MIPS_RAW_APPENDED_DTB) &&
121 fdt_magic((void *)&__appended_dtb) == FDT_MAGIC) {
122 unsigned int image_size, dtb_size;
123
124 dtb_size = fdt_totalsize((void *)&__appended_dtb);
125
126 /* last four bytes is always image size in little endian */
127 image_size = le32_to_cpup((void *)&__image_end - 4);
128
129 /* copy dtb to where the booted kernel will expect it */
130 memcpy((void *)VMLINUX_LOAD_ADDRESS_ULL + image_size,
131 __appended_dtb, dtb_size);
132 }
133
117 /* FIXME: should we flush cache here? */ 134 /* FIXME: should we flush cache here? */
118 puts("Now, booting the kernel...\n"); 135 puts("Now, booting the kernel...\n");
119} 136}
diff --git a/arch/mips/boot/compressed/head.S b/arch/mips/boot/compressed/head.S
index c580e853b9fb..409cb483a9ff 100644
--- a/arch/mips/boot/compressed/head.S
+++ b/arch/mips/boot/compressed/head.S
@@ -25,22 +25,6 @@ start:
25 move s2, a2 25 move s2, a2
26 move s3, a3 26 move s3, a3
27 27
28#ifdef CONFIG_MIPS_ZBOOT_APPENDED_DTB
29 PTR_LA t0, __appended_dtb
30#ifdef CONFIG_CPU_BIG_ENDIAN
31 li t1, 0xd00dfeed
32#else
33 li t1, 0xedfe0dd0
34#endif
35 lw t2, (t0)
36 bne t1, t2, not_found
37 nop
38
39 move s1, t0
40 PTR_LI s0, -2
41not_found:
42#endif
43
44 /* Clear BSS */ 28 /* Clear BSS */
45 PTR_LA a0, _edata 29 PTR_LA a0, _edata
46 PTR_LA a2, _end 30 PTR_LA a2, _end