Skip to contentSkip to conversation

bootstd: sunxi: Migrate to standard boot

PATCH Superseded Simon Glass 3 participants 12 messages Aug 7, 2024 – Aug 23, 2024

Subsystems (4)

v1 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

cover bootstd: sunxi: Migrate to standard boot

This series attempts to migrate all sunxi boards to use standard boot, along with a text environment.

Simon Glass (6):
sunxi: Drop BOOTCMD_SUNXI_COMPAT
sunxi: Add a bootmeth for FEL
sunxi: Move to bootstd
sunxi: Drop old distro boot variables
env: Provide a work-around for unquoting fdtfile
sunxi: Move to text environment

 Makefile                                      |   1 +
 arch/arm/Kconfig                              |   2 +-
 arch/arm/include/asm/arch-sunxi/clock_sun4i.h |  10 -
 arch/arm/mach-sunxi/Kconfig                   |  12 -
 arch/arm/mach-sunxi/dram_sun4i.c              |   4 -
 board/sunxi/sunxi.env                         | 138 ++++++++++
 boot/Kconfig                                  |  14 ++
 boot/Makefile                                 |   1 +
 boot/bootmeth_fel.c                           |  81 ++++++
 configs/icnova-a20-swac_defconfig             |   1 -
 doc/usage/environment.rst                     |  12 +
 include/configs/sunxi-common.h                | 238 ------------------
 12 files changed, 248 insertions(+), 266 deletions(-)
 create mode 100644 board/sunxi/sunxi.env
 create mode 100644 boot/bootmeth_fel.c
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/6 sunxi: Drop BOOTCMD_SUNXI_COMPAT

This dates from 2015 and talks about 'old' 3.x kernels. Perhaps we can drop this functionality now?

---

 arch/arm/include/asm/arch-sunxi/clock_sun4i.h | 10 ----------
 arch/arm/mach-sunxi/Kconfig                   | 12 ------------
 arch/arm/mach-sunxi/dram_sun4i.c              |  4 ----
 configs/icnova-a20-swac_defconfig             |  1 -
 include/configs/sunxi-common.h                | 17 -----------------
 5 files changed, 44 deletions(-)
arch/arm/include/asm/arch-sunxi/clock_sun4i.h +0 -10
index 2cec91cb20e..c0a438dee53 100644
@@ -142,17 +142,7 @@ struct sunxi_ccm_reg {
 #define CCM_PLL1_CFG_FACTOR_M_SHIFT		0
 
 #define PLL1_CFG_DEFAULT	0xa1005000
-
-#if defined CONFIG_OLD_SUNXI_KERNEL_COMPAT && defined CONFIG_MACH_SUN5I
-/*
- * Older linux-sunxi-3.4 kernels override our PLL6 setting with 300 MHz,
- * halving the mbus frequency, so set it to 300 MHz ourselves and base the
- * mbus divider on that.
- */
-#define PLL6_CFG_DEFAULT	0xa1009900
-#else
 #define PLL6_CFG_DEFAULT	0xa1009911
-#endif
 
 /* nand clock */
 #define NAND_CLK_SRC_OSC24		0
arch/arm/mach-sunxi/Kconfig +0 -12
index 17666814c52..67c141ced80 100644
@@ -294,7 +294,6 @@ config MACH_SUN6I
 	select SUNXI_GEN_SUN6I
 	select SUPPORT_SPL
 	select SYS_I2C_SUN6I_P2WI
-	select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT
 
 config MACH_SUN7I
 	bool "sun7i (Allwinner A20)"
@@ -306,7 +305,6 @@ config MACH_SUN7I
 	select DRAM_SUN4I
 	select SUNXI_GEN_SUN4I
 	select SUPPORT_SPL
-	select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT
 	imply SPL_SYS_I2C_LEGACY
 	imply SYS_I2C_LEGACY
 
@@ -321,7 +319,6 @@ config MACH_SUN8I_A23
 	select SUNXI_GEN_SUN6I
 	select SUPPORT_SPL
 	select SYS_I2C_SUN8I_RSB
-	select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT
 
 config MACH_SUN8I_A33
 	bool "sun8i (Allwinner A33)"
@@ -334,7 +331,6 @@ config MACH_SUN8I_A33
 	select SUNXI_GEN_SUN6I
 	select SUPPORT_SPL
 	select SYS_I2C_SUN8I_RSB
-	select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT
 
 config MACH_SUN8I_A83T
 	bool "sun8i (Allwinner A83T)"
@@ -354,7 +350,6 @@ config MACH_SUN8I_H3
 	select CPU_V7_HAS_VIRT
 	select ARCH_SUPPORT_PSCI
 	select MACH_SUNXI_H3_H5
-	select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT
 
 config MACH_SUN8I_R40
 	bool "sun8i (Allwinner R40)"
@@ -392,7 +387,6 @@ config MACH_SUN8I_V3S
 	select SUNXI_DRAM_DW
 	select SUNXI_DRAM_DW_16BIT
 	select SUPPORT_SPL
-	select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT
 
 config MACH_SUN9I
 	bool "sun9i (Allwinner A80)"
@@ -746,12 +740,6 @@ config UART0_PORT_F
 	at the same time, the system can be only booted in the FEL mode.
 	Only enable this if you really know what you are doing.
 
-config OLD_SUNXI_KERNEL_COMPAT
-	bool "Enable workarounds for booting old kernels"
-	---help---
-	Set this to enable various workarounds for old kernels, this results in
-	sub-optimal settings for newer kernels, only enable if needed.
-
 config MMC1_PINS_PH
 	bool "Pins for mmc1 are on Port H"
 	depends on MACH_SUN4I || MACH_SUN7I || MACH_SUN8I_R40
arch/arm/mach-sunxi/dram_sun4i.c +0 -4
index 2cce381c9df..dfdb32111b4 100644
@@ -249,10 +249,6 @@ static void mctl_setup_dram_clock(u32 clk, u32 mbus_clk)
 	reg_val &= ~CCM_PLL5_CTRL_K_MASK;		/* set K to 0 (x1) */
 	reg_val &= ~CCM_PLL5_CTRL_N_MASK;		/* set N to 0 (x0) */
 	reg_val &= ~CCM_PLL5_CTRL_P_MASK;		/* set P to 0 (x1) */
-#ifdef CONFIG_OLD_SUNXI_KERNEL_COMPAT
-	/* Old kernels are hardcoded to P=1 (divide by 2) */
-	reg_val |= CCM_PLL5_CTRL_P(1);
-#endif
 	if (clk >= 540 && clk < 552) {
 		/* dram = 540MHz */
 		reg_val |= CCM_PLL5_CTRL_M(CCM_PLL5_CTRL_M_X(2));
configs/icnova-a20-swac_defconfig +0 -1
index 30c28f70857..b942fab2bc7 100644
@@ -8,7 +8,6 @@ CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-icnova-swac"
 CONFIG_SPL=y
 CONFIG_MACH_SUN7I=y
 CONFIG_DRAM_CLK=384
-CONFIG_OLD_SUNXI_KERNEL_COMPAT=y
 CONFIG_USB0_VBUS_PIN="PG11"
 CONFIG_USB0_VBUS_DET="PH7"
 CONFIG_USB1_VBUS_PIN="PG10"
include/configs/sunxi-common.h +0 -17
index b29a25d5617..6ae6ef1b19c 100644
@@ -226,22 +226,6 @@
 	BOOT_TARGET_DEVICES_PXE(func) \
 	BOOT_TARGET_DEVICES_DHCP(func)
 
-#ifdef CONFIG_OLD_SUNXI_KERNEL_COMPAT
-#define BOOTCMD_SUNXI_COMPAT \
-	"bootcmd_sunxi_compat=" \
-		"setenv root /dev/mmcblk0p3 rootwait; " \
-		"if ext2load mmc 0 0x44000000 uEnv.txt; then " \
-			"echo Loaded environment from uEnv.txt; " \
-			"env import -t 0x44000000 ${filesize}; " \
-		"fi; " \
-		"setenv bootargs console=${console} root=${root} ${extraargs}; " \
-		"ext2load mmc 0 0x43000000 script.bin && " \
-		"ext2load mmc 0 0x48000000 uImage && " \
-		"bootm 0x48000000\0"
-#else
-#define BOOTCMD_SUNXI_COMPAT
-#endif
-
 #include <config_distro_bootcmd.h>
 
 #ifdef CONFIG_USB_KEYBOARD
@@ -296,7 +280,6 @@
 	"uuid_gpt_esp=" UUID_GPT_ESP "\0" \
 	"uuid_gpt_system=" UUID_GPT_SYSTEM "\0" \
 	"partitions=" PARTS_DEFAULT "\0" \
-	BOOTCMD_SUNXI_COMPAT \
 	BOOTENV
 
 #endif /* _SUNXI_COMMON_CONFIG_H */
Signature · 1 line
2.34.1
#2 lore raw

PATCH 2/6 sunxi: Add a bootmeth for FEL

In reply to Simon Glass

Add support for booting from a script loaded over FEL. This mirrors the bootcmd_fel provided by distro boot.

---

 boot/Kconfig        | 14 ++++++++
 boot/Makefile       |  1 +
 boot/bootmeth_fel.c | 81 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 96 insertions(+)
 create mode 100644 boot/bootmeth_fel.c
boot/Kconfig +14 -0
index 940389d4882..77f6382ab2a 100644
@@ -585,6 +585,20 @@ config BOOTMETH_EFI_BOOTMGR
 	  the EFI binary to be launched is determined. To set the EFI variables
 	  use the eficonfig command.
 
+config BOOTMETH_FEL
+	bool "Bootdev support for Sunxi FEL"
+	depends on ARCH_SUNXI
+	default y
+	help
+	  Enables support for booting over USB on a Sunxi device. This uses
+	  the FEL protocol and obtains the script address from the
+	  'fel_scriptaddr' environment variable.
+
+	  This method is only available if booting from FEL, i.e. the
+	  'fel_booted' environment variable is set.
+
+	  See https://linux-sunxi.org/FEL/Protocol for more information.
+
 config BOOTMETH_QFW
 	bool "Boot method using QEMU parameters"
 	depends on QFW
boot/Makefile +1 -0
index dff6f99081a..4a23fcdbfad 100644
@@ -30,6 +30,7 @@ obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_EXTLINUX) += bootmeth_extlinux.o
 obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_EXTLINUX_PXE) += bootmeth_pxe.o
 obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_EFILOADER) += bootmeth_efi.o
 obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_CROS) += bootm.o bootm_os.o bootmeth_cros.o
+obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_FEL) += bootmeth_fel.o
 obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_QFW) += bootmeth_qfw.o
 obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_SANDBOX) += bootmeth_sandbox.o
 obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_SCRIPT) += bootmeth_script.o
boot/bootmeth_fel.c new file +81 -0

81 lines not on this page · raw message

Signature · 1 line
2.34.1
Reviewed-by on v1 2/6
#3 lore raw

Re: [PATCH 2/6] sunxi: Add a bootmeth for FEL

Hi Simon,

Thank you for the patch.

Quoted 4 lines · Simon Glass

Add support for booting from a script loaded over FEL. This mirrors the bootcmd_fel provided by distro boot.

Quoted 8 lines

---

 boot/Kconfig        | 14 ++++++++
 boot/Makefile       |  1 +
 boot/bootmeth_fel.c | 81 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 96 insertions(+)
 create mode 100644 boot/bootmeth_fel.c
#4 lore raw

PATCH 3/6 sunxi: Move to bootstd

In reply to Simon Glass

Drop support for distroboot and move to using bootstd instead.

---

 arch/arm/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/Kconfig +1 -1
index ba0359fed5a..5fb14cb23c0 100644
@@ -1179,7 +1179,7 @@ config ARCH_SUNXI
 	imply CMD_DM
 	imply CMD_GPT
 	imply CMD_UBI if MTD_RAW_NAND
-	imply DISTRO_DEFAULTS
+	imply BOOTSTD_DEFAULTS
 	imply DM_REGULATOR
 	imply DM_REGULATOR_FIXED
 	imply FAT_WRITE
Signature · 1 line
2.34.1
#5 lore raw

PATCH 4/6 sunxi: Drop old distro boot variables

In reply to Simon Glass

These are not needed as bootstd handles the boot now. Drop them.

---

 include/configs/sunxi-common.h | 75 +---------------------------------
 1 file changed, 1 insertion(+), 74 deletions(-)
include/configs/sunxi-common.h +1 -74
index 6ae6ef1b19c..ac868ebe1d4 100644
@@ -156,78 +156,6 @@
 	"fdt ram " FDT_ADDR_R " 0x100000;" \
 	"ramdisk ram " RAMDISK_ADDR_R " 0x4000000\0"
 
-/****************************************************************************
- *                  definitions for the distro boot system                  *
- ****************************************************************************/
-#ifdef CONFIG_MMC
-#if CONFIG_MMC_SUNXI_SLOT_EXTRA != -1
-#define BOOTENV_DEV_MMC_AUTO(devtypeu, devtypel, instance)		\
-	BOOTENV_DEV_MMC(MMC, mmc, 0)					\
-	BOOTENV_DEV_MMC(MMC, mmc, 1)					\
-	"bootcmd_mmc_auto="						\
-		"if test ${mmc_bootdev} -eq 1; then "			\
-			"run bootcmd_mmc1; "				\
-			"run bootcmd_mmc0; "				\
-		"elif test ${mmc_bootdev} -eq 0; then "			\
-			"run bootcmd_mmc0; "				\
-			"run bootcmd_mmc1; "				\
-		"fi\0"
-
-#define BOOTENV_DEV_NAME_MMC_AUTO(devtypeu, devtypel, instance) \
-	"mmc_auto "
-
-#define BOOT_TARGET_DEVICES_MMC(func) func(MMC_AUTO, mmc_auto, na)
-#else
-#define BOOT_TARGET_DEVICES_MMC(func) func(MMC, mmc, 0)
-#endif
-#else
-#define BOOT_TARGET_DEVICES_MMC(func)
-#endif
-
-#ifdef CONFIG_AHCI
-#define BOOT_TARGET_DEVICES_SCSI(func) func(SCSI, scsi, 0)
-#else
-#define BOOT_TARGET_DEVICES_SCSI(func)
-#endif
-
-#ifdef CONFIG_USB_STORAGE
-#define BOOT_TARGET_DEVICES_USB(func) func(USB, usb, 0)
-#else
-#define BOOT_TARGET_DEVICES_USB(func)
-#endif
-
-#ifdef CONFIG_CMD_PXE
-#define BOOT_TARGET_DEVICES_PXE(func) func(PXE, pxe, na)
-#else
-#define BOOT_TARGET_DEVICES_PXE(func)
-#endif
-
-#ifdef CONFIG_CMD_DHCP
-#define BOOT_TARGET_DEVICES_DHCP(func) func(DHCP, dhcp, na)
-#else
-#define BOOT_TARGET_DEVICES_DHCP(func)
-#endif
-
-/* FEL boot support, auto-execute boot.scr if a script address was provided */
-#define BOOTENV_DEV_FEL(devtypeu, devtypel, instance) \
-	"bootcmd_fel=" \
-		"if test -n ${fel_booted} && test -n ${fel_scriptaddr}; then " \
-			"echo '(FEL boot)'; " \
-			"source ${fel_scriptaddr}; " \
-		"fi\0"
-#define BOOTENV_DEV_NAME_FEL(devtypeu, devtypel, instance) \
-	"fel "
-
-#define BOOT_TARGET_DEVICES(func) \
-	func(FEL, fel, na) \
-	BOOT_TARGET_DEVICES_MMC(func) \
-	BOOT_TARGET_DEVICES_SCSI(func) \
-	BOOT_TARGET_DEVICES_USB(func) \
-	BOOT_TARGET_DEVICES_PXE(func) \
-	BOOT_TARGET_DEVICES_DHCP(func)
-
-#include <config_distro_bootcmd.h>
-
 #ifdef CONFIG_USB_KEYBOARD
 #define CONSOLE_STDIN_SETTINGS \
 	"stdin=serial,usbkbd\0"
@@ -279,7 +207,6 @@
 	"console=ttyS0,115200\0" \
 	"uuid_gpt_esp=" UUID_GPT_ESP "\0" \
 	"uuid_gpt_system=" UUID_GPT_SYSTEM "\0" \
-	"partitions=" PARTS_DEFAULT "\0" \
-	BOOTENV
+	"partitions=" PARTS_DEFAULT "\0"
 
 #endif /* _SUNXI_COMMON_CONFIG_H */
Signature · 1 line
2.34.1
#6 lore raw

PATCH 5/6 env: Provide a work-around for unquoting fdtfile

In reply to Simon Glass

Some boards use a CONFIG option to specify the value of this variable. This is normally handled by efi_get_distro_fdt_name() but in the case of sunxi this does not work, since 'soc' is sunxi, but the files are in the allwinner directory.

Provide a work-around for this particular case.

---

 Makefile                  |  1 +
 doc/usage/environment.rst | 12 ++++++++++++
 2 files changed, 13 insertions(+)
Makefile +1 -0
index 2861b4d1402..8ea3308160f 100644
@@ -1842,6 +1842,7 @@ quiet_cmd_gen_envp = ENVP    $@
 		$(CPP) -P $(CFLAGS) -x assembler-with-cpp -undef \
 			-D__ASSEMBLY__ \
 			-D__UBOOT_CONFIG__ \
+			-DDEFAULT_DEVICE_TREE=$(subst ",,$(CONFIG_DEFAULT_DEVICE_TREE)) \
 			-I . -I include -I $(srctree)/include \
 			-include linux/kconfig.h -include include/config.h \
 			-I$(srctree)/arch/$(ARCH)/include \
doc/usage/environment.rst +12 -0
index cc33d3ec0f2..eaebf61742a 100644
@@ -87,6 +87,18 @@ settings. For example::
 
    #include <env/ti/mmc.env>
 
+Quotes are not supressed, for example::
+
+    fdtfile=CONFIG_DEFAULT_DEVICE_TREE.dtb
+    # produces: fdtfile="sun7i-a20-pcduino3.dtb"
+
+For this particular issue you can use DEFAULT_DEVICE_TREE instead::
+
+    fdtfile=DEFAULT_DEVICE_TREE.dtb
+    # produces: fdtfile=sun7i-a20-pcduino3.dtb
+
+There is no general way to remove quotes.
+
 If CONFIG_ENV_SOURCE_FILE is empty and the default filename is not present, then
 the old-style C environment is used instead. See below.
 
Signature · 1 line
2.34.1
#7 lore raw

PATCH 6/6 sunxi: Move to text environment

In reply to Simon Glass

Convert these boards to use a text environment.

For the boards check, the only differences are extra spaces after the semicolons in 'dfu_alt_info_ram' and 'partitions', both of which are permitted.

---

 board/sunxi/sunxi.env          | 138 ++++++++++++++++++++++++++++++
 include/configs/sunxi-common.h | 148 ---------------------------------
 2 files changed, 138 insertions(+), 148 deletions(-)
 create mode 100644 board/sunxi/sunxi.env
board/sunxi/sunxi.env new file +138 -0
new file mode 100644
index 00000000000..9be21bee086
@@ -0,0 +1,138 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Common sunxi environment
+ *
+ * Copyright 2024 Google LLC
+ * Written by Simon Glass <[email protected]>
+ /
+
+/****************************************************************************
+ *           environment variables holding default load addresses           *
+ ****************************************************************************/
+/*
+ * We cannot use expressions here, because expressions won't be evaluated in
+ * autoconf.mk.
+ */
+#ifdef CONFIG_ARM64
+/*
+ * Boards seem to come with at least 512MB of DRAM.
+ * The kernel should go at 512K, which is the default text offset (that will
+ * be adjusted at runtime if needed).
+ * There is no compression for arm64 kernels (yet), so leave some space
+ * for really big kernels, say 256MB for now.
+ * Scripts, PXE and DTBs should go afterwards, leaving the rest for the initrd.
+ */
+#define BOOTM_SIZE        0xa000000
+#define KERNEL_ADDR_R     SDRAM_OFFSET(0080000)
+#define KERNEL_COMP_ADDR_R SDRAM_OFFSET(4000000)
+#define KERNEL_COMP_SIZE  0xb000000
+#define FDT_ADDR_R        SDRAM_OFFSET(FA00000)
+#define SCRIPT_ADDR_R     SDRAM_OFFSET(FC00000)
+#define PXEFILE_ADDR_R    SDRAM_OFFSET(FD00000)
+#define FDTOVERLAY_ADDR_R SDRAM_OFFSET(FE00000)
+#define RAMDISK_ADDR_R    SDRAM_OFFSET(FF00000)
+
+#elif (CONFIG_SUNXI_MINIMUM_DRAM_MB >= 256)
+/*
+ * 160M RAM (256M minimum minus 64MB heap + 32MB for u-boot, stack, fb, etc.
+ * 32M uncompressed kernel, 16M compressed kernel, 1M fdt,
+ * 1M script, 1M pxe, 1M dt overlay and the ramdisk at the end.
+ */
+#define BOOTM_SIZE        0xa000000
+#define KERNEL_ADDR_R     SDRAM_OFFSET(2000000)
+#define FDT_ADDR_R        SDRAM_OFFSET(3000000)
+#define SCRIPT_ADDR_R     SDRAM_OFFSET(3100000)
+#define PXEFILE_ADDR_R    SDRAM_OFFSET(3200000)
+#define FDTOVERLAY_ADDR_R SDRAM_OFFSET(3300000)
+#define RAMDISK_ADDR_R    SDRAM_OFFSET(3400000)
+
+#elif (CONFIG_SUNXI_MINIMUM_DRAM_MB >= 64)
+/*
+ * 64M RAM minus 2MB heap + 16MB for u-boot, stack, fb, etc.
+ * 16M uncompressed kernel, 8M compressed kernel, 1M fdt,
+ * 1M script, 1M pxe, 1M dt overlay and the ramdisk at the end.
+ */
+#define BOOTM_SIZE        0x2e00000
+#define KERNEL_ADDR_R     SDRAM_OFFSET(1000000)
+#define FDT_ADDR_R        SDRAM_OFFSET(1800000)
+#define SCRIPT_ADDR_R     SDRAM_OFFSET(1900000)
+#define PXEFILE_ADDR_R    SDRAM_OFFSET(1A00000)
+#define FDTOVERLAY_ADDR_R SDRAM_OFFSET(1B00000)
+#define RAMDISK_ADDR_R    SDRAM_OFFSET(1C00000)
+
+#elif (CONFIG_SUNXI_MINIMUM_DRAM_MB >= 32)
+/*
+ * 32M RAM minus 2.5MB for u-boot, heap, stack, etc.
+ * 16M uncompressed kernel, 7M compressed kernel, 128K fdt, 64K script,
+ * 128K DT overlay, 128K PXE and the ramdisk in the rest (max. 5MB)
+ */
+#define BOOTM_SIZE        0x1700000
+#define KERNEL_ADDR_R     SDRAM_OFFSET(1000000)
+#define FDT_ADDR_R        SDRAM_OFFSET(1d50000)
+#define SCRIPT_ADDR_R     SDRAM_OFFSET(1d40000)
+#define PXEFILE_ADDR_R    SDRAM_OFFSET(1d00000)
+#define FDTOVERLAY_ADDR_R SDRAM_OFFSET(1d20000)
+#define RAMDISK_ADDR_R    SDRAM_OFFSET(1800000)
+
+#else
+#error Need at least 32MB of DRAM. Please adjust load addresses.
+#endif
+
+#define UUID_GPT_ESP ""
+
+#ifdef CONFIG_ARM64
+#define UUID_GPT_SYSTEM b921b045-1df0-41c3-af44-4c6f280d3fae
+#else
+#define UUID_GPT_SYSTEM 69dad710-2ce4-4e3c-b16c-21a1d49abed3
+#endif
+
+stdin=serial
+#ifdef CONFIG_USB_KEYBOARD
+stdin+=,usbkbd
+#endif
+
+stdout=serial
+stderr=serial
+#ifdef CONFIG_VIDEO
+stdout+=,vidconsole
+stderr+=,vidconsole
+#endif
+
+bootm_size=BOOTM_SIZE
+kernel_addr_r=KERNEL_ADDR_R
+fdt_addr_r=FDT_ADDR_R
+scriptaddr=SCRIPT_ADDR_R
+pxefile_addr_r=PXEFILE_ADDR_R
+fdtoverlay_addr_r=FDTOVERLAY_ADDR_R
+ramdisk_addr_r=RAMDISK_ADDR_R
+
+#ifdef CONFIG_ARM64
+kernel_comp_addr_r=KERNEL_COMP_ADDR_R
+kernel_comp_size=KERNEL_COMP_SIZE
+#endif
+
+dfu_alt_info_ram=
+  kernel ram KERNEL_ADDR_R 0x1000000;
+  fdt ram FDT_ADDR_R 0x100000;
+  ramdisk ram RAMDISK_ADDR_R 0x4000000
+
+#ifdef CONFIG_ARM64
+fdtfile=allwinner/DEFAULT_DEVICE_TREE.dtb
+#else
+fdtfile=DEFAULT_DEVICE_TREE.dtb
+#endif
+
+console=ttyS0,115200
+
+uuid_gpt_esp=c12a7328-f81f-11d2-ba4b-00a0c93ec93b
+#ifdef CONFIG_ARM64
+uuid_gpt_system=b921b045-1df0-41c3-af44-4c6f280d3fae
+#else
+uuid_gpt_system=69dad710-2ce4-4e3c-b16c-21a1d49abed3
+#endif
+
+partitions=
+  name=loader1,start=8k,size=32k,uuid=${uuid_gpt_loader1};
+  name=loader2,size=984k,uuid=${uuid_gpt_loader2};
+  name=esp,size=128M,bootable,uuid=${uuid_gpt_esp};
+  name=system,size=-,uuid=${uuid_gpt_system};
include/configs/sunxi-common.h +0 -148

152 lines not on this page · raw message

Signature · 1 line
2.34.1
#8 lore raw
In reply to Simon Glass

On Wed, 7 Aug 2024 14:50:26 -0600
Simon Glass <[email protected]> wrote:

Hey Simon,

Quoted 2 lines

This series attempts to migrate all sunxi boards to use standard boot, along with a text environment.

Ah, many thanks for that! I figured that we need a bootmeth for FEL, but never got around to have a closer look.
On a coarse glance, this looks roughly OK, and doing a super quick boot test on one board, it seems to still work(TM), though the priority of the FEL boot is not right?
And I guess ditching the old kernel support might be a bit controversial. I think this is about the vendor kernels, which some people still rely on?

I will have a closer look this week and give you a review, just wanted to acknowledge the series and thank you for your efforts.

Cheers,
Andre

Quoted 24 lines

Simon Glass (6):
sunxi: Drop BOOTCMD_SUNXI_COMPAT
sunxi: Add a bootmeth for FEL
sunxi: Move to bootstd
sunxi: Drop old distro boot variables
env: Provide a work-around for unquoting fdtfile
sunxi: Move to text environment

 Makefile                                      |   1 +
 arch/arm/Kconfig                              |   2 +-
 arch/arm/include/asm/arch-sunxi/clock_sun4i.h |  10 -
 arch/arm/mach-sunxi/Kconfig                   |  12 -
 arch/arm/mach-sunxi/dram_sun4i.c              |   4 -
 board/sunxi/sunxi.env                         | 138 ++++++++++
 boot/Kconfig                                  |  14 ++
 boot/Makefile                                 |   1 +
 boot/bootmeth_fel.c                           |  81 ++++++
 configs/icnova-a20-swac_defconfig             |   1 -
 doc/usage/environment.rst                     |  12 +
 include/configs/sunxi-common.h                | 238 ------------------
 12 files changed, 248 insertions(+), 266 deletions(-)
 create mode 100644 board/sunxi/sunxi.env
 create mode 100644 boot/bootmeth_fel.c
#9 lore raw

Hi Andre,

Quoted 6 lines · Andre Przywara

On Wed, 7 Aug 2024 14:50:26 -0600
Simon Glass <[email protected]> wrote:

Hey Simon,

Quoted 8 lines
Quoted 2 lines

This series attempts to migrate all sunxi boards to use standard boot, along with a text environment.

Ah, many thanks for that! I figured that we need a bootmeth for FEL, but never got around to have a closer look.
On a coarse glance, this looks roughly OK, and doing a super quick boot test on one board, it seems to still work(TM), though the priority of the FEL boot is not right?

Does it need to be the top priority, perhaps?

Quoted 2 lines

And I guess ditching the old kernel support might be a bit controversial. I think this is about the vendor kernels, which some people still rely on?

OK, perhaps it is. It might be a little tricky to handle it, but I suspect another bootmeth might be enough.

Quoted 3 lines

I will have a closer look this week and give you a review, just wanted to acknowledge the series and thank you for your efforts.

OK thank you.

Regards,
Simon

Quoted 29 lines

Cheers,
Andre

Quoted 24 lines

Simon Glass (6):
sunxi: Drop BOOTCMD_SUNXI_COMPAT
sunxi: Add a bootmeth for FEL
sunxi: Move to bootstd
sunxi: Drop old distro boot variables
env: Provide a work-around for unquoting fdtfile
sunxi: Move to text environment

 Makefile                                      |   1 +
 arch/arm/Kconfig                              |   2 +-
 arch/arm/include/asm/arch-sunxi/clock_sun4i.h |  10 -
 arch/arm/mach-sunxi/Kconfig                   |  12 -
 arch/arm/mach-sunxi/dram_sun4i.c              |   4 -
 board/sunxi/sunxi.env                         | 138 ++++++++++
 boot/Kconfig                                  |  14 ++
 boot/Makefile                                 |   1 +
 boot/bootmeth_fel.c                           |  81 ++++++
 configs/icnova-a20-swac_defconfig             |   1 -
 doc/usage/environment.rst                     |  12 +
 include/configs/sunxi-common.h                | 238 ------------------
 12 files changed, 248 insertions(+), 266 deletions(-)
 create mode 100644 board/sunxi/sunxi.env
 create mode 100644 boot/bootmeth_fel.c
#10 lore raw

On Tue, 13 Aug 2024 06:17:17 -0600
Simon Glass <[email protected]> wrote:

Hi Simon,

I had a bit deeper look yesterday.

Quoted 12 lines

Hi Andre,

Quoted 9 lines · Andre Przywara

On Wed, 7 Aug 2024 14:50:26 -0600
Simon Glass <[email protected]> wrote:

Hey Simon,

Quoted 2 lines

This series attempts to migrate all sunxi boards to use standard boot, along with a text environment.

Quoted 7 lines
Quoted 5 lines

Ah, many thanks for that! I figured that we need a bootmeth for FEL, but never got around to have a closer look.
On a coarse glance, this looks roughly OK, and doing a super quick boot test on one board, it seems to still work(TM), though the priority of the FEL boot is not right?

Does it need to be the top priority, perhaps?

Yes, please. It should only trigger when you a) do FEL booting and b) upload a boot script via FEL, in which case you surely want to execute that before anything else. From what I see the global EFI bootmeth is first in the list, but I couldn't find an easy way to fix this in the source file. Would that go through a platform specific bootmeths env variable?

Quoted 5 lines
Quoted 2 lines

And I guess ditching the old kernel support might be a bit controversial. I think this is about the vendor kernels, which some people still rely on?

OK, perhaps it is. It might be a little tricky to handle it, but I suspect another bootmeth might be enough.

Well, I had a look, and it looks like CONFIG_OLD_SUNXI_KERNEL_COMPAT covers multiple things:
- it sets up some clocks slightly differently
- it enters the kernel (stays?) in secure mode
- it provides a custom boot script

I think the latter can be replaced quite easily with something custom, and I guess it's the only one biting you? So I am OK with that going, but I think we should keep the first two features (and thus the Kconfig symbol).

Another thing I discovered: we lose USB support with patch 3/6. The reason is that USB support is enabled by having DISTRO_DEFAULTS. Just replacing that with BOOTSTD_DEFAULTS didn't work, though, I get a (ridiculous) splat about a circular Kconfig dependency. My hunch is that's something else not right in Kconfig, but I need to have a closer look.

Cheers,
Andre

Quoted 40 lines
Quoted 4 lines

I will have a closer look this week and give you a review, just wanted to acknowledge the series and thank you for your efforts.

OK thank you.

Regards,
Simon

Quoted 29 lines

Cheers,
Andre

Quoted 24 lines

Simon Glass (6):
sunxi: Drop BOOTCMD_SUNXI_COMPAT
sunxi: Add a bootmeth for FEL
sunxi: Move to bootstd
sunxi: Drop old distro boot variables
env: Provide a work-around for unquoting fdtfile
sunxi: Move to text environment

 Makefile                                      |   1 +
 arch/arm/Kconfig                              |   2 +-
 arch/arm/include/asm/arch-sunxi/clock_sun4i.h |  10 -
 arch/arm/mach-sunxi/Kconfig                   |  12 -
 arch/arm/mach-sunxi/dram_sun4i.c              |   4 -
 board/sunxi/sunxi.env                         | 138 ++++++++++
 boot/Kconfig                                  |  14 ++
 boot/Makefile                                 |   1 +
 boot/bootmeth_fel.c                           |  81 ++++++
 configs/icnova-a20-swac_defconfig             |   1 -
 doc/usage/environment.rst                     |  12 +
 include/configs/sunxi-common.h                | 238 ------------------
 12 files changed, 248 insertions(+), 266 deletions(-)
 create mode 100644 board/sunxi/sunxi.env
 create mode 100644 boot/bootmeth_fel.c
#11 lore raw

Hi Andre,

Quoted 7 lines · Andre Przywara

On Tue, 13 Aug 2024 06:17:17 -0600
Simon Glass <[email protected]> wrote:

Hi Simon,

I had a bit deeper look yesterday.

Thanks for digging into this.

Quoted 19 lines
Quoted 19 lines

Hi Andre,

Quoted 14 lines · Andre Przywara

On Wed, 7 Aug 2024 14:50:26 -0600
Simon Glass <[email protected]> wrote:

Hey Simon,

Quoted 2 lines

This series attempts to migrate all sunxi boards to use standard boot, along with a text environment.

Ah, many thanks for that! I figured that we need a bootmeth for FEL, but never got around to have a closer look.
On a coarse glance, this looks roughly OK, and doing a super quick boot test on one board, it seems to still work(TM), though the priority of the FEL boot is not right?

Quoted 7 lines
Quoted 1 line

Does it need to be the top priority, perhaps?

Yes, please. It should only trigger when you a) do FEL booting and b) upload a boot script via FEL, in which case you surely want to execute that before anything else. From what I see the global EFI bootmeth is first in the list, but I couldn't find an easy way to fix this in the source file. Would that go through a platform specific bootmeths env variable?

We can just rename the bootmeth to be before the EFI mgr one.

Quoted 13 lines
Quoted 6 lines
Quoted 3 lines

And I guess ditching the old kernel support might be a bit controversial. I think this is about the vendor kernels, which some people still rely on?

OK, perhaps it is. It might be a little tricky to handle it, but I suspect another bootmeth might be enough.

Well, I had a look, and it looks like CONFIG_OLD_SUNXI_KERNEL_COMPAT covers multiple things:
- it sets up some clocks slightly differently
- it enters the kernel (stays?) in secure mode
- it provides a custom boot script

Quoted 3 lines

I think the latter can be replaced quite easily with something custom, and I guess it's the only one biting you? So I am OK with that going, but I think we should keep the first two features (and thus the Kconfig symbol).

Yes the script is the only issue and actually it doesn't affect standard boot. So I can just convert it. I was just hoping to remove some old code!

Quoted 7 lines

Another thing I discovered: we lose USB support with patch 3/6. The reason is that USB support is enabled by having DISTRO_DEFAULTS. Just replacing that with BOOTSTD_DEFAULTS didn't work, though, I get a (ridiculous) splat about a circular Kconfig dependency. My hunch is that's something else not right in Kconfig, but I need to have a closer look.

Oh yes that is nasty. The problem goes back to BLK being selected by various things, while BOOTSTD depends on it. I eventually found a solution so will include that in v2.

Regards,
Simon