pxe: prepend fdtdir to DTB name irrespective of source
PATCH 1/1 pxe: prepend fdtdir to DTB name irrespective of source
From: Stephen Warren <[email protected]>
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.
--- common/cmd_pxe.c | 77 +++++++++++++++++++++++++++++--------------------------- 1 file changed, 40 insertions(+), 37 deletions(-)
common/cmd_pxe.c +40 -37
@@ -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) {
Signature · 1 line
1.8.1.5
PATCH 1/1 pxe: prepend fdtdir to DTB name irrespective of source
Quoted 7 lines · On Wed, 12 Feb 2014 14:30:04 -0700 Stephen Warren <[email protected]> wrote:
From: Stephen Warren <[email protected]>
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.
Thanks for the fix
PATCH 1/1 pxe: prepend fdtdir to DTB name irrespective of source
Quoted 11 lines · Dennis Gilmore
Quoted 7 lines · On Wed, 12 Feb 2014 14:30:04 -0700 Stephen Warren <[email protected]> wrote:
From: Stephen Warren <[email protected]>
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.
Quoted 4 lines
Reviewed-by Dennis Gilmore <[email protected]>Tested-by Dennis Gilmore <[email protected]>Thanks for the fix
Tom, does this patch look good?
PATCH 1/1 pxe: prepend fdtdir to DTB name irrespective of source
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 12 lines · Stephen Warren
Quoted 11 lines · Dennis Gilmore
Quoted 7 lines · On Wed, 12 Feb 2014 14:30:04 -0700 Stephen Warren <[email protected]> wrote:
From: Stephen Warren <[email protected]>
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.
Quoted 6 lines
Quoted 4 lines
Reviewed-by Dennis Gilmore <[email protected]>Tested-by Dennis Gilmore <[email protected]>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-----
Quoted 8 lines · Stephen Warren
From: Stephen Warren <[email protected]>
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.
Quoted 5 lines
Reported-by Dennis Gilmore <[email protected]>Fixes c61d94d86035 ("pxe: implement fdtdir extlinux.conf tag")Signed-off-by Stephen Warren <[email protected]>Reviewed-by Dennis Gilmore <[email protected]>Tested-by Dennis Gilmore <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
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>