mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-10-19 06:05:17 +00:00
Add compress, decompress, cleanup command
This commit is contained in:
@@ -28,6 +28,10 @@
|
||||
#define RAMDISK_FILE "ramdisk.cpio"
|
||||
#define SECOND_FILE "second"
|
||||
#define DTB_FILE "dtb"
|
||||
#define NEW_BOOT "new-boot.img"
|
||||
|
||||
#define SUP_LIST "gzip, xz, lzma, lz4, bzip2"
|
||||
#define SUP_NUM 5
|
||||
|
||||
typedef enum {
|
||||
UNKNOWN,
|
||||
@@ -44,6 +48,12 @@ typedef enum {
|
||||
QCDT,
|
||||
} file_t;
|
||||
|
||||
extern char *SUP_EXT_LIST[SUP_NUM];
|
||||
extern file_t SUP_TYPE_LIST[SUP_NUM];
|
||||
// Cannot declare in header, but place a copy here for convenience
|
||||
// char *SUP_EXT_LIST[SUP_NUM] = { "gz", "xz", "lzma", "bz2", "lz4" };
|
||||
// file_t SUP_TYPE_LIST[SUP_NUM] = { GZIP, XZ, LZMA, BZIP2, LZ4 };
|
||||
|
||||
// Global variables
|
||||
extern unsigned char *kernel, *ramdisk, *second, *dtb;
|
||||
extern boot_img_hdr hdr;
|
||||
@@ -57,6 +67,7 @@ void hexpatch(const char *image, const char *from, const char *to);
|
||||
void cpio(const char *filename);
|
||||
void error(int rc, const char *msg, ...);
|
||||
void parse_img(unsigned char *orig, size_t size);
|
||||
void cleanup();
|
||||
|
||||
// Compressions
|
||||
void gzip(int mode, const char* filename, const unsigned char* buf, size_t size);
|
||||
@@ -64,7 +75,9 @@ void lzma(int mode, const char* filename, const unsigned char* buf, size_t size)
|
||||
void lz4(int mode, const char* filename, const unsigned char* buf, size_t size);
|
||||
void bzip2(int mode, const char* filename, const unsigned char* buf, size_t size);
|
||||
int comp(file_t type, const char *to, const unsigned char *from, size_t size);
|
||||
void comp_file(const char *method, const char *from);
|
||||
int decomp(file_t type, const char *to, const unsigned char *from, size_t size);
|
||||
void decomp_file(char *from);
|
||||
|
||||
// Utils
|
||||
void mmap_ro(const char *filename, unsigned char **buf, size_t *size);
|
||||
@@ -73,5 +86,6 @@ file_t check_type(const unsigned char *buf);
|
||||
void mem_align(size_t *pos, size_t align);
|
||||
void file_align(int fd, size_t align);
|
||||
int open_new(const char *filename);
|
||||
void print_info();
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user