From f1f2f9edf8d4c5294e30f20546c5177ab59e53a2 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Brucker Date: Fri, 1 Feb 2019 15:50:28 +0000 Subject: arm64: wipe old initrd addresses when patching the DTB When copying the DTB from the current kernel, if the user didn't pass an initrd on the command-line, make sure that the new DTB doesn't contain initrd properties with stale addresses. Otherwise the next kernel will try to unpack the initramfs from a location that contains junk, since the initial initrd is long gone: [ 49.370026] Initramfs unpacking failed: junk in compressed archive This issue used to be hidden by a successful recovery, but since commit ff1522bb7d98 ("initramfs: cleanup incomplete rootfs") in Linux, the kernel removes the default /root mountpoint after failing to load an initramfs, and cannot mount the rootfs passed on the command-line anymore. Signed-off-by: Jean-Philippe Brucker Signed-off-by: Simon Horman --- kexec/arch/arm64/kexec-arm64.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'kexec/arch/arm64/kexec-arm64.c') diff --git a/kexec/arch/arm64/kexec-arm64.c b/kexec/arch/arm64/kexec-arm64.c index 1cde75d..2992bce 100644 --- a/kexec/arch/arm64/kexec-arm64.c +++ b/kexec/arch/arm64/kexec-arm64.c @@ -713,6 +713,11 @@ int arm64_load_other_segments(struct kexec_info *info, } } + if (!initrd_buf) { + /* Don't reuse the initrd addresses from 1st DTB */ + dtb_clear_initrd((char **)&dtb.buf, &dtb.size); + } + /* Check size limit as specified in booting.txt. */ if (dtb.size > MiB(2)) { -- cgit