Commit 6b41653a authored by topjohnwu's avatar topjohnwu

Add kernel decompression and appended dtb support

parent 59c1125e
This diff is collapsed.
...@@ -2,20 +2,21 @@ ...@@ -2,20 +2,21 @@
** **
** Copyright 2007, The Android Open Source Project ** Copyright 2007, The Android Open Source Project
** **
** Licensed under the Apache License, Version 2.0 (the "License"); ** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License. ** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at ** You may obtain a copy of the License at
** **
** http://www.apache.org/licenses/LICENSE-2.0 ** http://www.apache.org/licenses/LICENSE-2.0
** **
** Unless required by applicable law or agreed to in writing, software ** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS, ** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and ** See the License for the specific language governing permissions and
** limitations under the License. ** limitations under the License.
*/ */
#include <stdint.h> #include <stdint.h>
#include "magic.h"
#ifndef _BOOT_IMAGE_H_ #ifndef _BOOT_IMAGE_H_
#define _BOOT_IMAGE_H_ #define _BOOT_IMAGE_H_
...@@ -64,12 +65,12 @@ struct boot_img_hdr ...@@ -64,12 +65,12 @@ struct boot_img_hdr
} __attribute__((packed)); } __attribute__((packed));
/* /*
** +-----------------+ ** +-----------------+
** | boot header | 1 page ** | boot header | 1 page
** +-----------------+ ** +-----------------+
** | kernel | n pages ** | kernel | n pages
** +-----------------+ ** +-----------------+
** | ramdisk | m pages ** | ramdisk | m pages
** +-----------------+ ** +-----------------+
** | second stage | o pages ** | second stage | o pages
** +-----------------+ ** +-----------------+
...@@ -99,4 +100,21 @@ typedef struct mtk_hdr { ...@@ -99,4 +100,21 @@ typedef struct mtk_hdr {
uint8_t name[32]; /* The type of the header */ uint8_t name[32]; /* The type of the header */
} mtk_hdr; } mtk_hdr;
// Flags
#define MTK_KERNEL 0x1
#define MTK_RAMDISK 0x2
#define APPEND_DTB 0x4
typedef struct boot_img {
boot_img_hdr hdr;
void *kernel;
void *ramdisk;
void *second;
void *dtb;
void *extra;
int flags;
file_t kernel_type, ramdisk_type;
mtk_hdr mtk_kernel_hdr, mtk_ramdisk_hdr;
} boot_img;
#endif #endif
...@@ -35,7 +35,7 @@ extern file_t SUP_TYPE_LIST[]; ...@@ -35,7 +35,7 @@ extern file_t SUP_TYPE_LIST[];
void unpack(const char *image); void unpack(const char *image);
void repack(const char* orig_image, const char* out_image); void repack(const char* orig_image, const char* out_image);
void hexpatch(const char *image, const char *from, const char *to); void hexpatch(const char *image, const char *from, const char *to);
int parse_img(void *orig, size_t size); int parse_img(void *orig, size_t size, boot_img *boot);
int cpio_commands(const char *command, int argc, char *argv[]); int cpio_commands(const char *command, int argc, char *argv[]);
void comp_file(const char *method, const char *from, const char *to); void comp_file(const char *method, const char *from, const char *to);
void decomp_file(char *from, const char *to); void decomp_file(char *from, const char *to);
......
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