addpkg(main/mkbootimg): add mkbootimg and unpackbootimg

From repo maintained by osm0sis.
This commit is contained in:
Henrik Grimler 2022-07-12 22:44:33 +02:00
parent 77e092ac3e
commit f1f9cb75a3
No known key found for this signature in database
GPG Key ID: B0076E490B71616B
3 changed files with 56 additions and 0 deletions

View File

@ -0,0 +1,9 @@
--- ./Makefile.orig 2022-07-12 22:39:50.910860490 +0200
+++ ./Makefile 2022-07-12 22:40:55.774137149 +0200
@@ -49,3 +49,6 @@
$(RM) *.a *.~ *.exe *.o
$(MAKE) -C libmincrypt clean
+install: mkbootimg unpackbootimg
+ install -m700 mkbootimg $(DESTDIR)$(PREFIX)/bin/
+ install -m700 unpackbootimg $(DESTDIR)$(PREFIX)/bin/

View File

@ -0,0 +1,9 @@
TERMUX_PKG_HOMEPAGE=https://github.com/osm0sis/mkbootimg
TERMUX_PKG_DESCRIPTION="Maintained fork with android's mkbootimg and unpackbootimg"
TERMUX_PKG_LICENSE="BSD 3-Clause"
TERMUX_PKG_LICENSE_FILE="NOTICE"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=2021.08.06
TERMUX_PKG_SRCURL=https://github.com/osm0sis/mkbootimg/archive/refs/tags/${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=ce754bf13ceeac7f12581862c07ee5ad80b9648e464dca698dd4569bac088659
TERMUX_PKG_BUILD_IN_SRC=true

View File

@ -0,0 +1,38 @@
--- ./unpackbootimg.c.orig 2022-07-12 22:50:11.666837511 +0200
+++ ./unpackbootimg.c 2022-07-12 22:51:03.806772364 +0200
@@ -191,7 +191,7 @@
fseek(f, i, SEEK_SET);
if(fread(&header, sizeof(header), 1, f)) {};
- if(magic == BOOT_MAGIC) {
+ if(strncmp(magic, BOOT_MAGIC, BOOT_MAGIC_SIZE) == 0) {
if((header.header_version < 3) || (header.header_version > hdr_ver_max)) {
// boot_img_hdr_v2 in the backported header supports all boot_img_hdr versions and cross-compatible variants below 3
@@ -298,7 +298,7 @@
write_string_to_file("hashtype", hash_type);
total_read += sizeof(header);
- if(debug > 1) fprintf(stderr, "read: %ld\n", sizeof(header)); // this will harmlessly always show 1660 since it uses boot_img_hdr_v2 for all < v3
+ if(debug > 1) fprintf(stderr, "read: %ld\n", (long)sizeof(header)); // this will harmlessly always show 1660 since it uses boot_img_hdr_v2 for all < v3
total_read += read_padding(f, sizeof(header));
write_buffer_to_file("kernel", f, header.kernel_size);
@@ -350,7 +350,7 @@
write_string_to_file("header_version", hdrvertmp);
total_read += sizeof(header);
- if(debug > 1) fprintf(stderr, "read: %ld\n", sizeof(header));
+ if(debug > 1) fprintf(stderr, "read: %ld\n", (long)sizeof(header));
total_read += read_padding(f, sizeof(header));
write_buffer_to_file("kernel", f, header.kernel_size);
@@ -417,7 +417,7 @@
write_string_to_file("dtb_offset", dtbofftmp);
total_read += sizeof(header);
- if(debug > 1) fprintf(stderr, "read: %ld\n", sizeof(header));
+ if(debug > 1) fprintf(stderr, "read: %ld\n", (long)sizeof(header));
total_read += read_padding(f, sizeof(header));
write_buffer_to_file("vendor_ramdisk", f, header.vendor_ramdisk_size);