mirror of
https://github.com/anestisb/android-unpackbootimg.git
synced 2024-05-16 03:59:33 +00:00
commit
813a5e9a5a
2
Makefile
2
Makefile
|
@ -4,7 +4,7 @@ DEP_CC ?= gcc
|
|||
AR ?= ar
|
||||
RANLIB ?= ranlib
|
||||
STRIP ?= strip
|
||||
CFLAGS += -O2 -Wall -Werror -Wno-address-of-packed-member
|
||||
CFLAGS += -O2 -Wall -Werror -Wno-error=maybe-uninitialized -Wno-error=address-of-packed-member
|
||||
LDFLAGS +=
|
||||
|
||||
# libmincrypt
|
||||
|
|
|
@ -31,12 +31,22 @@ int read_padding(FILE* f, unsigned itemsize, int pagesize)
|
|||
return count;
|
||||
}
|
||||
|
||||
void write_string_to_file(const char* file, const char* string)
|
||||
int write_string_to_file(const char* file, const char* string)
|
||||
{
|
||||
// Try to create a directory first.
|
||||
char* fcopy = strdup(file);
|
||||
mkdir(dirname(fcopy), 0777);
|
||||
free(fcopy);
|
||||
|
||||
FILE* f = fopen(file, "w");
|
||||
if (!f) {
|
||||
printf("File %s can't be opened.\n", file);
|
||||
return 1;
|
||||
}
|
||||
fwrite(string, strlen(string), 1, f);
|
||||
fwrite("\n", 1, 1, f);
|
||||
fclose(f);
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char *detect_hash_type(const struct boot_img_hdr *hdr)
|
||||
|
@ -100,6 +110,10 @@ int main(int argc, char** argv)
|
|||
|
||||
int total_read = 0;
|
||||
FILE* f = fopen(filename, "rb");
|
||||
if (!f) {
|
||||
printf("Input file not found.\n");
|
||||
return 1;
|
||||
}
|
||||
boot_img_hdr header;
|
||||
|
||||
//printf("Reading header...\n");
|
||||
|
|
Loading…
Reference in New Issue
Block a user