* [Buildroot] [PATCH 1/1] package/mkbootimg: new host package
@ 2022-07-24 23:58 Christian Stewart via buildroot
2022-07-26 16:56 ` Thomas Petazzoni via buildroot
0 siblings, 1 reply; 2+ messages in thread
From: Christian Stewart via buildroot @ 2022-07-24 23:58 UTC (permalink / raw)
To: buildroot; +Cc: Christian Stewart, Yann E . MORIN, Thomas Petazzoni
Android bootimg utilities: mkbootimg and unpackbootimg.
Signed-off-by: Christian Stewart <christian@paral.in>
---
package/Config.in.host | 1 +
...akefile-remove-cc-and-ar-definitions.patch | 97 +++++++++++++++++++
package/mkbootimg/Config.in.host | 4 +
package/mkbootimg/mkbootimg.hash | 3 +
package/mkbootimg/mkbootimg.mk | 26 +++++
5 files changed, 131 insertions(+)
create mode 100644 package/mkbootimg/0001-makefile-remove-cc-and-ar-definitions.patch
create mode 100644 package/mkbootimg/Config.in.host
create mode 100644 package/mkbootimg/mkbootimg.hash
create mode 100644 package/mkbootimg/mkbootimg.mk
diff --git a/package/Config.in.host b/package/Config.in.host
index 71f2a9311c..38ee0e9e32 100644
--- a/package/Config.in.host
+++ b/package/Config.in.host
@@ -54,6 +54,7 @@ menu "Host utilities"
source "package/mender-artifact/Config.in.host"
source "package/meson-tools/Config.in.host"
source "package/mfgtools/Config.in.host"
+ source "package/mkbootimg/Config.in.host"
source "package/mkpasswd/Config.in.host"
source "package/mtd/Config.in.host"
source "package/mtools/Config.in.host"
diff --git a/package/mkbootimg/0001-makefile-remove-cc-and-ar-definitions.patch b/package/mkbootimg/0001-makefile-remove-cc-and-ar-definitions.patch
new file mode 100644
index 0000000000..d61b1e0b88
--- /dev/null
+++ b/package/mkbootimg/0001-makefile-remove-cc-and-ar-definitions.patch
@@ -0,0 +1,97 @@
+From 04a62922ce238f3106a916a30c0c2995ffa1526c Mon Sep 17 00:00:00 2001
+From: Christian Stewart <christian@paral.in>
+Date: Sat, 14 May 2022 20:58:14 -0700
+Subject: [PATCH] makefile: remove cc and ar definitions
+
+Signed-off-by: Christian Stewart <christian@paral.in>
+---
+ Makefile | 26 +-------------------------
+ libmincrypt/Makefile | 27 +++++----------------------
+ 2 files changed, 6 insertions(+), 47 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 6ee3a38c..39d0996b 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,29 +1,4 @@
+ # Andrew Huang <bluedrum@163.com>
+-ifeq ($(CC),cc)
+-CC = gcc
+-endif
+-AR = ar rcv
+-ifeq ($(windir),)
+-EXE =
+-RM = rm -f
+-else
+-EXE = .exe
+-RM = del
+-endif
+-
+-CFLAGS = -ffunction-sections -O3
+-
+-ifneq (,$(findstring darwin,$(CROSS_COMPILE)))
+- UNAME_S := Darwin
+-else
+- UNAME_S := $(shell uname -s)
+-endif
+-ifeq ($(UNAME_S),Darwin)
+- LDFLAGS += -Wl,-dead_strip
+-else
+- LDFLAGS += -Wl,--gc-sections -s
+-endif
+-
+ all:mkbootimg$(EXE) unpackbootimg$(EXE)
+
+ static:
+@@ -31,6 +6,7 @@ static:
+
+ libmincrypt.a:
+ $(MAKE) -C libmincrypt
++ cp ./libmincrypt/libmincrypt.a ./libmincrypt.a
+
+ mkbootimg$(EXE):mkbootimg.o libmincrypt.a
+ $(CROSS_COMPILE)$(CC) -o $@ $^ -L. -lmincrypt $(LDFLAGS)
+diff --git a/libmincrypt/Makefile b/libmincrypt/Makefile
+index ad482de9..c7c478ff 100755
+--- a/libmincrypt/Makefile
++++ b/libmincrypt/Makefile
+@@ -1,31 +1,14 @@
+-ifeq ($(CC),cc)
+-CC = gcc
+-endif
+-AR = ar rc
+-ifeq ($(windir),)
+-RM = rm -f
+-CP = cp
+-else
+-RM = del
+-CP = copy /y
+-endif
+-
+-CFLAGS = -ffunction-sections -O3
+-EXT = a
+-LIB = libmincrypt.$(EXT)
++LIB = libmincrypt.a
+ LIB_OBJS = dsa_sig.o p256.o p256_ec.o p256_ecdsa.o rsa.o sha.o sha256.o
+ INC = -I..
+
+-all:$(LIB)
++all: $(LIB)
+
+ clean:
+ $(RM) $(LIB_OBJS) $(LIB)
+
+-$(LIB):$(LIB_OBJS)
+- $(CROSS_COMPILE)$(AR) $@ $^
+- $(CP) $@ ..
+-
++$(LIB): $(LIB_OBJS)
++ $(CROSS_COMPILE)$(AR) rc $@ $^
+
+-%.o:%.c
++%.o: %.c
+ $(CROSS_COMPILE)$(CC) -o $@ $(CFLAGS) -c $< $(INC)
+-
+--
+2.35.1
+
diff --git a/package/mkbootimg/Config.in.host b/package/mkbootimg/Config.in.host
new file mode 100644
index 0000000000..2ca7bcae00
--- /dev/null
+++ b/package/mkbootimg/Config.in.host
@@ -0,0 +1,4 @@
+config BR2_PACKAGE_HOST_MKBOOTIMG
+ bool "host mkbootimg"
+ help
+ Android Bootimg mkbootimg and unpackbootimg utils.
diff --git a/package/mkbootimg/mkbootimg.hash b/package/mkbootimg/mkbootimg.hash
new file mode 100644
index 0000000000..8beaf8d56c
--- /dev/null
+++ b/package/mkbootimg/mkbootimg.hash
@@ -0,0 +1,3 @@
+# locally computed
+sha256 28ddd4a2e472e4e044c9b461fb8e3ce04ea9af0bbbafc8010958df28d27707a7 mkbootimg-d4a2677828fe9b60117af8996dcf1dea85d6b431.tar.gz
+sha256 b220fd3c79e0906eda798b23699305ab05576e849f45810eca74afcb2c7f2311 NOTICE
diff --git a/package/mkbootimg/mkbootimg.mk b/package/mkbootimg/mkbootimg.mk
new file mode 100644
index 0000000000..460e50aa9e
--- /dev/null
+++ b/package/mkbootimg/mkbootimg.mk
@@ -0,0 +1,26 @@
+################################################################################
+#
+# mkbootimg
+#
+################################################################################
+
+MKBOOTIMG_VERSION = d4a2677828fe9b60117af8996dcf1dea85d6b431
+MKBOOTIMG_SITE = $(call github,osm0sis,mkbootimg,$(MKBOOTIMG_VERSION))
+
+MKBOOTIMG_LICENSE = BSD-3-Clause
+MKBOOTIMG_LICENSE_FILES = NOTICE
+
+HOST_MKBOOTIMG_TARGETS = mkbootimg unpackbootimg
+
+define HOST_MKBOOTIMG_BUILD_CMDS
+ $(foreach t,$(HOST_MKBOOTIMG_TARGETS),\
+ $(HOST_MAKE_ENV) $(HOST_CONFIGURE_OPTS) $(MAKE) SRCDIR=$(@D) \
+ -C $(@D) $(t))
+endef
+
+define HOST_MKBOOTIMG_INSTALL_CMDS
+ $(foreach t,$(HOST_MKBOOTIMG_TARGETS),\
+ $(INSTALL) -D -m 0755 $(@D)/$(t) $(HOST_DIR)/bin/$(notdir $(t))$(sep))
+endef
+
+$(eval $(host-generic-package))
--
2.35.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Buildroot] [PATCH 1/1] package/mkbootimg: new host package
2022-07-24 23:58 [Buildroot] [PATCH 1/1] package/mkbootimg: new host package Christian Stewart via buildroot
@ 2022-07-26 16:56 ` Thomas Petazzoni via buildroot
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Petazzoni via buildroot @ 2022-07-26 16:56 UTC (permalink / raw)
To: Christian Stewart via buildroot; +Cc: Yann E . MORIN
Hello,
Thanks for your contribution! See some comments below.
On Sun, 24 Jul 2022 16:58:18 -0700
Christian Stewart via buildroot <buildroot@buildroot.org> wrote:
> Android bootimg utilities: mkbootimg and unpackbootimg.
>
> Signed-off-by: Christian Stewart <christian@paral.in>
> ---
> package/Config.in.host | 1 +
> ...akefile-remove-cc-and-ar-definitions.patch | 97 +++++++++++++++++++
> package/mkbootimg/Config.in.host | 4 +
> package/mkbootimg/mkbootimg.hash | 3 +
> package/mkbootimg/mkbootimg.mk | 26 +++++
> 5 files changed, 131 insertions(+)
Entry in the DEVELOPERS file is missing.
> diff --git a/package/mkbootimg/0001-makefile-remove-cc-and-ar-definitions.patch b/package/mkbootimg/0001-makefile-remove-cc-and-ar-definitions.patch
> new file mode 100644
> index 0000000000..d61b1e0b88
> --- /dev/null
> +++ b/package/mkbootimg/0001-makefile-remove-cc-and-ar-definitions.patch
> @@ -0,0 +1,97 @@
> +From 04a62922ce238f3106a916a30c0c2995ffa1526c Mon Sep 17 00:00:00 2001
> +From: Christian Stewart <christian@paral.in>
> +Date: Sat, 14 May 2022 20:58:14 -0700
> +Subject: [PATCH] makefile: remove cc and ar definitions
> +
> +Signed-off-by: Christian Stewart <christian@paral.in>
> +---
> + Makefile | 26 +-------------------------
> + libmincrypt/Makefile | 27 +++++----------------------
> + 2 files changed, 6 insertions(+), 47 deletions(-)
> +
> +diff --git a/Makefile b/Makefile
> +index 6ee3a38c..39d0996b 100644
> +--- a/Makefile
> ++++ b/Makefile
> +@@ -1,29 +1,4 @@
> + # Andrew Huang <bluedrum@163.com>
> +-ifeq ($(CC),cc)
> +-CC = gcc
> +-endif
> +-AR = ar rcv
> +-ifeq ($(windir),)
> +-EXE =
> +-RM = rm -f
> +-else
> +-EXE = .exe
> +-RM = del
> +-endif
> +-
> +-CFLAGS = -ffunction-sections -O3
> +-
> +-ifneq (,$(findstring darwin,$(CROSS_COMPILE)))
> +- UNAME_S := Darwin
> +-else
> +- UNAME_S := $(shell uname -s)
> +-endif
> +-ifeq ($(UNAME_S),Darwin)
> +- LDFLAGS += -Wl,-dead_strip
> +-else
> +- LDFLAGS += -Wl,--gc-sections -s
> +-endif
This is not needed. They can be overridden on the command line, as long
as you pass them to the right side of make, i.e:
$(MAKE) $(HOST_CONFIGURE_OPTS) -C $(@D)
The CC, CFLAGS, LDFLAGS from HOST_CONFIGURE_OPTS will take precedence
over the ones defined in the Makefile.
> +-
> + all:mkbootimg$(EXE) unpackbootimg$(EXE)
> +
> + static:
> +@@ -31,6 +6,7 @@ static:
> +
> + libmincrypt.a:
> + $(MAKE) -C libmincrypt
> ++ cp ./libmincrypt/libmincrypt.a ./libmincrypt.a
This added line is not related to the patch.
> +
> + mkbootimg$(EXE):mkbootimg.o libmincrypt.a
> + $(CROSS_COMPILE)$(CC) -o $@ $^ -L. -lmincrypt $(LDFLAGS)
> +diff --git a/libmincrypt/Makefile b/libmincrypt/Makefile
> +index ad482de9..c7c478ff 100755
> +--- a/libmincrypt/Makefile
> ++++ b/libmincrypt/Makefile
> +@@ -1,31 +1,14 @@
> +-ifeq ($(CC),cc)
> +-CC = gcc
> +-endif
> +-AR = ar rc
> +-ifeq ($(windir),)
> +-RM = rm -f
> +-CP = cp
> +-else
> +-RM = del
> +-CP = copy /y
> +-endif
> +-
> +-CFLAGS = -ffunction-sections -O3
> +-EXT = a
> +-LIB = libmincrypt.$(EXT)
> ++LIB = libmincrypt.a
Same comment. And EXT = a doesn't cause any problem.
> + LIB_OBJS = dsa_sig.o p256.o p256_ec.o p256_ecdsa.o rsa.o sha.o sha256.o
> + INC = -I..
> +
> +-all:$(LIB)
> ++all: $(LIB)
Spurious change.
> +
> + clean:
> + $(RM) $(LIB_OBJS) $(LIB)
> +
> +-$(LIB):$(LIB_OBJS)
> +- $(CROSS_COMPILE)$(AR) $@ $^
> +- $(CP) $@ ..
> +-
> ++$(LIB): $(LIB_OBJS)
> ++ $(CROSS_COMPILE)$(AR) rc $@ $^
Why?
> +
> +-%.o:%.c
> ++%.o: %.c
Spurious change.
> diff --git a/package/mkbootimg/Config.in.host b/package/mkbootimg/Config.in.host
> new file mode 100644
> index 0000000000..2ca7bcae00
> --- /dev/null
> +++ b/package/mkbootimg/Config.in.host
> @@ -0,0 +1,4 @@
> +config BR2_PACKAGE_HOST_MKBOOTIMG
> + bool "host mkbootimg"
> + help
> + Android Bootimg mkbootimg and unpackbootimg utils.
Missing link to the upstream Github project.
> +define HOST_MKBOOTIMG_BUILD_CMDS
> + $(foreach t,$(HOST_MKBOOTIMG_TARGETS),\
> + $(HOST_MAKE_ENV) $(HOST_CONFIGURE_OPTS) $(MAKE) SRCDIR=$(@D) \
Are you sure SRCDIR is needed?
Thanks!
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-07-26 16:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-24 23:58 [Buildroot] [PATCH 1/1] package/mkbootimg: new host package Christian Stewart via buildroot
2022-07-26 16:56 ` Thomas Petazzoni via buildroot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox