Fix MTK header support

This commit is contained in:
topjohnwu 2017-03-29 04:30:51 +08:00
parent 5aced279d6
commit 81542fc6a8
2 changed files with 4 additions and 3 deletions

View File

@ -16,9 +16,10 @@ static void check_headers() {
printf("MTK header found in kernel\n");
mtk_kernel = 1;
}
if (check_type(ramdisk) == MTK) {
if (ramdisk_type == MTK) {
printf("MTK header found in ramdisk\n");
mtk_ramdisk = 1;
ramdisk_type = check_type(ramdisk + 512);
}
// Check dtb if ELF boot

View File

@ -53,7 +53,7 @@ void repack(const char* orig_image, const char* out_image) {
// Restore kernel
if (mtk_kernel) {
mtk_kernel_off = lseek(fd, 0, SEEK_CUR);
write_zero(fd, 512);
restore_buf(fd, kernel, 512);
memcpy(&mtk_kernel_hdr, kernel, sizeof(mtk_kernel_hdr));
}
hdr.kernel_size = restore(KERNEL_FILE, fd);
@ -62,7 +62,7 @@ void repack(const char* orig_image, const char* out_image) {
// Restore ramdisk
if (mtk_ramdisk) {
mtk_ramdisk_off = lseek(fd, 0, SEEK_CUR);
write_zero(fd, 512);
restore_buf(fd, ramdisk, 512);
memcpy(&mtk_ramdisk_hdr, ramdisk, sizeof(mtk_ramdisk_hdr));
}
if (access(RAMDISK_FILE, R_OK) == 0) {