diff options
Diffstat (limited to 'arch/mips/boot/compressed/decompress.c')
-rw-r--r-- | arch/mips/boot/compressed/decompress.c | 17 |
1 files changed, 17 insertions, 0 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 | ||
40 | extern char __appended_dtb[]; | ||
41 | |||
39 | void error(char *x) | 42 | void 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 | } |