Skip to content

Commit a4b1edd

Browse files
rpardiniigorpecovnik
authored andcommitted
khadas-vim3: u-boot: bump to 2025.04-rc5; boot SD first; enable setexpr; patch 2025.04 for fileenv; enable squashfs support
- **CHANGE**: This version tries to boot SD first (thus SD -> USB -> NVMe -> eMMC); before it would boot USB before SD - as Armbian u-boot is possibly deployed to SPI, try to make as compatible as possible; eg enable squashfs support - enable `setexpr` and `fileenv`, used by HAOS - HAOS already has support for booting VIM3 from NVMe: home-assistant/operating-system#3784 - borrowed `fileenv` patch from v2025.01 to .04 - Similar treatment that `odroidm1` got in #7769 - note: I will be leaving my VIM3 behind in the other side of the globe, so this is my last chance to test
1 parent f4783ec commit a4b1edd

File tree

3 files changed

+117
-15
lines changed

3 files changed

+117
-15
lines changed

config/boards/khadas-vim3.conf

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ BOOT_LOGO="desktop"
1212
BOOT_FDT_FILE="amlogic/meson-g12b-a311d-khadas-vim3.dtb" # there is also a s922x dtb, but vim3 is a311d only
1313
ASOUND_STATE="asound.state.khadas-vim3"
1414

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

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

@@ -53,6 +53,12 @@ function post_config_uboot_target__extra_configs_for_khadas_vim3() {
5353
display_alert "u-boot for ${BOARD}" "u-boot: enable gpio LED support" "info"
5454
run_host_command_logged scripts/config --enable CONFIG_LED
5555
run_host_command_logged scripts/config --enable CONFIG_LED_GPIO
56+
display_alert "u-boot for ${BOARD}" "u-boot: enable more cmdline commands" "info" # for extra compat with eg HAOS
57+
run_host_command_logged scripts/config --enable CONFIG_CMD_SQUASHFS
58+
run_host_command_logged scripts/config --enable CONFIG_CMD_SETEXPR
59+
run_host_command_logged scripts/config --enable CONFIG_CMD_FILEENV # added via cmd-fileenv-read-string-from-file-into-env.patch
60+
run_host_command_logged scripts/config --enable CONFIG_CMD_CAT
61+
run_host_command_logged scripts/config --enable CONFIG_CMD_XXD
5662
display_alert "u-boot for ${BOARD}" "u-boot: enable networking cmds" "info"
5763
run_host_command_logged scripts/config --enable CONFIG_CMD_NFS
5864
run_host_command_logged scripts/config --enable CONFIG_CMD_WGET

patch/u-boot/v2024.01/board_khadas-vim3/meson64-boot-usb-nvme-scsi-first.patch renamed to patch/u-boot/v2025.04/board_khadas-vim3/meson64-boot-usb-nvme-scsi-first.patch

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,29 @@
11
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
22
From: Ricardo Pardini <[email protected]>
33
Date: Sun, 14 Jan 2024 13:44:58 +0100
4-
Subject: meson64: change `BOOT_TARGET_DEVICES` to try to boot USB, NVME and
5-
SCSI before SD, MMC, PXE, DHCP
4+
Subject: meson64: boot order: SD -> USB -> NVMe -> eMMC
65

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

1110
diff --git a/include/configs/meson64.h b/include/configs/meson64.h
12-
index efab9a624dc5..32c25098e674 100644
11+
index 111111111111..222222222222 100644
1312
--- a/include/configs/meson64.h
1413
+++ b/include/configs/meson64.h
15-
@@ -99,12 +99,12 @@
14+
@@ -119,10 +119,12 @@
1615
#define BOOT_TARGET_DEVICES(func) \
1716
func(ROMUSB, romusb, na) \
1817
func(USB_DFU, usbdfu, na) \
19-
- func(MMC, mmc, 0) \
20-
- func(MMC, mmc, 1) \
21-
- func(MMC, mmc, 2) \
18+
- BOOT_TARGET_MMC(func) \
19+
+ func(MMC, mmc, 0) \
20+
+ func(MMC, mmc, 1) \
2221
BOOT_TARGET_DEVICES_USB(func) \
2322
BOOT_TARGET_NVME(func) \
2423
BOOT_TARGET_SCSI(func) \
25-
+ func(MMC, mmc, 0) \
26-
+ func(MMC, mmc, 1) \
2724
+ func(MMC, mmc, 2) \
28-
func(PXE, pxe, na) \
29-
func(DHCP, dhcp, na)
25+
BOOT_TARGET_PXE(func) \
26+
BOOT_TARGET_DHCP(func)
3027
#endif
3128
--
3229
Armbian
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: Ricardo Pardini <[email protected]>
3+
Date: Fri, 31 Jan 2025 15:52:03 +0100
4+
Subject: cmd: fileenv: read string from file into env
5+
6+
- rpardini: adapted from vendor/legacy patch from 2018
7+
8+
Signed-off-by: Pascal Vizeli <[email protected]>
9+
Signed-off-by: Stefan Agner <[email protected]>
10+
Signed-off-by: Ricardo Pardini <[email protected]>
11+
---
12+
cmd/Kconfig | 5 +
13+
cmd/Makefile | 1 +
14+
cmd/fileenv.c | 46 ++++++++++
15+
3 files changed, 52 insertions(+)
16+
17+
diff --git a/cmd/Kconfig b/cmd/Kconfig
18+
index 111111111111..222222222222 100644
19+
--- a/cmd/Kconfig
20+
+++ b/cmd/Kconfig
21+
@@ -1825,6 +1825,11 @@ config CMD_XXD
22+
help
23+
Print file as hexdump to standard output
24+
25+
+config CMD_FILEENV
26+
+ bool "fileenv"
27+
+ help
28+
+ Read a file into memory and store it to env.
29+
+
30+
endmenu
31+
32+
if NET || NET_LWIP
33+
diff --git a/cmd/Makefile b/cmd/Makefile
34+
index 111111111111..222222222222 100644
35+
--- a/cmd/Makefile
36+
+++ b/cmd/Makefile
37+
@@ -173,6 +173,7 @@ obj-$(CONFIG_CMD_SHA1SUM) += sha1sum.o
38+
obj-$(CONFIG_CMD_SEAMA) += seama.o
39+
obj-$(CONFIG_CMD_SETEXPR) += setexpr.o
40+
obj-$(CONFIG_CMD_SETEXPR_FMT) += printf.o
41+
+obj-$(CONFIG_CMD_FILEENV) += fileenv.o
42+
obj-$(CONFIG_CMD_SPI) += spi.o
43+
obj-$(CONFIG_CMD_STRINGS) += strings.o
44+
obj-$(CONFIG_CMD_SMBIOS) += smbios.o
45+
diff --git a/cmd/fileenv.c b/cmd/fileenv.c
46+
new file mode 100644
47+
index 000000000000..111111111111
48+
--- /dev/null
49+
+++ b/cmd/fileenv.c
50+
@@ -0,0 +1,46 @@
51+
+#include <config.h>
52+
+#include <command.h>
53+
+#include <fs.h>
54+
+#include <linux/ctype.h>
55+
+#include <vsprintf.h>
56+
+
57+
+static char *fs_argv[5];
58+
+
59+
+int do_fileenv(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[])
60+
+{
61+
+ if (argc < 6)
62+
+ return CMD_RET_USAGE;
63+
+
64+
+ fs_argv[0] = "fatload";
65+
+ fs_argv[1] = argv[1];
66+
+ fs_argv[2] = argv[2];
67+
+ fs_argv[3] = argv[3];
68+
+ fs_argv[4] = argv[4];
69+
+
70+
+ if (do_fat_fsload(cmdtp, 0, 5, fs_argv) != 0)
71+
+ return 1;
72+
+
73+
+ char *addr = (char *)simple_strtoul(argv[3], NULL, 16);
74+
+ size_t size = env_get_hex("filesize", 0);
75+
+
76+
+ // Prepare string
77+
+ addr[size] = 0x00;
78+
+ char *s = addr;
79+
+ while(*s != 0x00) {
80+
+ if (isprint(*s)) {
81+
+ s++;
82+
+ }
83+
+ else {
84+
+ *s = 0x00;
85+
+ }
86+
+ }
87+
+
88+
+ return env_set(argv[5], addr);
89+
+}
90+
+
91+
+U_BOOT_CMD(
92+
+ fileenv, 6, 0, do_fileenv,
93+
+ "Read file and store it into env.",
94+
+ "<interface> <dev:part> <addr> <filename> <envname>\n"
95+
+ " - Read file from fat32 and store it as env."
96+
+);
97+
--
98+
Armbian
99+

0 commit comments

Comments
 (0)