[U-Boot] [PATCH] image: fix compiling without CMD_FDT

Booting an image currently sets the environment variable "fdtaddr" by calling into 'cmd/fdt.c'. As a result, linking U-Boot fails if CMD_FDT is not enabled.
Fix this by adding 'if (CONFIG_IS_ENABLED(CMD_FDT))' to the two places where 'set_working_fdt_addr()' is called.
Signed-off-by: Simon Goldschmidt simon.k.r.goldschmidt@gmail.com --- common/bootm.c | 3 ++- common/image-fdt.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/common/bootm.c b/common/bootm.c index 8bf84ebcb7..80f304ce9f 100644 --- a/common/bootm.c +++ b/common/bootm.c @@ -262,7 +262,8 @@ int bootm_find_images(int flag, int argc, char * const argv[]) puts("Could not find a valid device tree\n"); return 1; } - set_working_fdt_addr(map_to_sysmem(images.ft_addr)); + if (CONFIG_IS_ENABLED(CMD_FDT)) + set_working_fdt_addr(map_to_sysmem(images.ft_addr)); #endif
#if IMAGE_ENABLE_FIT diff --git a/common/image-fdt.c b/common/image-fdt.c index 95748f0ae1..8ee5a13352 100644 --- a/common/image-fdt.c +++ b/common/image-fdt.c @@ -193,7 +193,8 @@ int boot_relocate_fdt(struct lmb *lmb, char **of_flat_tree, ulong *of_size) *of_flat_tree = of_start; *of_size = of_len;
- set_working_fdt_addr(map_to_sysmem(*of_flat_tree)); + if (CONFIG_IS_ENABLED(CMD_FDT)) + set_working_fdt_addr(map_to_sysmem(*of_flat_tree)); return 0;
error:

On Fri, Dec 14, 2018 at 08:42:18AM +0100, Simon Goldschmidt wrote:
Booting an image currently sets the environment variable "fdtaddr" by calling into 'cmd/fdt.c'. As a result, linking U-Boot fails if CMD_FDT is not enabled.
Fix this by adding 'if (CONFIG_IS_ENABLED(CMD_FDT))' to the two places where 'set_working_fdt_addr()' is called.
Signed-off-by: Simon Goldschmidt simon.k.r.goldschmidt@gmail.com
common/bootm.c | 3 ++- common/image-fdt.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/common/bootm.c b/common/bootm.c index 8bf84ebcb7..80f304ce9f 100644 --- a/common/bootm.c +++ b/common/bootm.c @@ -262,7 +262,8 @@ int bootm_find_images(int flag, int argc, char * const argv[]) puts("Could not find a valid device tree\n"); return 1; }
- set_working_fdt_addr(map_to_sysmem(images.ft_addr));
- if (CONFIG_IS_ENABLED(CMD_FDT))
set_working_fdt_addr(map_to_sysmem(images.ft_addr));
#endif
#if IMAGE_ENABLE_FIT diff --git a/common/image-fdt.c b/common/image-fdt.c index 95748f0ae1..8ee5a13352 100644 --- a/common/image-fdt.c +++ b/common/image-fdt.c @@ -193,7 +193,8 @@ int boot_relocate_fdt(struct lmb *lmb, char **of_flat_tree, ulong *of_size) *of_flat_tree = of_start; *of_size = of_len;
- set_working_fdt_addr(map_to_sysmem(*of_flat_tree));
- if (CONFIG_IS_ENABLED(CMD_FDT))
return 0;set_working_fdt_addr(map_to_sysmem(*of_flat_tree));
error:
Your whitespace was totally destroyed, please v2, thanks!

Am Sa., 15. Dez. 2018, 15:56 hat Tom Rini trini@konsulko.com geschrieben:
On Fri, Dec 14, 2018 at 08:42:18AM +0100, Simon Goldschmidt wrote:
Booting an image currently sets the environment variable "fdtaddr" by calling into 'cmd/fdt.c'. As a result, linking U-Boot fails if CMD_FDT is not enabled.
Fix this by adding 'if (CONFIG_IS_ENABLED(CMD_FDT))' to the two places where 'set_working_fdt_addr()' is called.
Signed-off-by: Simon Goldschmidt simon.k.r.goldschmidt@gmail.com
common/bootm.c | 3 ++- common/image-fdt.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/common/bootm.c b/common/bootm.c index 8bf84ebcb7..80f304ce9f 100644 --- a/common/bootm.c +++ b/common/bootm.c @@ -262,7 +262,8 @@ int bootm_find_images(int flag, int argc, char * const argv[]) puts("Could not find a valid device tree\n"); return 1; }
- set_working_fdt_addr(map_to_sysmem(images.ft_addr));
- if (CONFIG_IS_ENABLED(CMD_FDT))
set_working_fdt_addr(map_to_sysmem(images.ft_addr));
#endif
#if IMAGE_ENABLE_FIT diff --git a/common/image-fdt.c b/common/image-fdt.c index 95748f0ae1..8ee5a13352 100644 --- a/common/image-fdt.c +++ b/common/image-fdt.c @@ -193,7 +193,8 @@ int boot_relocate_fdt(struct lmb *lmb, char **of_flat_tree, ulong *of_size) *of_flat_tree = of_start; *of_size = of_len;
- set_working_fdt_addr(map_to_sysmem(*of_flat_tree));
- if (CONFIG_IS_ENABLED(CMD_FDT))
return 0;set_working_fdt_addr(map_to_sysmem(*of_flat_tree));
error:
Your whitespace was totally destroyed, please v2, thanks!
Sorry for not noticing that. That was my editor at work... :-(
Regards, Simon

On Sat, Dec 15, 2018 at 04:00:33PM +0100, Simon Goldschmidt wrote:
Am Sa., 15. Dez. 2018, 15:56 hat Tom Rini trini@konsulko.com geschrieben:
On Fri, Dec 14, 2018 at 08:42:18AM +0100, Simon Goldschmidt wrote:
Booting an image currently sets the environment variable "fdtaddr" by calling into 'cmd/fdt.c'. As a result, linking U-Boot fails if CMD_FDT is not enabled.
Fix this by adding 'if (CONFIG_IS_ENABLED(CMD_FDT))' to the two places where 'set_working_fdt_addr()' is called.
Signed-off-by: Simon Goldschmidt simon.k.r.goldschmidt@gmail.com
common/bootm.c | 3 ++- common/image-fdt.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/common/bootm.c b/common/bootm.c index 8bf84ebcb7..80f304ce9f 100644 --- a/common/bootm.c +++ b/common/bootm.c @@ -262,7 +262,8 @@ int bootm_find_images(int flag, int argc, char * const argv[]) puts("Could not find a valid device tree\n"); return 1; }
- set_working_fdt_addr(map_to_sysmem(images.ft_addr));
- if (CONFIG_IS_ENABLED(CMD_FDT))
set_working_fdt_addr(map_to_sysmem(images.ft_addr));
#endif
#if IMAGE_ENABLE_FIT diff --git a/common/image-fdt.c b/common/image-fdt.c index 95748f0ae1..8ee5a13352 100644 --- a/common/image-fdt.c +++ b/common/image-fdt.c @@ -193,7 +193,8 @@ int boot_relocate_fdt(struct lmb *lmb, char **of_flat_tree, ulong *of_size) *of_flat_tree = of_start; *of_size = of_len;
- set_working_fdt_addr(map_to_sysmem(*of_flat_tree));
- if (CONFIG_IS_ENABLED(CMD_FDT))
return 0;set_working_fdt_addr(map_to_sysmem(*of_flat_tree));
error:
Your whitespace was totally destroyed, please v2, thanks!
Sorry for not noticing that. That was my editor at work... :-(
Not a huge deal, but I see that my "just apply it and ignore whitespace" is making the compiler very mad, ha.
participants (2)
-
Simon Goldschmidt
-
Tom Rini