Skip to contentSkip to conversation

package/byacc: new package

PATCH In review Thomas Perrot via buildroot 2 participants 7 messages Apr 20, 2022 – Aug 22, 2022 Arm i.MX and Layerscape

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 package/byacc: new package

This package provides a Berkeley LALR Yacc parser generator that has been use by i.MX Code Signing tool.

---

Changes v2:
- Remove Config.in.host
- Add a trailing slash
- Add a comment about HOST_BYACC_CONF_OPTS

 DEVELOPERS               |  3 +++
 package/byacc/byacc.hash |  3 +++
 package/byacc/byacc.mk   | 16 ++++++++++++++++
 3 files changed, 22 insertions(+)
 create mode 100644 package/byacc/byacc.hash
 create mode 100644 package/byacc/byacc.mk
DEVELOPERS +3 -0
index ca9decb58fec..6e49334dcc42 100644
@@ -2765,6 +2765,9 @@ F:	package/frotz/
 F:	package/kvm-unit-tests/
 F:	package/xorcurses/
 
+N:	Thomas Perrot <[email protected]>
+F:	package/byacc/
+
 N:	Thomas Petazzoni <[email protected]>
 F:	arch/Config.in.arm
 F:	board/beaglev/
package/byacc/byacc.hash new file +3 -0
new file mode 100644
index 000000000000..d2ad441df39f
@@ -0,0 +1,3 @@
+# Locally calculated
+sha256  42c1805cc529314e6a76326fe1b33e80c70862a44b01474da362e2f7db2d749c  byacc-20220128.tgz
+sha256  654a231fe9cd4d36e580214962fa777a1df0771d6889cfc74d19a3d414f14711  LICENSE
package/byacc/byacc.mk new file +16 -0
new file mode 100644
index 000000000000..648dc9a040ca
@@ -0,0 +1,16 @@
+################################################################################
+#
+# byacc
+#
+################################################################################
+
+BYACC_SITE = https://invisible-mirror.net/archives/byacc
+BYACC_VERSION = 20220128
+BYACC_SOURCE = byacc-$(BYACC_VERSION).tgz
+BYACC_LICENSE = Public Domain
+BYACC_LICENSE_FILES = LICENSE
+
+# To name byacc instead of yacc the binary built.
+HOST_BYACC_CONF_OPTS = --program-transform-name='s,^,b,'
+
+$(eval $(host-autotools-package))

--
2.35.1
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#1 lore raw

PATCH 2/2 package/imx-cst: new package

This package provides i.MX Code Signing Tools uses to sign i.MX bootloader to enable secure boot (HABv4 and AHAB).

---

Changes v2:
- - Add a trailing slash
- Preserve CFLAGS and LDFLAGS

 DEVELOPERS                     |  1 +
 package/Config.in.host         |  1 +
 package/imx-cst/Config.in.host |  8 ++++++
 package/imx-cst/imx-cst.hash   |  3 +++
 package/imx-cst/imx-cst.mk     | 49 ++++++++++++++++++++++++++++++++++
 5 files changed, 62 insertions(+)
 create mode 100644 package/imx-cst/Config.in.host
 create mode 100644 package/imx-cst/imx-cst.hash
 create mode 100644 package/imx-cst/imx-cst.mk
DEVELOPERS +1 -0
index 6e49334dcc42..86cb04e54e5d 100644
@@ -2767,6 +2767,7 @@ F:	package/xorcurses/
 
 N:	Thomas Perrot <[email protected]>
 F:	package/byacc/
+F:	package/imx-cst/
 
 N:	Thomas Petazzoni <[email protected]>
 F:	arch/Config.in.arm
package/Config.in.host +1 -0
index cd1c34b5a3d9..282594b40b8d 100644
@@ -40,6 +40,7 @@ menu "Host utilities"
 	source "package/google-breakpad/Config.in.host"
 	source "package/gptfdisk/Config.in.host"
 	source "package/imagemagick/Config.in.host"
+	source "package/imx-cst/Config.in.host"
 	source "package/imx-mkimage/Config.in.host"
 	source "package/imx-usb-loader/Config.in.host"
 	source "package/jh71xx-tools/Config.in.host"
package/imx-cst/Config.in.host new file +8 -0
new file mode 100644
index 000000000000..84cb825e59cf
@@ -0,0 +1,8 @@
+config BR2_PACKAGE_HOST_IMX_CST
+	bool "host imx-cst"
+	help
+	  I.MX code signing tool provides software code signing
+	  support designed that integrate the HABv4 and AHAB
+	  library.
+
+	  https://www.nxp.com/webapp/sps/download/license.jsp?colCode=IMX_CST_TOOL
package/imx-cst/imx-cst.hash new file +3 -0
new file mode 100644
index 000000000000..9c27bfe82038
@@ -0,0 +1,3 @@
+# Locally calculated
+sha256  2bcc03c7cedba58f7207a72a28e75cfe78007988d68c1095c793cce991c2936e  imx-cst-e2c687a856e6670e753147aacef42d0a3c07891a-br1.tar.gz
+sha256  5dee6f54c636a97b15d7e9dfc8075248c36764b3819828cbc94cbd17c1755fb9  LICENSE.bsd3
package/imx-cst/imx-cst.mk new file +49 -0

49 lines not on this page · raw message

--
2.35.1
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#2 lore raw

Re: [Buildroot] [PATCH 2/2] package/imx-cst: new package

Hi Thomas,

Quoted 5 lines · Thomas Perrot via buildroot

This package provides i.MX Code Signing Tools uses to sign i.MX bootloader to enable secure boot (HABv4 and AHAB).

---

[...]

Quoted 16 lines
package/imx-cst/imx-cst.mk new file +10 -0
new file mode 100644
index 000000000000..c91dfb602cbf
@@ -0,0 +1,49 @@
+################################################################################
+#
+# imx-cst
+#
+################################################################################
+
+# debian/3.3.1+dfsg-2
+IMX_CST_SITE = https://gitlab.apertis.org/pkg/imx-code-signing-tool.git
+IMX_CST_SITE_METHOD = git
+IMX_CST_VERSION = e2c687a856e6670e753147aacef42d0a3c07891a

package/imx-cst/imx-cst.mk line 20

Quoted 10 lines
package/imx-cst/imx-cst.mk new file +10 -0
+IMX_CST_LICENSE = BSD-3-Clause
+IMX_CST_LICENSE_FILES = LICENSE.bsd3
+
+HOST_IMX_CST_DEPENDENCIES = host-byacc host-flex host-openssl
+
+ifneq ($(filter %64,$(HOSTARCH)),)
+HOST_IMX_CST_OSTYPE = linux64
+else
+HOST_IMX_CST_OSTYPE = linux32
+endif

It looks like the only difference between 64 and 32 is in openssl build rule, and for x86 (host) targets only. We don't use this openssl rule since we build host-openssl with our own rules. So maybe we can just arbitrarily choose hard coded 'linux64'. It seems that debian/Makefile does that.

baruch

Quoted 29 lines
package/imx-cst/imx-cst.mk new file +29 -0
+
+# We don't use HOST_CONFIGURE_OPTS when building cst, because we need
+# to preserve the CFLAGS/LDFLAGS used by their Makefile.
+define HOST_IMX_CST_BUILD_CMDS
+	$(HOST_MAKE_ENV) $(MAKE) \
+		OSTYPE=$(HOST_IMX_CST_OSTYPE) \
+		ENCRYPTION=yes \
+		AR="$(HOSTAR)" \
+		CC="$(HOSTCC)" \
+		LD="$(HOSTCC)" \
+		OBJCOPY="$(HOSTOBJCOPY)" \
+		RANLIB="$(HOSTRANLIB)" \
+		EXTRACFLAGS="$(HOST_CFLAGS) $(HOST_CPPFLAGS)" \
+		EXTRALDFLAGS="$(HOST_LDFLAGS)" \
+		PWD=$(@D)/code/cst \
+		-C $(@D)/code/cst \
+		build
+	$(HOST_MAKE_ENV) $(MAKE) $(HOST_CONFIGURE_OPTS) \
+		COPTS="$(HOST_CFLAGS) $(HOST_CPPFLAGS) $(HOST_LDFLAGS)" \
+		-C $(@D)/code/hab_csf_parser
+endef
+
+define HOST_IMX_CST_INSTALL_CMDS
+	$(INSTALL) -D -m 755 $(@D)/code/cst/code/obj.linux64/cst $(HOST_DIR)/bin/cst
+	$(INSTALL) -D -m 755 $(@D)/code/cst/code/obj.linux64/srktool $(HOST_DIR)/bin/srktool
+	$(INSTALL) -D -m 755 $(@D)/code/hab_csf_parser/csf_parser $(HOST_DIR)/bin/csf_parser
+endef
+
+$(eval $(host-generic-package))
Signature · 7 lines
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - [email protected] - tel: +972.52.368.4656, http://www.tkos.co.il -
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#3 lore raw

Re: [Buildroot] [PATCH 2/2] package/imx-cst: new package

Hello Baruch,

Quoted 43 lines · Baruch Siach

Hi Thomas,

Quoted 6 lines · Thomas Perrot via buildroot

This package provides i.MX Code Signing Tools uses to sign i.MX bootloader
to enable secure boot (HABv4 and AHAB).

---

[...]

Quoted 20 lines
package/imx-cst/imx- renamed from package/imx-cst/imx-cst.mk +0 -0

cst.mk
new file mode 100644
index 000000000000..c91dfb602cbf

package/imx-cst/imx-cst.mk new file +1 -0
@@ -0,0 +1,49 @@
+##################################################################

##############

package/imx-cst/imx-cst.mk new file +4 -0
+#
+# imx-cst
+#
+##################################################################

##############

package/imx-cst/imx-cst.mk new file +3 -0
+
+# debian/3.3.1+dfsg-2
+IMX_CST_SITE =

https://gitlab.apertis.org/pkg/imx-code-signing-tool.git

package/imx-cst/imx-cst.mk new file +2 -0
+IMX_CST_SITE_METHOD = git
+IMX_CST_VERSION = e2c687a856e6670e753147aacef42d0a3c07891a

package/imx-cst/imx-cst.mk line 20

Quoted 10 lines
package/imx-cst/imx-cst.mk new file +10 -0
+IMX_CST_LICENSE = BSD-3-Clause
+IMX_CST_LICENSE_FILES = LICENSE.bsd3
+
+HOST_IMX_CST_DEPENDENCIES = host-byacc host-flex host-openssl
+
+ifneq ($(filter %64,$(HOSTARCH)),)
+HOST_IMX_CST_OSTYPE = linux64
+else
+HOST_IMX_CST_OSTYPE = linux32
+endif
Quoted 7 lines

It looks like the only difference between 64 and 32 is in openssl build
rule, and for x86 (host) targets only. We don't use this openssl rule since we build host-openssl with our own rules. So maybe we can just arbitrarily choose hard coded 'linux64'. It seems that debian/Makefile
does that.

Thanks for your review, I’m submitting a v3 with the OSTYPE variable hardcoded to linux64.

Kind regards,
Thomas

Quoted 39 lines

baruch

Quoted 34 lines
package/imx-cst/imx-cst.mk new file +2 -0
+
+# We don't use HOST_CONFIGURE_OPTS when building cst, because we

need

package/imx-cst/imx-cst.mk new file +17 -0
+# to preserve the CFLAGS/LDFLAGS used by their Makefile.
+define HOST_IMX_CST_BUILD_CMDS
+       $(HOST_MAKE_ENV) $(MAKE) \
+               OSTYPE=$(HOST_IMX_CST_OSTYPE) \
+               ENCRYPTION=yes \
+               AR="$(HOSTAR)" \
+               CC="$(HOSTCC)" \
+               LD="$(HOSTCC)" \
+               OBJCOPY="$(HOSTOBJCOPY)" \
+               RANLIB="$(HOSTRANLIB)" \
+               EXTRACFLAGS="$(HOST_CFLAGS) $(HOST_CPPFLAGS)" \
+               EXTRALDFLAGS="$(HOST_LDFLAGS)" \
+               PWD=$(@D)/code/cst \
+               -C $(@D)/code/cst \
+               build
+       $(HOST_MAKE_ENV) $(MAKE) $(HOST_CONFIGURE_OPTS) \
+               COPTS="$(HOST_CFLAGS) $(HOST_CPPFLAGS)

$(HOST_LDFLAGS)" \
+               -C $(@D)/code/hab_csf_parser

package/imx-cst/imx-cst.mk new file +4 -0
+endef
+
+define HOST_IMX_CST_INSTALL_CMDS
+       $(INSTALL) -D -m 755 $(@D)/code/cst/code/obj.linux64/cst

$(HOST_DIR)/bin/cst
+       $(INSTALL) -D -m 755 $(@D)/code/cst/code/obj.linux64/srktool $(HOST_DIR)/bin/srktool +       $(INSTALL) -D -m 755 $(@D)/code/hab_csf_parser/csf_parser $(HOST_DIR)/bin/csf_parser

package/imx-cst/imx-cst.mk new file +3 -0
+endef
+
+$(eval $(host-generic-package))
Signature · 3 lines
Thomas Perrot, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#4 lore raw

Re: [Buildroot] [PATCH 2/2] package/imx-cst: new package

Hello,

Quoted 10 lines · On Fri, 22 Apr 2022 12:09:00 +0200 Thomas Perrot <[email protected]>…
Quoted 7 lines

It looks like the only difference between 64 and 32 is in openssl build
rule, and for x86 (host) targets only. We don't use this openssl rule since we build host-openssl with our own rules. So maybe we can just arbitrarily choose hard coded 'linux64'. It seems that debian/Makefile
does that.

Thanks for your review, I’m submitting a v3 with the OSTYPE variable hardcoded to linux64.

No, please don't. We're doing the build like this:

build:

        $(MAKE) -C $(CST_CODE_PATH)/obj.$(OSTYPE) build

And code/cst/code/obj.linux32/Makefile contains:

COPTIONS += -m32
LDOPTIONS += -m32

while code/cst/code/obj.linux64/Makefile contains

COPTIONS += -m64
LDOPTIONS += -m64

And I can definitely see the -m64 being added in the compiler flags when doing a build on a x86-64 host (run the build with VERBOSE=1, you will see).

So if you use linux64 unconditionally, the CST binaries will be built with -m64, even on 32-bit host machines => bad.

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#5 lore raw

Re: [Buildroot] [PATCH 2/2] package/imx-cst: new package

Hi Thomas,

Quoted 29 lines · Thomas Petazzoni
Quoted 10 lines · On Fri, 22 Apr 2022 12:09:00 +0200 Thomas Perrot <[email protected]>…
Quoted 7 lines

It looks like the only difference between 64 and 32 is in openssl build
rule, and for x86 (host) targets only. We don't use this openssl rule since we build host-openssl with our own rules. So maybe we can just arbitrarily choose hard coded 'linux64'. It seems that debian/Makefile
does that.

Thanks for your review, I’m submitting a v3 with the OSTYPE variable hardcoded to linux64.

No, please don't. We're doing the build like this:

build:

        $(MAKE) -C $(CST_CODE_PATH)/obj.$(OSTYPE) build

And code/cst/code/obj.linux32/Makefile contains:

COPTIONS += -m32
LDOPTIONS += -m32

while code/cst/code/obj.linux64/Makefile contains

COPTIONS += -m64
LDOPTIONS += -m64

Quoted 6 lines

And I can definitely see the -m64 being added in the compiler flags when doing a build on a x86-64 host (run the build with VERBOSE=1, you will see).

So if you use linux64 unconditionally, the CST binaries will be built with -m64, even on 32-bit host machines => bad.

You are right. I didn't notice these -m32/-m64 parameters.

But that raises another problem. -m32/-m64 are platform specific options. A quick look at the GCC manual indicates that x86, Sparc, and PowerPC targets support these options. S390 supports -m64, but not -m32. ARM/ARM64 support none. So this package should depend on host architectures that support -m32/-m64.

Alternatively we can just patch out the whole 32/64 thing. This is most likely a remnant of previous versions that shipped binary .a files.

baruch

Signature · 7 lines
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - [email protected] - tel: +972.52.368.4656, http://www.tkos.co.il -
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#6 lore raw
In reply to Thomas Perrot via buildroot

Thomas, All,

On 2022-04-20 10:39 +0200, Thomas Perrot via buildroot spake thusly:

Quoted 2 lines

This package provides a Berkeley LALR Yacc parser generator that has been use by i.MX Code Signing tool.

Since this package is a host-only package, and it has no Kconfig entry, and as there were concerns with the imx-cst package, byacc is effectively dead code for now.

So, I've marked this patch as postponed.

Regards,
Yann E. MORIN.

Quoted 66 lines

---

Changes v2:
- Remove Config.in.host
- Add a trailing slash
- Add a comment about HOST_BYACC_CONF_OPTS

 DEVELOPERS               |  3 +++
 package/byacc/byacc.hash |  3 +++
 package/byacc/byacc.mk   | 16 ++++++++++++++++
 3 files changed, 22 insertions(+)
 create mode 100644 package/byacc/byacc.hash
 create mode 100644 package/byacc/byacc.mk
DEVELOPERS +3 -0
index ca9decb58fec..6e49334dcc42 100644
@@ -2765,6 +2765,9 @@ F:	package/frotz/
 F:	package/kvm-unit-tests/
 F:	package/xorcurses/
 
+N:	Thomas Perrot <[email protected]>
+F:	package/byacc/
+
 N:	Thomas Petazzoni <[email protected]>
 F:	arch/Config.in.arm
 F:	board/beaglev/
package/byacc/byacc.hash new file +3 -0
new file mode 100644
index 000000000000..d2ad441df39f
@@ -0,0 +1,3 @@
+# Locally calculated
+sha256  42c1805cc529314e6a76326fe1b33e80c70862a44b01474da362e2f7db2d749c  byacc-20220128.tgz
+sha256  654a231fe9cd4d36e580214962fa777a1df0771d6889cfc74d19a3d414f14711  LICENSE
package/byacc/byacc.mk new file +16 -1
new file mode 100644
index 000000000000..648dc9a040ca
@@ -0,0 +1,16 @@
+################################################################################
+#
+# byacc
+#
+################################################################################
+
+BYACC_SITE = https://invisible-mirror.net/archives/byacc
+BYACC_VERSION = 20220128
+BYACC_SOURCE = byacc-$(BYACC_VERSION).tgz
+BYACC_LICENSE = Public Domain
+BYACC_LICENSE_FILES = LICENSE
+
+# To name byacc instead of yacc the binary built.
+HOST_BYACC_CONF_OPTS = --program-transform-name='s,^,b,'
+
+$(eval $(host-autotools-package))
--

2.35.1
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

Signature · 10 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot