mirror of
https://github.com/home-assistant/operating-system.git
synced 2025-07-28 15:36:29 +00:00
Add fileenv patch for U-Boot 2021.04 (#1344)
Update of this patch has been missed. Also drop the versions for U-Boot 2020.01 and 2020.10 since they are no longer required.
This commit is contained in:
parent
33e0ccb9ce
commit
422bf2d1e1
@ -1,95 +0,0 @@
|
|||||||
From e22e7b8bf6eca98af102dd27991c089b8f3de65b Mon Sep 17 00:00:00 2001
|
|
||||||
From: Pascal Vizeli <pvizeli@syshack.ch>
|
|
||||||
Date: Sun, 5 Aug 2018 20:43:03 +0000
|
|
||||||
Subject: [PATCH 1/1] CMD: read string from fileinto env
|
|
||||||
|
|
||||||
Signed-off-by: Pascal Vizeli <pvizeli@syshack.ch>
|
|
||||||
---
|
|
||||||
cmd/Kconfig | 5 +++++
|
|
||||||
cmd/Makefile | 1 +
|
|
||||||
cmd/fileenv.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
|
|
||||||
3 files changed, 51 insertions(+)
|
|
||||||
create mode 100644 cmd/fileenv.c
|
|
||||||
|
|
||||||
diff --git a/cmd/Kconfig b/cmd/Kconfig
|
|
||||||
index aec209006db..d9d0d7326ac 100644
|
|
||||||
--- a/cmd/Kconfig
|
|
||||||
+++ b/cmd/Kconfig
|
|
||||||
@@ -1059,6 +1059,11 @@ config CMD_SETEXPR
|
|
||||||
Also supports loading the value at a memory location into a variable.
|
|
||||||
If CONFIG_REGEX is enabled, setexpr also supports a gsub function.
|
|
||||||
|
|
||||||
+config CMD_FILEENV
|
|
||||||
+ bool "fileenv"
|
|
||||||
+ help
|
|
||||||
+ Read a file into memory and store it to env.
|
|
||||||
+
|
|
||||||
endmenu
|
|
||||||
|
|
||||||
if NET
|
|
||||||
diff --git a/cmd/Makefile b/cmd/Makefile
|
|
||||||
index 323f1fd2c77..0d721dc5a72 100644
|
|
||||||
--- a/cmd/Makefile
|
|
||||||
+++ b/cmd/Makefile
|
|
||||||
@@ -114,6 +114,7 @@ obj-$(CONFIG_CMD_SF) += sf.o
|
|
||||||
obj-$(CONFIG_CMD_SCSI) += scsi.o disk.o
|
|
||||||
obj-$(CONFIG_CMD_SHA1SUM) += sha1sum.o
|
|
||||||
obj-$(CONFIG_CMD_SETEXPR) += setexpr.o
|
|
||||||
+obj-$(CONFIG_CMD_FILEENV) += fileenv.o
|
|
||||||
obj-$(CONFIG_CMD_SPI) += spi.o
|
|
||||||
obj-$(CONFIG_CMD_STRINGS) += strings.o
|
|
||||||
obj-$(CONFIG_CMD_SMC) += smccc.o
|
|
||||||
diff --git a/cmd/fileenv.c b/cmd/fileenv.c
|
|
||||||
new file mode 100644
|
|
||||||
index 00000000000..ddfc5dcdbc0
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/cmd/fileenv.c
|
|
||||||
@@ -0,0 +1,45 @@
|
|
||||||
+#include <config.h>
|
|
||||||
+#include <common.h>
|
|
||||||
+#include <command.h>
|
|
||||||
+#include <linux/ctype.h>
|
|
||||||
+
|
|
||||||
+static char *fs_argv[5];
|
|
||||||
+
|
|
||||||
+int do_fileenv(cmd_tbl_t *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."
|
|
||||||
+);
|
|
||||||
--
|
|
||||||
2.17.1
|
|
||||||
|
|
@ -1,22 +1,23 @@
|
|||||||
From 8a77e2b9f56c8973273b8dc6a7cfa1ed0330d058 Mon Sep 17 00:00:00 2001
|
From 41bc5702b6a856b6a135f705e747fae737277b20 Mon Sep 17 00:00:00 2001
|
||||||
Message-Id: <8a77e2b9f56c8973273b8dc6a7cfa1ed0330d058.1602102685.git.stefan@agner.ch>
|
Message-Id: <41bc5702b6a856b6a135f705e747fae737277b20.1619639299.git.stefan@agner.ch>
|
||||||
From: Pascal Vizeli <pvizeli@syshack.ch>
|
From: Pascal Vizeli <pvizeli@syshack.ch>
|
||||||
Date: Sun, 5 Aug 2018 20:43:03 +0000
|
Date: Sun, 5 Aug 2018 20:43:03 +0000
|
||||||
Subject: [PATCH] CMD: read string from fileinto env
|
Subject: [PATCH] cmd: read string from file into env
|
||||||
|
|
||||||
Signed-off-by: Pascal Vizeli <pvizeli@syshack.ch>
|
Signed-off-by: Pascal Vizeli <pvizeli@syshack.ch>
|
||||||
|
Signed-off-by: Stefan Agner <stefan@agner.ch>
|
||||||
---
|
---
|
||||||
cmd/Kconfig | 5 +++++
|
cmd/Kconfig | 5 +++++
|
||||||
cmd/Makefile | 1 +
|
cmd/Makefile | 1 +
|
||||||
cmd/fileenv.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
|
cmd/fileenv.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
3 files changed, 51 insertions(+)
|
3 files changed, 52 insertions(+)
|
||||||
create mode 100644 cmd/fileenv.c
|
create mode 100644 cmd/fileenv.c
|
||||||
|
|
||||||
diff --git a/cmd/Kconfig b/cmd/Kconfig
|
diff --git a/cmd/Kconfig b/cmd/Kconfig
|
||||||
index 0c984d735d..0dfd82d0a3 100644
|
index 863b7f9fda..5c67b6d719 100644
|
||||||
--- a/cmd/Kconfig
|
--- a/cmd/Kconfig
|
||||||
+++ b/cmd/Kconfig
|
+++ b/cmd/Kconfig
|
||||||
@@ -1448,6 +1448,11 @@ config CMD_SETEXPR
|
@@ -1397,6 +1397,11 @@ config CMD_SETEXPR
|
||||||
Also supports loading the value at a memory location into a variable.
|
Also supports loading the value at a memory location into a variable.
|
||||||
If CONFIG_REGEX is enabled, setexpr also supports a gsub function.
|
If CONFIG_REGEX is enabled, setexpr also supports a gsub function.
|
||||||
|
|
||||||
@ -29,10 +30,10 @@ index 0c984d735d..0dfd82d0a3 100644
|
|||||||
|
|
||||||
menu "Android support commands"
|
menu "Android support commands"
|
||||||
diff --git a/cmd/Makefile b/cmd/Makefile
|
diff --git a/cmd/Makefile b/cmd/Makefile
|
||||||
index 3a9c9747c9..9ccb63e248 100644
|
index 567e2b79d2..8804b70ca8 100644
|
||||||
--- a/cmd/Makefile
|
--- a/cmd/Makefile
|
||||||
+++ b/cmd/Makefile
|
+++ b/cmd/Makefile
|
||||||
@@ -133,6 +133,7 @@ obj-$(CONFIG_CMD_SF) += sf.o
|
@@ -140,6 +140,7 @@ obj-$(CONFIG_CMD_SF) += sf.o
|
||||||
obj-$(CONFIG_CMD_SCSI) += scsi.o disk.o
|
obj-$(CONFIG_CMD_SCSI) += scsi.o disk.o
|
||||||
obj-$(CONFIG_CMD_SHA1SUM) += sha1sum.o
|
obj-$(CONFIG_CMD_SHA1SUM) += sha1sum.o
|
||||||
obj-$(CONFIG_CMD_SETEXPR) += setexpr.o
|
obj-$(CONFIG_CMD_SETEXPR) += setexpr.o
|
||||||
@ -42,13 +43,14 @@ index 3a9c9747c9..9ccb63e248 100644
|
|||||||
obj-$(CONFIG_CMD_SMC) += smccc.o
|
obj-$(CONFIG_CMD_SMC) += smccc.o
|
||||||
diff --git a/cmd/fileenv.c b/cmd/fileenv.c
|
diff --git a/cmd/fileenv.c b/cmd/fileenv.c
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000..af24d22d0e
|
index 0000000000..9891cb05ab
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/cmd/fileenv.c
|
+++ b/cmd/fileenv.c
|
||||||
@@ -0,0 +1,45 @@
|
@@ -0,0 +1,46 @@
|
||||||
+#include <config.h>
|
+#include <config.h>
|
||||||
+#include <common.h>
|
+#include <common.h>
|
||||||
+#include <command.h>
|
+#include <command.h>
|
||||||
|
+#include <fs.h>
|
||||||
+#include <linux/ctype.h>
|
+#include <linux/ctype.h>
|
||||||
+
|
+
|
||||||
+static char *fs_argv[5];
|
+static char *fs_argv[5];
|
||||||
@ -92,5 +94,5 @@ index 0000000000..af24d22d0e
|
|||||||
+ " - Read file from fat32 and store it as env."
|
+ " - Read file from fat32 and store it as env."
|
||||||
+);
|
+);
|
||||||
--
|
--
|
||||||
2.28.0
|
2.31.1
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user