From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i7xRO-0002Kk-H5 for barebox@lists.infradead.org; Wed, 11 Sep 2019 07:53:28 +0000 References: <20190906132008.25309-1-m.tretter@pengutronix.de> <20190906132008.25309-7-m.tretter@pengutronix.de> From: Ahmad Fatoum Message-ID: <9d21f10e-9a02-a5c4-e921-42f76c89ebc7@pengutronix.de> Date: Wed, 11 Sep 2019 09:53:24 +0200 MIME-Version: 1.0 In-Reply-To: <20190906132008.25309-7-m.tretter@pengutronix.de> Content-Language: en-US List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: Re: [PATCH v2 6/7] blspec: load firmware if specified in dt overlay To: Michael Tretter , barebox@lists.infradead.org Hello Michael, On 9/6/19 3:20 PM, Michael Tretter wrote: > If a device tree overlay referenced by the blspec depends on firmware, > try to load the firmware from the default Linux firmware search path > /lib/firmware in the about to be started rootfs. Linking barebox with CONFIG_BLSPEC, but without CONFIG_OF_OVERLAY now fails: ./common/blspec.c:84: undefined reference to `firmware_load_overlay' Cheers Ahmad > > Signed-off-by: Michael Tretter > > --- > Changelog: > > v1->v2: none > --- > common/blspec.c | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) > > diff --git a/common/blspec.c b/common/blspec.c > index fbba2fc78c..e733bf1188 100644 > --- a/common/blspec.c > +++ b/common/blspec.c > @@ -14,6 +14,7 @@ > > #include > #include > +#include > #include > #include > #include > @@ -49,6 +50,7 @@ static int blspec_apply_oftree_overlay(char *file, const char *abspath, > struct fdt_header *fdt; > struct device_node *overlay; > char *path; > + char *firmware_path; > > path = basprintf("%s/%s", abspath, file); > > @@ -72,6 +74,20 @@ static int blspec_apply_oftree_overlay(char *file, const char *abspath, > goto out; > } > > + /* > + * Unfortunately the device tree overlay contains only the filename of > + * the firmware and relies on the firmware search paths to find the > + * actual file. Use /lib/firmware in the Linux root directory and hope > + * for the best. > + */ > + firmware_path = basprintf("%s/%s", abspath, "/lib/firmware"); > + ret = firmware_load_overlay(overlay, firmware_path); > + free(firmware_path); > + if (ret) { > + of_delete_node(overlay); > + goto out; > + } > + > ret = of_register_overlay(overlay); > if (ret) { > pr_warn("cannot register devicetree overlay \"%s\"\n", path); > -- 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