From d2882131f467bd7b469c1f68f32f5a0fedfdaa0d Mon Sep 17 00:00:00 2001 From: Henrik Grimler Date: Thu, 27 Oct 2022 20:57:00 +0200 Subject: [PATCH] newpkg(main/abootimg) Requested in termux/termux-packages#12567. --- ...001-fixed-silly-warnings-due-to-Wall.patch | 60 +++++++++++++++++++ ...ck-initrd-to-abootimg-un-pack-initrd.patch | 39 ++++++++++++ .../abootimg/0003-Fix-man-page-typos.patch | 47 +++++++++++++++ packages/abootimg/Makefile.patch | 21 +++++++ packages/abootimg/build.sh | 14 +++++ 5 files changed, 181 insertions(+) create mode 100644 packages/abootimg/0001-fixed-silly-warnings-due-to-Wall.patch create mode 100644 packages/abootimg/0002-renamed-un-pack-initrd-to-abootimg-un-pack-initrd.patch create mode 100644 packages/abootimg/0003-Fix-man-page-typos.patch create mode 100644 packages/abootimg/Makefile.patch create mode 100644 packages/abootimg/build.sh diff --git a/packages/abootimg/0001-fixed-silly-warnings-due-to-Wall.patch b/packages/abootimg/0001-fixed-silly-warnings-due-to-Wall.patch new file mode 100644 index 00000000000000..034dea1b3d8726 --- /dev/null +++ b/packages/abootimg/0001-fixed-silly-warnings-due-to-Wall.patch @@ -0,0 +1,60 @@ +From 4f8acfd12826037a8dbb183336922bdb9a1d6636 Mon Sep 17 00:00:00 2001 +From: Gilles Grandou +Date: Thu, 21 Jul 2011 01:21:34 +0200 +Subject: [PATCH 1/3] fixed silly warnings due to -Wall + +--- + abootimg.c | 14 ++++++++------ + 1 file changed, 8 insertions(+), 6 deletions(-) + +diff --git a/abootimg.c b/abootimg.c +index 464522f6a082..a55c5c84b160 100644 +--- a/abootimg.c ++++ b/abootimg.c +@@ -203,6 +203,10 @@ enum command parse_args(int argc, char** argv, t_abootimg* img) + return none; + + switch(cmd) { ++ case none: ++ case help: ++ break; ++ + case info: + if (argc != 3) + return none; +@@ -275,7 +279,7 @@ enum command parse_args(int argc, char** argv, t_abootimg* img) + + int check_boot_img_header(t_abootimg* img) + { +- if (strncmp(img->header.magic, BOOT_MAGIC, BOOT_MAGIC_SIZE)) { ++ if (strncmp((char*)(img->header.magic), BOOT_MAGIC, BOOT_MAGIC_SIZE)) { + fprintf(stderr, "%s: no Android Magic Value\n", img->fname); + return 1; + } +@@ -421,10 +425,10 @@ void update_header_entry(t_abootimg* img, char* cmd) + if (len >= BOOT_ARGS_SIZE) + abort_printf("cmdline length (%d) is too long (max %d)", len, BOOT_ARGS_SIZE-1); + memset(img->header.cmdline, 0, BOOT_ARGS_SIZE); +- strcpy(img->header.cmdline, value); ++ strcpy((char*)(img->header.cmdline), value); + } + else if (!strncmp(token, "name", 4)) { +- strncpy(img->header.name, value, BOOT_NAME_SIZE); ++ strncpy((char*)(img->header.name), value, BOOT_NAME_SIZE); + img->header.name[BOOT_NAME_SIZE-1] = '\0'; + } + else if (!strncmp(token, "bootsize", 8)) { +@@ -640,9 +644,7 @@ void write_bootimg(t_abootimg* img) + + unsigned n = (img->header.kernel_size + psize - 1) / psize; + unsigned m = (img->header.ramdisk_size + psize - 1) / psize; +- unsigned o = (img->header.second_size + psize - 1) / psize; +- unsigned total_pages = 1+n+m+o; +- unsigned bootimg_pages = img->size/psize; ++ //unsigned o = (img->header.second_size + psize - 1) / psize; + + if (fseek(img->stream, 0, SEEK_SET)) + abort_perror(img->fname); +-- +2.38.1 + diff --git a/packages/abootimg/0002-renamed-un-pack-initrd-to-abootimg-un-pack-initrd.patch b/packages/abootimg/0002-renamed-un-pack-initrd-to-abootimg-un-pack-initrd.patch new file mode 100644 index 00000000000000..9d430473711c91 --- /dev/null +++ b/packages/abootimg/0002-renamed-un-pack-initrd-to-abootimg-un-pack-initrd.patch @@ -0,0 +1,39 @@ +From ff8e759ed3c61dd1726f149452ec147b3ac77f1d Mon Sep 17 00:00:00 2001 +From: Gilles Grandou +Date: Thu, 21 Jul 2011 01:26:28 +0200 +Subject: [PATCH 2/3] renamed (un)pack-initrd to abootimg-(un)pack-initrd + +--- + pack-initrd => abootimg-pack-initrd | 0 + unpack-initrd => abootimg-unpack-initrd | 0 + debian/rules | 4 ++-- + 3 files changed, 2 insertions(+), 2 deletions(-) + rename pack-initrd => abootimg-pack-initrd (100%) + rename unpack-initrd => abootimg-unpack-initrd (100%) + +diff --git a/pack-initrd b/abootimg-pack-initrd +similarity index 100% +rename from pack-initrd +rename to abootimg-pack-initrd +diff --git a/unpack-initrd b/abootimg-unpack-initrd +similarity index 100% +rename from unpack-initrd +rename to abootimg-unpack-initrd +diff --git a/debian/rules b/debian/rules +index 98d8cd89eaa0..0196471adbb9 100755 +--- a/debian/rules ++++ b/debian/rules +@@ -12,8 +12,8 @@ configure/abootimg:: + binary-install/abootimg:: + dh_installman $(CURDIR)/debian/abootimg.1 + install $(CURDIR)/abootimg $(CURDIR)/debian/abootimg/usr/bin +- install -T $(CURDIR)/pack-initrd $(CURDIR)/debian/abootimg/usr/bin/abootimg-pack-initrd +- install -T $(CURDIR)/unpack-initrd $(CURDIR)/debian/abootimg/usr/bin/abootimg-unpack-initrd ++ install -T $(CURDIR)/abootimg-pack-initrd $(CURDIR)/debian/abootimg/usr/bin ++ install -T $(CURDIR)/abootimg-unpack-initrd $(CURDIR)/debian/abootimg/usr/bin + + clean:: + rm -rf files/agtl.egg-info +-- +2.38.1 + diff --git a/packages/abootimg/0003-Fix-man-page-typos.patch b/packages/abootimg/0003-Fix-man-page-typos.patch new file mode 100644 index 00000000000000..0c48d630cfdf8e --- /dev/null +++ b/packages/abootimg/0003-Fix-man-page-typos.patch @@ -0,0 +1,47 @@ +From 7e127fee6a3981f6b0a50ce9910267cd501e09d4 Mon Sep 17 00:00:00 2001 +From: Filip Holec +Date: Tue, 11 Sep 2012 17:47:07 +0300 +Subject: [PATCH 3/3] Fix man page typos + +--- + debian/abootimg.1 | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/debian/abootimg.1 b/debian/abootimg.1 +index 16f707d584cf..2415889c87ad 100644 +--- a/debian/abootimg.1 ++++ b/debian/abootimg.1 +@@ -20,7 +20,7 @@ Tool to read/write/update android boot images + .SH OPTIONS + .TP + .B \-i +-print boot imgage informations ++print boot image information + .TP + .B \-x + Extract a boot image +@@ -34,7 +34,7 @@ Create a boot image + .SS "Options for extracting boot images" + .TP + .B bootimg +-Existing bootimage to use ++Existing boot image to use + .TP + .B bootimg.cfg + Name for the bootimg.cfg file, defaults to bootimg.cfg +@@ -51,10 +51,10 @@ Name for the second-stage image, defaults to stage2.img + .SS "Options for updating and creating boot images" + .TP + .B bootimg +-Existing bootimage to use ++Existing boot image to use + .TP + .B \-c "param=value" +-Existing bootimage to use ++Existing boot image to use + .TP + .B \-f + Update bootimg.cfg with the named file +-- +2.38.1 + diff --git a/packages/abootimg/Makefile.patch b/packages/abootimg/Makefile.patch new file mode 100644 index 00000000000000..01db7cbed7994e --- /dev/null +++ b/packages/abootimg/Makefile.patch @@ -0,0 +1,21 @@ +--- ../abootimg-v0.6/Makefile 2011-07-14 21:13:25.000000000 +0200 ++++ ./Makefile 2022-10-27 21:48:21.460756923 +0200 +@@ -1,6 +1,6 @@ + +-CPPFLAGS=-DHAS_BLKID +-CFLAGS=-O3 -Wall ++CPPFLAGS+=-DHAS_BLKID ++CFLAGS+=-O3 -Wall + LDLIBS=-lblkid + + all: abootimg +@@ -16,6 +16,9 @@ + + abootimg.o: bootimg.h version.h + ++install: ++ install -Dm700 abootimg $(DESTDIR)$(PREFIX)/bin/ ++ + clean: + rm -f abootimg *.o version.h + diff --git a/packages/abootimg/build.sh b/packages/abootimg/build.sh new file mode 100644 index 00000000000000..3bd676adab58e0 --- /dev/null +++ b/packages/abootimg/build.sh @@ -0,0 +1,14 @@ +TERMUX_PKG_HOMEPAGE=https://gitlab.com/ajs124/abootimg +TERMUX_PKG_DESCRIPTION="Pack or unpack android boot images" +TERMUX_PKG_LICENSE="GPL-2.0" +TERMUX_PKG_MAINTAINER="@termux" +TERMUX_PKG_VERSION=0.6 +TERMUX_PKG_SRCURL=https://gitlab.com/ajs124/abootimg/-/archive/v${TERMUX_PKG_VERSION}/abootimg-v${TERMUX_PKG_VERSION}.tar.gz +TERMUX_PKG_SHA256=1dde5cadb8a14fccc677e5422d32c969a49c705daa03ce9b69af941247ff7cde +TERMUX_PKG_DEPENDS="util-linux" +TERMUX_PKG_BUILD_IN_SRC=true + +termux_step_post_get_source () { + echo "#define VERSION_STR \"$TERMUX_PKG_VERSION\"" > $TERMUX_PKG_SRCDIR/version.h + touch -d "next hour" $TERMUX_PKG_SRCDIR/version.h +}