diff mbox series

[v2,03/11] package/qoriq-mc-binary: new package

Message ID 20241208143802.1048266-4-olteanv@gmail.com
State New
Headers show
Series Initial support for SolidRun LX2160A-CEX7 | expand

Commit Message

Vladimir Oltean Dec. 8, 2024, 2:37 p.m. UTC
Add a package which deploys the NXP MC (Management Complex) firmware
to the target. This is necessary for NXP DPAA2 SoCs (LS1088A, LS2080A,
LS2088A, LX2160A).

Signed-off-by: Vladimir Oltean <olteanv@gmail.com>
---
v1->v2: none

 DEVELOPERS                                   |  1 +
 package/Config.in                            |  1 +
 package/qoriq-mc-binary/Config.in            | 48 ++++++++++++++++++++
 package/qoriq-mc-binary/qoriq-mc-binary.hash |  3 ++
 package/qoriq-mc-binary/qoriq-mc-binary.mk   | 22 +++++++++
 5 files changed, 75 insertions(+)
 create mode 100644 package/qoriq-mc-binary/Config.in
 create mode 100644 package/qoriq-mc-binary/qoriq-mc-binary.hash
 create mode 100644 package/qoriq-mc-binary/qoriq-mc-binary.mk

Comments

Romain Naour Feb. 5, 2025, 2:45 p.m. UTC | #1
Hello,

Le 08/12/2024 à 15:37, Vladimir Oltean a écrit :
> Add a package which deploys the NXP MC (Management Complex) firmware
> to the target. This is necessary for NXP DPAA2 SoCs (LS1088A, LS2080A,
> LS2088A, LX2160A).
> 
> Signed-off-by: Vladimir Oltean <olteanv@gmail.com>
> ---
> v1->v2: none
> 
>  DEVELOPERS                                   |  1 +
>  package/Config.in                            |  1 +
>  package/qoriq-mc-binary/Config.in            | 48 ++++++++++++++++++++
>  package/qoriq-mc-binary/qoriq-mc-binary.hash |  3 ++
>  package/qoriq-mc-binary/qoriq-mc-binary.mk   | 22 +++++++++
>  5 files changed, 75 insertions(+)
>  create mode 100644 package/qoriq-mc-binary/Config.in
>  create mode 100644 package/qoriq-mc-binary/qoriq-mc-binary.hash
>  create mode 100644 package/qoriq-mc-binary/qoriq-mc-binary.mk
> 
> diff --git a/DEVELOPERS b/DEVELOPERS
> index 0260fc52e4e3..68c8af0ddc15 100644
> --- a/DEVELOPERS
> +++ b/DEVELOPERS
> @@ -3303,6 +3303,7 @@ F:	configs/ts5500_defconfig
>  
>  N:	Vladimir Oltean <olteanv@gmail.com>
>  F:	package/qoriq-ddr-phy-binary/
> +F:	package/qoriq-mc-binary/
>  
>  N:	Volkov Viacheslav <sv99@inbox.ru>
>  F:	package/v4l2grab/
> diff --git a/package/Config.in b/package/Config.in
> index 53e3170ea0f6..36337834f284 100644
> --- a/package/Config.in
> +++ b/package/Config.in
> @@ -456,6 +456,7 @@ menu "Firmware"
>  	source "package/qcom-db410c-firmware/Config.in"
>  	source "package/qoriq-ddr-phy-binary/Config.in"
>  	source "package/qoriq-fm-ucode/Config.in"
> +	source "package/qoriq-mc-binary/Config.in"
>  	source "package/rcw-smarc-sal28/Config.in"
>  	source "package/rpi-firmware/Config.in"
>  	source "package/sunxi-boards/Config.in"
> diff --git a/package/qoriq-mc-binary/Config.in b/package/qoriq-mc-binary/Config.in
> new file mode 100644
> index 000000000000..fa0983759082
> --- /dev/null
> +++ b/package/qoriq-mc-binary/Config.in
> @@ -0,0 +1,48 @@
> +config BR2_PACKAGE_QORIQ_MC_BINARY
> +	bool "qoriq-mc-binary"
> +	help
> +	  The Management Complex (MC) is a key component of the networking
> +	  subsystem named DPAA2 (Data Path Acceleration Architecture, second
> +	  version) in some NXP Layerscape SoCs.
> +
> +	  The MC coprocessor runs a closed-source, NXP-supplied firmware image
> +	  that abstracts and simplifies the allocation and configuration of the
> +	  networking hardware primitives into DPAA2 "objects". The MC firmware
> +	  exclusively manages the networking control path, and not the data path.
> +
> +	  https://github.com/nxp-qoriq/qoriq-mc-binary
> +	  https://www.nxp.com/webapp/Download?colCode=DPAA2UM # sign in required

There are some style issue reported by check-package:

$ ./utils/check-package package/qoriq-mc-binary/*
package/qoriq-mc-binary/Config.in:4: help text: <tab><2 spaces><62 chars>
(https://nightly.buildroot.org/#writing-rules-config-in)
package/qoriq-mc-binary/Config.in:5: help text: <tab><2 spaces><62 chars>
(https://nightly.buildroot.org/#writing-rules-config-in)
package/qoriq-mc-binary/Config.in:8: help text: <tab><2 spaces><62 chars>
(https://nightly.buildroot.org/#writing-rules-config-in)
package/qoriq-mc-binary/Config.in:9: help text: <tab><2 spaces><62 chars>
(https://nightly.buildroot.org/#writing-rules-config-in)
package/qoriq-mc-binary/Config.in:10: help text: <tab><2 spaces><62 chars>
(https://nightly.buildroot.org/#writing-rules-config-in)
package/qoriq-mc-binary/Config.in:11: help text: <tab><2 spaces><62 chars>
(https://nightly.buildroot.org/#writing-rules-config-in)
package/qoriq-mc-binary/Config.in:14: help text: <tab><2 spaces><62 chars>
(https://nightly.buildroot.org/#writing-rules-config-in)

The help text is slightly too long, please fix.

> +
> +if BR2_PACKAGE_QORIQ_MC_BINARY
> +choice
> +	prompt "QorIQ MC Target"
> +	help
> +	  Select the target for the QorIQ MC firmware.
> +
> +config BR2_PACKAGE_QORIQ_MC_TARGET_LS1088A
> +	bool "ls1088a"
> +
> +config BR2_PACKAGE_QORIQ_MC_TARGET_LS2080A
> +	bool "ls2080a"
> +
> +config BR2_PACKAGE_QORIQ_MC_TARGET_LS2088A
> +	bool "ls2088a"
> +
> +config BR2_PACKAGE_QORIQ_MC_TARGET_LX2160A
> +	bool "lx2160a"
> +
> +endchoice
> +
> +config BR2_QORIQ_MC_PLATFORM
> +	string
> +	default "ls1088a" if BR2_PACKAGE_QORIQ_MC_TARGET_LS1088A
> +	default "ls2080a" if BR2_PACKAGE_QORIQ_MC_TARGET_LS2080A
> +	default "ls2088a" if BR2_PACKAGE_QORIQ_MC_TARGET_LS2088A
> +	default "lx2160a" if BR2_PACKAGE_QORIQ_MC_TARGET_LX2160A
> +
> +config BR2_QORIQ_MC_DIR
> +	string
> +	default "lx216xa" if BR2_PACKAGE_QORIQ_MC_TARGET_LX2160A
> +	default BR2_QORIQ_MC_PLATFORM
> +
> +endif
> diff --git a/package/qoriq-mc-binary/qoriq-mc-binary.hash b/package/qoriq-mc-binary/qoriq-mc-binary.hash
> new file mode 100644
> index 000000000000..7afa62183c6c
> --- /dev/null
> +++ b/package/qoriq-mc-binary/qoriq-mc-binary.hash
> @@ -0,0 +1,3 @@
> +# Locally calculated
> +sha256  912ad8effd5c7b08eb277719b1e021b8b1fe4022dc3d961b419562e1d2d7a860  qoriq-mc-binary-10.39.0.tar.gz
> +sha256  7a223031d76339df0e4e5a94d193a270fb9963d42b577aa42fe130a4657f3e17  LICENSE
> diff --git a/package/qoriq-mc-binary/qoriq-mc-binary.mk b/package/qoriq-mc-binary/qoriq-mc-binary.mk
> new file mode 100644
> index 000000000000..21f9468e7c45
> --- /dev/null
> +++ b/package/qoriq-mc-binary/qoriq-mc-binary.mk
> @@ -0,0 +1,22 @@
> +################################################################################
> +#
> +# qoriq-mc-binary
> +#
> +################################################################################
> +
> +QORIQ_MC_BINARY_VERSION = 10.39.0
> +QORIQ_MC_BINARY_SITE = $(call github,nxp-qoriq,qoriq-mc-binary,mc_release_$(QORIQ_MC_BINARY_VERSION))
> +QORIQ_MC_BINARY_LICENSE = NXP Binary EULA
> +QORIQ_MC_BINARY_LICENSE_FILES = LICENSE
> +QORIQ_MC_BINARY_INSTALL_IMAGES = YES
> +QORIQ_MC_BINARY_INSTALL_TARGET = NO
> +
> +MC_PLATFORM = $(call qstrip,$(BR2_QORIQ_MC_PLATFORM))
> +MC_DIR = $(call qstrip,$(BR2_QORIQ_MC_DIR))
> +MC_BIN = mc_$(MC_PLATFORM)_$(QORIQ_MC_BINARY_VERSION).itb

Here the same tool (check-package) require to use "QORIQ_MC_BINARY" as prefix
for each variable use/defined by this package:

package/qoriq-mc-binary/qoriq-mc-binary.mk:14: possible typo, variable not
properly prefixed: MC_PLATFORM -> *QORIQ_MC_BINARY_XXXX*
(https://nightly.buildroot.org/#_tips_and_tricks)
package/qoriq-mc-binary/qoriq-mc-binary.mk:15: possible typo, variable not
properly prefixed: MC_DIR -> *QORIQ_MC_BINARY_XXXX*
(https://nightly.buildroot.org/#_tips_and_tricks)
package/qoriq-mc-binary/qoriq-mc-binary.mk:16: possible typo, variable not
properly prefixed: MC_BIN -> *QORIQ_MC_BINARY_XXXX*
(https://nightly.buildroot.org/#_tips_and_tricks)

Try with:
QORIQ_MC_BINARY_MC_PLATFORM = $(call qstrip,$(BR2_QORIQ_MC_PLATFORM))

Same for MC_DIR and MC_BIN.

> +
> +define QORIQ_MC_BINARY_INSTALL_IMAGES_CMDS
> +	$(INSTALL) -D $(@D)/${MC_DIR}/${MC_BIN} $(BINARIES_DIR)/mc.itb

Finally: use $()
package/qoriq-mc-binary/qoriq-mc-binary.mk:19: use $() to delimit variables, not ${}

Best regards,
Romain


> +endef
> +
> +$(eval $(generic-package))
Vladimir Oltean Feb. 15, 2025, 10:12 p.m. UTC | #2
On Wed, Feb 05, 2025 at 03:45:22PM +0100, Romain Naour wrote:
> There are some style issue reported by check-package:

Thanks for the review, I didn't know about check-package.
Vladimir Oltean Feb. 16, 2025, 2:36 p.m. UTC | #3
On Wed, Feb 05, 2025 at 03:45:22PM +0100, Romain Naour wrote:
> > +if BR2_PACKAGE_QORIQ_MC_BINARY
> > +choice
> > +	prompt "QorIQ MC Target"
> > +	help
> > +	  Select the target for the QorIQ MC firmware.
> > +
> > +config BR2_PACKAGE_QORIQ_MC_TARGET_LS1088A
> > +	bool "ls1088a"
> > +
> > +config BR2_PACKAGE_QORIQ_MC_TARGET_LS2080A
> > +	bool "ls2080a"
> > +
> > +config BR2_PACKAGE_QORIQ_MC_TARGET_LS2088A
> > +	bool "ls2088a"
> > +
> > +config BR2_PACKAGE_QORIQ_MC_TARGET_LX2160A
> > +	bool "lx2160a"
> > +
> > +endchoice
> > +
> > +config BR2_QORIQ_MC_PLATFORM
> > +	string
> > +	default "ls1088a" if BR2_PACKAGE_QORIQ_MC_TARGET_LS1088A
> > +	default "ls2080a" if BR2_PACKAGE_QORIQ_MC_TARGET_LS2080A
> > +	default "ls2088a" if BR2_PACKAGE_QORIQ_MC_TARGET_LS2088A
> > +	default "lx2160a" if BR2_PACKAGE_QORIQ_MC_TARGET_LX2160A
> > +
> > +QORIQ_MC_BINARY_VERSION = 10.39.0
> > +QORIQ_MC_BINARY_SITE = $(call github,nxp-qoriq,qoriq-mc-binary,mc_release_$(QORIQ_MC_BINARY_VERSION))
> > +QORIQ_MC_BINARY_LICENSE = NXP Binary EULA
> > +QORIQ_MC_BINARY_LICENSE_FILES = LICENSE
> > +QORIQ_MC_BINARY_INSTALL_IMAGES = YES
> > +QORIQ_MC_BINARY_INSTALL_TARGET = NO
> > +
> > +MC_PLATFORM = $(call qstrip,$(BR2_QORIQ_MC_PLATFORM))
> > +MC_DIR = $(call qstrip,$(BR2_QORIQ_MC_DIR))
> > +MC_BIN = mc_$(MC_PLATFORM)_$(QORIQ_MC_BINARY_VERSION).itb
> 
> Here the same tool (check-package) require to use "QORIQ_MC_BINARY" as prefix
> for each variable use/defined by this package:
> 
> package/qoriq-mc-binary/qoriq-mc-binary.mk:14: possible typo, variable not
> properly prefixed: MC_PLATFORM -> *QORIQ_MC_BINARY_XXXX*
> (https://nightly.buildroot.org/#_tips_and_tricks)
> package/qoriq-mc-binary/qoriq-mc-binary.mk:15: possible typo, variable not
> properly prefixed: MC_DIR -> *QORIQ_MC_BINARY_XXXX*
> (https://nightly.buildroot.org/#_tips_and_tricks)
> package/qoriq-mc-binary/qoriq-mc-binary.mk:16: possible typo, variable not
> properly prefixed: MC_BIN -> *QORIQ_MC_BINARY_XXXX*
> (https://nightly.buildroot.org/#_tips_and_tricks)
> 
> Try with:
> QORIQ_MC_BINARY_MC_PLATFORM = $(call qstrip,$(BR2_QORIQ_MC_PLATFORM))
> 
> Same for MC_DIR and MC_BIN.

If I were to replace MC_DIR with QORIQ_MC_BINARY_DIR, it would conflict
with package/pkg-generic.mk's use of $(2)_DIR	=  $$(BUILD_DIR)/$$($(2)_BASENAME).
I guess I don't fundamentally understand the best practices of naming
private Make variables when I don't want them to collide with the build
system's use, and the "tips and tricks" link didn't really cover that.
I'd guess you'd recommend renaming "QORIQ_MC_BINARY_DIR" to
"QORIQ_MC_BINARY_DIRECTORY" and just "knowing" that the latter is not a
variable used by the build system?
Arnout Vandecappelle Feb. 17, 2025, 8:46 p.m. UTC | #4
On 16/02/2025 15:36, Vladimir Oltean wrote:
> On Wed, Feb 05, 2025 at 03:45:22PM +0100, Romain Naour wrote:
[snip]
>>> +MC_PLATFORM = $(call qstrip,$(BR2_QORIQ_MC_PLATFORM))
>>> +MC_DIR = $(call qstrip,$(BR2_QORIQ_MC_DIR))
>>> +MC_BIN = mc_$(MC_PLATFORM)_$(QORIQ_MC_BINARY_VERSION).itb
>>
[snip]
>> Try with:
>> QORIQ_MC_BINARY_MC_PLATFORM = $(call qstrip,$(BR2_QORIQ_MC_PLATFORM))
>>
>> Same for MC_DIR and MC_BIN.
> 
> If I were to replace MC_DIR with QORIQ_MC_BINARY_DIR, it would conflict
> with package/pkg-generic.mk's use of $(2)_DIR	=  $$(BUILD_DIR)/$$($(2)_BASENAME).
> I guess I don't fundamentally understand the best practices of naming
> private Make variables when I don't want them to collide with the build
> system's use, and the "tips and tricks" link didn't really cover that.
> I'd guess you'd recommend renaming "QORIQ_MC_BINARY_DIR" to
> "QORIQ_MC_BINARY_DIRECTORY" and just "knowing" that the latter is not a
> variable used by the build system?

  In general, you have to make sure that all variables begin with the package 
name, and that they don't conflict with existing variables. It's unfortunately 
indeed tricky to do that...

  However, in this specific case, you're not doing anything in configure and 
build anyway, and you can use the subdir variable:

QORIQ_MC_BINARY_SUBDIR = $(call qstrip,$(BR2_QORIQ_MC_BINARY_DIR))
QORIQ_MC_BINARY_PLATFORM = $(call qstrip,$(BR2_QORIQ_MC_BINARY_PLATFORM))
QORIQ_MC_BINARY_BIN = mc_$(QORIQ_MC_BINARY_PLATFORM)_$(QORIQ_MC_BINARY_VERSION).itb

define QORIQ_MC_BINARY_INSTALL_IMAGES_CMDS
	$(INSTALL) -D $(QORIQ_MC_BINARY_DIR}/$(MC_BIN) $(BINARIES_DIR)/mc.itb
endef


(note that Config.in options also have to begin with the package name, so 
BR2_QORIQ_MC_BINARY_PLATFORM instead of BR2_QORIQ_MC_PLATFORM).


  Regards,
  Arnout
diff mbox series

Patch

diff --git a/DEVELOPERS b/DEVELOPERS
index 0260fc52e4e3..68c8af0ddc15 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -3303,6 +3303,7 @@  F:	configs/ts5500_defconfig
 
 N:	Vladimir Oltean <olteanv@gmail.com>
 F:	package/qoriq-ddr-phy-binary/
+F:	package/qoriq-mc-binary/
 
 N:	Volkov Viacheslav <sv99@inbox.ru>
 F:	package/v4l2grab/
diff --git a/package/Config.in b/package/Config.in
index 53e3170ea0f6..36337834f284 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -456,6 +456,7 @@  menu "Firmware"
 	source "package/qcom-db410c-firmware/Config.in"
 	source "package/qoriq-ddr-phy-binary/Config.in"
 	source "package/qoriq-fm-ucode/Config.in"
+	source "package/qoriq-mc-binary/Config.in"
 	source "package/rcw-smarc-sal28/Config.in"
 	source "package/rpi-firmware/Config.in"
 	source "package/sunxi-boards/Config.in"
diff --git a/package/qoriq-mc-binary/Config.in b/package/qoriq-mc-binary/Config.in
new file mode 100644
index 000000000000..fa0983759082
--- /dev/null
+++ b/package/qoriq-mc-binary/Config.in
@@ -0,0 +1,48 @@ 
+config BR2_PACKAGE_QORIQ_MC_BINARY
+	bool "qoriq-mc-binary"
+	help
+	  The Management Complex (MC) is a key component of the networking
+	  subsystem named DPAA2 (Data Path Acceleration Architecture, second
+	  version) in some NXP Layerscape SoCs.
+
+	  The MC coprocessor runs a closed-source, NXP-supplied firmware image
+	  that abstracts and simplifies the allocation and configuration of the
+	  networking hardware primitives into DPAA2 "objects". The MC firmware
+	  exclusively manages the networking control path, and not the data path.
+
+	  https://github.com/nxp-qoriq/qoriq-mc-binary
+	  https://www.nxp.com/webapp/Download?colCode=DPAA2UM # sign in required
+
+if BR2_PACKAGE_QORIQ_MC_BINARY
+choice
+	prompt "QorIQ MC Target"
+	help
+	  Select the target for the QorIQ MC firmware.
+
+config BR2_PACKAGE_QORIQ_MC_TARGET_LS1088A
+	bool "ls1088a"
+
+config BR2_PACKAGE_QORIQ_MC_TARGET_LS2080A
+	bool "ls2080a"
+
+config BR2_PACKAGE_QORIQ_MC_TARGET_LS2088A
+	bool "ls2088a"
+
+config BR2_PACKAGE_QORIQ_MC_TARGET_LX2160A
+	bool "lx2160a"
+
+endchoice
+
+config BR2_QORIQ_MC_PLATFORM
+	string
+	default "ls1088a" if BR2_PACKAGE_QORIQ_MC_TARGET_LS1088A
+	default "ls2080a" if BR2_PACKAGE_QORIQ_MC_TARGET_LS2080A
+	default "ls2088a" if BR2_PACKAGE_QORIQ_MC_TARGET_LS2088A
+	default "lx2160a" if BR2_PACKAGE_QORIQ_MC_TARGET_LX2160A
+
+config BR2_QORIQ_MC_DIR
+	string
+	default "lx216xa" if BR2_PACKAGE_QORIQ_MC_TARGET_LX2160A
+	default BR2_QORIQ_MC_PLATFORM
+
+endif
diff --git a/package/qoriq-mc-binary/qoriq-mc-binary.hash b/package/qoriq-mc-binary/qoriq-mc-binary.hash
new file mode 100644
index 000000000000..7afa62183c6c
--- /dev/null
+++ b/package/qoriq-mc-binary/qoriq-mc-binary.hash
@@ -0,0 +1,3 @@ 
+# Locally calculated
+sha256  912ad8effd5c7b08eb277719b1e021b8b1fe4022dc3d961b419562e1d2d7a860  qoriq-mc-binary-10.39.0.tar.gz
+sha256  7a223031d76339df0e4e5a94d193a270fb9963d42b577aa42fe130a4657f3e17  LICENSE
diff --git a/package/qoriq-mc-binary/qoriq-mc-binary.mk b/package/qoriq-mc-binary/qoriq-mc-binary.mk
new file mode 100644
index 000000000000..21f9468e7c45
--- /dev/null
+++ b/package/qoriq-mc-binary/qoriq-mc-binary.mk
@@ -0,0 +1,22 @@ 
+################################################################################
+#
+# qoriq-mc-binary
+#
+################################################################################
+
+QORIQ_MC_BINARY_VERSION = 10.39.0
+QORIQ_MC_BINARY_SITE = $(call github,nxp-qoriq,qoriq-mc-binary,mc_release_$(QORIQ_MC_BINARY_VERSION))
+QORIQ_MC_BINARY_LICENSE = NXP Binary EULA
+QORIQ_MC_BINARY_LICENSE_FILES = LICENSE
+QORIQ_MC_BINARY_INSTALL_IMAGES = YES
+QORIQ_MC_BINARY_INSTALL_TARGET = NO
+
+MC_PLATFORM = $(call qstrip,$(BR2_QORIQ_MC_PLATFORM))
+MC_DIR = $(call qstrip,$(BR2_QORIQ_MC_DIR))
+MC_BIN = mc_$(MC_PLATFORM)_$(QORIQ_MC_BINARY_VERSION).itb
+
+define QORIQ_MC_BINARY_INSTALL_IMAGES_CMDS
+	$(INSTALL) -D $(@D)/${MC_DIR}/${MC_BIN} $(BINARIES_DIR)/mc.itb
+endef
+
+$(eval $(generic-package))