From 0b3192c4d559d5310597922afd65da737b748629 Mon Sep 17 00:00:00 2001 From: Shaka Huang Date: Mon, 26 Feb 2018 22:53:04 +0800 Subject: [PATCH] Check dtb even if kernel is not available MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit By the flow of unpacking boot image of Chrome OS there will be no kernel file but an dtb image. In that case the dtb image won’t be added when repacking boot image. Signed-off-by: Shaka Huang --- native/jni/magiskboot/bootimg.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/native/jni/magiskboot/bootimg.c b/native/jni/magiskboot/bootimg.c index c0bdbfd82..6a2dad7da 100644 --- a/native/jni/magiskboot/bootimg.c +++ b/native/jni/magiskboot/bootimg.c @@ -320,13 +320,14 @@ void repack(const char* orig_image, const char* out_image) { } else { lheader(&boot, kernel_size, = restore(KERNEL_FILE, fd)); } - // dtb - if (access(DTB_FILE, R_OK) == 0) { - lheader(&boot, kernel_size, += restore(DTB_FILE, fd)); - } - file_align(); } + // dtb + if (access(DTB_FILE, R_OK) == 0) { + lheader(&boot, kernel_size, += restore(DTB_FILE, fd)); + } + file_align(); + // ramdisk ramdisk_off = lseek(fd, 0, SEEK_CUR); if (boot.flags & MTK_RAMDISK) {