No kernel repack if it isn't patched at all

It turns out that decompressing and recompressing the kernel is enough to break booting on many devices that use MT6763.
Fix #5124, fix #6204, fix #6566 

Co-authored-by: LoveSy <shana@zju.edu.cn>
Co-authored-by: 南宫雪珊 <vvb2060@gmail.com>
This commit is contained in:
残页
2023-02-18 07:00:14 +08:00
committed by GitHub
parent 79a85f5937
commit ae34659b26
2 changed files with 17 additions and 6 deletions

View File

@ -601,6 +601,9 @@ void repack(const char *src_img, const char *out_img, bool skip_comp) {
// zImage size shall remain the same
hdr->kernel_size() = boot.hdr->kernel_size();
}
} else if (boot.hdr->kernel_size() != 0) {
xwrite(fd, boot.kernel, boot.hdr->kernel_size());
hdr->kernel_size() = boot.hdr->kernel_size();
}
if (boot.flags[ZIMAGE_KERNEL]) {
// Copy zImage tail and adjust size accordingly