2017-03-01 21:12:47 +01:00
|
|
|
#ifndef _MAGISKBOOT_H_
|
|
|
|
#define _MAGISKBOOT_H_
|
2017-02-27 22:37:47 +01:00
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
2018-10-20 05:10:47 +02:00
|
|
|
#include "format.h"
|
2017-02-27 22:37:47 +01:00
|
|
|
|
2017-04-28 15:48:38 +02:00
|
|
|
#define KERNEL_FILE "kernel"
|
|
|
|
#define RAMDISK_FILE "ramdisk.cpio"
|
|
|
|
#define SECOND_FILE "second"
|
2017-10-07 16:08:10 +02:00
|
|
|
#define EXTRA_FILE "extra"
|
2017-04-28 15:48:38 +02:00
|
|
|
#define DTB_FILE "dtb"
|
2018-10-20 05:10:47 +02:00
|
|
|
#define RECV_DTBO_FILE "recovery_dtbo"
|
2017-04-28 15:48:38 +02:00
|
|
|
#define NEW_BOOT "new-boot.img"
|
2017-03-04 18:50:36 +01:00
|
|
|
|
2017-02-27 22:37:47 +01:00
|
|
|
// Main entries
|
2018-01-28 19:44:30 +01:00
|
|
|
int unpack(const char *image);
|
2017-03-07 17:54:23 +01:00
|
|
|
void repack(const char* orig_image, const char* out_image);
|
2017-03-04 14:16:59 +01:00
|
|
|
void hexpatch(const char *image, const char *from, const char *to);
|
2017-12-20 20:36:18 +01:00
|
|
|
int cpio_commands(int argc, char *argv[]);
|
2018-10-25 03:08:06 +02:00
|
|
|
void compress(const char *method, const char *from, const char *to);
|
|
|
|
void decompress(char *from, const char *to);
|
2017-11-10 18:30:33 +01:00
|
|
|
int dtb_commands(const char *cmd, int argc, char *argv[]);
|
2017-02-27 22:37:47 +01:00
|
|
|
|
|
|
|
// Compressions
|
2017-09-12 11:00:45 +02:00
|
|
|
size_t gzip(int mode, int fd, const void *buf, size_t size);
|
|
|
|
size_t lzma(int mode, int fd, const void *buf, size_t size);
|
2018-10-25 03:08:06 +02:00
|
|
|
size_t lz4(int mode, int fd, const uint8_t *buf, size_t size);
|
2017-09-12 11:00:45 +02:00
|
|
|
size_t bzip2(int mode, int fd, const void *buf, size_t size);
|
2018-10-25 03:08:06 +02:00
|
|
|
size_t lz4_legacy(int mode, int fd, const uint8_t *buf, size_t size);
|
|
|
|
long long compress(format_t type, int fd, const void *from, size_t size);
|
|
|
|
long long decompress(format_t type, int fd, const void *from, size_t size);
|
2017-03-04 14:16:59 +01:00
|
|
|
|
2018-08-09 18:40:23 +02:00
|
|
|
// Pattern
|
|
|
|
int patch_verity(void **buf, uint32_t *size, int patch);
|
|
|
|
void patch_encryption(void **buf, uint32_t *size);
|
|
|
|
|
2017-02-27 22:37:47 +01:00
|
|
|
#endif
|