* [PATCH v1 1/2] bootm: fit: support multiple configuration nodes
@ 2017-03-20 12:55 Oleksij Rempel
2017-03-20 12:55 ` [PATCH v1 2/2] bootm: fit: support rsa2048 Oleksij Rempel
2017-03-22 7:08 ` [PATCH v1 1/2] bootm: fit: support multiple configuration nodes Sascha Hauer
0 siblings, 2 replies; 4+ messages in thread
From: Oleksij Rempel @ 2017-03-20 12:55 UTC (permalink / raw)
To: barebox; +Cc: Oleksij Rempel, Steffen Trumtrar
From: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
common/image-fit.c | 39 +++++++++++++++++++++++++++++++++++++--
1 file changed, 37 insertions(+), 2 deletions(-)
diff --git a/common/image-fit.c b/common/image-fit.c
index 6a01c614c..48c021347 100644
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -489,6 +489,37 @@ static int fit_config_verify_signature(struct fit_handle *handle, struct device_
return ret;
}
+static int fit_find_compatible_unit(struct device_node *conf_node,
+ const char **unit)
+{
+ struct device_node *child = NULL;
+ struct device_node *barebox_root;
+ const char *machine;
+ int ret;
+
+ barebox_root = of_get_root_node();
+ if (!barebox_root)
+ return -ENOSYS;
+
+ ret = of_property_read_string(barebox_root, "compatible", &machine);
+ if (ret)
+ return -ENOENT;
+
+ for_each_child_of_node(conf_node, child) {
+ if (of_device_is_compatible(child, machine)) {
+ *unit = xasprintf("%s", child->name);
+ pr_info("matching unit '%s' found\n", *unit);
+ return 0;
+ }
+ }
+
+ pr_info("No match found. Trying default.\n");
+ if (of_property_read_string(conf_node, "default", unit) == 0)
+ return 0;
+
+ return -ENOENT;
+}
+
static int fit_open_configuration(struct fit_handle *handle, const char *name)
{
struct device_node *conf_node = NULL;
@@ -501,8 +532,12 @@ static int fit_open_configuration(struct fit_handle *handle, const char *name)
if (name) {
unit = name;
- } else if (of_property_read_string(conf_node, "default", &unit)) {
- unit = "conf@1";
+ } else {
+ ret = fit_find_compatible_unit(conf_node, &unit);
+ if (ret) {
+ pr_info("Couldn't get a valid configuration. Aborting.\n");
+ return ret;
+ }
}
conf_node = of_get_child_by_name(conf_node, unit);
--
2.11.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v1 2/2] bootm: fit: support rsa2048
2017-03-20 12:55 [PATCH v1 1/2] bootm: fit: support multiple configuration nodes Oleksij Rempel
@ 2017-03-20 12:55 ` Oleksij Rempel
2017-03-22 7:09 ` Sascha Hauer
2017-03-22 7:08 ` [PATCH v1 1/2] bootm: fit: support multiple configuration nodes Sascha Hauer
1 sibling, 1 reply; 4+ messages in thread
From: Oleksij Rempel @ 2017-03-20 12:55 UTC (permalink / raw)
To: barebox; +Cc: Oleksij Rempel, Steffen Trumtrar
From: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
common/image-fit.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/common/image-fit.c b/common/image-fit.c
index 48c021347..2597312f7 100644
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -254,6 +254,8 @@ static int fit_verify_signature(struct device_node *sig_node, void *fit)
}
if (strcmp(algo_name, "sha1,rsa2048") == 0) {
algo = HASH_ALGO_SHA1;
+ } else if (strcmp(algo_name, "sha256,rsa2048") == 0) {
+ algo = HASH_ALGO_SHA256;
} else if (strcmp(algo_name, "sha256,rsa4096") == 0) {
algo = HASH_ALGO_SHA256;
} else {
--
2.11.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1 2/2] bootm: fit: support rsa2048
2017-03-20 12:55 ` [PATCH v1 2/2] bootm: fit: support rsa2048 Oleksij Rempel
@ 2017-03-22 7:09 ` Sascha Hauer
0 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2017-03-22 7:09 UTC (permalink / raw)
To: Oleksij Rempel; +Cc: barebox, Steffen Trumtrar
On Mon, Mar 20, 2017 at 01:55:40PM +0100, Oleksij Rempel wrote:
> From: Steffen Trumtrar <s.trumtrar@pengutronix.de>
>
> Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> ---
> common/image-fit.c | 2 ++
> 1 file changed, 2 insertions(+)
Applied (only this one), thanks
Sascha
>
> diff --git a/common/image-fit.c b/common/image-fit.c
> index 48c021347..2597312f7 100644
> --- a/common/image-fit.c
> +++ b/common/image-fit.c
> @@ -254,6 +254,8 @@ static int fit_verify_signature(struct device_node *sig_node, void *fit)
> }
> if (strcmp(algo_name, "sha1,rsa2048") == 0) {
> algo = HASH_ALGO_SHA1;
> + } else if (strcmp(algo_name, "sha256,rsa2048") == 0) {
> + algo = HASH_ALGO_SHA256;
> } else if (strcmp(algo_name, "sha256,rsa4096") == 0) {
> algo = HASH_ALGO_SHA256;
> } else {
> --
> 2.11.0
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1 1/2] bootm: fit: support multiple configuration nodes
2017-03-20 12:55 [PATCH v1 1/2] bootm: fit: support multiple configuration nodes Oleksij Rempel
2017-03-20 12:55 ` [PATCH v1 2/2] bootm: fit: support rsa2048 Oleksij Rempel
@ 2017-03-22 7:08 ` Sascha Hauer
1 sibling, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2017-03-22 7:08 UTC (permalink / raw)
To: Oleksij Rempel; +Cc: barebox, Steffen Trumtrar
On Mon, Mar 20, 2017 at 01:55:39PM +0100, Oleksij Rempel wrote:
> From: Steffen Trumtrar <s.trumtrar@pengutronix.de>
>
> Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> ---
> common/image-fit.c | 39 +++++++++++++++++++++++++++++++++++++--
> 1 file changed, 37 insertions(+), 2 deletions(-)
>
> diff --git a/common/image-fit.c b/common/image-fit.c
> index 6a01c614c..48c021347 100644
> --- a/common/image-fit.c
> +++ b/common/image-fit.c
> @@ -489,6 +489,37 @@ static int fit_config_verify_signature(struct fit_handle *handle, struct device_
> return ret;
> }
>
> +static int fit_find_compatible_unit(struct device_node *conf_node,
> + const char **unit)
> +{
> + struct device_node *child = NULL;
> + struct device_node *barebox_root;
> + const char *machine;
> + int ret;
> +
> + barebox_root = of_get_root_node();
> + if (!barebox_root)
> + return -ENOSYS;
> +
> + ret = of_property_read_string(barebox_root, "compatible", &machine);
> + if (ret)
> + return -ENOENT;
> +
> + for_each_child_of_node(conf_node, child) {
> + if (of_device_is_compatible(child, machine)) {
> + *unit = xasprintf("%s", child->name);
This is never freed. *unit is a const char * in the caller.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-03-22 7:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-20 12:55 [PATCH v1 1/2] bootm: fit: support multiple configuration nodes Oleksij Rempel
2017-03-20 12:55 ` [PATCH v1 2/2] bootm: fit: support rsa2048 Oleksij Rempel
2017-03-22 7:09 ` Sascha Hauer
2017-03-22 7:08 ` [PATCH v1 1/2] bootm: fit: support multiple configuration nodes Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox