diff --git a/buildroot b/buildroot index f10577b83..3c5f87185 160000 --- a/buildroot +++ b/buildroot @@ -1 +1 @@ -Subproject commit f10577b83679910e52f9b90b9d943eceb4a4f0a1 +Subproject commit 3c5f87185d5507c21a975580b5c1d4303a3bed54 diff --git a/buildroot-external/board/pc/patches/dt-utils/0001-barebox-state-get-devicetree-from-file.patch b/buildroot-external/board/pc/patches/dt-utils/0001-barebox-state-get-devicetree-from-file.patch deleted file mode 100644 index ecfa1b0c7..000000000 --- a/buildroot-external/board/pc/patches/dt-utils/0001-barebox-state-get-devicetree-from-file.patch +++ /dev/null @@ -1,130 +0,0 @@ -From 4e9abe7945370765a9e8e88b01a7ef5f266bf7fd Mon Sep 17 00:00:00 2001 -Message-Id: <4e9abe7945370765a9e8e88b01a7ef5f266bf7fd.1606682453.git.stefan@agner.ch> -From: Steffen Trumtrar -Date: Fri, 30 Jun 2017 16:53:34 +0200 -Subject: [PATCH dt-utils 1/3] barebox-state: get devicetree from file - -Signed-off-by: Steffen Trumtrar ---- - src/barebox-state.c | 30 ++++++++++++++++++++++-------- - src/barebox-state.h | 2 +- - src/keystore-blob.c | 2 +- - 3 files changed, 24 insertions(+), 10 deletions(-) - -diff --git a/src/barebox-state.c b/src/barebox-state.c -index f8b8df6..76f9c41 100644 ---- a/src/barebox-state.c -+++ b/src/barebox-state.c -@@ -308,7 +308,7 @@ static int state_set_var(struct state *state, const char *var, const char *val) - } - - --struct state *state_get(const char *name, bool readonly, bool auth) -+struct state *state_get(const char *name, const char *filename, bool readonly, bool auth) - { - struct device_node *root, *node; - char *path; -@@ -317,11 +317,19 @@ struct state *state_get(const char *name, bool readonly, bool auth) - const char *backend_type = NULL; - struct state_variable *v; - -- root = of_read_proc_devicetree(); -- if (IS_ERR(root)) { -- pr_err("Unable to read devicetree. %s\n", -- strerror(-PTR_ERR(root))); -- return ERR_CAST(root); -+ if (filename) { -+ void *fdt; -+ -+ fdt = read_file(filename, NULL); -+ if (fdt) -+ root = of_unflatten_dtb(fdt); -+ } else { -+ root = of_read_proc_devicetree(); -+ if (IS_ERR(root)) { -+ pr_err("Unable to read devicetree. %s\n", -+ strerror(-PTR_ERR(root))); -+ return ERR_CAST(root); -+ } - } - - of_set_root_node(root); -@@ -372,6 +380,7 @@ static struct option long_options[] = { - {"get", required_argument, 0, 'g' }, - {"set", required_argument, 0, 's' }, - {"name", required_argument, 0, 'n' }, -+ {"input", required_argument, 0, 'i' }, - {"dump", no_argument, 0, 'd' }, - {"dump-shell", no_argument, 0, OPT_DUMP_SHELL }, - {"verbose", no_argument, 0, 'v' }, -@@ -387,6 +396,7 @@ static void usage(char *name) - "-g, --get get the value of a variable\n" - "-s, --set = set the value of a variable\n" - "-n, --name specify the state to use (default=\"state\"). Multiple states are allowed.\n" -+"-i, --input load the devicetree from a file instead of using the system devicetree.\n" - "-d, --dump dump the state\n" - "--dump-shell dump the state suitable for shell sourcing\n" - "-v, --verbose increase verbosity\n" -@@ -424,12 +434,13 @@ int main(int argc, char *argv[]) - bool readonly = true; - int pr_level = 5; - int auth = 1; -+ const char *dtb = NULL; - - INIT_LIST_HEAD(&sg_list); - INIT_LIST_HEAD(&state_list.list); - - while (1) { -- c = getopt_long(argc, argv, "hg:s:dvn:qf", long_options, &option_index); -+ c = getopt_long(argc, argv, "hg:s:i:dvn:qf", long_options, &option_index); - if (c < 0) - break; - switch (c) { -@@ -475,6 +486,9 @@ int main(int argc, char *argv[]) - ++nr_states; - break; - } -+ case 'i': -+ dtb = strdup(optarg); -+ break; - case ':': - case '?': - default: -@@ -515,7 +529,7 @@ int main(int argc, char *argv[]) - } - - list_for_each_entry(state, &state_list.list, list) { -- state->state = state_get(state->name, readonly, auth); -+ state->state = state_get(state->name, dtb, readonly, auth); - if (!IS_ERR(state->state) && !state->name) - state->name = state->state->name; - if (IS_ERR(state->state)) { -diff --git a/src/barebox-state.h b/src/barebox-state.h -index bd89cf4..a0f49a5 100644 ---- a/src/barebox-state.h -+++ b/src/barebox-state.h -@@ -1,7 +1,7 @@ - #ifndef __BAREBOX_STATE__ - #define __BAREBOX_STATE__ - --struct state *state_get(const char *name, bool readonly, bool auth); -+struct state *state_get(const char *name, const char *file, bool readonly, bool auth); - char *state_get_var(struct state *state, const char *var); - - #endif /* __BAREBOX_STATE__ */ -diff --git a/src/keystore-blob.c b/src/keystore-blob.c -index 028dd8b..4572431 100644 ---- a/src/keystore-blob.c -+++ b/src/keystore-blob.c -@@ -30,7 +30,7 @@ int keystore_get_secret(const char *name, const unsigned char **key, int *key_le - if (!state) { - struct state *tmp; - -- tmp = state_get(keystore_state_name, true, false); -+ tmp = state_get(keystore_state_name, NULL, true, false); - if (IS_ERR(tmp)) - return PTR_ERR(tmp); - state = tmp; --- -2.29.2 - diff --git a/buildroot-external/board/pc/patches/dt-utils/0002-libdt-support-finding-devices-by-partuuid.patch b/buildroot-external/board/pc/patches/dt-utils/0002-libdt-support-finding-devices-by-partuuid.patch deleted file mode 100644 index cdbf8b288..000000000 --- a/buildroot-external/board/pc/patches/dt-utils/0002-libdt-support-finding-devices-by-partuuid.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 4eb260d97419349320aa688866b4cf1eb177df70 Mon Sep 17 00:00:00 2001 -Message-Id: <4eb260d97419349320aa688866b4cf1eb177df70.1606682453.git.stefan@agner.ch> -In-Reply-To: <4e9abe7945370765a9e8e88b01a7ef5f266bf7fd.1606682453.git.stefan@agner.ch> -References: <4e9abe7945370765a9e8e88b01a7ef5f266bf7fd.1606682453.git.stefan@agner.ch> -From: Steffen Trumtrar -Date: Fri, 30 Jun 2017 16:53:17 +0200 -Subject: [PATCH dt-utils 2/3] libdt: support finding devices by partuuid - -Signed-off-by: Steffen Trumtrar ---- - src/libdt.c | 12 ++++++++++++ - 1 file changed, 12 insertions(+) - -diff --git a/src/libdt.c b/src/libdt.c -index 4638678..b52f80c 100644 ---- a/src/libdt.c -+++ b/src/libdt.c -@@ -2416,6 +2416,18 @@ int of_get_devicepath(struct device_node *partition_node, char **devpath, off_t - */ - node = partition_node->parent; - -+ if (of_device_is_compatible(node, "fixed-partitions")) { -+ const char *uuid; -+ -+ /* when partuuid is specified short-circuit the search for the cdev */ -+ ret = of_property_read_string(partition_node, "partuuid", &uuid); -+ if (!ret) { -+ *devpath = basprintf("/dev/disk/by-partuuid/%s", uuid); -+ -+ return 0; -+ } -+ } -+ - /* - * Respect flash "partitions" subnode. Use parent of parent in this - * case. --- -2.29.2 - diff --git a/buildroot-external/board/pc/patches/dt-utils/0003-state-use-run-to-store-lockfile.patch b/buildroot-external/board/pc/patches/dt-utils/0003-state-use-run-to-store-lockfile.patch deleted file mode 100644 index 811fdc3c7..000000000 --- a/buildroot-external/board/pc/patches/dt-utils/0003-state-use-run-to-store-lockfile.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 665603ecadb8385dd6c18840d3b0120859a00369 Mon Sep 17 00:00:00 2001 -Message-Id: <665603ecadb8385dd6c18840d3b0120859a00369.1606682453.git.stefan@agner.ch> -In-Reply-To: <4e9abe7945370765a9e8e88b01a7ef5f266bf7fd.1606682453.git.stefan@agner.ch> -References: <4e9abe7945370765a9e8e88b01a7ef5f266bf7fd.1606682453.git.stefan@agner.ch> -From: Stefan Agner -Date: Fri, 13 Nov 2020 10:39:03 +0100 -Subject: [PATCH dt-utils 3/3] state: use /run to store lockfile - -The current location /var/lock is considered legacy (at least by -systemd). Just use /run to store the lockfile and append the usual .lock -suffix. - -Signed-off-by: Stefan Agner ---- - src/barebox-state.c | 8 +++++--- - 1 file changed, 5 insertions(+), 3 deletions(-) - -diff --git a/src/barebox-state.c b/src/barebox-state.c -index 76f9c41..53e5eb6 100644 ---- a/src/barebox-state.c -+++ b/src/barebox-state.c -@@ -38,6 +38,8 @@ - #include
- #include - -+#define BAREBOX_STATE_LOCKFILE "/run/barebox-state.lock" -+ - struct state_variable; - - static int __state_uint8_set(struct state_variable *var, const char *val); -@@ -515,15 +517,15 @@ int main(int argc, char *argv[]) - ++nr_states; - } - -- lock_fd = open("/var/lock/barebox-state", O_CREAT | O_RDWR, 0600); -+ lock_fd = open(BAREBOX_STATE_LOCKFILE, O_CREAT | O_RDWR, 0600); - if (lock_fd < 0) { -- pr_err("Failed to open lock-file /var/lock/barebox-state\n"); -+ pr_err("Failed to open lock-file " BAREBOX_STATE_LOCKFILE "\n"); - exit(1); - } - - ret = flock(lock_fd, LOCK_EX); - if (ret < 0) { -- pr_err("Failed to lock /var/lock/barebox-state: %m\n"); -+ pr_err("Failed to lock " BAREBOX_STATE_LOCKFILE ": %m\n"); - close(lock_fd); - exit(1); - } --- -2.29.2 -