mirror of
https://github.com/armbian/build.git
synced 2025-09-15 18:51:27 +02:00
- while at it rewrite-uboot-patches Signed-off-by: Martin Schmiedel <Martin.Schmiedel@tq-group.com>
685 lines
25 KiB
Diff
685 lines
25 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Martin Schmiedel <Martin.Schmiedel@tq-group.com>
|
|
Date: Mon, 9 Oct 2023 09:50:48 +0200
|
|
Subject: tqma8: enable distro boot
|
|
|
|
Signed-off-by: Martin Schmiedel <Martin.Schmiedel@tq-group.com>
|
|
---
|
|
board/tqc/common/Kconfig | 4 +
|
|
board/tqc/common/Makefile | 1 +
|
|
board/tqc/common/tqc_bb.h | 6 +
|
|
board/tqc/common/tqc_distro.c | 37 ++
|
|
board/tqc/tqma8mpxl/tqma8mpxl.c | 5 +-
|
|
board/tqc/tqma8mx/tqma8mx.c | 5 +-
|
|
board/tqc/tqma8mxml/tqma8mxml.c | 5 +-
|
|
configs/tqma8mxml_1gb_mba8mx_fspi_defconfig | 1 -
|
|
configs/tqma8mxml_1gb_mba8mx_mfg_defconfig | 1 -
|
|
configs/tqma8mxml_1gb_mba8mx_mmc_defconfig | 1 -
|
|
configs/tqma8mxml_2gb_mba8mx_fspi_defconfig | 1 -
|
|
configs/tqma8mxml_2gb_mba8mx_mfg_defconfig | 1 -
|
|
configs/tqma8mxml_2gb_mba8mx_mmc_defconfig | 1 -
|
|
configs/tqma8mxml_4gb_mba8mx_fspi_defconfig | 1 -
|
|
configs/tqma8mxml_4gb_mba8mx_mfg_defconfig | 1 -
|
|
configs/tqma8mxml_4gb_mba8mx_mmc_defconfig | 1 -
|
|
configs/tqma8mxnl_1gb_mba8mx_defconfig | 1 -
|
|
configs/tqma8mxnl_1gb_mba8mx_mfg_defconfig | 1 -
|
|
doc/board/tq/examples/boot-legacy.cmd | 26 +
|
|
include/configs/tqma8mxml-mba8mx.h | 11 +-
|
|
include/configs/tqma8mxml.h | 256 ++--------
|
|
include/environment/tq/boot.h | 21 +
|
|
22 files changed, 167 insertions(+), 221 deletions(-)
|
|
|
|
diff --git a/board/tqc/common/Kconfig b/board/tqc/common/Kconfig
|
|
index 111111111111..222222222222 100644
|
|
--- a/board/tqc/common/Kconfig
|
|
+++ b/board/tqc/common/Kconfig
|
|
@@ -16,6 +16,10 @@ config TQC_ENVLOC
|
|
bool
|
|
select ENV_IS_NOWHERE
|
|
|
|
+config TQC_DISTRO
|
|
+ bool
|
|
+ default y if DISTRO_DEFAULTS
|
|
+
|
|
config TQC_RTC
|
|
bool
|
|
|
|
diff --git a/board/tqc/common/Makefile b/board/tqc/common/Makefile
|
|
index 111111111111..222222222222 100644
|
|
--- a/board/tqc/common/Makefile
|
|
+++ b/board/tqc/common/Makefile
|
|
@@ -24,6 +24,7 @@ obj-$(CONFIG_TQC_EMMC) += tqc_emmc.o
|
|
obj-$(CONFIG_TQC_SDMMC) += tqc_sdmmc.o
|
|
obj-$(CONFIG_TQC_SCU) += tqc_scu.o
|
|
obj-$(CONFIG_TQC_RTC) += tqc_rtc.o
|
|
+obj-$(CONFIG_TQC_DISTRO) += tqc_distro.o
|
|
obj-$(CONFIG_TQC_ENVLOC) += tqc_envloc.o
|
|
obj-$(CONFIG_TQC_VARD) += tq_som_features.o
|
|
obj-$(CONFIG_TQC_SPI_NOR) += tqc_spi_nor.o
|
|
diff --git a/board/tqc/common/tqc_bb.h b/board/tqc/common/tqc_bb.h
|
|
index 111111111111..222222222222 100644
|
|
--- a/board/tqc/common/tqc_bb.h
|
|
+++ b/board/tqc/common/tqc_bb.h
|
|
@@ -64,4 +64,10 @@ int tqc_pcf85063_set_clkout(int bus, int address, uint8_t clkout);
|
|
int tqc_pcf85063_set_offset(int bus, int address, bool mode, int offset);
|
|
#endif /* CONFIG_TQC_RTC */
|
|
|
|
+#if IS_ENABLED(CONFIG_TQC_DISTRO)
|
|
+void tqc_distro_env_init(const char *boot_devtype);
|
|
+#else
|
|
+static inline void tqc_distro_env_init(const char *boot_devtype) {}
|
|
+#endif
|
|
+
|
|
#endif
|
|
diff --git a/board/tqc/common/tqc_distro.c b/board/tqc/common/tqc_distro.c
|
|
new file mode 100644
|
|
index 000000000000..111111111111
|
|
--- /dev/null
|
|
+++ b/board/tqc/common/tqc_distro.c
|
|
@@ -0,0 +1,37 @@
|
|
+// SPDX-License-Identifier: GPL-2.0-or-later
|
|
+/*
|
|
+ * Copyright (c) 2023 TQ-Systems GmbH <u-boot@ew.tq-group.com>,
|
|
+ * D-82229 Seefeld, Germany.
|
|
+ * Author: Matthias Schiffer
|
|
+ */
|
|
+
|
|
+#include <common.h>
|
|
+#include <mmc.h>
|
|
+
|
|
+/*
|
|
+ * Set up boot_targets for distroboot automatically
|
|
+ *
|
|
+ * If boot_targets_auto is set to "yes", boot_targets will be set to the
|
|
+ * correct device based on the environment device (which should be configured
|
|
+ * to be the boot device). Currently, this works for MMC devices.
|
|
+ */
|
|
+void tqc_distro_env_init(const char *boot_devtype)
|
|
+{
|
|
+ if (strcmp(env_get("boot_targets_auto") ?: "", "yes") != 0)
|
|
+ return;
|
|
+
|
|
+ if (strcmp(boot_devtype, "mmc") == 0) {
|
|
+ int index = 0;
|
|
+ char buf[10];
|
|
+
|
|
+#ifdef CONFIG_ENV_IS_IN_MMC
|
|
+ index = mmc_get_env_dev();
|
|
+#endif
|
|
+
|
|
+ snprintf(buf, sizeof(buf), "mmc%d", index);
|
|
+ env_set("boot_targets", buf);
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ env_set("boot_targets", boot_devtype);
|
|
+}
|
|
diff --git a/board/tqc/tqma8mpxl/tqma8mpxl.c b/board/tqc/tqma8mpxl/tqma8mpxl.c
|
|
index 111111111111..222222222222 100644
|
|
--- a/board/tqc/tqma8mpxl/tqma8mpxl.c
|
|
+++ b/board/tqc/tqma8mpxl/tqma8mpxl.c
|
|
@@ -294,9 +294,12 @@ int board_late_init(void)
|
|
|
|
#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
|
|
env_set("board_name", tqc_bb_get_boardname());
|
|
- env_set("board_rev", tqc_get_boardname());
|
|
+ env_set("board_rev", bname);
|
|
#endif
|
|
|
|
+ /* TODO: Add support for detecting non-MMC boot devices */
|
|
+ tqc_distro_env_init("mmc");
|
|
+
|
|
tqc_bb_board_late_init();
|
|
|
|
return 0;
|
|
diff --git a/board/tqc/tqma8mx/tqma8mx.c b/board/tqc/tqma8mx/tqma8mx.c
|
|
index 111111111111..222222222222 100644
|
|
--- a/board/tqc/tqma8mx/tqma8mx.c
|
|
+++ b/board/tqc/tqma8mx/tqma8mx.c
|
|
@@ -219,9 +219,12 @@ int board_late_init(void)
|
|
|
|
#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
|
|
env_set("board_name", tqc_bb_get_boardname());
|
|
- env_set("board_rev", tqc_get_boardname());
|
|
+ env_set("board_rev", bname);
|
|
#endif
|
|
|
|
+ /* TODO: Add support for detecting non-MMC boot devices */
|
|
+ tqc_distro_env_init("mmc");
|
|
+
|
|
return tqc_bb_board_late_init();
|
|
}
|
|
|
|
diff --git a/board/tqc/tqma8mxml/tqma8mxml.c b/board/tqc/tqma8mxml/tqma8mxml.c
|
|
index 111111111111..222222222222 100644
|
|
--- a/board/tqc/tqma8mxml/tqma8mxml.c
|
|
+++ b/board/tqc/tqma8mxml/tqma8mxml.c
|
|
@@ -179,9 +179,12 @@ int board_late_init(void)
|
|
|
|
#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
|
|
env_set("board_name", tqc_bb_get_boardname());
|
|
- env_set("board_rev", tqc_get_boardname());
|
|
+ env_set("board_rev", bname);
|
|
#endif
|
|
|
|
+ /* TODO: Add support for detecting non-MMC boot devices */
|
|
+ tqc_distro_env_init("mmc");
|
|
+
|
|
return tqc_bb_board_late_init();
|
|
}
|
|
|
|
diff --git a/configs/tqma8mxml_1gb_mba8mx_fspi_defconfig b/configs/tqma8mxml_1gb_mba8mx_fspi_defconfig
|
|
index 111111111111..222222222222 100644
|
|
--- a/configs/tqma8mxml_1gb_mba8mx_fspi_defconfig
|
|
+++ b/configs/tqma8mxml_1gb_mba8mx_fspi_defconfig
|
|
@@ -8,7 +8,6 @@ CONFIG_TQMA8MXX_BOOT_FSPI=y
|
|
CONFIG_IMX_BOOTAUX=y
|
|
CONFIG_DISTRO_DEFAULTS=y
|
|
CONFIG_BOOTDELAY=3
|
|
-CONFIG_BOOTCOMMAND="run mmcboot"
|
|
CONFIG_VERSION_VARIABLE=y
|
|
CONFIG_ARCH_MISC_INIT=y
|
|
CONFIG_SPL_SEPARATE_BSS=y
|
|
diff --git a/configs/tqma8mxml_1gb_mba8mx_mfg_defconfig b/configs/tqma8mxml_1gb_mba8mx_mfg_defconfig
|
|
index 111111111111..222222222222 100644
|
|
--- a/configs/tqma8mxml_1gb_mba8mx_mfg_defconfig
|
|
+++ b/configs/tqma8mxml_1gb_mba8mx_mfg_defconfig
|
|
@@ -9,7 +9,6 @@ CONFIG_TQMA8MXX_BOOT_SDCARD=y
|
|
CONFIG_IMX_BOOTAUX=y
|
|
CONFIG_DISTRO_DEFAULTS=y
|
|
CONFIG_BOOTDELAY=3
|
|
-CONFIG_BOOTCOMMAND="run mmcboot"
|
|
CONFIG_VERSION_VARIABLE=y
|
|
CONFIG_ARCH_MISC_INIT=y
|
|
CONFIG_SPL_SEPARATE_BSS=y
|
|
diff --git a/configs/tqma8mxml_1gb_mba8mx_mmc_defconfig b/configs/tqma8mxml_1gb_mba8mx_mmc_defconfig
|
|
index 111111111111..222222222222 100644
|
|
--- a/configs/tqma8mxml_1gb_mba8mx_mmc_defconfig
|
|
+++ b/configs/tqma8mxml_1gb_mba8mx_mmc_defconfig
|
|
@@ -8,7 +8,6 @@ CONFIG_TQMA8MXX_BOOT_SDCARD=y
|
|
CONFIG_IMX_BOOTAUX=y
|
|
CONFIG_DISTRO_DEFAULTS=y
|
|
CONFIG_BOOTDELAY=3
|
|
-CONFIG_BOOTCOMMAND="run mmcboot"
|
|
CONFIG_VERSION_VARIABLE=y
|
|
CONFIG_ARCH_MISC_INIT=y
|
|
CONFIG_SPL_SEPARATE_BSS=y
|
|
diff --git a/configs/tqma8mxml_2gb_mba8mx_fspi_defconfig b/configs/tqma8mxml_2gb_mba8mx_fspi_defconfig
|
|
index 111111111111..222222222222 100644
|
|
--- a/configs/tqma8mxml_2gb_mba8mx_fspi_defconfig
|
|
+++ b/configs/tqma8mxml_2gb_mba8mx_fspi_defconfig
|
|
@@ -7,7 +7,6 @@ CONFIG_TQMA8MXX_BOOT_FSPI=y
|
|
CONFIG_IMX_BOOTAUX=y
|
|
CONFIG_DISTRO_DEFAULTS=y
|
|
CONFIG_BOOTDELAY=3
|
|
-CONFIG_BOOTCOMMAND="run mmcboot"
|
|
CONFIG_VERSION_VARIABLE=y
|
|
CONFIG_ARCH_MISC_INIT=y
|
|
CONFIG_SPL_SEPARATE_BSS=y
|
|
diff --git a/configs/tqma8mxml_2gb_mba8mx_mfg_defconfig b/configs/tqma8mxml_2gb_mba8mx_mfg_defconfig
|
|
index 111111111111..222222222222 100644
|
|
--- a/configs/tqma8mxml_2gb_mba8mx_mfg_defconfig
|
|
+++ b/configs/tqma8mxml_2gb_mba8mx_mfg_defconfig
|
|
@@ -8,7 +8,6 @@ CONFIG_TQMA8MXX_BOOT_SDCARD=y
|
|
CONFIG_IMX_BOOTAUX=y
|
|
CONFIG_DISTRO_DEFAULTS=y
|
|
CONFIG_BOOTDELAY=3
|
|
-CONFIG_BOOTCOMMAND="run mmcboot"
|
|
CONFIG_VERSION_VARIABLE=y
|
|
CONFIG_ARCH_MISC_INIT=y
|
|
CONFIG_SPL_SEPARATE_BSS=y
|
|
diff --git a/configs/tqma8mxml_2gb_mba8mx_mmc_defconfig b/configs/tqma8mxml_2gb_mba8mx_mmc_defconfig
|
|
index 111111111111..222222222222 100644
|
|
--- a/configs/tqma8mxml_2gb_mba8mx_mmc_defconfig
|
|
+++ b/configs/tqma8mxml_2gb_mba8mx_mmc_defconfig
|
|
@@ -7,7 +7,6 @@ CONFIG_TQMA8MXX_BOOT_SDCARD=y
|
|
CONFIG_IMX_BOOTAUX=y
|
|
CONFIG_DISTRO_DEFAULTS=y
|
|
CONFIG_BOOTDELAY=3
|
|
-CONFIG_BOOTCOMMAND="run mmcboot"
|
|
CONFIG_VERSION_VARIABLE=y
|
|
CONFIG_ARCH_MISC_INIT=y
|
|
CONFIG_SPL_SEPARATE_BSS=y
|
|
diff --git a/configs/tqma8mxml_4gb_mba8mx_fspi_defconfig b/configs/tqma8mxml_4gb_mba8mx_fspi_defconfig
|
|
index 111111111111..222222222222 100644
|
|
--- a/configs/tqma8mxml_4gb_mba8mx_fspi_defconfig
|
|
+++ b/configs/tqma8mxml_4gb_mba8mx_fspi_defconfig
|
|
@@ -8,7 +8,6 @@ CONFIG_TQMA8MXX_BOOT_FSPI=y
|
|
CONFIG_IMX_BOOTAUX=y
|
|
CONFIG_DISTRO_DEFAULTS=y
|
|
CONFIG_BOOTDELAY=3
|
|
-CONFIG_BOOTCOMMAND="run mmcboot"
|
|
CONFIG_VERSION_VARIABLE=y
|
|
CONFIG_ARCH_MISC_INIT=y
|
|
CONFIG_SPL_SEPARATE_BSS=y
|
|
diff --git a/configs/tqma8mxml_4gb_mba8mx_mfg_defconfig b/configs/tqma8mxml_4gb_mba8mx_mfg_defconfig
|
|
index 111111111111..222222222222 100644
|
|
--- a/configs/tqma8mxml_4gb_mba8mx_mfg_defconfig
|
|
+++ b/configs/tqma8mxml_4gb_mba8mx_mfg_defconfig
|
|
@@ -9,7 +9,6 @@ CONFIG_TQMA8MXX_BOOT_SDCARD=y
|
|
CONFIG_IMX_BOOTAUX=y
|
|
CONFIG_DISTRO_DEFAULTS=y
|
|
CONFIG_BOOTDELAY=3
|
|
-CONFIG_BOOTCOMMAND="run mmcboot"
|
|
CONFIG_VERSION_VARIABLE=y
|
|
CONFIG_ARCH_MISC_INIT=y
|
|
CONFIG_SPL_SEPARATE_BSS=y
|
|
diff --git a/configs/tqma8mxml_4gb_mba8mx_mmc_defconfig b/configs/tqma8mxml_4gb_mba8mx_mmc_defconfig
|
|
index 111111111111..222222222222 100644
|
|
--- a/configs/tqma8mxml_4gb_mba8mx_mmc_defconfig
|
|
+++ b/configs/tqma8mxml_4gb_mba8mx_mmc_defconfig
|
|
@@ -8,7 +8,6 @@ CONFIG_TQMA8MXX_BOOT_SDCARD=y
|
|
CONFIG_IMX_BOOTAUX=y
|
|
CONFIG_DISTRO_DEFAULTS=y
|
|
CONFIG_BOOTDELAY=3
|
|
-CONFIG_BOOTCOMMAND="run mmcboot"
|
|
CONFIG_VERSION_VARIABLE=y
|
|
CONFIG_ARCH_MISC_INIT=y
|
|
CONFIG_SPL_SEPARATE_BSS=y
|
|
diff --git a/configs/tqma8mxnl_1gb_mba8mx_defconfig b/configs/tqma8mxnl_1gb_mba8mx_defconfig
|
|
index 111111111111..222222222222 100644
|
|
--- a/configs/tqma8mxnl_1gb_mba8mx_defconfig
|
|
+++ b/configs/tqma8mxnl_1gb_mba8mx_defconfig
|
|
@@ -6,7 +6,6 @@ CONFIG_TARGET_TQMA8MXNL=y
|
|
CONFIG_IMX_BOOTAUX=y
|
|
CONFIG_DISTRO_DEFAULTS=y
|
|
CONFIG_BOOTDELAY=3
|
|
-CONFIG_BOOTCOMMAND="run mmcboot"
|
|
CONFIG_VERSION_VARIABLE=y
|
|
CONFIG_ARCH_MISC_INIT=y
|
|
CONFIG_SPL_SEPARATE_BSS=y
|
|
diff --git a/configs/tqma8mxnl_1gb_mba8mx_mfg_defconfig b/configs/tqma8mxnl_1gb_mba8mx_mfg_defconfig
|
|
index 111111111111..222222222222 100644
|
|
--- a/configs/tqma8mxnl_1gb_mba8mx_mfg_defconfig
|
|
+++ b/configs/tqma8mxnl_1gb_mba8mx_mfg_defconfig
|
|
@@ -7,7 +7,6 @@ CONFIG_TQMA8MXX_MFG_SUPPORT=y
|
|
CONFIG_IMX_BOOTAUX=y
|
|
CONFIG_DISTRO_DEFAULTS=y
|
|
CONFIG_BOOTDELAY=3
|
|
-CONFIG_BOOTCOMMAND="run mmcboot"
|
|
CONFIG_VERSION_VARIABLE=y
|
|
CONFIG_ARCH_MISC_INIT=y
|
|
CONFIG_SPL_SEPARATE_BSS=y
|
|
diff --git a/doc/board/tq/examples/boot-legacy.cmd b/doc/board/tq/examples/boot-legacy.cmd
|
|
new file mode 100644
|
|
index 000000000000..111111111111
|
|
--- /dev/null
|
|
+++ b/doc/board/tq/examples/boot-legacy.cmd
|
|
@@ -0,0 +1,26 @@
|
|
+test "${rootpart}" || setenv rootpart 2
|
|
+
|
|
+# devtype/devnum are part of the distroboot contract
|
|
+if test "${devtype}" = mmc; then
|
|
+ # Explicitly set device path, so the correct rootfs is used even when
|
|
+ # the same image has been written to eMMC and SD-card
|
|
+ setenv rootdev "/dev/mmcblk${devnum}p${rootpart}"
|
|
+else
|
|
+ # Generic fallback for other boot media like USB/SATA/... drives.
|
|
+ # Requires a unique partition UUID to work as expected.
|
|
+ part uuid ${devtype} ${devnum}:${rootpart} rootuuid
|
|
+ setenv rootdev "PARTUUID=${rootuuid}"
|
|
+fi
|
|
+setenv bootargs_root "root=${rootdev}"
|
|
+
|
|
+# Set bootargs for additional arguments, or override bootargs_default
|
|
+# to replace the cmdline completely
|
|
+test "${bootargs_default}" || bootargs_default="${bootargs_root} rootwait rw console=${console},${baudrate}"
|
|
+setenv bootargs "${bootargs_default} ${bootargs}"
|
|
+
|
|
+test "${bootfile}" || bootfile='/Image'
|
|
+test "${boottype}" || boottype='booti'
|
|
+
|
|
+load "${devtype}" "${devnum}:${bootpart}" "${loadaddr}" "${bootfile}" || exit 1
|
|
+load "${devtype}" "${devnum}:${bootpart}" "${fdt_addr_r}" "${fdtfile}" || exit 1
|
|
+${boottype} "${loadaddr}" - "${fdt_addr_r}"
|
|
diff --git a/include/configs/tqma8mxml-mba8mx.h b/include/configs/tqma8mxml-mba8mx.h
|
|
index 111111111111..222222222222 100644
|
|
--- a/include/configs/tqma8mxml-mba8mx.h
|
|
+++ b/include/configs/tqma8mxml-mba8mx.h
|
|
@@ -14,9 +14,12 @@
|
|
|
|
#define BB_ENV_SETTINGS \
|
|
"console=" CONSOLE_DEV "\0" \
|
|
- "addearlycon=setenv bootargs ${bootargs} " \
|
|
- "earlycon=ec_imx6q," __stringify(CONFIG_MXC_UART_BASE) \
|
|
- ",${baudrate}\0" \
|
|
- "fdt_file=" CONFIG_DEFAULT_FDT_FILE "\0"
|
|
+ "fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0"
|
|
+
|
|
+#define BOOT_TARGET_DEVICES(func) \
|
|
+ func(MMC, mmc, 0) \
|
|
+ func(MMC, mmc, 1) \
|
|
+ func(PXE, pxe, na) \
|
|
+ func(DHCP, dhcp, na)
|
|
|
|
#endif /* __TQMA8MXML_MBA8MX_H */
|
|
diff --git a/include/configs/tqma8mxml.h b/include/configs/tqma8mxml.h
|
|
index 111111111111..222222222222 100644
|
|
--- a/include/configs/tqma8mxml.h
|
|
+++ b/include/configs/tqma8mxml.h
|
|
@@ -10,7 +10,8 @@
|
|
|
|
#include <linux/sizes.h>
|
|
#include <asm/arch/imx-regs.h>
|
|
-#include "imx_env.h"
|
|
+#include <config_distro_bootcmd.h>
|
|
+#include <environment/tq/boot.h>
|
|
|
|
#define CONFIG_SPL_MAX_SIZE (208 * 1024)
|
|
#define CONFIG_SYS_MONITOR_LEN SZ_512K
|
|
@@ -71,13 +72,6 @@
|
|
|
|
#define CONFIG_REMAKE_ELF
|
|
|
|
-#define CONFIG_MFG_ENV_SETTINGS \
|
|
- CONFIG_MFG_ENV_SETTINGS_DEFAULT \
|
|
- "initrd_addr=0x43800000\0" \
|
|
- "initrd_high=0xffffffffffffffff\0" \
|
|
- "emmc_dev=0\0"\
|
|
- "sd_dev=1\0" \
|
|
-
|
|
#if defined(CONFIG_IMX8MM)
|
|
|
|
#define TQMA8MX_CPU_ENV_SETTINGS \
|
|
@@ -102,193 +96,56 @@
|
|
#error
|
|
#endif
|
|
|
|
-#if defined(CONFIG_IMX_BOOTAUX)
|
|
-
|
|
-/*
|
|
- * cm_loadaddr is set to ITCM (instruction tightly coupled memory) on i.MX8MN
|
|
- * or TCML (i.MX8MM) per default.
|
|
- * cm_maxsize is used to prevent loading too large images. This limit is
|
|
- * 128 kiByte for i.MX8MM and i.MX8MN
|
|
- * Size and base address can be changed to RAM address or SPI NOR if larger
|
|
- * images are needed. In this case further adaption is needed.
|
|
- */
|
|
-#define TQMA8MXML_CM_ENV_SETTINGS \
|
|
- "cm_image=cm.bin\0" \
|
|
- "cm_loadaddr=0x7e0000\0" \
|
|
- "cm_maxsize=0x20000\0" \
|
|
- "boot_cm_mmc=if load mmc ${mmcdev}:${mmcpart} ${loadaddr} " \
|
|
- "${mmcpath}/${cm_image}; then " \
|
|
- "if itest ${filesize} > 0; then " \
|
|
- "if itest ${filesize} <= ${cm_maxsize}; then " \
|
|
- "cp.b ${loadaddr} ${cm_loadaddr} " \
|
|
- "${filesize};" \
|
|
- "dcache flush; " \
|
|
- "bootaux ${cm_loadaddr}; " \
|
|
- "else " \
|
|
- "echo ${filesize} > ${cm_maxsize}; " \
|
|
- "false; " \
|
|
- "fi; " \
|
|
- "else " \
|
|
- "echo invalid data size; " \
|
|
- "false; " \
|
|
- "fi; " \
|
|
- "else " \
|
|
- "echo file not loaded; " \
|
|
- "false; " \
|
|
- "fi; setenv filesize;\0" \
|
|
- "update_cm_mmc=run set_getcmd; " \
|
|
- "if ${get_cmd} ${cm_image}; then " \
|
|
- "if itest ${filesize} > 0; then " \
|
|
- "echo Write CM image to mmc ...; " \
|
|
- "save mmc ${mmcdev}:${mmcpart} ${loadaddr} " \
|
|
- "${mmcpath}${cm_image} ${filesize}; " \
|
|
- "fi; " \
|
|
- "fi; " \
|
|
- "setenv filesize; setenv get_cmd\0"
|
|
-#else
|
|
-
|
|
-#define TQMA8MXML_CM_ENV_SETTINGS
|
|
-
|
|
-#endif
|
|
-
|
|
/* Initial environment variables */
|
|
-#define TQMA8MX_MODULE_ENV_SETTINGS \
|
|
+#define TQMA8MX_MODULE_ENV_SETTINGS \
|
|
TQMA8MX_CPU_ENV_SETTINGS \
|
|
- CONFIG_MFG_ENV_SETTINGS \
|
|
- "script=boot.scr\0" \
|
|
- "image=Image\0" \
|
|
- "fdt_addr=0x43000000\0" \
|
|
- "fdt_high=0xffffffffffffffff\0" \
|
|
- "boot_fdt=try\0" \
|
|
- "initrd_addr=0x43800000\0" \
|
|
- "initrd_high=0xffffffffffffffff\0" \
|
|
- "mmcdev=" __stringify(CONFIG_SYS_MMC_ENV_DEV) "\0" \
|
|
- "mmcpart=" __stringify(CONFIG_SYS_MMC_IMG_LOAD_PART) "\0" \
|
|
- "mmcpath=/\0" \
|
|
+ "kernel_addr_r=0x44000000\0" \
|
|
+ "fdt_addr_r=0x46000000\0" \
|
|
+ "initrd_addr_r=0x47000000\0" \
|
|
+ "scriptaddr=0x50000000\0" \
|
|
+ "pxefile_addr_r=0x51000000\0" \
|
|
+ "emmc_dev=0\0" /* for UUU */ \
|
|
+ "sd_dev=1\0" /* for UUU */ \
|
|
+ "mmcdev=" __stringify(CONFIG_SYS_MMC_ENV_DEV) "\0" /* for update_*_mmc */ \
|
|
+ "bootpart=" __stringify(CONFIG_SYS_MMCSD_FS_BOOT_PARTITION) "\0" /* for update_cm_mmc */ \
|
|
+ "mmcpath=/\0" /* for update_cm_mmc */ \
|
|
"mmcautodetect=yes\0" \
|
|
- "loadbootscript=mmc dev ${mmcdev}; mmc rescan;" \
|
|
- "load mmc ${mmcdev}:${mmcpart} ${loadaddr} " \
|
|
- "${mmcpath}${script};\0" \
|
|
- "bootscript=echo Running bootscript from mmc ...; " \
|
|
- "source\0" \
|
|
- "loadimage=mmc dev ${mmcdev}; mmc rescan;" \
|
|
- "load mmc ${mmcdev}:${mmcpart} ${loadaddr} " \
|
|
- "${mmcpath}${image}\0" \
|
|
- "loadfdt=mmc dev ${mmcdev}; mmc rescan;" \
|
|
- "load mmc ${mmcdev}:${mmcpart} ${fdt_addr} " \
|
|
- "${mmcpath}${fdt_file}\0" \
|
|
- "boot_os=booti ${loadaddr} - ${fdt_addr};\0" \
|
|
- "mmcboot=echo Booting from mmc ...; " \
|
|
- "setenv bootargs; " \
|
|
- "run mmcargs; " \
|
|
- "run loadimage; " \
|
|
- "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
|
|
- "if run loadfdt; then " \
|
|
- "run boot_os; " \
|
|
- "else " \
|
|
- "echo WARN: Cannot load the DT; " \
|
|
- "fi; " \
|
|
- "else " \
|
|
- "echo wait for boot; " \
|
|
- "fi;\0" \
|
|
- "netboot=echo Booting from net ...; " \
|
|
- "setenv bootargs; " \
|
|
- "run netargs; " \
|
|
- "run set_getcmd; " \
|
|
- "${get_cmd} ${loadaddr} ${image}; " \
|
|
- "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
|
|
- "if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \
|
|
- "run boot_os; " \
|
|
- "else " \
|
|
- "echo WARN: Cannot load the DT; " \
|
|
- "fi; " \
|
|
- "else " \
|
|
- "booti; " \
|
|
- "fi;\0" \
|
|
- "update_kernel_mmc=run set_getcmd; " \
|
|
- "if ${get_cmd} ${image}; then " \
|
|
- "if itest ${filesize} > 0; then " \
|
|
- "echo Write kernel image to mmc ${mmcdev}:${mmcpart}...; " \
|
|
- "mmc dev ${mmcdev}; mmc rescan;" \
|
|
- "save mmc ${mmcdev}:${mmcpart} ${loadaddr} " \
|
|
- "${mmcpath}${image} ${filesize}; " \
|
|
- "fi; " \
|
|
- "fi; " \
|
|
- "setenv filesize; setenv get_cmd \0" \
|
|
- "update_fdt_mmc=run set_getcmd; " \
|
|
- "if ${get_cmd} ${fdt_file}; then " \
|
|
- "if itest ${filesize} > 0; then " \
|
|
- "echo Write fdt image to mmc ${mmcdev}:${mmcpart}...; " \
|
|
- "mmc dev ${mmcdev}; mmc rescan;" \
|
|
- "save mmc ${mmcdev}:${mmcpart} ${loadaddr} " \
|
|
- "${mmcpath}${fdt_file} ${filesize}; " \
|
|
- "fi; " \
|
|
- "fi; " \
|
|
- "setenv filesize; setenv get_cmd \0" \
|
|
- "uboot=bootstream.bin\0" \
|
|
- "update_uboot_mmc=run set_getcmd; if ${get_cmd} ${uboot}; then " \
|
|
- "if itest ${filesize} > 0; then " \
|
|
- "echo Write u-boot image to mmc ${mmcdev} ...; " \
|
|
- "mmc dev ${mmcdev}; mmc rescan; " \
|
|
- "setexpr blkc ${filesize} + 0x1ff; " \
|
|
- "setexpr blkc ${blkc} / 0x200; " \
|
|
- "if itest ${blkc} <= ${uboot_mmc_size}; then " \
|
|
- "mmc write ${loadaddr} ${uboot_mmc_start} " \
|
|
- "${blkc}; " \
|
|
- "fi; " \
|
|
- "fi; fi; " \
|
|
- "setenv filesize; setenv blkc \0" \
|
|
- "update_uboot_spi=run set_getcmd; if ${get_cmd} ${uboot}; then " \
|
|
- "if itest ${filesize} > 0; then " \
|
|
- "echo Write u-boot image to flexspi ...; " \
|
|
- "if itest ${filesize} <= ${uboot_fspi_size}; then " \
|
|
- "if sf probe; then " \
|
|
- "sf update ${loadaddr} " \
|
|
- "${uboot_fspi_start} " \
|
|
- "${filesize}; " \
|
|
- "fi; " \
|
|
- "fi; " \
|
|
- "fi; fi; " \
|
|
- "setenv filesize \0" \
|
|
- "set_getcmd=if test \"${ip_dyn}\" = yes; then " \
|
|
- "setenv get_cmd dhcp; " \
|
|
- "else " \
|
|
- "setenv get_cmd tftp; " \
|
|
- "fi; \0" \
|
|
- "rootfsmode=ro\0" \
|
|
- "addtty=setenv bootargs ${bootargs} console=${console},${baudrate}\0" \
|
|
- "mmcrootpart=2\0" \
|
|
- "addmmc=setenv bootargs ${bootargs} " \
|
|
- "root=/dev/mmcblk${mmcblkdev}p${mmcrootpart} ${rootfsmode} " \
|
|
- "rootwait\0" \
|
|
- "mmcargs=run addtty addearlycon addmmc\0" \
|
|
- "netargs=run addnfs addip addtty addearlycon\0" \
|
|
- "addnfs=setenv bootargs ${bootargs} " \
|
|
- "root=/dev/nfs rw " \
|
|
- "nfsroot=${serverip}:${rootpath},v3,tcp;\0" \
|
|
- "netdev=eth0\0" \
|
|
- "rootpath=/srv/nfs\0" \
|
|
- "ipmode=static\0" \
|
|
- "addip_static=setenv bootargs ${bootargs} " \
|
|
- "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:" \
|
|
- "${hostname}:${netdev}:off\0" \
|
|
- "addip_dynamic=setenv bootargs ${bootargs} ip=dhcp\0" \
|
|
- "addip=if test \"${ipmode}\" != static; then " \
|
|
- "run addip_dynamic; else run addip_static; fi\0"
|
|
-
|
|
-#if !defined(CONFIG_BOOTCOMMAND)
|
|
-#define CONFIG_BOOTCOMMAND \
|
|
- "mmc dev ${mmcdev}; if mmc rescan; then " \
|
|
- "if run loadbootscript; then " \
|
|
- "run bootscript; " \
|
|
- "else " \
|
|
- "if run loadimage; then " \
|
|
- "run mmcboot; " \
|
|
- "else run netboot; " \
|
|
- "fi; " \
|
|
- "fi; " \
|
|
- "else run boot_os; fi"
|
|
-#endif
|
|
+ "boot_targets_auto=yes\0" \
|
|
+ "uboot=bootstream.bin\0" /* for update_uboot_* */ \
|
|
+ "update_uboot_mmc=" \
|
|
+ "run check_ipaddr; " \
|
|
+ "tftp ${uboot} || exit 1; " \
|
|
+ "itest ${filesize} > 0 || exit 1; " \
|
|
+ "echo \"Writing u-boot image to mmc ${mmcdev} ...\"; " \
|
|
+ "mmc dev ${mmcdev}; mmc rescan; " \
|
|
+ "setexpr tmp ${filesize} + 0x1ff; setexpr tmp ${tmp} / 0x200; blkc=${tmp}; " \
|
|
+ "setenv filesize; setenv tmp; " \
|
|
+ "if itest ${blkc} > ${uboot_mmc_size}; then " \
|
|
+ "echo \"U-Boot image too large (${blkc} > ${uboot_mmc_size} sectors)\"; " \
|
|
+ "exit 1; " \
|
|
+ "fi; " \
|
|
+ "mmc write ${loadaddr} ${uboot_mmc_start} ${blkc}\0" \
|
|
+ "update_uboot_spi=" \
|
|
+ "run check_ipaddr; " \
|
|
+ "tftp ${uboot} || exit 1; " \
|
|
+ "itest ${filesize} > 0 || exit 1; " \
|
|
+ "echo 'Writing u-boot image to flexspi ...'; " \
|
|
+ "if itest ${filesize} > ${uboot_fspi_size}; then " \
|
|
+ "echo \"U-Boot image too large " \
|
|
+ "(${filesize} > ${uboot_fspi_size} bytes)\"; " \
|
|
+ "exit 1; " \
|
|
+ "fi; " \
|
|
+ "sf probe && sf update ${loadaddr} ${uboot_fspi_start} ${filesize}; " \
|
|
+ "setenv filesize\0" \
|
|
+ "cm_image=cm.bin\0" \
|
|
+ "update_cm_mmc=" \
|
|
+ "run check_ipaddr; " \
|
|
+ "tftp ${cm_image} || exit 1; " \
|
|
+ "itest ${filesize} > 0 || exit 1; " \
|
|
+ "echo \"Writing CM image to mmc ${mmcdev}:${bootpart} ${mmcpath}${cm_image} ...\"; "\
|
|
+ "save mmc ${mmcdev}:${bootpart} ${loadaddr} ${mmcpath}${cm_image} ${filesize}; " \
|
|
+ "setenv filesize\0" \
|
|
+ ""
|
|
|
|
/* Link Definitions */
|
|
#define CONFIG_LOADADDR 0x40480000
|
|
@@ -309,7 +166,6 @@
|
|
*/
|
|
#define CONFIG_SYS_MMC_ENV_DEV -1 /* invalid */
|
|
#define CONFIG_SYS_MMC_ENV_PART 0 /* user area */
|
|
-#define CONFIG_SYS_MMC_IMG_LOAD_PART 1
|
|
|
|
/* Size of malloc() pool */
|
|
#define CONFIG_SYS_MALLOC_LEN SZ_64M
|
|
@@ -391,17 +247,11 @@
|
|
|
|
#include "tqma8-shared-env.h"
|
|
|
|
-#define CONFIG_EXTRA_ENV_SETTINGS \
|
|
+#define CONFIG_EXTRA_ENV_SETTINGS \
|
|
TQMA8_SHARED_ENV_SETTINGS \
|
|
- TQMA8MXML_CM_ENV_SETTINGS \
|
|
- TQMA8MX_MODULE_ENV_SETTINGS \
|
|
+ TQ_BOOT_ENV_SETTINGS \
|
|
+ BOOTENV \
|
|
+ TQMA8MX_MODULE_ENV_SETTINGS \
|
|
BB_ENV_SETTINGS
|
|
|
|
-#ifndef CONFIG_SPL_BUILD
|
|
-#define BOOT_TARGET_DEVICES(func) \
|
|
- func(MMC, mmc, 0) \
|
|
- func(USB, usb, 0)
|
|
-#include <config_distro_bootcmd.h>
|
|
-#endif
|
|
-
|
|
#endif /* __TQMA8MXML_H */
|
|
diff --git a/include/environment/tq/boot.h b/include/environment/tq/boot.h
|
|
new file mode 100644
|
|
index 000000000000..111111111111
|
|
--- /dev/null
|
|
+++ b/include/environment/tq/boot.h
|
|
@@ -0,0 +1,21 @@
|
|
+/* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
+/*
|
|
+ * Copyright (c) 2023 TQ-Systems GmbH <u-boot@ew.tq-group.com>,
|
|
+ * D-82229 Seefeld, Germany.
|
|
+ * Author: Matthias Schiffer
|
|
+ *
|
|
+ * Common boot helpers for TQ-Systems default environments
|
|
+ */
|
|
+
|
|
+#ifndef __TQ_BOOT_H
|
|
+#define __TQ_BOOT_H
|
|
+
|
|
+#define CONFIG_SYS_AUTOLOAD "no"
|
|
+
|
|
+#define TQ_BOOT_ENV_SETTINGS \
|
|
+ "check_ipaddr=" \
|
|
+ "if test \"${ipaddr}\" && test \"${serverip}\"; then exit; fi; " \
|
|
+ "echo 'ipaddr or serverip unset, falling back to DHCP...'; " \
|
|
+ "dhcp\0"
|
|
+
|
|
+#endif /* __TQ_BOOT_H */
|
|
--
|
|
Armbian
|
|
|