RFC: machine customized ixp4xx NPE firmware
Hello everyone,
The platform I am working on is using NPE-B and NPE-C as Ethernet interfaces. The ixp4xx-npe package from the OE snapshot I am currently
using builds firmware for NPE-B only and the firmware type is hard-coded
in "IxNpeMicrocode.h".
The patch below proposes a means of letting the machine configuration file
decide which NPE firmware to build.
Another but somewhat related point is the COMPATIBLE_MACHINE variable. If
my machine's name does not start with nslug or ixp4xx, I am forced to
change many package recipes (I suspect it is a FAQ but I do not seem to
able to access the mailing-list archive at the moment), perhaps a COMPATIBLE_ARCH variable would be help here ?
Thanks,
Robin
(quoted diff) +0 -0
a/packages/ixp4xx/ixp4xx-npe-native-2.3.2/IxNpeMicrocode.h b/packages/ixp4xx/ixp4xx-npe-native-2.3.2/IxNpeMicrocode.h
packages/ixp4xx/ixp4xx-npe-native-2.3.2/IxNpeMicrocode.h +0 -0
@@ -42,7 +42,7 @@// #define IX_NPEDL_NPEIMAGE_NPEB_DMA // #define
IX_NPEDL_NPEIMAGE_NPEB_ETH_SPAN_FIREWALL_VLAN_QOS_HDR_CONV
// #defineIX_NPEDL_NPEIMAGE_NPEB_ETH_LEARN_FILTER_SPAN_FIREWALL_VLAN_QOS -#define IX_NPEDL_NPEIMAGE_NPEB_ETH_LEARN_FILTER_SPAN_FIREWALL +// #define IX_NPEDL_NPEIMAGE_NPEB_ETH_LEARN_FILTER_SPAN_FIREWALL
// #defineIX_NPEDL_NPEIMAGE_NPEC_ETH_SPAN_MASK_FIREWALL_VLAN_QOS_HDR_CONV_EXTMIB @@ -51,7 +51,7 @@
// #define IX_NPEDL_NPEIMAGE_NPEC_DMA
// #define IX_NPEDL_NPEIMAGE_NPEC_CRYPTO_AES_ETH_LEARN_FILTER_SPAN // #defineIX_NPEDL_NPEIMAGE_NPEC_CRYPTO_AES_ETH_LEARN_FILTER_FIREWALL -#define IX_NPEDL_NPEIMAGE_NPEC_CRYPTO_AES_CCM_ETH
+// #define IX_NPEDL_NPEIMAGE_NPEC_CRYPTO_AES_CCM_ETH
// #defineIX_NPEDL_NPEIMAGE_NPEC_CRYPTO_ETH_LEARN_FILTER_SPAN_FIREWALL
// #defineIX_NPEDL_NPEIMAGE_NPEC_ETH_SPAN_FIREWALL_VLAN_QOS_HDR_CONV
// #defineIX_NPEDL_NPEIMAGE_NPEC_ETH_LEARN_FILTER_SPAN_FIREWALL_VLAN_QOS
(quoted diff) +0 -0
b/packages/ixp4xx/ixp4xx-npe-native_2.3.2.bb
packages/ixp4xx/ixp4xx-npe-native_2.3.2.bb +1 -0
@@ -7,9 +7,14 @@ inherit native inherit native S = "${WORKDIR}/ixp400_xscale_sw/src/npeDl" +# A space-separated list of CPP defines that select the firmware
images
+# to build for the target machine. +IXP4XX_NPE_FIRWMARE_DEFINES ?= "\
+-DIX_NPEDL_NPEIMAGE_NPEB_ETH_LEARN_FILTER_SPAN_FIREWALL" +
do_compile() {
mv ${WORKDIR}/IxNpeMicrocode.h ${S}/
- gcc -Wall IxNpeMicrocode.c -o IxNpeMicrocode
+ gcc -Wall ${IXP4XX_NPE_FIRWMARE_DEFINES} IxNpeMicrocode.c -o
IxNpeMicrocode
}
do_stage() {
(quoted diff) +0 -0
b/packages/ixp4xx/ixp4xx-npe_2.3.2.bb
packages/ixp4xx/ixp4xx-npe_2.3.2.bb +13 -6
@@ -13,7 +13,7 @@ S = "${WORKDIR}/ixp400_xscale_sw/src/npe COMPATIBLE_MACHINE = "(nslu2|ixp4xx)" -FILES_${PN} = "${base_libdir}/firmware/NPE-B" +FILES_${PN} = "${base_libdir}/firmware/NPE-*" do_compile() { ${STAGING_BINDIR_NATIVE}/IxNpeMicrocode-${PV} -be
@@ -21,13 +21,20 @@ do_compile() { do_install() { install -d ${D}/${base_libdir}/firmware/ - rm ${S}/NPE-B - mv ${S}/NPE-B.* ${S}/NPE-B - install ${S}/NPE-B ${D}/${base_libdir}/firmware/ + for npe in A B C; do + rm ${S}/NPE-${npe} 2>/dev/null || true + mv ${S}/NPE-${npe}.* ${S}/NPE-${npe} 2>/dev/null || true + if test -f ${S}/NPE-${npe}; then + install -m 644 ${S}/NPE-${npe} ${D}/${base_libdir}/firmware/ + fi + done } do_populate_staging() { install -d ${STAGING_FIRMWARE_DIR} - install ${S}/NPE-B ${STAGING_FIRMWARE_DIR}/ + for npe in A B C; do + if test -f ${S}/NPE-${npe}; then + install -m 644 ${S}/NPE-${npe} ${STAGING_FIRMWARE_DIR}/ + fi + done } -
Hello Robin,
Review
Quoted 8 lines · Robin Farine
(quoted diff) +4
-1+IXP4XX_NPE_FIRWMARE_DEFINES ?= "\ +-DIX_NPEDL_NPEIMAGE_NPEB_ETH_LEARN_FILTER_SPAN_FIREWALL" + do_compile() { mv ${WORKDIR}/IxNpeMicrocode.h ${S}/ - gcc -Wall IxNpeMicrocode.c -o IxNpeMicrocode + gcc -Wall ${IXP4XX_NPE_FIRWMARE_DEFINES} IxNpeMicrocode.c -o
Please change IXP4XX_NPE_FIRWMARE_DEFINES into IXP4X IX_NPE_FIRMWARE_DEFINES.
The idea looks ok.
Regards,
Leon.
Quoted 12 lines · Leon Woestenberg
Quoted 8 lines · Robin Farine
(quoted diff) +4
-1+IXP4XX_NPE_FIRWMARE_DEFINES ?= "\ +-DIX_NPEDL_NPEIMAGE_NPEB_ETH_LEARN_FILTER_SPAN_FIREWALL" + do_compile() { mv ${WORKDIR}/IxNpeMicrocode.h ${S}/ - gcc -Wall IxNpeMicrocode.c -o IxNpeMicrocode + gcc -Wall ${IXP4XX_NPE_FIRWMARE_DEFINES}
IxNpeMicrocode.c-oPlease change
IXP4XX_NPE_FIRWMARE_DEFINESinto IXP4XIX_NPE_FIRMWARE_DEFINES.
Ah, you mean s/FIRWMARE/FIRMWARE/, yes, makes sense :-). I'll fix this and submit the patch to the bug tracker.
Quoted 1 line
The idea looks ok.
Thanks for reviewing it.
Regards,
Robin
Quoted 10 lines · Robin Farine
The platform I am working on is using NPE-B and NPE-C as Ethernet interfaces. The ixp4xx-npe package from the OE snapshot I am currently
using builds firmware for NPE-B only and the firmware type is hard-coded
in "IxNpeMicrocode.h".The patch below proposes a means of letting the machine configuration file
decide which NPE firmware to build.
Thanks. We'll be very happy to apply that patch. I'll take a close look at it tonight.
Quoted 8 lines
Another but somewhat related point is the
COMPATIBLE_MACHINEvariable. If
my machine's name does not start with nslug or ixp4xx, I am forced to
change many package recipes (I suspect it is a FAQ but I do not seem to
able to access the mailing-list archive at the moment), perhaps aCOMPATIBLE_ARCHvariable would be help here ?
Which machine/arch are you using? We can easily extend that compatibility to include any other machines/archs that will use it.
-- Rod
Quoted 8 lines · Rod Whitby
Quoted 3 lines · Robin Farine
The patch below proposes a means of letting the machine configuration file
decide which NPE firmware to build.Thanks. We'll be very happy to apply that patch. I'll take a close look at it tonight.
I forgot to disable line wrapping when I reposted it to the correct mailing-list... You may prefer to have a look at the cleaner version in bugzilla.
Quoted 3 lines
Which machine/arch are you using? We can easily extend that compatibility to include any other machines/archs that will use it.
Its a custom ixp425 big-endian board of which 2 functional exemplars currently exist :-). Not a problem, I just wondered whether something like COMPATIBLE_ARCH exists.
Robin
Quoted 10 lines · Rod Whitby
Quoted 8 lines · Robin Farine
Another but somewhat related point is the
COMPATIBLE_MACHINEvariable. If
my machine's name does not start with nslug or ixp4xx, I am forced to
change many package recipes (I suspect it is a FAQ but I do not seem to
able to access the mailing-list archive at the moment), perhaps aCOMPATIBLE_ARCHvariable would be help here ?
Quoted 2 lines
Which machine/arch are you using? We can easily extend that compatibility to include any other machines/archs that will use it.
A neat way to handle this might be to define:
IXPMACHINES = "nslu2|ixp4xx|whatever"
and then the ixp specific .bb's check IXPMACHINES rather than a specific list. The list would then be maintained in one place and is easily updated if anyone adds a new ixp like machine.
I've not looked at the specifics, its just a random idea I had...
Cheers,
Richard