summaryrefslogtreecommitdiff
path: root/common/blspec.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2021-06-24 10:52:15 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2021-06-25 09:27:07 +0200
commitdfebbb0a594453a02078fe3d8370496c9a0a1349 (patch)
tree2a25418ed137883c87000732df097c40c5817856 /common/blspec.c
parent04a6e765f70aaf7614ec62a7955d9f07b4309a17 (diff)
downloadbarebox-dfebbb0a594453a02078fe3d8370496c9a0a1349.tar.gz
blspec: Set firmware searchpath
When bootloader spec triggers dt overlay loading then this might also trigger loading firmware. This firmware should be looked for relative to the filesystem providing the bootloader spec files, so add that to the firmware search path. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20210624085223.14616-11-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/blspec.c')
-rw-r--r--common/blspec.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/common/blspec.c b/common/blspec.c
index 056c0dbf7f..c39805cb0b 100644
--- a/common/blspec.c
+++ b/common/blspec.c
@@ -122,6 +122,8 @@ static int blspec_boot(struct bootentry *be, int verbose, int dryrun)
const char *abspath, *devicetree, *options, *initrd, *linuximage;
const char *overlays;
const char *appendroot;
+ const char *old_fws;
+ char *fws;
struct bootm_data data = {
.dryrun = dryrun,
};
@@ -184,9 +186,20 @@ static int blspec_boot(struct bootentry *be, int verbose, int dryrun)
(entry->cdev && entry->cdev->dev) ?
dev_name(entry->cdev->dev) : "none");
+ old_fws = firmware_get_searchpath();
+ if (old_fws && *old_fws)
+ fws = basprintf("%s/lib/firmware:%s", abspath, old_fws);
+ else
+ fws = basprintf("%s/lib/firmware", abspath);
+ firmware_set_searchpath(fws);
+ free(fws);
+
ret = bootm_boot(&data);
if (ret)
pr_err("Booting failed\n");
+
+ firmware_set_searchpath(old_fws);
+
err_out:
free((char *)data.oftree_file);
free((char *)data.initrd_file);