mirror of
https://github.com/armbian/build.git
synced 2025-08-14 07:06:58 +02:00
Some checks failed
Forked Helper / 📢 Run repository dispatch on fork (push) Has been cancelled
Announce PR merge to Discord / announcepush (push) Has been cancelled
Scorecards Security Scan / Scorecards analysis (push) Has been cancelled
Update Board Lists / Send dispatch (push) Has been cancelled
- **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: https://github.com/home-assistant/operating-system/pull/3784 - borrowed `fileenv` patch from v2025.01 to .04 - Similar treatment that `odroidm1` got in https://github.com/armbian/build/pull/7769 - note: I will be leaving my VIM3 behind in the other side of the globe, so this is my last chance to test
100 lines
2.4 KiB
Diff
100 lines
2.4 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Ricardo Pardini <ricardo@pardini.net>
|
|
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 <pvizeli@syshack.ch>
|
|
Signed-off-by: Stefan Agner <stefan@agner.ch>
|
|
Signed-off-by: Ricardo Pardini <ricardo@pardini.net>
|
|
---
|
|
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
|
|
|