Commit 81542fc6 authored by topjohnwu's avatar topjohnwu

Fix MTK header support

parent 5aced279
......@@ -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
......
......@@ -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) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment