Follow up commits will flesh out the sandbox.dts and make most of what's in the skeleton.dtsi redundant. Merge the .dtsi with the .dts to have all the code at one place. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> --- v1 -> v2: no changes --- arch/sandbox/dts/sandbox.dts | 16 ++++++++++++++-- arch/sandbox/dts/skeleton.dtsi | 13 ------------- 2 files changed, 14 insertions(+), 15 deletions(-) delete mode 100644 arch/sandbox/dts/skeleton.dtsi diff --git a/arch/sandbox/dts/sandbox.dts b/arch/sandbox/dts/sandbox.dts index 4576e873d9cb..b3327837a38a 100644 --- a/arch/sandbox/dts/sandbox.dts +++ b/arch/sandbox/dts/sandbox.dts @@ -1,8 +1,20 @@ /dts-v1/; -#include "skeleton.dtsi" - / { model = "Sandbox"; compatible = "barebox,sandbox"; + + #address-cells = <2>; + #size-cells = <2>; + + aliases { + }; + + chosen { + }; + + memory { + device_type = "memory"; + reg = <0 0 0 0>; + }; }; diff --git a/arch/sandbox/dts/skeleton.dtsi b/arch/sandbox/dts/skeleton.dtsi deleted file mode 100644 index 8ba7663eb5c0..000000000000 --- a/arch/sandbox/dts/skeleton.dtsi +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Skeleton device tree; the bare minimum needed to boot; just include and - * add a compatible value. The bootloader will typically populate the memory - * node. - */ - -/ { - #address-cells = <2>; - #size-cells = <2>; - chosen { }; - aliases { }; - memory { device_type = "memory"; reg = <0 0 0 0>; }; -}; -- 2.28.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
For reading reg with #address-cells and #size-cells of 2, an of_property_read_u64_array can be quite convenient. Add one. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> --- v1 -> v2: no changes --- drivers/of/base.c | 37 +++++++++++++++++++++++++++++++++++++ include/of.h | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+) diff --git a/drivers/of/base.c b/drivers/of/base.c index f5aad268b2d0..5b45c2023f3b 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -893,6 +893,43 @@ int of_property_read_u64(const struct device_node *np, const char *propname, } EXPORT_SYMBOL_GPL(of_property_read_u64); +/** + * of_property_read_u64_array - Find and read an array of 64 bit integers + * from a property. + * + * @np: device node from which the property value is to be read. + * @propname: name of the property to be searched. + * @out_value: pointer to return value, modified only if return value is 0. + * @sz: number of array elements to read + * + * Search for a property in a device node and read 64-bit value(s) from + * it. Returns 0 on success, -EINVAL if the property does not exist, + * -ENODATA if property does not have a value, and -EOVERFLOW if the + * property data isn't large enough. + * + * The out_value is modified only if a valid u64 value can be decoded. + */ +int of_property_read_variable_u64_array(const struct device_node *np, + const char *propname, u64 *out_values, + size_t sz) +{ + size_t count; + const __be32 *val = of_find_property_value_of_size(np, propname, + (sz * sizeof(*out_values))); + + if (IS_ERR(val)) + return PTR_ERR(val); + + count = sz; + while (count--) { + *out_values++ = of_read_number(val, 2); + val += 2; + } + + return sz; +} +EXPORT_SYMBOL_GPL(of_property_read_variable_u64_array); + /** * of_property_read_string - Find and read a string from a property * @np: device node from which the property value is to be read. diff --git a/include/of.h b/include/of.h index d5947fbaab56..d87eeff738e8 100644 --- a/include/of.h +++ b/include/of.h @@ -201,6 +201,11 @@ extern int of_property_read_u32_array(const struct device_node *np, extern int of_property_read_u64(const struct device_node *np, const char *propname, u64 *out_value); +extern int of_property_read_variable_u64_array(const struct device_node *np, + const char *propname, + u64 *out_values, + size_t sz); + extern int of_property_read_string(struct device_node *np, const char *propname, const char **out_string); @@ -469,6 +474,15 @@ static inline int of_property_read_u64(const struct device_node *np, return -ENOSYS; } +static inline int of_property_read_variable_u64_array(const struct device_node *np, + const char *propname, + u64 *out_values, + size_t sz_min, + size_t sz_max) +{ + return -ENOSYS; +} + static inline int of_property_read_string(struct device_node *np, const char *propname, const char **out_string) { @@ -881,6 +895,34 @@ static inline int of_property_read_u32(const struct device_node *np, return of_property_read_u32_array(np, propname, out_value, 1); } +/** + * of_property_read_u64_array - Find and read an array of 64 bit integers + * from a property. + * + * @np: device node from which the property value is to be read. + * @propname: name of the property to be searched. + * @out_values: pointer to return value, modified only if return value is 0. + * @sz: number of array elements to read + * + * Search for a property in a device node and read 64-bit value(s) from + * it. Returns 0 on success, -EINVAL if the property does not exist, + * -ENODATA if property does not have a value, and -EOVERFLOW if the + * property data isn't large enough. + * + * The out_values is modified only if a valid u64 value can be decoded. + */ +static inline int of_property_read_u64_array(const struct device_node *np, + const char *propname, + u64 *out_values, size_t sz) +{ + int ret = of_property_read_variable_u64_array(np, propname, out_values, + sz); + if (ret >= 0) + return 0; + else + return ret; +} + /* * struct property *prop; * const __be32 *p; -- 2.28.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
801b7cff0210 ("sandbox: hostfile: allow probing from device tree") added initial support for probing hostfiles out of a non-fixed up device tree. This was achieved by having the driver probe call linux_open if the device tree node doesn't contain a valid barebox,fd property. A mmap did not happen in that case and as such the node couldn't be used as a syscon. Fix this by unifying the binding for hostfiles added by --image and ones already in the device tree. Both will result in a device node with just a barebox,filename property. On pure init level, both kinds of hostfiles will be iterated through and filenames will be opened and mmaped. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> --- v1 -> v2: no changes --- arch/sandbox/board/hostfile.c | 73 ++++++++++++++----- .../mach-sandbox/include/mach/hostfile.h | 2 + .../sandbox/mach-sandbox/include/mach/linux.h | 3 + arch/sandbox/os/common.c | 52 +++++++------ 4 files changed, 90 insertions(+), 40 deletions(-) diff --git a/arch/sandbox/board/hostfile.c b/arch/sandbox/board/hostfile.c index 63530bd25e1b..8990e20f15b6 100644 --- a/arch/sandbox/board/hostfile.c +++ b/arch/sandbox/board/hostfile.c @@ -124,9 +124,6 @@ static int hf_probe(struct device_d *dev) if (err) return err; - if (!priv->fd) - priv->fd = linux_open(priv->filename, true); - if (priv->fd < 0) return priv->fd; @@ -194,37 +191,79 @@ static int of_hostfile_fixup(struct device_node *root, void *ctx) { struct hf_info *hf = ctx; struct device_node *node; - uint32_t reg[] = { - hf->base >> 32, - hf->base, - hf->size >> 32, - hf->size - }; int ret; node = of_new_node(root, hf->devname); - ret = of_property_write_string(node, "compatible", hostfile_dt_ids->compatible); + ret = of_property_write_string(node, "barebox,filename", hf->filename); if (ret) return ret; - ret = of_property_write_u32_array(node, "reg", reg, ARRAY_SIZE(reg)); + ret = of_property_write_string(node, "compatible", hostfile_dt_ids->compatible); if (ret) return ret; - ret = of_property_write_u32(node, "barebox,fd", hf->fd); + ret = of_property_write_bool(node, "barebox,blockdev", hf->is_blockdev); if (ret) return ret; - ret = of_property_write_string(node, "barebox,filename", hf->filename); - - if (hf->is_blockdev) - ret = of_property_write_bool(node, "barebox,blockdev", true); + ret = of_property_write_bool(node, "barebox,cdev", hf->is_cdev); + if (ret) + return ret; - return ret; + return of_property_write_bool(node, "barebox,read-only", hf->is_readonly); } int barebox_register_filedev(struct hf_info *hf) { return of_register_fixup(of_hostfile_fixup, hf); } + +static int of_hostfile_map_fixup(struct device_node *root, void *ctx) +{ + struct device_node *node; + int ret; + + for_each_compatible_node_from(node, root, NULL, hostfile_dt_ids->compatible) { + struct hf_info hf = {}; + uint64_t reg[2]; + + hf.devname = node->name; + + ret = of_property_read_string(node, "barebox,filename", &hf.filename); + if (ret) + goto out; + + hf.is_blockdev = of_property_read_bool(node, "barebox,blockdev"); + hf.is_cdev = of_property_read_bool(node, "barebox,cdev"); + hf.is_readonly = of_property_read_bool(node, "barebox,read-only"); + + ret = linux_open_hostfile(&hf); + if (ret) + goto out; + + reg[0] = hf.base; + reg[1] = hf.size; + + ret = of_property_write_u64_array(node, "reg", reg, ARRAY_SIZE(reg)); + if (ret) + goto out; + + ret = of_property_write_bool(node, "barebox,blockdev", hf.is_blockdev); + if (ret) + goto out; + + ret = of_property_write_u32(node, "barebox,fd", hf.fd); +out: + if (ret) + pr_err("error fixing up %s: %pe\n", hf.devname, ERR_PTR(ret)); + } + + return 0; +} + +static int barebox_fixup_filedevs(void) +{ + return of_register_fixup(of_hostfile_map_fixup, NULL); +} +pure_initcall(barebox_fixup_filedevs); diff --git a/arch/sandbox/mach-sandbox/include/mach/hostfile.h b/arch/sandbox/mach-sandbox/include/mach/hostfile.h index c3f9af97c451..3ef34bcc1c22 100644 --- a/arch/sandbox/mach-sandbox/include/mach/hostfile.h +++ b/arch/sandbox/mach-sandbox/include/mach/hostfile.h @@ -8,6 +8,8 @@ struct hf_info { const char *devname; const char *filename; unsigned int is_blockdev:1; + unsigned int is_cdev:1; + unsigned int is_readonly:1; }; int barebox_register_filedev(struct hf_info *hf); diff --git a/arch/sandbox/mach-sandbox/include/mach/linux.h b/arch/sandbox/mach-sandbox/include/mach/linux.h index 1ab48e52a00a..7bb022a6de1d 100644 --- a/arch/sandbox/mach-sandbox/include/mach/linux.h +++ b/arch/sandbox/mach-sandbox/include/mach/linux.h @@ -1,6 +1,8 @@ #ifndef __ASM_ARCH_LINUX_H #define __ASM_ARCH_LINUX_H +struct hf_info; + struct device_d; int sandbox_add_device(struct device_d *dev); @@ -11,6 +13,7 @@ int linux_register_device(const char *name, void *start, void *end); int tap_alloc(const char *dev); uint64_t linux_get_time(void); int linux_open(const char *filename, int readwrite); +int linux_open_hostfile(struct hf_info *hf); int linux_read(int fd, void *buf, size_t count); int linux_read_nonblock(int fd, void *buf, size_t count); ssize_t linux_write(int fd, const void *buf, size_t count); diff --git a/arch/sandbox/os/common.c b/arch/sandbox/os/common.c index 72bb35464f25..6032a8c26b41 100644 --- a/arch/sandbox/os/common.c +++ b/arch/sandbox/os/common.c @@ -252,10 +252,8 @@ static int add_image(const char *_str, char *devname_template, int *devname_numb struct hf_info *hf = malloc(sizeof(struct hf_info)); char *str, *filename, *devname; char tmp[16]; - int readonly = 0, cdev = 0, blkdev = 0; - struct stat s; char *opt; - int fd, ret; + int ret; if (!hf) return -1; @@ -265,11 +263,11 @@ static int add_image(const char *_str, char *devname_template, int *devname_numb filename = strsep_unescaped(&str, ","); while ((opt = strsep_unescaped(&str, ","))) { if (!strcmp(opt, "ro")) - readonly = 1; + hf->is_readonly = 1; if (!strcmp(opt, "cdev")) - cdev = 1; + hf->is_cdev = 1; if (!strcmp(opt, "blkdev")) - blkdev = 1; + hf->is_blockdev = 1; } /* parses: "devname=filename" */ @@ -282,13 +280,25 @@ static int add_image(const char *_str, char *devname_template, int *devname_numb devname = tmp; } - printf("add %s backed by file %s%s\n", devname, - filename, readonly ? "(ro)" : ""); - - fd = open(filename, (readonly ? O_RDONLY : O_RDWR) | O_CLOEXEC); - hf->fd = fd; hf->filename = filename; - hf->is_blockdev = blkdev; + hf->devname = strdup(devname); + + ret = barebox_register_filedev(hf); + if (ret) + free(hf); + + return ret; +} + +int linux_open_hostfile(struct hf_info *hf) +{ + struct stat s; + int fd; + + printf("add %s backed by file %s%s\n", hf->devname, + hf->filename, hf->is_readonly ? "(ro)" : ""); + + fd = hf->fd = open(hf->filename, (hf->is_readonly ? O_RDONLY : O_RDWR) | O_CLOEXEC); hf->base = (unsigned long)MAP_FAILED; if (fd < 0) { @@ -302,42 +312,38 @@ static int add_image(const char *_str, char *devname_template, int *devname_numb } hf->size = s.st_size; - hf->devname = strdup(devname); if (S_ISBLK(s.st_mode)) { if (ioctl(fd, BLKGETSIZE64, &hf->size) == -1) { perror("ioctl"); goto err_out; } - if (!cdev) + if (!hf->is_cdev) hf->is_blockdev = 1; } if (hf->size <= SIZE_MAX) { hf->base = (unsigned long)mmap(NULL, hf->size, - PROT_READ | (readonly ? 0 : PROT_WRITE), + PROT_READ | (hf->is_readonly ? 0 : PROT_WRITE), MAP_SHARED, fd, 0); if (hf->base == (unsigned long)MAP_FAILED) - printf("warning: mmapping %s failed: %s\n", filename, strerror(errno)); + printf("warning: mmapping %s failed: %s\n", + hf->filename, strerror(errno)); } else { - printf("warning: %s: contiguous map failed\n", filename); + printf("warning: %s: contiguous map failed\n", hf->filename); } - if (blkdev && hf->size % 512 != 0) { + if (hf->is_blockdev && hf->size % 512 != 0) { printf("warning: registering %s as block device failed: invalid block size\n", - filename); + hf->filename); return -EINVAL; } - ret = barebox_register_filedev(hf); - if (ret) - goto err_out; return 0; err_out: if (fd > 0) close(fd); - free(hf); return -1; } -- 2.28.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
So far use of hostfile in the device tree required us to hard code a file name. If we instead create a temporary file on demand, we can support: - environment - barebox-state - syscon for reset source and reboot mode out of the box with no dependency on external files. Do the necessary, so a hostfile device tree node without a barebox,filename gets a temporary file generated with the appropriate size. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> --- v1 -> v2: split anonymous hostfiles commit into two: one for temp files creation and another for maintaining them over resets. They were squashed by mistake. --- arch/sandbox/Makefile | 1 + arch/sandbox/board/hostfile.c | 17 ++++++++++++++--- arch/sandbox/os/common.c | 28 ++++++++++++++++++++++++++-- 3 files changed, 41 insertions(+), 5 deletions(-) diff --git a/arch/sandbox/Makefile b/arch/sandbox/Makefile index 09112c3ba8d3..23832e6b2fc2 100644 --- a/arch/sandbox/Makefile +++ b/arch/sandbox/Makefile @@ -24,6 +24,7 @@ KBUILD_CFLAGS += -Dmalloc=barebox_malloc -Dcalloc=barebox_calloc \ -Dgetenv=barebox_getenv -Dprintf=barebox_printf \ -Dglob=barebox_glob -Dglobfree=barebox_globfree \ -Dioctl=barebox_ioctl -Dfstat=barebox_fstat \ + -Dftruncate=barebox_ftruncate \ -Dopendir=barebox_opendir -Dreaddir=barebox_readdir \ -Dclosedir=barebox_closedir -Dreadlink=barebox_readlink \ -Doptarg=barebox_optarg -Doptind=barebox_optind diff --git a/arch/sandbox/board/hostfile.c b/arch/sandbox/board/hostfile.c index 8990e20f15b6..2d4e5d55eae0 100644 --- a/arch/sandbox/board/hostfile.c +++ b/arch/sandbox/board/hostfile.c @@ -226,18 +226,23 @@ static int of_hostfile_map_fixup(struct device_node *root, void *ctx) for_each_compatible_node_from(node, root, NULL, hostfile_dt_ids->compatible) { struct hf_info hf = {}; - uint64_t reg[2]; + uint64_t reg[2] = {}; + bool no_filename; hf.devname = node->name; ret = of_property_read_string(node, "barebox,filename", &hf.filename); - if (ret) - goto out; + no_filename = ret; hf.is_blockdev = of_property_read_bool(node, "barebox,blockdev"); hf.is_cdev = of_property_read_bool(node, "barebox,cdev"); hf.is_readonly = of_property_read_bool(node, "barebox,read-only"); + of_property_read_u64_array(node, "reg", reg, ARRAY_SIZE(reg)); + + hf.base = reg[0]; + hf.size = reg[1]; + ret = linux_open_hostfile(&hf); if (ret) goto out; @@ -253,6 +258,12 @@ static int of_hostfile_map_fixup(struct device_node *root, void *ctx) if (ret) goto out; + if (no_filename) { + ret = of_property_write_string(node, "barebox,filename", hf.filename); + if (ret) + goto out; + } + ret = of_property_write_u32(node, "barebox,fd", hf.fd); out: if (ret) diff --git a/arch/sandbox/os/common.c b/arch/sandbox/os/common.c index 6032a8c26b41..5326df4891c9 100644 --- a/arch/sandbox/os/common.c +++ b/arch/sandbox/os/common.c @@ -292,14 +292,36 @@ static int add_image(const char *_str, char *devname_template, int *devname_numb int linux_open_hostfile(struct hf_info *hf) { + char *buf = NULL; struct stat s; int fd; printf("add %s backed by file %s%s\n", hf->devname, hf->filename, hf->is_readonly ? "(ro)" : ""); - fd = hf->fd = open(hf->filename, (hf->is_readonly ? O_RDONLY : O_RDWR) | O_CLOEXEC); - hf->base = (unsigned long)MAP_FAILED; + if (hf->filename) { + fd = hf->fd = open(hf->filename, (hf->is_readonly ? O_RDONLY : O_RDWR) | O_CLOEXEC); + } else { + buf = strdup("/tmp/barebox-hostfileXXXXXX"); + int ret; + + fd = hf->fd = mkstemp(buf); + if (fd >= 0) { + ret = fcntl(fd, F_SETFD, FD_CLOEXEC); + if (ret < 0) { + perror("fcntl"); + goto err_out; + } + + ret = ftruncate(fd, hf->size); + if (ret < 0) { + perror("ftruncate"); + goto err_out; + } + + hf->filename = buf; + } + } if (fd < 0) { perror("open"); @@ -311,6 +333,7 @@ int linux_open_hostfile(struct hf_info *hf) goto err_out; } + hf->base = (unsigned long)MAP_FAILED; hf->size = s.st_size; if (S_ISBLK(s.st_mode)) { @@ -344,6 +367,7 @@ int linux_open_hostfile(struct hf_info *hf) err_out: if (fd > 0) close(fd); + free(buf); return -1; } -- 2.28.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
Currently, hostfils without a barebox,filename are assigned a new temporary file on every start. For use of a hostfile syscon for reboot mode or reset source, we will need to persist the changes over a regular reset. This can easily be done by passing through all automatically created temporary file with an explicit --image option on subsequent runs. Do so. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> --- v1 -> v2: split anonymous hostfiles commit into two: one for temp files creation and another for maintaining them over resets. They were squashed by mistake. --- arch/sandbox/Makefile | 2 +- arch/sandbox/board/hostfile.c | 10 +++++++++- arch/sandbox/os/common.c | 36 ++++++++++++++++++++++++++++------- 3 files changed, 39 insertions(+), 9 deletions(-) diff --git a/arch/sandbox/Makefile b/arch/sandbox/Makefile index 23832e6b2fc2..17f9a298d773 100644 --- a/arch/sandbox/Makefile +++ b/arch/sandbox/Makefile @@ -24,7 +24,7 @@ KBUILD_CFLAGS += -Dmalloc=barebox_malloc -Dcalloc=barebox_calloc \ -Dgetenv=barebox_getenv -Dprintf=barebox_printf \ -Dglob=barebox_glob -Dglobfree=barebox_globfree \ -Dioctl=barebox_ioctl -Dfstat=barebox_fstat \ - -Dftruncate=barebox_ftruncate \ + -Dftruncate=barebox_ftruncate -Dasprintf=barebox_asprintf \ -Dopendir=barebox_opendir -Dreaddir=barebox_readdir \ -Dclosedir=barebox_closedir -Dreadlink=barebox_readlink \ -Doptarg=barebox_optarg -Doptind=barebox_optind diff --git a/arch/sandbox/board/hostfile.c b/arch/sandbox/board/hostfile.c index 2d4e5d55eae0..e3e38b7119d5 100644 --- a/arch/sandbox/board/hostfile.c +++ b/arch/sandbox/board/hostfile.c @@ -191,14 +191,22 @@ static int of_hostfile_fixup(struct device_node *root, void *ctx) { struct hf_info *hf = ctx; struct device_node *node; + bool name_only = false; int ret; - node = of_new_node(root, hf->devname); + node = of_get_child_by_name(root, hf->devname); + if (node) + name_only = true; + else + node = of_new_node(root, hf->devname); ret = of_property_write_string(node, "barebox,filename", hf->filename); if (ret) return ret; + if (name_only) + return 0; + ret = of_property_write_string(node, "compatible", hostfile_dt_ids->compatible); if (ret) return ret; diff --git a/arch/sandbox/os/common.c b/arch/sandbox/os/common.c index 5326df4891c9..54d2b97b4af7 100644 --- a/arch/sandbox/os/common.c +++ b/arch/sandbox/os/common.c @@ -19,6 +19,7 @@ * These are host includes. Never include any barebox header * files here... */ +#define _GNU_SOURCE #include <stdio.h> #include <stdlib.h> #include <stdint.h> @@ -124,6 +125,7 @@ void __attribute__((noreturn)) linux_exit(void) exit(0); } +static size_t saved_argv_len; static char **saved_argv; void linux_reexec(void) @@ -296,16 +298,25 @@ int linux_open_hostfile(struct hf_info *hf) struct stat s; int fd; - printf("add %s backed by file %s%s\n", hf->devname, - hf->filename, hf->is_readonly ? "(ro)" : ""); + printf("add %s %sbacked by file %s%s\n", hf->devname, + hf->filename ? "" : "initially un", hf->filename ?: "", + hf->is_readonly ? "(ro)" : ""); if (hf->filename) { fd = hf->fd = open(hf->filename, (hf->is_readonly ? O_RDONLY : O_RDWR) | O_CLOEXEC); } else { - buf = strdup("/tmp/barebox-hostfileXXXXXX"); + char *filename; int ret; - fd = hf->fd = mkstemp(buf); + ret = asprintf(&buf, "--image=%s=/tmp/barebox-hostfileXXXXXX", hf->devname); + if (ret < 0) { + perror("asprintf"); + goto err_out; + } + + filename = buf + strlen("--image==") + strlen(hf->devname); + + fd = hf->fd = mkstemp(filename); if (fd >= 0) { ret = fcntl(fd, F_SETFD, FD_CLOEXEC); if (ret < 0) { @@ -319,7 +330,14 @@ int linux_open_hostfile(struct hf_info *hf) goto err_out; } - hf->filename = buf; + hf->filename = filename; + + saved_argv = realloc(saved_argv, + ++saved_argv_len * sizeof(*saved_argv)); + if (!saved_argv) + exit(1); + saved_argv[saved_argv_len - 2] = buf; + saved_argv[saved_argv_len - 1] = NULL; } } @@ -437,8 +455,6 @@ int main(int argc, char *argv[]) __sanitizer_set_death_callback(cookmode); #endif - saved_argv = argv; - while (1) { option_index = 0; opt = getopt_long(argc, argv, optstring, @@ -476,6 +492,12 @@ int main(int argc, char *argv[]) } } + saved_argv_len = argc + 1; + saved_argv = calloc(saved_argv_len, sizeof(*saved_argv)); + if (!saved_argv) + exit(1); + memcpy(saved_argv, argv, saved_argv_len * sizeof(*saved_argv)); + ram = malloc(malloc_size); if (!ram) { printf("unable to get malloc space\n"); -- 2.28.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
Now that we can define a hostfile that's persistent over barebox resets, but does not rely on a hard coded filename, we can have an always-on environment node. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> --- v1 -> v2: no changes --- arch/sandbox/dts/sandbox.dts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/arch/sandbox/dts/sandbox.dts b/arch/sandbox/dts/sandbox.dts index b3327837a38a..afca02d41014 100644 --- a/arch/sandbox/dts/sandbox.dts +++ b/arch/sandbox/dts/sandbox.dts @@ -11,10 +11,30 @@ }; chosen { + environment { + compatible = "barebox,environment"; + device-path = &part_env; + }; }; memory { device_type = "memory"; reg = <0 0 0 0>; }; + + stickypage: stickypage { + compatible = "barebox,hostfile"; + reg = <0 0 0 4096>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + part_env: env@400 { + reg = <0x400 0x800>; + label = "env"; + }; + }; + }; }; -- 2.28.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
Follow-up will extend the poweroff driver to support system reset source. Set the stage by renaming the driver to power (as it does reset as well) and make it probe from device tree, so it can point at the system reset source syscon via phandle. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> --- v1 -> v2: no changes --- arch/sandbox/board/Makefile | 2 +- arch/sandbox/board/power.c | 61 +++++++++++++++++++++++++++++++++++ arch/sandbox/board/poweroff.c | 42 ------------------------ arch/sandbox/dts/sandbox.dts | 4 +++ 4 files changed, 66 insertions(+), 43 deletions(-) create mode 100644 arch/sandbox/board/power.c delete mode 100644 arch/sandbox/board/poweroff.c diff --git a/arch/sandbox/board/Makefile b/arch/sandbox/board/Makefile index 26f6cb192269..e50d2ca0f148 100644 --- a/arch/sandbox/board/Makefile +++ b/arch/sandbox/board/Makefile @@ -4,7 +4,7 @@ obj-y += hostfile.o obj-y += console.o obj-y += devices.o obj-y += dtb.o -obj-y += poweroff.o +obj-y += power.o obj-y += dev-random.o extra-y += barebox.lds diff --git a/arch/sandbox/board/power.c b/arch/sandbox/board/power.c new file mode 100644 index 000000000000..ffd8692845ef --- /dev/null +++ b/arch/sandbox/board/power.c @@ -0,0 +1,61 @@ +#include <common.h> +#include <driver.h> +#include <poweroff.h> +#include <restart.h> +#include <mach/linux.h> +#include <reset_source.h> + +struct sandbox_power { + struct restart_handler rst_hang, rst_reexec; +}; + +static void sandbox_poweroff(struct poweroff_handler *poweroff) +{ + linux_exit(); +} + +static void sandbox_rst_hang(struct restart_handler *rst) +{ + linux_hang(); +} + +static void sandbox_rst_reexec(struct restart_handler *rst) +{ + linux_reexec(); +} + +static int sandbox_power_probe(struct device_d *dev) +{ + struct sandbox_power *power = xzalloc(sizeof(*power)); + + poweroff_handler_register_fn(sandbox_poweroff); + + power->rst_hang = (struct restart_handler) { + .name = "hang", + .restart = sandbox_rst_hang + }; + + power->rst_reexec = (struct restart_handler) { + .name = "reexec", .priority = 200, + .restart = sandbox_rst_reexec, + }; + + restart_handler_register(&power->rst_hang); + + if (IS_ENABLED(CONFIG_SANDBOX_REEXEC)) + restart_handler_register(&power->rst_reexec); + + return 0; +} + +static __maybe_unused struct of_device_id sandbox_power_dt_ids[] = { + { .compatible = "barebox,sandbox-power" }, + { /* sentinel */ } +}; + +static struct driver_d sandbox_power_drv = { + .name = "sandbox-power", + .of_compatible = sandbox_power_dt_ids, + .probe = sandbox_power_probe, +}; +coredevice_platform_driver(sandbox_power_drv); diff --git a/arch/sandbox/board/poweroff.c b/arch/sandbox/board/poweroff.c deleted file mode 100644 index 8ce739af72c1..000000000000 --- a/arch/sandbox/board/poweroff.c +++ /dev/null @@ -1,42 +0,0 @@ -#include <common.h> -#include <init.h> -#include <poweroff.h> -#include <restart.h> -#include <mach/linux.h> - -static void sandbox_poweroff(struct poweroff_handler *poweroff) -{ - linux_exit(); -} - -static void sandbox_rst_hang(struct restart_handler *rst) -{ - linux_hang(); -} - -static struct restart_handler rst_hang = { - .name = "hang", - .restart = sandbox_rst_hang -}; - -static void sandbox_rst_reexec(struct restart_handler *rst) -{ - linux_reexec(); -} - -static struct restart_handler rst_reexec = { - .name = "reexec", .priority = 200, - .restart = sandbox_rst_reexec, -}; - -static int poweroff_register_feature(void) -{ - poweroff_handler_register_fn(sandbox_poweroff); - restart_handler_register(&rst_hang); - - if (IS_ENABLED(CONFIG_SANDBOX_REEXEC)) - restart_handler_register(&rst_reexec); - - return 0; -} -coredevice_initcall(poweroff_register_feature); diff --git a/arch/sandbox/dts/sandbox.dts b/arch/sandbox/dts/sandbox.dts index afca02d41014..d32999292eb3 100644 --- a/arch/sandbox/dts/sandbox.dts +++ b/arch/sandbox/dts/sandbox.dts @@ -37,4 +37,8 @@ }; }; }; + + power { + compatible = "barebox,sandbox-power"; + }; }; -- 2.28.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
We can differentiate between POR and RST by explicitly storing RST as reset reason when we invoke the reset handler. Do so. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> --- v1 -> v2: no changes --- arch/sandbox/board/power.c | 21 +++++++++++++++++++++ arch/sandbox/dts/sandbox.dts | 5 ++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/arch/sandbox/board/power.c b/arch/sandbox/board/power.c index ffd8692845ef..3cc944795895 100644 --- a/arch/sandbox/board/power.c +++ b/arch/sandbox/board/power.c @@ -4,9 +4,12 @@ #include <restart.h> #include <mach/linux.h> #include <reset_source.h> +#include <mfd/syscon.h> struct sandbox_power { struct restart_handler rst_hang, rst_reexec; + struct regmap *src; + u32 src_offset; }; static void sandbox_poweroff(struct poweroff_handler *poweroff) @@ -21,12 +24,16 @@ static void sandbox_rst_hang(struct restart_handler *rst) static void sandbox_rst_reexec(struct restart_handler *rst) { + struct sandbox_power *power = container_of(rst, struct sandbox_power, rst_reexec); + regmap_update_bits(power->src, power->src_offset, 0xff, RESET_RST); linux_reexec(); } static int sandbox_power_probe(struct device_d *dev) { struct sandbox_power *power = xzalloc(sizeof(*power)); + unsigned int rst; + int ret; poweroff_handler_register_fn(sandbox_poweroff); @@ -45,6 +52,20 @@ static int sandbox_power_probe(struct device_d *dev) if (IS_ENABLED(CONFIG_SANDBOX_REEXEC)) restart_handler_register(&power->rst_reexec); + power->src = syscon_regmap_lookup_by_phandle(dev->device_node, "barebox,reset-source"); + if (IS_ERR(power->src)) + return 0; + + ret = of_property_read_u32_index(dev->device_node, "barebox,reset-source", 1, + &power->src_offset); + if (ret) + return 0; + + ret = regmap_read(power->src, power->src_offset, &rst); + if (ret == 0 && rst == 0) + rst = RESET_POR; + + reset_source_set_prinst(rst, RESET_SOURCE_DEFAULT_PRIORITY, 0); return 0; } diff --git a/arch/sandbox/dts/sandbox.dts b/arch/sandbox/dts/sandbox.dts index d32999292eb3..93824cba9da5 100644 --- a/arch/sandbox/dts/sandbox.dts +++ b/arch/sandbox/dts/sandbox.dts @@ -23,7 +23,7 @@ }; stickypage: stickypage { - compatible = "barebox,hostfile"; + compatible = "barebox,hostfile", "syscon"; reg = <0 0 0 4096>; partitions { @@ -31,6 +31,8 @@ #address-cells = <1>; #size-cells = <1>; + /* 0x00+4 reserved for syscon use */ + part_env: env@400 { reg = <0x400 0x800>; label = "env"; @@ -40,5 +42,6 @@ power { compatible = "barebox,sandbox-power"; + barebox,reset-source = <&stickypage 0>; }; }; -- 2.28.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
Having a default reboot mode in the device tree allows testing the functionality out of sandbox without prior setup. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> --- v1 -> v2: no changes --- arch/sandbox/dts/sandbox.dts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/arch/sandbox/dts/sandbox.dts b/arch/sandbox/dts/sandbox.dts index 93824cba9da5..be96745b4274 100644 --- a/arch/sandbox/dts/sandbox.dts +++ b/arch/sandbox/dts/sandbox.dts @@ -8,6 +8,7 @@ #size-cells = <2>; aliases { + bmode = &bmode; }; chosen { @@ -23,8 +24,17 @@ }; stickypage: stickypage { - compatible = "barebox,hostfile", "syscon"; + compatible = "barebox,hostfile", "syscon", "simple-mfd"; reg = <0 0 0 4096>; + barebox,cdev; /* no caching allowed */ + + bmode: reboot-mode { + compatible = "syscon-reboot-mode"; + offset = <0>; + mask = <0xffffff00>; + mode-normal = <0x00000000>; + mode-loader = <0xbbbbbb00>; + }; partitions { compatible = "fixed-partitions"; -- 2.28.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
Add SIGALRM based watchdog driver. This can reset barebox if stuck and plays nicely with $global.system.reset. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> --- v1 -> v2: no changes --- arch/sandbox/board/Makefile | 1 + arch/sandbox/board/watchdog.c | 84 +++++++++++++++++++ arch/sandbox/dts/sandbox.dts | 5 ++ .../sandbox/mach-sandbox/include/mach/linux.h | 2 + arch/sandbox/os/common.c | 25 ++++++ 5 files changed, 117 insertions(+) create mode 100644 arch/sandbox/board/watchdog.c diff --git a/arch/sandbox/board/Makefile b/arch/sandbox/board/Makefile index e50d2ca0f148..c504c967decd 100644 --- a/arch/sandbox/board/Makefile +++ b/arch/sandbox/board/Makefile @@ -6,5 +6,6 @@ obj-y += devices.o obj-y += dtb.o obj-y += power.o obj-y += dev-random.o +obj-y += watchdog.o extra-y += barebox.lds diff --git a/arch/sandbox/board/watchdog.c b/arch/sandbox/board/watchdog.c new file mode 100644 index 000000000000..336451282fd3 --- /dev/null +++ b/arch/sandbox/board/watchdog.c @@ -0,0 +1,84 @@ +// SPDX-License-Identifier: GPL-2.0-only + +#include <common.h> +#include <errno.h> +#include <driver.h> +#include <mach/linux.h> +#include <of.h> +#include <watchdog.h> +#include <mfd/syscon.h> +#include <reset_source.h> + +struct sandbox_watchdog { + struct watchdog wdd; + bool cant_disable :1; +}; + +static inline struct sandbox_watchdog *to_sandbox_watchdog(struct watchdog *wdd) +{ + return container_of(wdd, struct sandbox_watchdog, wdd); +} + +static int sandbox_watchdog_set_timeout(struct watchdog *wdd, unsigned int timeout) +{ + struct sandbox_watchdog *wd = to_sandbox_watchdog(wdd); + + if (!timeout && wd->cant_disable) + return -ENOSYS; + + if (timeout > wdd->timeout_max) + return -EINVAL; + + return linux_watchdog_set_timeout(timeout); +} + +static int sandbox_watchdog_probe(struct device_d *dev) +{ + struct device_node *np = dev->device_node; + struct sandbox_watchdog *wd; + struct watchdog *wdd; + struct regmap *src; + u32 src_offset; + int ret; + + wd = xzalloc(sizeof(*wd)); + + wdd = &wd->wdd; + wdd->hwdev = dev; + wdd->set_timeout = sandbox_watchdog_set_timeout; + wdd->timeout_max = 1000; + + wd->cant_disable = of_property_read_bool(np, "barebox,cant-disable"); + + ret = watchdog_register(wdd); + if (ret) { + dev_err(dev, "Failed to register watchdog device\n"); + return ret; + } + + src = syscon_regmap_lookup_by_phandle(np, "barebox,reset-source"); + if (IS_ERR(src)) + return 0; + + ret = of_property_read_u32_index(np, "barebox,reset-source", 1, &src_offset); + if (ret) + return 0; + + regmap_update_bits(src, src_offset, 0xff, RESET_WDG); + + dev_info(dev, "probed\n"); + return 0; +} + + +static __maybe_unused struct of_device_id sandbox_watchdog_dt_ids[] = { + { .compatible = "barebox,sandbox-watchdog" }, + { /* sentinel */ } +}; + +static struct driver_d sandbox_watchdog_drv = { + .name = "sandbox-watchdog", + .of_compatible = sandbox_watchdog_dt_ids, + .probe = sandbox_watchdog_probe, +}; +device_platform_driver(sandbox_watchdog_drv); diff --git a/arch/sandbox/dts/sandbox.dts b/arch/sandbox/dts/sandbox.dts index be96745b4274..f830adecf796 100644 --- a/arch/sandbox/dts/sandbox.dts +++ b/arch/sandbox/dts/sandbox.dts @@ -54,4 +54,9 @@ compatible = "barebox,sandbox-power"; barebox,reset-source = <&stickypage 0>; }; + + watchdog { + compatible = "barebox,sandbox-watchdog"; + barebox,reset-source = <&stickypage 0>; + }; }; diff --git a/arch/sandbox/mach-sandbox/include/mach/linux.h b/arch/sandbox/mach-sandbox/include/mach/linux.h index 7bb022a6de1d..b26bfc24a291 100644 --- a/arch/sandbox/mach-sandbox/include/mach/linux.h +++ b/arch/sandbox/mach-sandbox/include/mach/linux.h @@ -25,6 +25,8 @@ void linux_reexec(void); int linux_execve(const char * filename, char *const argv[], char *const envp[]); +int linux_watchdog_set_timeout(unsigned int timeout); + int barebox_register_console(int stdinfd, int stdoutfd); int barebox_register_dtb(const void *dtb); diff --git a/arch/sandbox/os/common.c b/arch/sandbox/os/common.c index 54d2b97b4af7..da87be29c74d 100644 --- a/arch/sandbox/os/common.c +++ b/arch/sandbox/os/common.c @@ -39,6 +39,8 @@ #include <sys/wait.h> #include <sys/ioctl.h> #include <linux/fs.h> +#include <sys/time.h> +#include <signal.h> /* * ...except the ones needed to connect with barebox */ @@ -244,6 +246,29 @@ int linux_execve(const char * filename, char *const argv[], char *const envp[]) } } +static void linux_watchdog(int signo) +{ + linux_reexec(); + _exit(0); +} + +int linux_watchdog_set_timeout(unsigned int timeout) +{ + static int signal_handler_installed; + + if (!signal_handler_installed) { + struct sigaction sact = { + .sa_flags = SA_NODEFER, .sa_handler = linux_watchdog + }; + + sigemptyset(&sact.sa_mask); + sigaction(SIGALRM, &sact, NULL); + signal_handler_installed = 1; + } + + return alarm(timeout); +} + extern void start_barebox(void); extern void mem_malloc_init(void *start, void *end); -- 2.28.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
For testing barebox-state, it would be nice to have a state pre-configured out-of-the-box. Add one to sandbox.dts. Because the barebox message on an non-configured state can looks quite scary, add an init script that tells the user that all is well. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> --- v1 -> v2: no changes --- arch/sandbox/board/env/init/state | 12 +++++ arch/sandbox/dts/sandbox-state-example.dtsi | 50 --------------------- arch/sandbox/dts/sandbox.dts | 35 +++++++++++++++ 3 files changed, 47 insertions(+), 50 deletions(-) create mode 100644 arch/sandbox/board/env/init/state delete mode 100644 arch/sandbox/dts/sandbox-state-example.dtsi diff --git a/arch/sandbox/board/env/init/state b/arch/sandbox/board/env/init/state new file mode 100644 index 000000000000..0b8e40409f97 --- /dev/null +++ b/arch/sandbox/board/env/init/state @@ -0,0 +1,12 @@ +if [ "x$state.dirty" != "x1" -o $global.system.reset != "POR" ]; then + exit +fi + +source /env/data/ansi-colors + +echo -e $CYAN +echo "******************************************************************" +echo "*** Inconsistent barebox state buckets detected on first boot ***" +echo "*** barebox will repair them on next shutdown ***" +echo "*****************************************************************" +echo -e -n $NC diff --git a/arch/sandbox/dts/sandbox-state-example.dtsi b/arch/sandbox/dts/sandbox-state-example.dtsi deleted file mode 100644 index 98640f6677cf..000000000000 --- a/arch/sandbox/dts/sandbox-state-example.dtsi +++ /dev/null @@ -1,50 +0,0 @@ -/ { - aliases { - state = &state; - }; - - disk { - compatible = "barebox,hostfile"; - barebox,filename = "disk"; - reg = <0x0 0x0 0x0 0x100000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - hostfile_state: state@0 { - reg = <0x0 0x1000>; - label = "state"; - }; - }; - }; - - state: state { - magic = <0xaa3b86a6>; - compatible = "barebox,state"; - backend-type = "raw"; - backend = <&hostfile_state>; - backend-storage-type = "direct"; - backend-stridesize = <64>; - - #address-cells = <1>; - #size-cells = <1>; - vars { - #address-cells = <1>; - #size-cells = <1>; - - x { - reg = <0x0 0x4>; - type = "uint32"; - default = <1>; - }; - - y { - reg = <0x4 0x4>; - type = "uint32"; - default = <3>; - }; - }; - }; -}; diff --git a/arch/sandbox/dts/sandbox.dts b/arch/sandbox/dts/sandbox.dts index f830adecf796..afe48154c488 100644 --- a/arch/sandbox/dts/sandbox.dts +++ b/arch/sandbox/dts/sandbox.dts @@ -9,6 +9,7 @@ aliases { bmode = &bmode; + state = &state; }; chosen { @@ -23,6 +24,35 @@ reg = <0 0 0 0>; }; + state: state { + magic = <0xaa3b86a6>; + compatible = "barebox,state"; + backend-type = "raw"; + backend = <&part_state>; + backend-storage-type = "direct"; + backend-stridesize = <64>; + + #address-cells = <1>; + #size-cells = <1>; + + vars { + #address-cells = <1>; + #size-cells = <1>; + + x { + reg = <0x0 0x4>; + type = "uint32"; + default = <1>; + }; + + y { + reg = <0x4 0x4>; + type = "uint32"; + default = <3>; + }; + }; + }; + stickypage: stickypage { compatible = "barebox,hostfile", "syscon", "simple-mfd"; reg = <0 0 0 4096>; @@ -47,6 +77,11 @@ reg = <0x400 0x800>; label = "env"; }; + + part_state: state@800 { + reg = <0xC00 0x400>; + label = "state"; + }; }; }; -- 2.28.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
Recent commits have modified sandbox for easier support of many common features: - block devices - watchdogs - reset source - reboot mode - barebox state Enable those in defconfig along with some other useful options. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> --- v1 -> v2: no changes --- arch/sandbox/configs/sandbox_defconfig | 45 ++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/arch/sandbox/configs/sandbox_defconfig b/arch/sandbox/configs/sandbox_defconfig index c343f053faff..ca24d81acac7 100644 --- a/arch/sandbox/configs/sandbox_defconfig +++ b/arch/sandbox/configs/sandbox_defconfig @@ -2,20 +2,34 @@ CONFIG_HUSH_FANCY_PROMPT=y CONFIG_CMDLINE_EDITING=y CONFIG_AUTO_COMPLETE=y CONFIG_MENU=y +CONFIG_CONSOLE_ALLOW_COLOR=y CONFIG_PARTITION=y +CONFIG_PARTITION_DISK_EFI=y CONFIG_DEFAULT_COMPRESSION_GZIP=y CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW=y +CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW_REBOOT_MODE=y CONFIG_DEFAULT_ENVIRONMENT_PATH="arch/sandbox/board/env" +CONFIG_STATE=y +CONFIG_STATE_CRYPTO=y +CONFIG_RESET_SOURCE=y CONFIG_CMD_DMESG=y CONFIG_LONGHELP=y +CONFIG_CMD_IOMEM=y CONFIG_CMD_IMD=y CONFIG_CMD_MEMINFO=y -# CONFIG_CMD_BOOTM is not set +CONFIG_CMD_POLLER=y +CONFIG_CMD_SLICE=y CONFIG_CMD_GO=y +CONFIG_CMD_LOADB=y +CONFIG_CMD_LOADS=y +CONFIG_CMD_LOADY=y +CONFIG_CMD_RESET=y +CONFIG_CMD_SAVES=y CONFIG_CMD_UIMAGE=y CONFIG_CMD_PARTITION=y CONFIG_CMD_EXPORT=y CONFIG_CMD_DEFAULTENV=y +CONFIG_CMD_LOADENV=y CONFIG_CMD_PRINTENV=y CONFIG_CMD_MAGICVAR=y CONFIG_CMD_MAGICVAR_HELP=y @@ -39,14 +53,18 @@ CONFIG_CMD_PING=y CONFIG_CMD_TFTP=y CONFIG_CMD_ECHO_E=y CONFIG_CMD_EDIT=y +CONFIG_CMD_LOGIN=y CONFIG_CMD_MENU=y CONFIG_CMD_MENU_MANAGEMENT=y CONFIG_CMD_MENUTREE=y +CONFIG_CMD_PASSWD=y CONFIG_CMD_SPLASH=y +CONFIG_CMD_FBTEST=y CONFIG_CMD_READLINE=y CONFIG_CMD_TIMEOUT=y CONFIG_CMD_CRC=y CONFIG_CMD_CRC_CMP=y +CONFIG_CMD_MEMTEST=y CONFIG_CMD_MM=y CONFIG_CMD_DETECT=y CONFIG_CMD_FLASH=y @@ -56,18 +74,31 @@ CONFIG_CMD_LED=y CONFIG_CMD_POWEROFF=y CONFIG_CMD_SPI=y CONFIG_CMD_LED_TRIGGER=y +CONFIG_CMD_WD=y CONFIG_CMD_2048=y +CONFIG_CMD_KEYSTORE=y +CONFIG_CMD_LINUX_EXEC=y +CONFIG_CMD_OF_DIFF=y CONFIG_CMD_OF_NODE=y CONFIG_CMD_OF_PROPERTY=y CONFIG_CMD_OF_DISPLAY_TIMINGS=y +CONFIG_CMD_OF_FIXUP_STATUS=y +CONFIG_CMD_OF_OVERLAY=y CONFIG_CMD_OFTREE=y CONFIG_CMD_TIME=y +CONFIG_CMD_STATE=y +CONFIG_CMD_DHRYSTONE=y CONFIG_CMD_SPD_DECODE=y +CONFIG_CMD_SEED=y CONFIG_NET=y CONFIG_NET_NFS=y CONFIG_NET_NETCONSOLE=y +CONFIG_NET_SNTP=y +CONFIG_NET_FASTBOOT=y CONFIG_OFDEVICE=y CONFIG_OF_BAREBOX_DRIVERS=y +CONFIG_OF_BAREBOX_ENV_IN_FS=y +CONFIG_OF_OVERLAY_LIVE=y CONFIG_DRIVER_NET_TAP=y CONFIG_DRIVER_SPI_GPIO=y CONFIG_I2C=y @@ -76,6 +107,9 @@ CONFIG_MTD=y CONFIG_MTD_M25P80=y CONFIG_VIDEO=y CONFIG_FRAMEBUFFER_CONSOLE=y +CONFIG_MFD_SYSCON=y +CONFIG_STATE_DRV=y +CONFIG_UBOOTVAR=y CONFIG_LED=y CONFIG_LED_GPIO=y CONFIG_LED_GPIO_OF=y @@ -84,9 +118,12 @@ CONFIG_LED_GPIO_BICOLOR=y CONFIG_LED_TRIGGERS=y CONFIG_EEPROM_AT25=y CONFIG_EEPROM_AT24=y +CONFIG_WATCHDOG=y +CONFIG_WATCHDOG_POLLER=y # CONFIG_PINCTRL is not set CONFIG_RTC_CLASS=y CONFIG_RTC_DRV_DS1307=y +CONFIG_SYSCON_REBOOT_MODE=y CONFIG_FS_CRAMFS=y CONFIG_FS_EXT4=y CONFIG_FS_TFTP=y @@ -94,12 +131,17 @@ CONFIG_FS_NFS=y CONFIG_FS_FAT=y CONFIG_FS_FAT_WRITE=y CONFIG_FS_FAT_LFN=y +CONFIG_FS_JFFS2=y CONFIG_FS_BPKFS=y CONFIG_FS_UIMAGEFS=y +CONFIG_FS_PSTORE=y +CONFIG_FS_PSTORE_CONSOLE=y CONFIG_FS_SQUASHFS=y +CONFIG_FS_UBOOTVARFS=y CONFIG_BZLIB=y CONFIG_LZ4_DECOMPRESS=y CONFIG_XZ_DECOMPRESS=y +CONFIG_BASE64=y CONFIG_LZO_DECOMPRESS=y CONFIG_BMP=y CONFIG_PNG=y @@ -112,4 +154,3 @@ CONFIG_BAREBOX_LOGO_240=y CONFIG_BAREBOX_LOGO_320=y CONFIG_BAREBOX_LOGO_400=y CONFIG_BAREBOX_LOGO_640=y -CONFIG_DIGEST_HMAC_GENERIC=y -- 2.28.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
On Mon, Oct 12, 2020 at 08:26:08AM +0200, Ahmad Fatoum wrote: > Follow up commits will flesh out the sandbox.dts and make most of what's > in the skeleton.dtsi redundant. Merge the .dtsi with the .dts to have > all the code at one place. > > Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> > --- > v1 -> v2: no changes > --- > arch/sandbox/dts/sandbox.dts | 16 ++++++++++++++-- > arch/sandbox/dts/skeleton.dtsi | 13 ------------- > 2 files changed, 14 insertions(+), 15 deletions(-) > delete mode 100644 arch/sandbox/dts/skeleton.dtsi Applied, thanks Sascha > > diff --git a/arch/sandbox/dts/sandbox.dts b/arch/sandbox/dts/sandbox.dts > index 4576e873d9cb..b3327837a38a 100644 > --- a/arch/sandbox/dts/sandbox.dts > +++ b/arch/sandbox/dts/sandbox.dts > @@ -1,8 +1,20 @@ > /dts-v1/; > > -#include "skeleton.dtsi" > - > / { > model = "Sandbox"; > compatible = "barebox,sandbox"; > + > + #address-cells = <2>; > + #size-cells = <2>; > + > + aliases { > + }; > + > + chosen { > + }; > + > + memory { > + device_type = "memory"; > + reg = <0 0 0 0>; > + }; > }; > diff --git a/arch/sandbox/dts/skeleton.dtsi b/arch/sandbox/dts/skeleton.dtsi > deleted file mode 100644 > index 8ba7663eb5c0..000000000000 > --- a/arch/sandbox/dts/skeleton.dtsi > +++ /dev/null > @@ -1,13 +0,0 @@ > -/* > - * Skeleton device tree; the bare minimum needed to boot; just include and > - * add a compatible value. The bootloader will typically populate the memory > - * node. > - */ > - > -/ { > - #address-cells = <2>; > - #size-cells = <2>; > - chosen { }; > - aliases { }; > - memory { device_type = "memory"; reg = <0 0 0 0>; }; > -}; > -- > 2.28.0 > > > _______________________________________________ > barebox mailing list > barebox@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/barebox > -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox