Skip to content

khadas-vim3: u-boot: bump to 2025.04-rc5; boot SD first; enable setexpr; patch 2025.04 for fileenv; enable squashfs support #8044

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions config/boards/khadas-vim3.conf
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ BOOT_LOGO="desktop"
BOOT_FDT_FILE="amlogic/meson-g12b-a311d-khadas-vim3.dtb" # there is also a s922x dtb, but vim3 is a311d only
ASOUND_STATE="asound.state.khadas-vim3"

BOOTBRANCH_BOARD="tag:v2024.01"
BOOTPATCHDIR="v2024.01" # this has 'board_khadas-vim3' which has a patch to boot USB/NVMe/SCSI first
BOOTBRANCH_BOARD="tag:v2025.04-rc5"
BOOTPATCHDIR="v2025.04" # this has 'board_khadas-vim3' which has a patch to boot USB/NVMe/SCSI first

declare -g KHADAS_OOWOW_BOARD_ID="VIM3" # for use with EXT=output-image-oowow

Expand Down Expand Up @@ -53,6 +53,12 @@ function post_config_uboot_target__extra_configs_for_khadas_vim3() {
display_alert "u-boot for ${BOARD}" "u-boot: enable gpio LED support" "info"
run_host_command_logged scripts/config --enable CONFIG_LED
run_host_command_logged scripts/config --enable CONFIG_LED_GPIO
display_alert "u-boot for ${BOARD}" "u-boot: enable more cmdline commands" "info" # for extra compat with eg HAOS
run_host_command_logged scripts/config --enable CONFIG_CMD_SQUASHFS
run_host_command_logged scripts/config --enable CONFIG_CMD_SETEXPR
run_host_command_logged scripts/config --enable CONFIG_CMD_FILEENV # added via cmd-fileenv-read-string-from-file-into-env.patch
run_host_command_logged scripts/config --enable CONFIG_CMD_CAT
run_host_command_logged scripts/config --enable CONFIG_CMD_XXD
display_alert "u-boot for ${BOARD}" "u-boot: enable networking cmds" "info"
run_host_command_logged scripts/config --enable CONFIG_CMD_NFS
run_host_command_logged scripts/config --enable CONFIG_CMD_WGET
Expand Down
Original file line number Diff line number Diff line change
@@ -1,32 +1,29 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <[email protected]>
Date: Sun, 14 Jan 2024 13:44:58 +0100
Subject: meson64: change `BOOT_TARGET_DEVICES` to try to boot USB, NVME and
SCSI before SD, MMC, PXE, DHCP
Subject: meson64: boot order: SD -> USB -> NVMe -> eMMC

---
include/configs/meson64.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
include/configs/meson64.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/configs/meson64.h b/include/configs/meson64.h
index efab9a624dc5..32c25098e674 100644
index 111111111111..222222222222 100644
--- a/include/configs/meson64.h
+++ b/include/configs/meson64.h
@@ -99,12 +99,12 @@
@@ -119,10 +119,12 @@
#define BOOT_TARGET_DEVICES(func) \
func(ROMUSB, romusb, na) \
func(USB_DFU, usbdfu, na) \
- func(MMC, mmc, 0) \
- func(MMC, mmc, 1) \
- func(MMC, mmc, 2) \
- BOOT_TARGET_MMC(func) \
+ func(MMC, mmc, 0) \
+ func(MMC, mmc, 1) \
BOOT_TARGET_DEVICES_USB(func) \
BOOT_TARGET_NVME(func) \
BOOT_TARGET_SCSI(func) \
+ func(MMC, mmc, 0) \
+ func(MMC, mmc, 1) \
+ func(MMC, mmc, 2) \
func(PXE, pxe, na) \
func(DHCP, dhcp, na)
BOOT_TARGET_PXE(func) \
BOOT_TARGET_DHCP(func)
#endif
--
Armbian
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <[email protected]>
Date: Fri, 31 Jan 2025 15:52:03 +0100
Subject: cmd: fileenv: read string from file into env

- rpardini: adapted from vendor/legacy patch from 2018

Signed-off-by: Pascal Vizeli <[email protected]>
Signed-off-by: Stefan Agner <[email protected]>
Signed-off-by: Ricardo Pardini <[email protected]>
---
cmd/Kconfig | 5 +
cmd/Makefile | 1 +
cmd/fileenv.c | 46 ++++++++++
3 files changed, 52 insertions(+)

diff --git a/cmd/Kconfig b/cmd/Kconfig
index 111111111111..222222222222 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -1825,6 +1825,11 @@ config CMD_XXD
help
Print file as hexdump to standard output

+config CMD_FILEENV
+ bool "fileenv"
+ help
+ Read a file into memory and store it to env.
+
endmenu

if NET || NET_LWIP
diff --git a/cmd/Makefile b/cmd/Makefile
index 111111111111..222222222222 100644
--- a/cmd/Makefile
+++ b/cmd/Makefile
@@ -173,6 +173,7 @@ obj-$(CONFIG_CMD_SHA1SUM) += sha1sum.o
obj-$(CONFIG_CMD_SEAMA) += seama.o
obj-$(CONFIG_CMD_SETEXPR) += setexpr.o
obj-$(CONFIG_CMD_SETEXPR_FMT) += printf.o
+obj-$(CONFIG_CMD_FILEENV) += fileenv.o
obj-$(CONFIG_CMD_SPI) += spi.o
obj-$(CONFIG_CMD_STRINGS) += strings.o
obj-$(CONFIG_CMD_SMBIOS) += smbios.o
diff --git a/cmd/fileenv.c b/cmd/fileenv.c
new file mode 100644
index 000000000000..111111111111
--- /dev/null
+++ b/cmd/fileenv.c
@@ -0,0 +1,46 @@
+#include <config.h>
+#include <command.h>
+#include <fs.h>
+#include <linux/ctype.h>
+#include <vsprintf.h>
+
+static char *fs_argv[5];
+
+int do_fileenv(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[])
+{
+ if (argc < 6)
+ return CMD_RET_USAGE;
+
+ fs_argv[0] = "fatload";
+ fs_argv[1] = argv[1];
+ fs_argv[2] = argv[2];
+ fs_argv[3] = argv[3];
+ fs_argv[4] = argv[4];
+
+ if (do_fat_fsload(cmdtp, 0, 5, fs_argv) != 0)
+ return 1;
+
+ char *addr = (char *)simple_strtoul(argv[3], NULL, 16);
+ size_t size = env_get_hex("filesize", 0);
+
+ // Prepare string
+ addr[size] = 0x00;
+ char *s = addr;
+ while(*s != 0x00) {
+ if (isprint(*s)) {
+ s++;
+ }
+ else {
+ *s = 0x00;
+ }
+ }
+
+ return env_set(argv[5], addr);
+}
+
+U_BOOT_CMD(
+ fileenv, 6, 0, do_fileenv,
+ "Read file and store it into env.",
+ "<interface> <dev:part> <addr> <filename> <envname>\n"
+ " - Read file from fat32 and store it as env."
+);
--
Armbian