mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 04:33:26 +02:00
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>
This commit is contained in:
committed by
Ralf Baechle
parent
7997789461
commit
b8f54f2cde
@@ -14,6 +14,7 @@
|
||||
#include <linux/types.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/libfdt.h>
|
||||
|
||||
#include <asm/addrspace.h>
|
||||
|
||||
@@ -36,6 +37,8 @@ extern void puthex(unsigned long long val);
|
||||
#define puthex(val) do {} while (0)
|
||||
#endif
|
||||
|
||||
extern char __appended_dtb[];
|
||||
|
||||
void error(char *x)
|
||||
{
|
||||
puts("\n\n");
|
||||
@@ -114,6 +117,20 @@ void decompress_kernel(unsigned long boot_heap_start)
|
||||
__decompress((char *)zimage_start, zimage_size, 0, 0,
|
||||
(void *)VMLINUX_LOAD_ADDRESS_ULL, 0, 0, error);
|
||||
|
||||
if (IS_ENABLED(CONFIG_MIPS_RAW_APPENDED_DTB) &&
|
||||
fdt_magic((void *)&__appended_dtb) == FDT_MAGIC) {
|
||||
unsigned int image_size, dtb_size;
|
||||
|
||||
dtb_size = fdt_totalsize((void *)&__appended_dtb);
|
||||
|
||||
/* last four bytes is always image size in little endian */
|
||||
image_size = le32_to_cpup((void *)&__image_end - 4);
|
||||
|
||||
/* copy dtb to where the booted kernel will expect it */
|
||||
memcpy((void *)VMLINUX_LOAD_ADDRESS_ULL + image_size,
|
||||
__appended_dtb, dtb_size);
|
||||
}
|
||||
|
||||
/* FIXME: should we flush cache here? */
|
||||
puts("Now, booting the kernel...\n");
|
||||
}
|
||||
|
Reference in New Issue
Block a user