Skip to contentSkip to conversation

sunxi: add NetCube Nagami support and T113 secure boot enablement

PATCH In review Lukas Schmid 3 participants 13 messages Apr 30 – May 8

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

v2 cover sunxi: add NetCube Nagami support and T113 secure boot enablement

This series adds support for the NetCube Systems Nagami T113-based system-on-module and its associated carrier boards, along with the sunxi changes needed to boot signed FIT images from SPL in secure mode on R528/T113.

The Nagami module is based on the Allwinner T113-S3/T113-S4 family and the included defconfigs cover the basic carrier, keypad carrier, and a secure boot example configuration for the basic carrier.

To support the secure boot flow in SPL, the series adds the missing sunxi pieces for R528/T113: I2C3 pinmux support, early SPC setup for non-secure peripheral handoff, non-DM SPL FIT signature verification, and signed SPL image generation in the sunxi binman/FIT description.

The SID MAC fallback handling is also cleaned up. The original fix used a board-level check for whether nvmem-cells were present in the DT. This version moves the fallback into the Ethernet drivers instead of env_setup, so the sunxi EMAC and DesignWare GMAC paths share a generic implementation.

Changes in v2:
- Add SID-derived read_rom_hwaddr support for SUN7I_GMAC through the DesignWare Ethernet driver.
- Drop the board-local get_unique_sid() wrapper and call sunxi_get_unique_sid() directly.
- Keep the sunxi SID MAC prototype out of designware.c block scope.

Lukas Schmid (6):
sunxi: move SID MAC fallback from board env setup to EMAC
read_rom_hwaddr
pinctrl: sunxi: add I2C3 mux for D1/T113-s3 (PG10/PG11)
sunxi: add SPC setup for R528/T113 secure boot handoff
boot: allow SPL FIT signature verification without DM
sunxi: extend binman FIT description for signed SPL images
sunxi: add support for NetCube Systems Nagami and associated carrier
boards

 arch/arm/cpu/armv7/sunxi/Makefile             |  1 +
 arch/arm/cpu/armv7/sunxi/spc.c                | 20 ++++++
 arch/arm/dts/sunxi-u-boot.dtsi                | 68 +++++++++++++++++--
 .../include/asm/arch-sunxi/cpu_sunxi_ncat2.h  | 27 ++++++++
 arch/arm/include/asm/arch-sunxi/sys_proto.h   | 14 ++++
 arch/arm/mach-sunxi/board.c                   |  1 +
 arch/arm/mach-sunxi/clock_sun50i_h6.c         |  8 +++
 arch/arm/mach-sunxi/cpu_info.c                | 44 ++++++++++++
 board/sunxi/board.c                           | 64 +----------------
 boot/Kconfig                                  |  1 -
 .../netcube_nagami_basic_carrier_defconfig    | 43 ++++++++++++
 ..._nagami_basic_carrier_secureboot_defconfig | 52 ++++++++++++++
 .../netcube_nagami_keypad_carrier_defconfig   | 43 ++++++++++++
 drivers/net/designware.c                      | 20 ++++++
 drivers/net/sun8i_emac.c                      | 15 ++++
 drivers/net/sunxi_emac.c                      | 15 ++++
 drivers/pinctrl/sunxi/pinctrl-sunxi.c         |  1 +
 lib/rsa/rsa-verify.c                          | 16 +++--
 18 files changed, 380 insertions(+), 73 deletions(-)
 create mode 100644 arch/arm/cpu/armv7/sunxi/spc.c
 create mode 100644 configs/netcube_nagami_basic_carrier_defconfig
 create mode 100644 configs/netcube_nagami_basic_carrier_secureboot_defconfig
 create mode 100644 configs/netcube_nagami_keypad_carrier_defconfig
Signature · 1 line
2.47.3
#1 lore raw

PATCH v2 1/6 sunxi: move SID MAC fallback from board env setup to EMAC read_rom_hwaddr

sunxi currently seeds ethaddr/ethXaddr in setup_environment() from SID. That happens before Ethernet probe, so even with a clean persisted environment we can populate env with a generated MAC and later get a mismatch warning when DM Ethernet reads a different MAC from DT/NVMEM.

Stop generating Ethernet MAC env variables in setup_environment() and provide SID-derived fallback addresses through read_rom_hwaddr in the sunxi EMAC and designware eth drivers instead.

Also move the SID uniqueness/MAC derivation logic into shared sunxi arch helpers so board code and drivers use one implementation and keep legacy algorithm compatibility across SoCs.

This keeps the generic MAC source order (DT/NVMEM first, fallback second), avoids board-level MAC policy special-casing, and prevents same-boot env-vs-NVMEM mismatch warnings caused by early env seeding.

---
 arch/arm/include/asm/arch-sunxi/sys_proto.h |  6 ++
 arch/arm/mach-sunxi/cpu_info.c              | 44 ++++++++++++++
 board/sunxi/board.c                         | 64 +--------------------
 drivers/net/designware.c                    | 20 +++++++
 drivers/net/sun8i_emac.c                    | 15 +++++
 drivers/net/sunxi_emac.c                    | 15 +++++
 6 files changed, 102 insertions(+), 62 deletions(-)
arch/arm/include/asm/arch-sunxi/sys_proto.h +6 -0
index 92c7721a530..6f70753e948 100644
@@ -12,6 +12,12 @@
 
 void sdelay(unsigned long);
 
+/* Read SID and apply legacy/newer-SoC normalization for uniqueness. */
+bool sunxi_get_unique_sid(unsigned int *sid);
+
+/* Build legacy-compatible SID-derived locally administered MAC address. */
+bool sunxi_get_sid_mac_addr(int index, u8 mac[6]);
+
 /* return_to_fel() - Return to BROM from SPL
  *
  * This returns back into the BROM after U-Boot SPL has performed its initial
arch/arm/mach-sunxi/cpu_info.c +44 -0

55 lines not on this page · raw message

board/sunxi/board.c +2 -62

91 lines not on this page · raw message

drivers/net/designware.c +20 -0
index 6ed9c6d538a..3d8e13031af 100644
@@ -37,6 +37,8 @@
 #include <asm/arch/gmac.h>
 #endif
 
+bool sunxi_get_sid_mac_addr(int index, u8 mac[6]);
+
 static int dw_mdio_read(struct mii_dev *bus, int addr, int devad, int reg)
 {
 	struct dw_eth_dev *priv = dev_get_priv((struct udevice *)bus->priv);
@@ -842,6 +844,23 @@ int designware_eth_write_hwaddr(struct udevice *dev)
 	return _dw_write_hwaddr(priv, pdata->enetaddr);
 }
 
+static int designware_eth_read_rom_hwaddr(struct udevice *dev)
+{
+	struct eth_pdata *pdata = dev_get_plat(dev);
+	u8 mac[ARP_HLEN];
+
+	if (IS_ENABLED(CONFIG_ARCH_SUNXI)) {
+		if (!sunxi_get_sid_mac_addr(dev_seq(dev), mac))
+			return -ENODEV;
+
+		memcpy(pdata->enetaddr, mac, ARP_HLEN);
+
+		return 0;
+	}
+
+	return -ENOSYS;
+}
+
 static int designware_eth_bind(struct udevice *dev)
 {
 	if (IS_ENABLED(CONFIG_PCI)) {
@@ -1018,6 +1037,7 @@ const struct eth_ops designware_eth_ops = {
 	.free_pkt		= designware_eth_free_pkt,
 	.stop			= designware_eth_stop,
 	.write_hwaddr		= designware_eth_write_hwaddr,
+	.read_rom_hwaddr	= designware_eth_read_rom_hwaddr,
 };
 
 int designware_eth_of_to_plat(struct udevice *dev)
drivers/net/sun8i_emac.c +15 -0
index 41c52f56d7a..a267b6cd7f5 100644
@@ -13,6 +13,7 @@
 #include <cpu_func.h>
 #include <log.h>
 #include <asm/cache.h>
+#include <asm/arch/sys_proto.h>
 #include <asm/global_data.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
@@ -259,6 +260,19 @@ static int sun8i_eth_write_hwaddr(struct udevice *dev)
 	return 0;
 }
 
+static int sun8i_eth_read_rom_hwaddr(struct udevice *dev)
+{
+	struct eth_pdata *pdata = dev_get_plat(dev);
+	u8 mac[ARP_HLEN];
+
+	if (!sunxi_get_sid_mac_addr(dev_seq(dev), mac))
+		return -ENODEV;
+
+	memcpy(pdata->enetaddr, mac, ARP_HLEN);
+
+	return 0;
+}
+
 static void sun8i_adjust_link(struct emac_eth_dev *priv,
 			      struct phy_device *phydev)
 {
@@ -715,6 +729,7 @@ static int sun8i_emac_eth_probe(struct udevice *dev)
 
 static const struct eth_ops sun8i_emac_eth_ops = {
 	.start                  = sun8i_emac_eth_start,
+	.read_rom_hwaddr	= sun8i_eth_read_rom_hwaddr,
 	.write_hwaddr           = sun8i_eth_write_hwaddr,
 	.send                   = sun8i_emac_eth_send,
 	.recv                   = sun8i_emac_eth_recv,
drivers/net/sunxi_emac.c +15 -0
index 3dee849c97e..f45a0790a40 100644
@@ -15,6 +15,7 @@
 #include <miiphy.h>
 #include <net.h>
 #include <asm/io.h>
+#include <asm/arch/sys_proto.h>
 #include <asm/arch/clock.h>
 #include <power/regulator.h>
 
@@ -539,6 +540,19 @@ static int sunxi_emac_eth_send(struct udevice *dev, void *packet, int length)
 	return _sunxi_emac_eth_send(priv, packet, length);
 }
 
+static int sunxi_emac_read_rom_hwaddr(struct udevice *dev)
+{
+	struct eth_pdata *pdata = dev_get_plat(dev);
+	u8 mac[ARP_HLEN];
+
+	if (!sunxi_get_sid_mac_addr(dev_seq(dev), mac))
+		return -ENODEV;
+
+	memcpy(pdata->enetaddr, mac, ARP_HLEN);
+
+	return 0;
+}
+
 static int sunxi_emac_eth_recv(struct udevice *dev, int flags, uchar **packetp)
 {
 	struct emac_eth_dev *priv = dev_get_priv(dev);
@@ -581,6 +595,7 @@ static int sunxi_emac_eth_probe(struct udevice *dev)
 
 static const struct eth_ops sunxi_emac_eth_ops = {
 	.start			= sunxi_emac_eth_start,
+	.read_rom_hwaddr	= sunxi_emac_read_rom_hwaddr,
 	.send			= sunxi_emac_eth_send,
 	.recv			= sunxi_emac_eth_recv,
 	.stop			= sunxi_emac_eth_stop,
Signature · 1 line
2.47.3
#2 lore raw

PATCH v2 2/6 pinctrl: sunxi: add I2C3 mux for D1/T113-s3 (PG10/PG11)

In reply to Lukas Schmid

Boards based on the Allwinner D1/T113-s3, such as the NetCube Systems Nagami, can expose a third I2C controller on PG10/PG11. However, the sun20i_d1 pinctrl function table lacked an entry for this mux.

Add the "i2c3" function with mux value 3 on PG10/PG11, allowing device trees to enable the I2C3 controller.

---
 drivers/pinctrl/sunxi/pinctrl-sunxi.c | 1 +
 1 file changed, 1 insertion(+)
drivers/pinctrl/sunxi/pinctrl-sunxi.c +1 -0
index fd357ab0d4e..a8632aeaf8f 100644
@@ -603,6 +603,7 @@ static const struct sunxi_pinctrl_function sun20i_d1_pinctrl_functions[] = {
 	{ "gpio_in",	0 },
 	{ "gpio_out",	1 },
 	{ "i2c0",	4 },	/* PB10-PB11 */
+	{ "i2c3",	3 },	/* PG10-PG11 */
 	{ "mmc0",	2 },	/* PF0-PF5 */
 	{ "mmc1",	2 },	/* PG0-PG5 */
 	{ "mmc2",	3 },	/* PC2-PC7 */
Signature · 1 line
2.47.3
#3 lore raw

PATCH v2 3/6 sunxi: add SPC setup for R528/T113 secure boot handoff

In reply to Lukas Schmid

The R528/T113 family protects peripheral access through the SPC, and also uses security switch registers in the CCU, PRCM and DMA controller.

Configure these blocks during early platform init so Linux can access the peripherals after U-Boot hands off control when booting in secure mode. Add an R528/T113-specific SPC init step alongside the existing early security controller setup, allow non-secure DMA access there, and switch the CCU and PRCM buses to non-secure access in clock_init_sec().

---
 arch/arm/cpu/armv7/sunxi/Makefile             |  1 +
 arch/arm/cpu/armv7/sunxi/spc.c                | 20 ++++++++++++++
 .../include/asm/arch-sunxi/cpu_sunxi_ncat2.h  | 27 +++++++++++++++++++
 arch/arm/include/asm/arch-sunxi/sys_proto.h   |  8 ++++++
 arch/arm/mach-sunxi/board.c                   |  1 +
 arch/arm/mach-sunxi/clock_sun50i_h6.c         |  8 ++++++
 6 files changed, 65 insertions(+)
 create mode 100644 arch/arm/cpu/armv7/sunxi/spc.c
arch/arm/cpu/armv7/sunxi/Makefile +1 -0
index 0624e93efde..bc19f6a203c 100644
@@ -8,6 +8,7 @@
 
 obj-$(CONFIG_MACH_SUN6I)	+= tzpc.o
 obj-$(CONFIG_MACH_SUN8I_H3)	+= tzpc.o
+obj-$(CONFIG_MACH_SUN8I_R528)	+= spc.o
 
 obj-$(CONFIG_MACH_SUN6I)	+= sram.o
 obj-$(CONFIG_MACH_SUN8I)	+= sram.o
arch/arm/cpu/armv7/sunxi/spc.c new file +20 -0
new file mode 100644
index 00000000000..bdecfaa1b4b
@@ -0,0 +1,20 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2015 Chen-Yu Tsai <[email protected]>
+ * (C) Copyright 2026 Lukas Schmid <[email protected]>
+ */
+
+#include <asm/io.h>
+#include <asm/arch/cpu.h>
+#include <asm/arch/sys_proto.h>
+
+void spc_init(void)
+{
+	struct sunxi_spc *spc = (struct sunxi_spc *)SUNXI_SPC_BASE;
+	int i;
+
+	for (i = 0; i < SUNXI_SPC_NUM_PORTS; i++)
+		writel(SUNXI_SPC_DECPORT_MASK, &spc->decport[i].set);
+
+	writel(SUNXI_DMA_SEC_MASK, SUNXI_DMA_BASE + SUNXI_DMA_SEC_REG);
+}
arch/arm/include/asm/arch-sunxi/cpu_sunxi_ncat2.h +27 -0
index bcfdc0a41c5..7a4d25e6e78 100644
@@ -7,6 +7,7 @@
 #ifndef _SUNXI_CPU_SUNXI_NCAT2_H
 #define _SUNXI_CPU_SUNXI_NCAT2_H
 
+#define SUNXI_SPC_BASE			0x02000800
 #define SUNXI_CCM_BASE			0x02001000
 #define SUNXI_TIMER_BASE		0x02050000
 
@@ -16,6 +17,7 @@
 #define SUNXI_TWI3_BASE			0x02502C00
 
 #define SUNXI_SRAMC_BASE		0x03000000
+#define SUNXI_DMA_BASE			0x03002000
 /* SID address space starts at 0x03006000, but e-fuse is at offset 0x200 */
 #define SUNXI_SIDC_BASE			0x03006000
 #define SUNXI_SID_BASE			0x03006200
@@ -50,7 +52,32 @@
 
 #define SUNXI_CPU_PLL_CFG_BASE		0x08817000
 
+#ifdef CONFIG_MACH_SUN8I_R528
+#define SUNXI_CCM_SEC_SWITCH_REG        (SUNXI_CCM_BASE + 0x0f00)
+#define SUNXI_CCM_SEC_SWITCH_NONSEC	0x7
+#define SUNXI_PRCM_SEC_SWITCH_REG       (SUNXI_PRCM_BASE + 0x0290)
+#define SUNXI_PRCM_SEC_SWITCH_NONSEC	0x1
+#define SUNXI_SPC_DECPORT_STA_REG(p)    (SUNXI_SPC_BASE + 0x0000 + 0x10 * (p))
+#define SUNXI_SPC_DECPORT_SET_REG(p)    (SUNXI_SPC_BASE + 0x0004 + 0x10 * (p))
+#define SUNXI_SPC_DECPORT_CLR_REG(p)    (SUNXI_SPC_BASE + 0x0008 + 0x10 * (p))
+#define SUNXI_SPC_NUM_PORTS             13
+#define SUNXI_SPC_DECPORT_MASK		0xffffffff
+#define SUNXI_DMA_SEC_REG		0x20
+#define SUNXI_DMA_SEC_MASK		0xffff
+#endif
+
 #ifndef __ASSEMBLY__
+struct sunxi_spc_decport {
+	u32 status;
+	u32 set;
+	u32 clear;
+	u32 reserved;
+};
+
+struct sunxi_spc {
+	struct sunxi_spc_decport decport[SUNXI_SPC_NUM_PORTS];
+};
+
 void sunxi_board_init(void);
 void sunxi_reset(void);
 int sunxi_get_sid(unsigned int *sid);
arch/arm/include/asm/arch-sunxi/sys_proto.h +8 -0
index 6f70753e948..a006e592f83 100644
@@ -18,6 +18,14 @@ bool sunxi_get_unique_sid(unsigned int *sid);
 /* Build legacy-compatible SID-derived locally administered MAC address. */
 bool sunxi_get_sid_mac_addr(int index, u8 mac[6]);
 
+#ifdef CONFIG_MACH_SUN8I_R528
+void spc_init(void);
+#else
+static inline void spc_init(void)
+{
+}
+#endif
+
 /* return_to_fel() - Return to BROM from SPL
  *
  * This returns back into the BROM after U-Boot SPL has performed its initial
arch/arm/mach-sunxi/board.c +1 -0
index 432b1c10f92..4d98d350cbe 100644
@@ -475,6 +475,7 @@ void board_init_f(ulong dummy)
 
 	/* Enable non-secure access to some peripherals */
 	tzpc_init();
+	spc_init();
 
 	timer_init();
 	clock_init();
arch/arm/mach-sunxi/clock_sun50i_h6.c +8 -0
index 80004f13a1e..217d47c8770 100644
@@ -74,6 +74,14 @@ void clock_init_safe(void)
 	}
 }
 
+void clock_init_sec(void)
+{
+	if (IS_ENABLED(CONFIG_MACH_SUN8I_R528)) {
+		writel(SUNXI_CCM_SEC_SWITCH_NONSEC, SUNXI_CCM_SEC_SWITCH_REG);
+		writel(SUNXI_PRCM_SEC_SWITCH_NONSEC, SUNXI_PRCM_SEC_SWITCH_REG);
+	}
+}
+
 void clock_init_uart(void)
 {
 	void *const ccm = (void *)SUNXI_CCM_BASE;
Signature · 1 line
2.47.3
#4 lore raw

PATCH v2 4/6 boot: allow SPL FIT signature verification without DM

In reply to Lukas Schmid

SPL FIT verification was effectively tied to Driver Model. The RSA verifier assumed a DM-backed modexp device, and SPL_FIT_SIGNATURE depended on SPL_DM. This prevents non-DM SPL platforms from using FIT signature verification even though the software modular exponent fallback is already available.

Drop the hard SPL_DM dependency and only look up the modexp device when DM is enabled. Non-DM SPL builds then fall back to the software implementation and can enable signed FIT verification.

---
 boot/Kconfig         |  1 -
 lib/rsa/rsa-verify.c | 16 ++++++++++------
 2 files changed, 10 insertions(+), 7 deletions(-)
boot/Kconfig +0 -1
index 4e9bc9491a0..6ccb7d44a5e 100644
@@ -202,7 +202,6 @@ config SPL_FIT_FULL_CHECK
 
 config SPL_FIT_SIGNATURE
 	bool "Enable signature verification of FIT firmware within SPL"
-	depends on SPL_DM
 	depends on SPL_LOAD_FIT
 	select FIT_SIGNATURE
 	select SPL_FIT
lib/rsa/rsa-verify.c +10 -6
index 3169c3a6dd1..24b23ab565a 100644
@@ -355,13 +355,17 @@ static int rsa_verify_key(struct image_sign_info *info,
 	hash_len = checksum->checksum_len;
 
 #if !defined(USE_HOSTCC)
-	ret = uclass_get_device(UCLASS_MOD_EXP, 0, &mod_exp_dev);
-	if (ret) {
-		printf("RSA: Can't find Modular Exp implementation\n");
-		return -EINVAL;
-	}
+	if (CONFIG_IS_ENABLED(DM)) {
+		ret = uclass_get_device(UCLASS_MOD_EXP, 0, &mod_exp_dev);
+		if (ret) {
+			printf("RSA: Can't find Modular Exp implementation\n");
+			return -EINVAL;
+		}
 
-	ret = rsa_mod_exp(mod_exp_dev, sig, sig_len, prop, buf);
+		ret = rsa_mod_exp(mod_exp_dev, sig, sig_len, prop, buf);
+	} else {
+		ret = rsa_mod_exp_sw(sig, sig_len, prop, buf);
+	}
 #else
 	ret = rsa_mod_exp_sw(sig, sig_len, prop, buf);
 #endif
Signature · 1 line
2.47.3
#5 lore raw

Re: [PATCH v2 4/6] boot: allow SPL FIT signature verification without DM

Hi Lukas,

Quoted 43 lines · Lukas Schmid

SPL FIT verification was effectively tied to Driver Model. The RSA verifier assumed a DM-backed modexp device, and SPL_FIT_SIGNATURE depended on SPL_DM. This prevents non-DM SPL platforms from using FIT signature verification even though the software modular exponent fallback is already available.

Drop the hard SPL_DM dependency and only look up the modexp device when DM is enabled. Non-DM SPL builds then fall back to the software implementation and can enable signed FIT verification.

---
  boot/Kconfig         |  1 -
  lib/rsa/rsa-verify.c | 16 ++++++++++------
  2 files changed, 10 insertions(+), 7 deletions(-)
boot/Kconfig +0 -1
index 4e9bc9491a0..6ccb7d44a5e 100644
@@ -202,7 +202,6 @@ config SPL_FIT_FULL_CHECK
 
  config SPL_FIT_SIGNATURE
  	bool "Enable signature verification of FIT firmware within SPL"
-	depends on SPL_DM
  	depends on SPL_LOAD_FIT
  	select FIT_SIGNATURE
  	select SPL_FIT
lib/rsa/rsa-verify.c +2 -5
index 3169c3a6dd1..24b23ab565a 100644
@@ -355,13 +355,17 @@ static int rsa_verify_key(struct image_sign_info *info,
  	hash_len = checksum->checksum_len;
 
  #if !defined(USE_HOSTCC)
-	ret = uclass_get_device(UCLASS_MOD_EXP, 0, &mod_exp_dev);
-	if (ret) {
-		printf("RSA: Can't find Modular Exp implementation\n");
-		return -EINVAL;
-	}
+	if (CONFIG_IS_ENABLED(DM)) {
+		ret = uclass_get_device(UCLASS_MOD_EXP, 0, &mod_exp_dev);

lib/rsa/rsa-verify.c static int rsa_verify_key(struct image_sign_info *info, · line 368

Quoted 10 lines
lib/rsa/rsa-verify.c +8 -1
+		if (ret) {
+			printf("RSA: Can't find Modular Exp implementation\n");
+			return -EINVAL;
+		}
 
-	ret = rsa_mod_exp(mod_exp_dev, sig, sig_len, prop, buf);
+		ret = rsa_mod_exp(mod_exp_dev, sig, sig_len, prop, buf);
+	} else {
+		ret = rsa_mod_exp_sw(sig, sig_len, prop, buf);
+	}

Mmmmm I'm wondering if in the event we build with DM support but cannot find a modexp implem we shouldn't default to the software implem if available? Security-wise I'm not sure we're losing here, it's just that I'm assuming SW-based RSA verification is slower than HW-based no?

Also, this function is only defined when CONFIG_RSA_SOFTWARE_EXP is enabled (and we don't have a toggle for xPL phases (should we?)), so we need to handle this here to avoid breaking builds.

Finally, I still see RSA_SOFTWARE_EXP depends on DM at the Kconfig level. So bringing this in SPL seems wrong, as we would depend on U-Boot proper having DM enabled for it to work in xPL. So either the dependency is incorrect or we're missing something in SPL. With a cursory look at it, it seems DM isn't required so maybe we can drop it.

Cheers,
Quentin

#6 lore raw

Re: [PATCH v2 4/6] boot: allow SPL FIT signature verification without DM

Hi Quentin,

Quoted 63 lines · Quentin Schulz

Hi Lukas,

Quoted 43 lines · Lukas Schmid

SPL FIT verification was effectively tied to Driver Model. The RSA verifier assumed a DM-backed modexp device, and SPL_FIT_SIGNATURE depended on SPL_DM. This prevents non-DM SPL platforms from using FIT signature verification even though the software modular exponent fallback is already available.

Drop the hard SPL_DM dependency and only look up the modexp device when DM is enabled. Non-DM SPL builds then fall back to the software implementation and can enable signed FIT verification.

---
  boot/Kconfig         |  1 -
  lib/rsa/rsa-verify.c | 16 ++++++++++------
  2 files changed, 10 insertions(+), 7 deletions(-)
boot/Kconfig +0 -1
index 4e9bc9491a0..6ccb7d44a5e 100644
@@ -202,7 +202,6 @@ config SPL_FIT_FULL_CHECK
 
  config SPL_FIT_SIGNATURE
      bool "Enable signature verification of FIT firmware within SPL"
-     depends on SPL_DM
      depends on SPL_LOAD_FIT
      select FIT_SIGNATURE
      select SPL_FIT
lib/rsa/rsa-verify.c +2 -5
index 3169c3a6dd1..24b23ab565a 100644
@@ -355,13 +355,17 @@ static int rsa_verify_key(struct image_sign_info *info,
      hash_len = checksum->checksum_len;
 
  #if !defined(USE_HOSTCC)
-     ret = uclass_get_device(UCLASS_MOD_EXP, 0, &mod_exp_dev);
-     if (ret) {
-             printf("RSA: Can't find Modular Exp implementation\n");
-             return -EINVAL;
-     }
+     if (CONFIG_IS_ENABLED(DM)) {
+             ret = uclass_get_device(UCLASS_MOD_EXP, 0, &mod_exp_dev);

lib/rsa/rsa-verify.c static int rsa_verify_key(struct image_sign_info *info, · line 368

Quoted 10 lines
lib/rsa/rsa-verify.c +8 -1
+             if (ret) {
+                     printf("RSA: Can't find Modular Exp implementation\n");
+                     return -EINVAL;
+             }
 
-     ret = rsa_mod_exp(mod_exp_dev, sig, sig_len, prop, buf);
+             ret = rsa_mod_exp(mod_exp_dev, sig, sig_len, prop, buf);
+     } else {
+             ret = rsa_mod_exp_sw(sig, sig_len, prop, buf);
+     }

Mmmmm I'm wondering if in the event we build with DM support but cannot find a modexp implem we shouldn't default to the software implem if available? Security-wise I'm not sure we're losing here, it's just that I'm assuming SW-based RSA verification is slower than HW-based no?

Quoted 3 lines

Also, this function is only defined when CONFIG_RSA_SOFTWARE_EXP is enabled (and we don't have a toggle for xPL phases (should we?)), so we need to handle this here to avoid breaking builds.

Right

Quoted 6 lines

Finally, I still see RSA_SOFTWARE_EXP depends on DM at the Kconfig level. So bringing this in SPL seems wrong, as we would depend on U-Boot proper having DM enabled for it to work in xPL. So either the dependency is incorrect or we're missing something in SPL. With a cursory look at it, it seems DM isn't required so maybe we can drop it.

Re DM, there is a UCLASS_MOD_EXP so we can support hardware-accelerated verification.

Regards,
Simon

#7 lore raw

PATCH v2 5/6 sunxi: extend binman FIT description for signed SPL images

In reply to Lukas Schmid

Extend the sunxi binman/FIT description to support signed SPL FIT images. Add an SPL public-key DTB image, per-image hash nodes, fit,sign support, and a configuration signature that covers firmware, loadables and the selected FDT.

Handle TOC0 SPL output as well by adding the required filename and mkimage wrapping so the generated sunxi image remains verifiable.

---
 arch/arm/dts/sunxi-u-boot.dtsi | 68 ++++++++++++++++++++++++++++++++--
 1 file changed, 64 insertions(+), 4 deletions(-)
arch/arm/dts/sunxi-u-boot.dtsi +64 -4
index e1a9a7f5d4c..313fcad3922 100644
@@ -27,6 +27,38 @@
 #endif
 
 &binman {
+#ifdef CONFIG_SPL_FIT_SIGNATURE
+	spl {
+#ifdef CONFIG_SPL_IMAGE_TYPE_SUNXI_TOC0
+		filename = "spl/u-boot-spl.bin";
+#else
+		filename = "spl/sunxi-spl.bin";
+#endif
+
+		u-boot-spl-nodtb {
+		};
+
+		u-boot-spl-pubkey-dtb {
+			algo = "sha256,rsa2048";
+			required = "conf";
+			key-name-hint = "dev";
+		};
+	};
+
+#ifdef CONFIG_SPL_IMAGE_TYPE_SUNXI_TOC0
+	image {
+		filename = "spl/sunxi-spl.bin";
+
+		mkimage {
+			args = "-a 0x20060 -T sunxi_toc0";
+			data-to-imagename;
+
+			u-boot-spl {
+			};
+		};
+	};
+#endif
+#endif
 	u-boot-sunxi-with-spl {
 		filename = "u-boot-sunxi-with-spl.bin";
 		pad-byte = <0xff>;
@@ -45,6 +77,9 @@
 			description = "Configuration to load U-Boot and firmware";
 			#address-cells = <1>;
 			fit,fdt-list = "of-list";
+#ifdef CONFIG_SPL_FIT_SIGNATURE
+			fit,sign;
+#endif
 
 			images {
 				uboot {
@@ -60,6 +95,11 @@
 
 					u-boot-nodtb {
 					};
+#ifdef CONFIG_SPL_FIT_SIGNATURE
+					hash {
+						algo = "sha256";
+					};
+#endif
 				};
 
 #if CONFIG_SUNXI_BL31_BASE
@@ -76,6 +116,11 @@
 						filename = "bl31.bin";
 						missing-msg = "atf-bl31-sunxi";
 					};
+#ifdef CONFIG_SPL_FIT_SIGNATURE
+					hash {
+						algo = "sha256";
+					};
+#endif
 				};
 #endif
 
@@ -92,6 +137,11 @@
 						missing-msg = "scp-sunxi";
 						optional;
 					};
+#ifdef CONFIG_SPL_FIT_SIGNATURE
+					hash {
+						algo = "sha256";
+					};
+#endif
 				};
 #endif
 
@@ -99,6 +149,11 @@
 					description = "NAME";
 					type = "flat_dt";
 					compression = "none";
+#ifdef CONFIG_SPL_FIT_SIGNATURE
+					hash {
+						algo = "sha256";
+					};
+#endif
 				};
 			};
 
@@ -108,16 +163,21 @@
 				@config-SEQ {
 					description = "NAME";
 #if CONFIG_SUNXI_BL31_BASE
-					firmware = "atf";
+					firmware = "atf", "uboot";
 #else
 					firmware = "uboot";
 #endif
 #if CONFIG_SUNXI_SCP_BASE
-					loadables = "scp", "uboot";
-#else
-					loadables = "uboot";
+					loadables = "scp";
 #endif
 					fdt = "fdt-SEQ";
+#ifdef CONFIG_SPL_FIT_SIGNATURE
+					signature {
+						algo = "sha256,rsa2048";
+						key-name-hint = "dev";
+						sign-images = "firmware", "loadables", "fdt";
+					};
+#endif
 				};
 			};
 		};
Signature · 1 line
2.47.3
#8 lore raw

Re: [PATCH v2 5/6] sunxi: extend binman FIT description for signed SPL images

Hi Lukas,

Quoted 8 lines · Lukas Schmid

Extend the sunxi binman/FIT description to support signed SPL FIT images. Add an SPL public-key DTB image, per-image hash nodes, fit,sign support, and a configuration signature that covers firmware, loadables and the selected FDT.

Handle TOC0 SPL output as well by adding the required filename and mkimage wrapping so the generated sunxi image remains verifiable.

I sympathize with the effort as I'd like something similar on Rockchip but I don't think this is right.

Quoted 14 lines
---
  arch/arm/dts/sunxi-u-boot.dtsi | 68 ++++++++++++++++++++++++++++++++--
  1 file changed, 64 insertions(+), 4 deletions(-)
arch/arm/dts/sunxi-u-boot.dtsi +1 -0
index e1a9a7f5d4c..313fcad3922 100644
@@ -27,6 +27,38 @@
  #endif
 
  &binman {
+#ifdef CONFIG_SPL_FIT_SIGNATURE

arch/arm/dts/sunxi-u-boot.dtsi line 40

Quoted 10 lines
arch/arm/dts/sunxi-u-boot.dtsi +10 -0
+	spl {
+#ifdef CONFIG_SPL_IMAGE_TYPE_SUNXI_TOC0
+		filename = "spl/u-boot-spl.bin";
+#else
+		filename = "spl/sunxi-spl.bin";
+#endif
+
+		u-boot-spl-nodtb {
+		};
+

You're missing

#if !IS_ENABLED(CONFIG_SPL_SEPARATE_BSS)
                        u-boot-spl-bss-pad {
                        };

#endif /* !CONFIG_SPL_SEPARATE_BSS */

here.

arch/arm/dts/sunxi-u-boot.dtsi line 45

Quoted 5 lines
arch/arm/dts/sunxi-u-boot.dtsi +5 -0
+		u-boot-spl-pubkey-dtb {
+			algo = "sha256,rsa2048";
+			required = "conf";
+			key-name-hint = "dev";
+		};

You're forcing the use of an RSA2048 key which is not recommended nowadays anymore as far as I know. RSA4096 is "better" when using RSA.

This also forces the user to have a dev.crt certificate to be able to build the image. It's not a secret or sensitive info so I guess that's fine.

Quoted 20 lines
arch/arm/dts/sunxi-u-boot.dtsi +16 -0
+	};
+
+#ifdef CONFIG_SPL_IMAGE_TYPE_SUNXI_TOC0
+	image {
+		filename = "spl/sunxi-spl.bin";
+
+		mkimage {
+			args = "-a 0x20060 -T sunxi_toc0";
+			data-to-imagename;
+
+			u-boot-spl {
+			};
+		};
+	};
+#endif
+#endif
  	u-boot-sunxi-with-spl {
  		filename = "u-boot-sunxi-with-spl.bin";
  		pad-byte = <0xff>;

arch/arm/dts/sunxi-u-boot.dtsi line 83

Quoted 7 lines
arch/arm/dts/sunxi-u-boot.dtsi +3 -0
@@ -45,6 +77,9 @@
  			description = "Configuration to load U-Boot and firmware";
  			#address-cells = <1>;
  			fit,fdt-list = "of-list";
+#ifdef CONFIG_SPL_FIT_SIGNATURE
+			fit,sign;
+#endif
 

This requires the user to sign as part of building U-Boot and therefore have access to the private key. Some users may want to sign separately from their U-Boot building step such that building can be done anywhere but signing is only done on specific infrastructure.

This also doesn't allow the user to use OpenSSL engines for signing (yes engines are deprecated and replaced by providers, but the same likely apply for providers once we'll support that).

You definitely need to document this somewhere, likely in doc/board/allwinner?

I'll try to keep an eye on this and see if there's something we can take for Rockchip as well :) But I don't know how to do this nicely and make it "safer" to set up FIT signature verification for devices and avoid common pitfalls or misconfigurations while still allowing out-of-build signing and configuration of keys.

Cheers,
Quentin

#9 lore raw

Re: [PATCH v2 5/6] sunxi: extend binman FIT description for signed SPL images

Hi Lukas, Quentin,

Quoted 87 lines · Quentin Schulz

Hi Lukas,

Quoted 8 lines · Lukas Schmid

Extend the sunxi binman/FIT description to support signed SPL FIT images. Add an SPL public-key DTB image, per-image hash nodes, fit,sign support, and a configuration signature that covers firmware, loadables and the selected FDT.

Handle TOC0 SPL output as well by adding the required filename and mkimage wrapping so the generated sunxi image remains verifiable.

I sympathize with the effort as I'd like something similar on Rockchip but I don't think this is right.

Quoted 14 lines
---
  arch/arm/dts/sunxi-u-boot.dtsi | 68 ++++++++++++++++++++++++++++++++--
  1 file changed, 64 insertions(+), 4 deletions(-)
arch/arm/dts/sunxi-u-boot.dtsi +1 -0
index e1a9a7f5d4c..313fcad3922 100644
@@ -27,6 +27,38 @@
  #endif
 
  &binman {
+#ifdef CONFIG_SPL_FIT_SIGNATURE

arch/arm/dts/sunxi-u-boot.dtsi line 40

Quoted 10 lines
arch/arm/dts/sunxi-u-boot.dtsi +10 -0
+     spl {
+#ifdef CONFIG_SPL_IMAGE_TYPE_SUNXI_TOC0
+             filename = "spl/u-boot-spl.bin";
+#else
+             filename = "spl/sunxi-spl.bin";
+#endif
+
+             u-boot-spl-nodtb {
+             };
+

You're missing

#if !IS_ENABLED(CONFIG_SPL_SEPARATE_BSS)
                         u-boot-spl-bss-pad {
                         };

#endif /* !CONFIG_SPL_SEPARATE_BSS */

here.

arch/arm/dts/sunxi-u-boot.dtsi line 45

Quoted 5 lines
arch/arm/dts/sunxi-u-boot.dtsi +5 -0
+             u-boot-spl-pubkey-dtb {
+                     algo = "sha256,rsa2048";
+                     required = "conf";
+                     key-name-hint = "dev";
+             };

You're forcing the use of an RSA2048 key which is not recommended nowadays anymore as far as I know. RSA4096 is "better" when using RSA.

This also forces the user to have a dev.crt certificate to be able to build the image. It's not a secret or sensitive info so I guess that's fine.

Quoted 24 lines
arch/arm/dts/sunxi-u-boot.dtsi +17 -0
+     };
+
+#ifdef CONFIG_SPL_IMAGE_TYPE_SUNXI_TOC0
+     image {
+             filename = "spl/sunxi-spl.bin";
+
+             mkimage {
+                     args = "-a 0x20060 -T sunxi_toc0";
+                     data-to-imagename;
+
+                     u-boot-spl {
+                     };
+             };
+     };
+#endif
+#endif
      u-boot-sunxi-with-spl {
              filename = "u-boot-sunxi-with-spl.bin";
              pad-byte = <0xff>;
@@ -45,6 +77,9 @@
                      description = "Configuration to load U-Boot and firmware";
                      #address-cells = <1>;
                      fit,fdt-list = "of-list";
+#ifdef CONFIG_SPL_FIT_SIGNATURE
Quoted 8 lines

arch/arm/dts/sunxi-u-boot.dtsi line 83

Quoted 3 lines
arch/arm/dts/sunxi-u-boot.dtsi +2 -0
+                     fit,sign;
+#endif
 

This requires the user to sign as part of building U-Boot and therefore have access to the private key. Some users may want to sign separately from their U-Boot building step such that building can be done anywhere but signing is only done on specific infrastructure.

I wonder if binman could help here, perhaps by providing an option (for CI) to skip signing if the file is missing?

Quoted 5 lines

This also doesn't allow the user to use OpenSSL engines for signing (yes engines are deprecated and replaced by providers, but the same likely apply for providers once we'll support that).

Quoted 8 lines

You definitely need to document this somewhere, likely in doc/board/allwinner?

I'll try to keep an eye on this and see if there's something we can take for Rockchip as well :) But I don't know how to do this nicely and make it "safer" to set up FIT signature verification for devices and avoid common pitfalls or misconfigurations while still allowing out-of-build signing and configuration of keys.

Regards,
Simon

#10 lore raw

Re: [PATCH v2 5/6] sunxi: extend binman FIT description for signed SPL images

Hi Simon,

Quoted 99 lines · Simon Glass

Hi Lukas, Quentin,

Quoted 87 lines · Quentin Schulz

Hi Lukas,

Quoted 8 lines · Lukas Schmid

Extend the sunxi binman/FIT description to support signed SPL FIT images. Add an SPL public-key DTB image, per-image hash nodes, fit,sign support, and a configuration signature that covers firmware, loadables and the selected FDT.

Handle TOC0 SPL output as well by adding the required filename and mkimage wrapping so the generated sunxi image remains verifiable.

I sympathize with the effort as I'd like something similar on Rockchip but I don't think this is right.

Quoted 14 lines
---
   arch/arm/dts/sunxi-u-boot.dtsi | 68 ++++++++++++++++++++++++++++++++--
   1 file changed, 64 insertions(+), 4 deletions(-)
arch/arm/dts/sunxi-u-boot.dtsi +1 -0
index e1a9a7f5d4c..313fcad3922 100644
@@ -27,6 +27,38 @@
   #endif
 
   &binman {
+#ifdef CONFIG_SPL_FIT_SIGNATURE

arch/arm/dts/sunxi-u-boot.dtsi line 40

Quoted 10 lines
arch/arm/dts/sunxi-u-boot.dtsi +10 -0
+     spl {
+#ifdef CONFIG_SPL_IMAGE_TYPE_SUNXI_TOC0
+             filename = "spl/u-boot-spl.bin";
+#else
+             filename = "spl/sunxi-spl.bin";
+#endif
+
+             u-boot-spl-nodtb {
+             };
+

You're missing

#if !IS_ENABLED(CONFIG_SPL_SEPARATE_BSS)
                          u-boot-spl-bss-pad {
                          };

#endif /* !CONFIG_SPL_SEPARATE_BSS */

here.

arch/arm/dts/sunxi-u-boot.dtsi line 45

Quoted 5 lines
arch/arm/dts/sunxi-u-boot.dtsi +5 -0
+             u-boot-spl-pubkey-dtb {
+                     algo = "sha256,rsa2048";
+                     required = "conf";
+                     key-name-hint = "dev";
+             };

You're forcing the use of an RSA2048 key which is not recommended nowadays anymore as far as I know. RSA4096 is "better" when using RSA.

This also forces the user to have a dev.crt certificate to be able to build the image. It's not a secret or sensitive info so I guess that's fine.

Quoted 24 lines
arch/arm/dts/sunxi-u-boot.dtsi +17 -0
+     };
+
+#ifdef CONFIG_SPL_IMAGE_TYPE_SUNXI_TOC0
+     image {
+             filename = "spl/sunxi-spl.bin";
+
+             mkimage {
+                     args = "-a 0x20060 -T sunxi_toc0";
+                     data-to-imagename;
+
+                     u-boot-spl {
+                     };
+             };
+     };
+#endif
+#endif
       u-boot-sunxi-with-spl {
               filename = "u-boot-sunxi-with-spl.bin";
               pad-byte = <0xff>;
@@ -45,6 +77,9 @@
                       description = "Configuration to load U-Boot and firmware";
                       #address-cells = <1>;
                       fit,fdt-list = "of-list";
+#ifdef CONFIG_SPL_FIT_SIGNATURE
Quoted 8 lines

arch/arm/dts/sunxi-u-boot.dtsi line 83

Quoted 3 lines
arch/arm/dts/sunxi-u-boot.dtsi +2 -0
+                     fit,sign;
+#endif
 

This requires the user to sign as part of building U-Boot and therefore have access to the private key. Some users may want to sign separately from their U-Boot building step such that building can be done anywhere but signing is only done on specific infrastructure.

Quoted 3 lines

I wonder if binman could help here, perhaps by providing an option (for CI) to skip signing if the file is missing?

If fit,sign is there, we should sign and not give an option to silence fails. The fact we can have SPL_FIT_SIGNATURE enabled and not include the pubkey in the SPL DTB is already big enough of a footgun, we shouldn't add more 🙂

The thought I had a while ago was that we could simply have the whole setup without fit,sign property during typical build workflow and then sign with yet-unused info in the FIT Device Tree. Meaning the hash nodes are added, in images/confs/both, with the expected key-name-hint and all, but not signed (the pubkey can be inserted already if we have access to it, but maybe it's stored in an HSM also, not always easy to think about every possible scenario). So you generate an image with pubkey in SPL DTB, and unsigned FIT as u-boot.itb. Then have mkimage or binman run outside of the normal build workflow to sign required artifacts in u-boot.itb. All the info for that is hopefully still in the FIT Device Tree such that we can sign properly.

Cheers,
Quentin

#11 lore raw

Re: [PATCH v2 5/6] sunxi: extend binman FIT description for signed SPL images

Hi Quentin,

Quoted 103 lines · Quentin Schulz

Hi Simon,

Quoted 99 lines · Simon Glass

Hi Lukas, Quentin,

Quoted 95 lines · Quentin Schulz

Hi Lukas,

Quoted 8 lines · Lukas Schmid

Extend the sunxi binman/FIT description to support signed SPL FIT images. Add an SPL public-key DTB image, per-image hash nodes, fit,sign support, and a configuration signature that covers firmware, loadables and the selected FDT.

Handle TOC0 SPL output as well by adding the required filename and mkimage wrapping so the generated sunxi image remains verifiable.

I sympathize with the effort as I'd like something similar on Rockchip but I don't think this is right.

Quoted 14 lines
---
   arch/arm/dts/sunxi-u-boot.dtsi | 68 ++++++++++++++++++++++++++++++++--
   1 file changed, 64 insertions(+), 4 deletions(-)
arch/arm/dts/sunxi-u-boot.dtsi +1 -0
index e1a9a7f5d4c..313fcad3922 100644
@@ -27,6 +27,38 @@
   #endif
 
   &binman {
+#ifdef CONFIG_SPL_FIT_SIGNATURE

arch/arm/dts/sunxi-u-boot.dtsi line 40

Quoted 10 lines
arch/arm/dts/sunxi-u-boot.dtsi +10 -0
+     spl {
+#ifdef CONFIG_SPL_IMAGE_TYPE_SUNXI_TOC0
+             filename = "spl/u-boot-spl.bin";
+#else
+             filename = "spl/sunxi-spl.bin";
+#endif
+
+             u-boot-spl-nodtb {
+             };
+

You're missing

#if !IS_ENABLED(CONFIG_SPL_SEPARATE_BSS)
                          u-boot-spl-bss-pad {
                          };

#endif /* !CONFIG_SPL_SEPARATE_BSS */

here.

arch/arm/dts/sunxi-u-boot.dtsi line 45

Quoted 5 lines
arch/arm/dts/sunxi-u-boot.dtsi +5 -0
+             u-boot-spl-pubkey-dtb {
+                     algo = "sha256,rsa2048";
+                     required = "conf";
+                     key-name-hint = "dev";
+             };

You're forcing the use of an RSA2048 key which is not recommended nowadays anymore as far as I know. RSA4096 is "better" when using RSA.

This also forces the user to have a dev.crt certificate to be able to build the image. It's not a secret or sensitive info so I guess that's fine.

Quoted 20 lines
arch/arm/dts/sunxi-u-boot.dtsi +16 -0
+     };
+
+#ifdef CONFIG_SPL_IMAGE_TYPE_SUNXI_TOC0
+     image {
+             filename = "spl/sunxi-spl.bin";
+
+             mkimage {
+                     args = "-a 0x20060 -T sunxi_toc0";
+                     data-to-imagename;
+
+                     u-boot-spl {
+                     };
+             };
+     };
+#endif
+#endif
       u-boot-sunxi-with-spl {
               filename = "u-boot-sunxi-with-spl.bin";
               pad-byte = <0xff>;

arch/arm/dts/sunxi-u-boot.dtsi line 83

Quoted 7 lines
arch/arm/dts/sunxi-u-boot.dtsi +3 -0
@@ -45,6 +77,9 @@
                       description = "Configuration to load U-Boot and firmware";
                       #address-cells = <1>;
                       fit,fdt-list = "of-list";
+#ifdef CONFIG_SPL_FIT_SIGNATURE
+                     fit,sign;
+#endif
 

This requires the user to sign as part of building U-Boot and therefore have access to the private key. Some users may want to sign separately from their U-Boot building step such that building can be done anywhere but signing is only done on specific infrastructure.

Quoted 8 lines
Quoted 3 lines

I wonder if binman could help here, perhaps by providing an option (for CI) to skip signing if the file is missing?

If fit,sign is there, we should sign and not give an option to silence fails. The fact we can have SPL_FIT_SIGNATURE enabled and not include the pubkey in the SPL DTB is already big enough of a footgun, we shouldn't add more 🙂

Sure...I'm not suggesting that the build should succeed though...a bit like how we have 'buildman --allow-missing'. It's just a wacky idea so that we can avoid needing special cases everywhere.

Quoted 12 lines

The thought I had a while ago was that we could simply have the whole setup without fit,sign property during typical build workflow and then sign with yet-unused info in the FIT Device Tree. Meaning the hash nodes are added, in images/confs/both, with the expected key-name-hint and all, but not signed (the pubkey can be inserted already if we have access to it, but maybe it's stored in an HSM also, not always easy to think about every possible scenario). So you generate an image with pubkey in SPL DTB, and unsigned FIT as u-boot.itb. Then have mkimage or binman run outside of the normal build workflow to sign required artifacts in u-boot.itb. All the info for that is hopefully still in the FIT Device Tree such that we can sign properly.

Yes I thought we had that feature somewhere but can't remember where. It might have been my imagination.

Regards,
Simon

#12 lore raw

PATCH v2 6/6 sunxi: add support for NetCube Systems Nagami and associated carrier boards

In reply to Lukas Schmid

NetCube Systems Nagami is a system-on-module based on the Allwinner T113-S3 and T113-S4 series chips.

Its features include:
* Dual ARM Cortex-A7 @ 1.2 GHz
* 128/256 MiB DDR3 memory, 4 GiB eMMC
* 10/100 Ethernet PHY
* 1x USB 2.0 OTG, 1x USB 2.0 host
* 1x SPI interface with HOLD/WP
* Up to 5 UARTs (2 with RTS/CTS)
* Up to 4 I2C interfaces
* Up to 2 CAN 2.0B interfaces
* Up to 2 I2S/PCM interfaces
* Up to 1 SPDIF input and output
* I2C extension interface with INT

Add defconfigs for the basic carrier and keypad carrier variants, plus a secure-boot example defconfig for the basic carrier.

The basic carrier brings out the SD interface to a microSD slot, the USB host to USB-A, and USB OTG to micro-B. It has an Ethernet MagJack and exposes CAN, I2C, SPI, I2S and GPIO signals on pin headers.

The keypad carrier adds an I2C-connected PN532 NFC reader, a 4x3 keypad, Ethernet with PoE, a USB mini-B diagnostics port, and a two-colour status LED.

---
 .../netcube_nagami_basic_carrier_defconfig    | 43 +++++++++++++++
 ..._nagami_basic_carrier_secureboot_defconfig | 52 +++++++++++++++++++
 .../netcube_nagami_keypad_carrier_defconfig   | 43 +++++++++++++++
 3 files changed, 138 insertions(+)
 create mode 100644 configs/netcube_nagami_basic_carrier_defconfig
 create mode 100644 configs/netcube_nagami_basic_carrier_secureboot_defconfig
 create mode 100644 configs/netcube_nagami_keypad_carrier_defconfig
configs/netcube_nagami_basic_carrier_defconfig new file +43 -0
new file mode 100644
index 00000000000..ab56479545d
@@ -0,0 +1,43 @@
+CONFIG_ARM=y
+CONFIG_ARCH_SUNXI=y
+CONFIG_DEFAULT_DEVICE_TREE="allwinner/sun8i-t113s-netcube-nagami-basic-carrier"
+CONFIG_DRAM_CLK=792
+CONFIG_SPL=y
+CONFIG_DRAM_SUNXI_ODT_EN=0
+CONFIG_DRAM_SUNXI_TPR0=0x004a2195
+CONFIG_DRAM_SUNXI_TPR11=0x340000
+CONFIG_DRAM_SUNXI_TPR12=0x46
+CONFIG_DRAM_SUNXI_TPR13=0x34000100
+CONFIG_MACH_SUN8I_R528=y
+CONFIG_DRAM_ZQ=8092667
+CONFIG_SUNXI_MINIMUM_DRAM_MB=128
+CONFIG_MMC_SUNXI_SLOT_EXTRA=2
+# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
+CONFIG_BOOTDELAY=1
+CONFIG_PREBOOT="gpio set PD9"
+# CONFIG_SYS_DEVICE_NULLDEV is not set
+# CONFIG_SYS_MMCSD_FS_BOOT is not set
+CONFIG_SYS_PROMPT="Nagami> "
+CONFIG_CMD_EEPROM=y
+CONFIG_SYS_I2C_EEPROM_BUS=1
+CONFIG_CMD_I2C=y
+CONFIG_CMD_USB_MASS_STORAGE=y
+CONFIG_ENV_IS_IN_MMC=y
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
+CONFIG_USE_HOSTNAME=y
+CONFIG_HOSTNAME="nagami"
+CONFIG_VERSION_VARIABLE=y
+# CONFIG_USB_FUNCTION_FASTBOOT is not set
+CONFIG_SYS_I2C_MVTWSI=y
+CONFIG_MISC=y
+CONFIG_NVMEM=y
+CONFIG_I2C_EEPROM=y
+CONFIG_SYS_I2C_EEPROM_ADDR=0x50
+CONFIG_SUPPORT_EMMC_BOOT=y
+CONFIG_RMII=y
+CONFIG_SUN8I_EMAC=y
+CONFIG_CONS_INDEX=4
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_OHCI_HCD=y
+CONFIG_USB_MUSB_GADGET=y
+CONFIG_USB_GADGET_DOWNLOAD=y
configs/netcube_nagami_basic_carrier_secureboot_defconfig new file +52 -0

52 lines not on this page · raw message

configs/netcube_nagami_keypad_carrier_defconfig new file +43 -0

43 lines not on this page · raw message

Signature · 1 line
2.47.3