cd $(DIR_APP) && make distclean
cd $(DIR_APP) && rm -f bl31.bin
+ # distrobootcmd support was removed for rockchip boards. Revert.
+ cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/u-boot/u-boot-2024.10-revert_rockchip_distro_bootcmd_removal.patch
+
# Nanopi R2S
cd $(DIR_APP) && rm -rf arm-trusted-firmware-$(ATF_VER)
cd $(DIR_APP) && tar axf $(DIR_DL)/arm-trusted-firmware-$(ATF_VER).tar.gz
-mkdir -pv /usr/share/u-boot/nanopi_r2s
cd $(DIR_APP) && make CROSS_COMPILE="" nanopi-r2s-rk3328_config
cd $(DIR_APP) && sed -i -e 's!^CONFIG_IDENT_STRING=.*!CONFIG_IDENT_STRING=" Nanopi R2S - IPFire.org"!' .config
+ cd $(DIR_APP) && sed -i -e 's!^CONFIG_DISTRO_DEFAULTS.*!CONFIG_DISTRO_DEFAULTS=y!' .config
cd $(DIR_APP) && sed -i -e 's!^CONFIG_BOOTCOMMAND=.*!CONFIG_BOOTCOMMAND="console=ttyS2,115200n8;run distro_bootcmd"!' .config
cd $(DIR_APP) && sed -i -e 's!^CONFIG_BAUDRATE=.*!CONFIG_BAUDRATE=115200!' .config
cd $(DIR_APP) && sed -i -e 's!.*CONFIG_ENV_OVERWRITE.*!CONFIG_ENV_OVERWRITE=y!' .config
cd $(DIR_APP) && cp arm-trusted-firmware-$(ATF_VER)/build/rk3328/release/bl31/bl31.elf bl31.elf
cd $(DIR_APP) && rm -rf arm-trusted-firmware-$(ATF_VER)
-mkdir -pv /usr/share/u-boot/nanopi_r2c
-
cd $(DIR_APP) && make CROSS_COMPILE="" nanopi-r2c-rk3328_config
cd $(DIR_APP) && sed -i -e 's!^CONFIG_IDENT_STRING=.*!CONFIG_IDENT_STRING=" Nanopi R2C - IPFire.org"!' .config
+ cd $(DIR_APP) && sed -i -e 's!^CONFIG_DISTRO_DEFAULTS.*!CONFIG_DISTRO_DEFAULTS=y!' .config
cd $(DIR_APP) && sed -i -e 's!^CONFIG_BOOTCOMMAND=.*!CONFIG_BOOTCOMMAND="console=ttyS2,115200n8;run distro_bootcmd"!' .config
cd $(DIR_APP) && sed -i -e 's!^CONFIG_BAUDRATE=.*!CONFIG_BAUDRATE=115200!' .config
cd $(DIR_APP) && sed -i -e 's!.*CONFIG_ENV_OVERWRITE.*!CONFIG_ENV_OVERWRITE=y!' .config
cd $(DIR_APP) && cp arm-trusted-firmware-$(ATF_VER)/build/rk3328/release/bl31/bl31.elf bl31.elf
cd $(DIR_APP) && rm -rf arm-trusted-firmware-$(ATF_VER)
-mkdir -pv /usr/share/u-boot/orangepi_r1_plus_lts
-
cd $(DIR_APP) && make CROSS_COMPILE="" orangepi-r1-plus-lts-rk3328_config
cd $(DIR_APP) && sed -i -e 's!^CONFIG_IDENT_STRING=.*!CONFIG_IDENT_STRING=" OrangePi R1 plus lts - IPFire.org"!' .config
+ cd $(DIR_APP) && sed -i -e 's!^CONFIG_DISTRO_DEFAULTS.*!CONFIG_DISTRO_DEFAULTS=y!' .config
cd $(DIR_APP) && sed -i -e 's!^CONFIG_BOOTCOMMAND=.*!CONFIG_BOOTCOMMAND="console=ttyS2,115200n8;run distro_bootcmd"!' .config
cd $(DIR_APP) && sed -i -e 's!^CONFIG_BAUDRATE=.*!CONFIG_BAUDRATE=115200!' .config
cd $(DIR_APP) && sed -i -e 's!.*CONFIG_ENV_OVERWRITE.*!CONFIG_ENV_OVERWRITE=y!' .config
-mkdir -pv /usr/share/u-boot/nanopi_r4s
cd $(DIR_APP) && make BL31=$(DIR_APP)/bl31.elf CROSS_COMPILE="" nanopi-r4s-rk3399_config
cd $(DIR_APP) && sed -i -e 's!^CONFIG_IDENT_STRING=.*!CONFIG_IDENT_STRING=" Nanopi R4S - IPFire.org"!' .config
+ cd $(DIR_APP) && sed -i -e 's!^CONFIG_DISTRO_DEFAULTS.*!CONFIG_DISTRO_DEFAULTS=y!' .config
cd $(DIR_APP) && sed -i -e 's!^CONFIG_BOOTCOMMAND=.*!CONFIG_BOOTCOMMAND="console=ttyS2,115200n8;run distro_bootcmd"!' .config
cd $(DIR_APP) && sed -i -e 's!^CONFIG_BAUDRATE=.*!CONFIG_BAUDRATE=115200!' .config
cd $(DIR_APP) && sed -i -e 's!.*CONFIG_ENV_OVERWRITE.*!CONFIG_ENV_OVERWRITE=y!' .config
--- /dev/null
+diff -Naur u-boot-2024.10.org/arch/arm/Kconfig u-boot-2024.10/arch/arm/Kconfig
+--- u-boot-2024.10.org/arch/arm/Kconfig 2024-10-07 14:54:35.000000000 +0000
++++ u-boot-2024.10/arch/arm/Kconfig 2024-12-30 13:49:36.476480002 +0000
+@@ -2035,7 +2035,8 @@
+ imply ADC
+ imply CMD_DM
+ imply DEBUG_UART_BOARD_INIT
+- imply BOOTSTD_DEFAULTS
++ imply DISTRO_DEFAULTS if !ROCKCHIP_RK3399
++ imply BOOTSTD_DEFAULTS if !DISTRO_DEFAULTS
+ imply FAT_WRITE
+ imply SARADC_ROCKCHIP
+ imply SPL_SYSRESET
+diff -Naur u-boot-2024.10.org/include/configs/px30_common.h u-boot-2024.10/include/configs/px30_common.h
+--- u-boot-2024.10.org/include/configs/px30_common.h 2024-10-07 14:54:35.000000000 +0000
++++ u-boot-2024.10/include/configs/px30_common.h 2024-12-30 13:49:36.477479987 +0000
+@@ -25,11 +25,12 @@
+ "kernel_comp_addr_r=0x03e80000\0" \
+ "kernel_comp_size=0x2000000\0"
+
++#include <config_distro_bootcmd.h>
+ #define CFG_EXTRA_ENV_SETTINGS \
+ ENV_MEM_LAYOUT_SETTINGS \
+ "fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \
+ "partitions=" PARTS_DEFAULT \
+ ROCKCHIP_DEVICE_SETTINGS \
+- "boot_targets=" BOOT_TARGETS "\0"
++ BOOTENV
+
+ #endif
+diff -Naur u-boot-2024.10.org/include/configs/rk3036_common.h u-boot-2024.10/include/configs/rk3036_common.h
+--- u-boot-2024.10.org/include/configs/rk3036_common.h 2024-10-07 14:54:35.000000000 +0000
++++ u-boot-2024.10/include/configs/rk3036_common.h 2024-12-30 13:49:36.478479972 +0000
+@@ -20,6 +20,8 @@
+ "kernel_addr_r=0x62000000\0" \
+ "ramdisk_addr_r=0x64000000\0"
+
++#include <config_distro_bootcmd.h>
++
+ /* Linux fails to load the fdt if it's loaded above 512M on a evb-rk3036 board,
+ * so limit the fdt reallocation to that */
+ #define CFG_EXTRA_ENV_SETTINGS \
+@@ -27,6 +29,6 @@
+ "fdt_high=0x7fffffff\0" \
+ "partitions=" PARTS_DEFAULT \
+ ENV_MEM_LAYOUT_SETTINGS \
+- "boot_targets=" BOOT_TARGETS "\0"
++ BOOTENV
+
+ #endif
+diff -Naur u-boot-2024.10.org/include/configs/rk3066_common.h u-boot-2024.10/include/configs/rk3066_common.h
+--- u-boot-2024.10.org/include/configs/rk3066_common.h 2024-10-07 14:54:35.000000000 +0000
++++ u-boot-2024.10/include/configs/rk3066_common.h 2024-12-30 13:49:36.478479972 +0000
+@@ -21,12 +21,14 @@
+ "kernel_addr_r=0x62000000\0" \
+ "ramdisk_addr_r=0x64000000\0"
+
++#include <config_distro_bootcmd.h>
++
+ #define CFG_EXTRA_ENV_SETTINGS \
+ "fdt_high=0x6fffffff\0" \
+ "initrd_high=0x6fffffff\0" \
+ "partitions=" PARTS_DEFAULT \
+ ENV_MEM_LAYOUT_SETTINGS \
+ ROCKCHIP_DEVICE_SETTINGS \
+- "boot_targets=" BOOT_TARGETS "\0"
++ BOOTENV
+
+ #endif
+diff -Naur u-boot-2024.10.org/include/configs/rk3128_common.h u-boot-2024.10/include/configs/rk3128_common.h
+--- u-boot-2024.10.org/include/configs/rk3128_common.h 2024-10-07 14:54:35.000000000 +0000
++++ u-boot-2024.10/include/configs/rk3128_common.h 2024-12-30 13:49:36.479479958 +0000
+@@ -22,10 +22,11 @@
+ "kernel_addr_r=0x62000000\0" \
+ "ramdisk_addr_r=0x64000000\0"
+
++#include <config_distro_bootcmd.h>
+ #define CFG_EXTRA_ENV_SETTINGS \
+ ENV_MEM_LAYOUT_SETTINGS \
+ "fdt_file=" CONFIG_DEFAULT_FDT_FILE "\0" \
+ "partitions=" PARTS_DEFAULT \
+- "boot_targets=" BOOT_TARGETS "\0"
++ BOOTENV
+
+ #endif
+diff -Naur u-boot-2024.10.org/include/configs/rk3188_common.h u-boot-2024.10/include/configs/rk3188_common.h
+--- u-boot-2024.10.org/include/configs/rk3188_common.h 2024-10-07 14:54:35.000000000 +0000
++++ u-boot-2024.10/include/configs/rk3188_common.h 2024-12-30 13:49:36.479479958 +0000
+@@ -20,6 +20,8 @@
+ "kernel_addr_r=0x62000000\0" \
+ "ramdisk_addr_r=0x64000000\0"
+
++#include <config_distro_bootcmd.h>
++
+ /* Linux fails to load the fdt if it's loaded above 256M on a Rock board,
+ * so limit the fdt reallocation to that */
+ #define CFG_EXTRA_ENV_SETTINGS \
+@@ -29,6 +31,6 @@
+ "partitions=" PARTS_DEFAULT \
+ ENV_MEM_LAYOUT_SETTINGS \
+ ROCKCHIP_DEVICE_SETTINGS \
+- "boot_targets=" BOOT_TARGETS "\0"
++ BOOTENV
+
+ #endif
+diff -Naur u-boot-2024.10.org/include/configs/rk322x_common.h u-boot-2024.10/include/configs/rk322x_common.h
+--- u-boot-2024.10.org/include/configs/rk322x_common.h 2024-10-07 14:54:35.000000000 +0000
++++ u-boot-2024.10/include/configs/rk322x_common.h 2024-12-30 13:49:36.480479943 +0000
+@@ -21,6 +21,8 @@
+ "kernel_addr_r=0x62000000\0" \
+ "ramdisk_addr_r=0x64000000\0"
+
++#include <config_distro_bootcmd.h>
++
+ /* Linux fails to load the fdt if it's loaded above 512M on a evb-rk3036 board,
+ * so limit the fdt reallocation to that */
+ #define CFG_EXTRA_ENV_SETTINGS \
+@@ -28,6 +30,6 @@
+ "fdt_high=0x7fffffff\0" \
+ "partitions=" PARTS_DEFAULT \
+ ENV_MEM_LAYOUT_SETTINGS \
+- "boot_targets=" BOOT_TARGETS "\0"
++ BOOTENV
+
+ #endif
+diff -Naur u-boot-2024.10.org/include/configs/rk3288_common.h u-boot-2024.10/include/configs/rk3288_common.h
+--- u-boot-2024.10.org/include/configs/rk3288_common.h 2024-10-07 14:54:35.000000000 +0000
++++ u-boot-2024.10/include/configs/rk3288_common.h 2024-12-30 13:49:36.480479943 +0000
+@@ -22,6 +22,8 @@
+ "kernel_addr_r=0x02000000\0" \
+ "ramdisk_addr_r=0x04000000\0"
+
++#include <config_distro_bootcmd.h>
++
+ /* Linux fails to load the fdt if it's loaded above 256M on a Rock 2 board, so
+ * limit the fdt reallocation to that */
+ #define CFG_EXTRA_ENV_SETTINGS \
+@@ -31,6 +33,6 @@
+ "partitions=" PARTS_DEFAULT \
+ ENV_MEM_LAYOUT_SETTINGS \
+ ROCKCHIP_DEVICE_SETTINGS \
+- "boot_targets=" BOOT_TARGETS "\0"
++ BOOTENV
+
+ #endif
+diff -Naur u-boot-2024.10.org/include/configs/rk3308_common.h u-boot-2024.10/include/configs/rk3308_common.h
+--- u-boot-2024.10.org/include/configs/rk3308_common.h 2024-10-07 14:54:35.000000000 +0000
++++ u-boot-2024.10/include/configs/rk3308_common.h 2024-12-30 14:01:57.925815373 +0000
+@@ -25,11 +25,13 @@
+ "kernel_comp_addr_r=0x08000000\0" \
+ "kernel_comp_size=0x2000000\0"
+
+++#include <config_distro_bootcmd.h>
+ #define CFG_EXTRA_ENV_SETTINGS \
+ "fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \
+ "partitions=" PARTS_DEFAULT \
+ ENV_MEM_LAYOUT_SETTINGS \
+ ROCKCHIP_DEVICE_SETTINGS \
+ "boot_targets=" BOOT_TARGETS "\0"
++ BOOTENV
+
+ #endif /* __CONFIG_RK3308_COMMON_H */
+diff -Naur u-boot-2024.10.org/include/configs/rk3328_common.h u-boot-2024.10/include/configs/rk3328_common.h
+--- u-boot-2024.10.org/include/configs/rk3328_common.h 2024-10-07 14:54:35.000000000 +0000
++++ u-boot-2024.10/include/configs/rk3328_common.h 2024-12-30 14:06:25.263035725 +0000
+@@ -25,11 +25,12 @@
+ "kernel_comp_addr_r=0x08000000\0" \
+ "kernel_comp_size=0x2000000\0"
+
++#include <config_distro_bootcmd.h>
+ #define CFG_EXTRA_ENV_SETTINGS \
+ "fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \
+ "partitions=" PARTS_DEFAULT \
+ ENV_MEM_LAYOUT_SETTINGS \
+ ROCKCHIP_DEVICE_SETTINGS \
+- "boot_targets=" BOOT_TARGETS "\0"
++ BOOTENV
+
+ #endif /* __CONFIG_RK3328_COMMON_H */
+diff -Naur u-boot-2024.10.org/include/configs/rk3368_common.h u-boot-2024.10/include/configs/rk3368_common.h
+--- u-boot-2024.10.org/include/configs/rk3368_common.h 2024-10-07 14:54:35.000000000 +0000
++++ u-boot-2024.10/include/configs/rk3368_common.h 2024-12-30 13:49:36.482479914 +0000
+@@ -22,9 +22,11 @@
+ "kernel_addr_r=0x280000\0" \
+ "ramdisk_addr_r=0x5bf0000\0"
+
++#include <config_distro_bootcmd.h>
++
+ #define CFG_EXTRA_ENV_SETTINGS \
+ "fdtfile=" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0" \
+- ENV_MEM_LAYOUT_SETTINGS \
+- "boot_targets=" BOOT_TARGETS "\0"
++ ENV_MEM_LAYOUT_SETTINGS \
++ BOOTENV
+
+ #endif
+diff -Naur u-boot-2024.10.org/include/configs/rk3568_common.h u-boot-2024.10/include/configs/rk3568_common.h
+--- u-boot-2024.10.org/include/configs/rk3568_common.h 2024-10-07 14:54:35.000000000 +0000
++++ u-boot-2024.10/include/configs/rk3568_common.h 2024-12-30 14:03:57.919116640 +0000
+@@ -27,11 +27,14 @@
+ "ramdisk_addr_r=0x12180000\0" \
+ "kernel_comp_size=0x8000000\0"
+
++#include <config_distro_bootcmd.h>
+ #define CFG_EXTRA_ENV_SETTINGS \
+ "fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \
+ "partitions=" PARTS_DEFAULT \
+ ENV_MEM_LAYOUT_SETTINGS \
+ ROCKCHIP_DEVICE_SETTINGS \
++ BOOTENV
++
+ "boot_targets=" BOOT_TARGETS "\0"
+
+ #endif /* __CONFIG_RK3568_COMMON_H */
+diff -Naur u-boot-2024.10.org/include/configs/rk3588_common.h u-boot-2024.10/include/configs/rk3588_common.h
+--- u-boot-2024.10.org/include/configs/rk3588_common.h 2024-10-07 14:54:35.000000000 +0000
++++ u-boot-2024.10/include/configs/rk3588_common.h 2024-12-30 14:05:20.861944658 +0000
+@@ -26,11 +26,12 @@
+ "ramdisk_addr_r=0x12180000\0" \
+ "kernel_comp_size=0x8000000\0"
+
++#include <config_distro_bootcmd.h>
+ #define CFG_EXTRA_ENV_SETTINGS \
+ "fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \
+ "partitions=" PARTS_DEFAULT \
+ ENV_MEM_LAYOUT_SETTINGS \
+ ROCKCHIP_DEVICE_SETTINGS \
+- "boot_targets=" BOOT_TARGETS "\0"
++ BOOTENV
+
+ #endif /* __CONFIG_RK3588_COMMON_H */
+diff -Naur u-boot-2024.10.org/include/configs/rockchip-common.h u-boot-2024.10/include/configs/rockchip-common.h
+--- u-boot-2024.10.org/include/configs/rockchip-common.h 2024-10-07 14:54:35.000000000 +0000
++++ u-boot-2024.10/include/configs/rockchip-common.h 2024-12-30 13:59:28.290940486 +0000
+@@ -13,7 +13,69 @@
+
+ #ifndef CONFIG_SPL_BUILD
+
++/* First try to boot from SD (index 1), then eMMC (index 0) */
++#if IS_ENABLED(CONFIG_CMD_MMC)
++ #define BOOT_TARGET_MMC(func) \
++ func(MMC, mmc, 1) \
++ func(MMC, mmc, 0)
++#else
++ #define BOOT_TARGET_MMC(func)
++#endif
++
++#if IS_ENABLED(CONFIG_CMD_NVME)
++ #define BOOT_TARGET_NVME(func) func(NVME, nvme, 0)
++#else
++ #define BOOT_TARGET_NVME(func)
++#endif
++
++#if IS_ENABLED(CONFIG_CMD_SCSI)
++ #define BOOT_TARGET_SCSI(func) func(SCSI, scsi, 0)
++#else
++ #define BOOT_TARGET_SCSI(func)
++#endif
++
++#if IS_ENABLED(CONFIG_CMD_USB)
++ #define BOOT_TARGET_USB(func) func(USB, usb, 0)
++#else
++ #define BOOT_TARGET_USB(func)
++#endif
++
++#if CONFIG_IS_ENABLED(CMD_PXE)
++ #define BOOT_TARGET_PXE(func) func(PXE, pxe, na)
++#else
++ #define BOOT_TARGET_PXE(func)
++#endif
++
++#if CONFIG_IS_ENABLED(CMD_DHCP)
++ #define BOOT_TARGET_DHCP(func) func(DHCP, dhcp, na)
++#else
++ #define BOOT_TARGET_DHCP(func)
++#endif
++
++#if IS_ENABLED(CONFIG_CMD_SF)
++ #define BOOT_TARGET_SF(func) func(SF, sf, 0)
++#else
++ #define BOOT_TARGET_SF(func)
++#endif
++
++#ifdef CONFIG_ROCKCHIP_RK3399
++#define BOOT_TARGET_DEVICES(func) \
++ BOOT_TARGET_MMC(func) \
++ BOOT_TARGET_NVME(func) \
++ BOOT_TARGET_SCSI(func) \
++ BOOT_TARGET_USB(func) \
++ BOOT_TARGET_PXE(func) \
++ BOOT_TARGET_DHCP(func) \
++ BOOT_TARGET_SF(func)
+ #define BOOT_TARGETS "mmc1 mmc0 nvme scsi usb pxe dhcp spi"
++#else
++#define BOOT_TARGET_DEVICES(func) \
++ BOOT_TARGET_MMC(func) \
++ BOOT_TARGET_USB(func) \
++ BOOT_TARGET_PXE(func) \
++ BOOT_TARGET_DHCP(func)
++#define BOOT_TARGETS "mmc1 mmc0 usb pxe dhcp"
++#endif
+
+ #ifdef CONFIG_ARM64
+ #define ROOT_UUID "B921B045-1DF0-41C3-AF44-4C6F280D3FAE;\0"
+diff -Naur u-boot-2024.10.org/include/configs/rv1108_common.h u-boot-2024.10/include/configs/rv1108_common.h
+--- u-boot-2024.10.org/include/configs/rv1108_common.h 2024-10-07 14:54:35.000000000 +0000
++++ u-boot-2024.10/include/configs/rv1108_common.h 2024-12-30 13:49:36.484479884 +0000
+@@ -27,6 +27,6 @@
+ ENV_MEM_LAYOUT_SETTINGS \
+ "fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \
+ "partitions=" PARTS_DEFAULT \
+- "boot_targets=" BOOT_TARGETS "\0"
++ BOOTENV
+
+ #endif