public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] pxe: prepend fdtdir to DTB name irrespective of source
@ 2014-02-12 21:30 Stephen Warren
  2014-02-14 18:49 ` Dennis Gilmore
  2014-02-21 19:59 ` [U-Boot] " Tom Rini
  0 siblings, 2 replies; 5+ messages in thread
From: Stephen Warren @ 2014-02-12 21:30 UTC (permalink / raw)
  To: u-boot

From: Stephen Warren <swarren@nvidia.com>

The directory name from an fdtdir directive in a PXE config file should
always be pre-pended to the DTB filename; it shouldn't matter whether
the DTB filename came from the $fdtfile environment variable, or whether
it was constructed dynamically from ${soc}-${board}.dtb. Fix the code to
always prepend the directory name.

Reported-by: Dennis Gilmore <dennis@ausil.us>
Fixes: c61d94d86035 ("pxe: implement fdtdir extlinux.conf tag")
Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
 common/cmd_pxe.c | 77 +++++++++++++++++++++++++++++---------------------------
 1 file changed, 40 insertions(+), 37 deletions(-)

diff --git a/common/cmd_pxe.c b/common/cmd_pxe.c
index 29e48db20416..6aabd1357c7f 100644
--- a/common/cmd_pxe.c
+++ b/common/cmd_pxe.c
@@ -700,44 +700,47 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
 		if (label->fdt) {
 			fdtfile = label->fdt;
 		} else if (label->fdtdir) {
-			fdtfile = getenv("fdtfile");
-			/*
-			 * For complex cases, it might be worth calling a
-			 * board- or SoC-provided function here to provide a
-			 * better default:
-			 *
-			 * if (!fdtfile)
-			 *     fdtfile = gen_fdtfile();
-			 *
-			 * If this is added, be sure to keep the default below,
-			 * or move it to the default weak implementation of
-			 * gen_fdtfile().
-			 */
-			if (!fdtfile) {
-				char *soc = getenv("soc");
-				char *board = getenv("board");
-				char *slash;
-
-				len = strlen(label->fdtdir);
-				if (!len)
-					slash = "./";
-				else if (label->fdtdir[len - 1] != '/')
-					slash = "/";
-				else
-					slash = "";
-
-				len = strlen(label->fdtdir) + strlen(slash) +
-					strlen(soc) + 1 + strlen(board) + 5;
-				fdtfilefree = malloc(len);
-				if (!fdtfilefree) {
-					printf("malloc fail (FDT filename)\n");
-					return 1;
-				}
-
-				snprintf(fdtfilefree, len, "%s%s%s-%s.dtb",
-					label->fdtdir, slash, soc, board);
-				fdtfile = fdtfilefree;
+			char *f1, *f2, *f3, *f4, *slash;
+
+			f1 = getenv("fdtfile");
+			if (f1) {
+				f2 = "";
+				f3 = "";
+				f4 = "";
+			} else {
+				/*
+				 * For complex cases where this code doesn't
+				 * generate the correct filename, the board
+				 * code should set $fdtfile during early boot,
+				 * or the boot scripts should set $fdtfile
+				 * before invoking "pxe" or "sysboot".
+				 */
+				f1 = getenv("soc");
+				f2 = "-";
+				f3 = getenv("board");
+				f4 = ".dtb";
+			}
+
+			len = strlen(label->fdtdir);
+			if (!len)
+				slash = "./";
+			else if (label->fdtdir[len - 1] != '/')
+				slash = "/";
+			else
+				slash = "";
+
+			len = strlen(label->fdtdir) + strlen(slash) +
+				strlen(f1) + strlen(f2) + strlen(f3) +
+				strlen(f4) + 1;
+			fdtfilefree = malloc(len);
+			if (!fdtfilefree) {
+				printf("malloc fail (FDT filename)\n");
+				return 1;
 			}
+
+			snprintf(fdtfilefree, len, "%s%s%s%s%s%s",
+				 label->fdtdir, slash, f1, f2, f3, f4);
+			fdtfile = fdtfilefree;
 		}
 
 		if (fdtfile) {
-- 
1.8.1.5

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH] pxe: prepend fdtdir to DTB name irrespective of source
  2014-02-12 21:30 [U-Boot] [PATCH] pxe: prepend fdtdir to DTB name irrespective of source Stephen Warren
@ 2014-02-14 18:49 ` Dennis Gilmore
  2014-02-19 17:00   ` Stephen Warren
  2014-02-21 19:59 ` [U-Boot] " Tom Rini
  1 sibling, 1 reply; 5+ messages in thread
From: Dennis Gilmore @ 2014-02-14 18:49 UTC (permalink / raw)
  To: u-boot

On Wed, 12 Feb 2014 14:30:04 -0700
Stephen Warren <swarren@wwwdotorg.org> wrote:

> From: Stephen Warren <swarren@nvidia.com>
> 
> The directory name from an fdtdir directive in a PXE config file
> should always be pre-pended to the DTB filename; it shouldn't matter
> whether the DTB filename came from the $fdtfile environment variable,
> or whether it was constructed dynamically from ${soc}-${board}.dtb.
> Fix the code to always prepend the directory name.

Reviewed-by: Dennis Gilmore <dennis@ausil.us>
Tested-by: Dennis Gilmore <dennis@ausil.us>

Thanks for the fix

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH] pxe: prepend fdtdir to DTB name irrespective of source
  2014-02-14 18:49 ` Dennis Gilmore
@ 2014-02-19 17:00   ` Stephen Warren
  2014-02-19 17:02     ` Tom Rini
  0 siblings, 1 reply; 5+ messages in thread
From: Stephen Warren @ 2014-02-19 17:00 UTC (permalink / raw)
  To: u-boot

On 02/14/2014 11:49 AM, Dennis Gilmore wrote:
> On Wed, 12 Feb 2014 14:30:04 -0700
> Stephen Warren <swarren@wwwdotorg.org> wrote:
> 
>> From: Stephen Warren <swarren@nvidia.com>
>>
>> The directory name from an fdtdir directive in a PXE config file
>> should always be pre-pended to the DTB filename; it shouldn't matter
>> whether the DTB filename came from the $fdtfile environment variable,
>> or whether it was constructed dynamically from ${soc}-${board}.dtb.
>> Fix the code to always prepend the directory name.
> 
> Reviewed-by: Dennis Gilmore <dennis@ausil.us>
> Tested-by: Dennis Gilmore <dennis@ausil.us>
> 
> Thanks for the fix

Tom, does this patch look good?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH] pxe: prepend fdtdir to DTB name irrespective of source
  2014-02-19 17:00   ` Stephen Warren
@ 2014-02-19 17:02     ` Tom Rini
  0 siblings, 0 replies; 5+ messages in thread
From: Tom Rini @ 2014-02-19 17:02 UTC (permalink / raw)
  To: u-boot

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 02/19/2014 12:00 PM, Stephen Warren wrote:
> On 02/14/2014 11:49 AM, Dennis Gilmore wrote:
>> On Wed, 12 Feb 2014 14:30:04 -0700
>> Stephen Warren <swarren@wwwdotorg.org> wrote:
>>
>>> From: Stephen Warren <swarren@nvidia.com>
>>>
>>> The directory name from an fdtdir directive in a PXE config file
>>> should always be pre-pended to the DTB filename; it shouldn't matter
>>> whether the DTB filename came from the $fdtfile environment variable,
>>> or whether it was constructed dynamically from ${soc}-${board}.dtb.
>>> Fix the code to always prepend the directory name.
>>
>> Reviewed-by: Dennis Gilmore <dennis@ausil.us>
>> Tested-by: Dennis Gilmore <dennis@ausil.us>
>>
>> Thanks for the fix
> 
> Tom, does this patch look good?

Yes.  Sorry, I'm doing the following today:
- - Clean out patches in my TODO list older than v9 of the kbuild series
(done).
- - Do v9 of kbuild series (in progress)
- - Do stuff after v9 of kbuild series (hopefully later today).

- -- 
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJTBOOuAAoJENk4IS6UOR1WhggP/1QSELUbzznfDUNcapSG9lhO
8tZTUGgmTaKTr2v6ruRHyKbf4RnzP+RfJrecXLXqdR2ymEzhS1Xs0TSrCBApAYub
R2YFnvJWwH53IsZcwgH4B6zdGbO+OaaNcwL9waJ9aoXaSKYeiktrZQCEf8KYUx5r
UaPAD/fPW7BygAjwys03YlVxW4GEsxfRGWXU7I/6uT+ytBXgbNkbHmkXcYSp0LpG
YLbhc6pUZtkXTw8tXoKc6oxW+LNpVxdLZhtbPdse/h2T3SSGuuqnky1/agrlYXtg
tJ3rOBmIP5n1Z2dvTLMTS58kB+lZssxcGcsDcMLT2BLZiPhhseISte4NMgBedk/E
GMhOpvIktDa1VWShjOo5EI/8NFRO7mlhGqfFWV3HoO25olBdPGtHj9UZQJkOeKni
pT/2OoGTjM+Wq/F2ybrUDOpRKBVwC+OjgTZ8trgmXiJMEaBspa+aE7w5k5FAoK3E
IF6zE9HN6nEu68DP2XAV1ySKn8WAiet/6P6ePf9AI4C+H5XEUVmdscOsCymiu5or
saORS7GrHd3CAJzSZtGDVjnCcAfg4W9Cwb5IVfWyfN4H0f0sx7RkbV6CfwK3AdPQ
f/YhOtt4LDR9yY063bag7SX6rFStdWm3UUcmOhCtms2rZI2ueU0VPB4lR/k7wtyY
SaBqo0iDDaUeeTeIWlan
=bbfE
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] pxe: prepend fdtdir to DTB name irrespective of source
  2014-02-12 21:30 [U-Boot] [PATCH] pxe: prepend fdtdir to DTB name irrespective of source Stephen Warren
  2014-02-14 18:49 ` Dennis Gilmore
@ 2014-02-21 19:59 ` Tom Rini
  1 sibling, 0 replies; 5+ messages in thread
From: Tom Rini @ 2014-02-21 19:59 UTC (permalink / raw)
  To: u-boot

On Wed, Feb 12, 2014 at 02:30:04PM -0700, Stephen Warren wrote:

> From: Stephen Warren <swarren@nvidia.com>
> 
> The directory name from an fdtdir directive in a PXE config file should
> always be pre-pended to the DTB filename; it shouldn't matter whether
> the DTB filename came from the $fdtfile environment variable, or whether
> it was constructed dynamically from ${soc}-${board}.dtb. Fix the code to
> always prepend the directory name.
> 
> Reported-by: Dennis Gilmore <dennis@ausil.us>
> Fixes: c61d94d86035 ("pxe: implement fdtdir extlinux.conf tag")
> Signed-off-by: Stephen Warren <swarren@nvidia.com>
> Reviewed-by: Dennis Gilmore <dennis@ausil.us>
> Tested-by: Dennis Gilmore <dennis@ausil.us>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140221/b3514107/attachment.pgp>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-02-21 19:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-12 21:30 [U-Boot] [PATCH] pxe: prepend fdtdir to DTB name irrespective of source Stephen Warren
2014-02-14 18:49 ` Dennis Gilmore
2014-02-19 17:00   ` Stephen Warren
2014-02-19 17:02     ` Tom Rini
2014-02-21 19:59 ` [U-Boot] " Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox