WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 586ef1f

Browse files
committed
u-boot: prepare v2026.01 patch directory
- fileenv patch, generic for all - 0000.patching_config.yaml for null-patch-free future
1 parent b6d4e33 commit 586ef1f

File tree

2 files changed

+105
-0
lines changed

2 files changed

+105
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
config:
2+
3+
overlay-directories:
4+
- { source: "defconfig", target: "configs" } # copies all files in defconfig dir to the configs/ dir in the u-boot source tree
5+
- { source: "dt_upstream_rockchip", target: "dts/upstream/src/arm64/rockchip" } # copies all files in dt_upstream_rockchip dir to the dts/upstream/src/arm64/rockchip dir in the u-boot source tree
6+
- { source: "dt_uboot", target: "arch/arm/dts" } # copies all files in dt_uboot dir to the arch/arm/dts dir in the u-boot source tree
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+
@@ -1898,6 +1898,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+
@@ -175,6 +175,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+
+#include "env.h"
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)