From e13df08a2685345f12ae1ec1d99ea3f599d58360 Mon Sep 17 00:00:00 2001 From: Rasmus Villemoes Date: Thu, 27 Feb 2020 13:56:10 +0000 Subject: env: remove callback.o for an SPL build env.h says this about about callback declarations (U_BOOT_ENV_CALLBACK): * For SPL these are silently dropped to reduce code size, since environment * callbacks are not supported with SPL. So env_callback_init() does a lot of work to not find anything in the guaranteed empty env_clbk list. Drop callback.o entirely from the link and stub out the only public function defined in callback.o. This cuts about 600 bytes from the SPL on my ppc build. Signed-off-by: Rasmus Villemoes Reviewed-by: Simon Glass --- include/env_callback.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include') diff --git a/include/env_callback.h b/include/env_callback.h index 74da20eec3..05e9516a0f 100644 --- a/include/env_callback.h +++ b/include/env_callback.h @@ -72,6 +72,12 @@ "serial#:serialno," \ CONFIG_ENV_CALLBACK_LIST_STATIC +#ifndef CONFIG_SPL_BUILD void env_callback_init(struct env_entry *var_entry); +#else +static inline void env_callback_init(struct env_entry *var_entry) +{ +} +#endif #endif /* __ENV_CALLBACK_H__ */ -- cgit From 080019b86c997a9b7e13bc7b8f476fbf9a0e5f3c Mon Sep 17 00:00:00 2001 From: Rasmus Villemoes Date: Thu, 27 Feb 2020 13:56:12 +0000 Subject: make env_entry::callback conditional on !CONFIG_SPL_BUILD The callback member of struct env_entry is always NULL for an SPL build. Removing it thus saves a bit of run-time memory in the SPL (when CONFIG_SPL_ENV_SUPPORT=y) since struct env_entry is embedded in struct env_entry_node - i.e. about 2KB for the normal case of 512+change hash table entries. Two small fixups are needed for this, all other references to the callback member are already under !CONFIG_SPL_BUILD: Don't initialize .callback in set_flags() - hsearch_r doesn't use that value anyway. And make env_callback_init() initialize ->callback to NULL for a new entry instead of relying on an unused or deleted entry having NULL in ->callback. Signed-off-by: Rasmus Villemoes Reviewed-by: Simon Glass --- include/search.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/search.h b/include/search.h index 0469a852e0..8f87dc72ce 100644 --- a/include/search.h +++ b/include/search.h @@ -29,8 +29,10 @@ enum env_action { struct env_entry { const char *key; char *data; +#ifndef CONFIG_SPL_BUILD int (*callback)(const char *name, const char *value, enum env_op op, int flags); +#endif int flags; }; -- cgit From 82b2f41357199c9fd06da80f8dd21e0576d08efe Mon Sep 17 00:00:00 2001 From: Rasmus Villemoes Date: Wed, 19 Feb 2020 09:47:40 +0000 Subject: env_internal.h: add alternative ENV_SAVE_PTR macro The current definition of the env_save_ptr does not take SPL_SAVEENV into account. Moreover, the way it is implemented means that drivers need to guard the definitions of their _save methods with ifdefs to avoid "defined but unused" warnings in case CMD_SAVEENV=n. The ifdeffery can be avoided by using a "something ? x : NULL" construction instead and still have the compiler elide the _save method when it is not referenced. Unfortunately we can't just switch the existing env_save_ptr macro, since that would give a lot of build errors unless all the ifdeffery is removed at the same time. Conversely, removing that ifdeffery first would merely lead to the "defined but unused" warnings temporarily, but for some storage drivers it requires a bit more work than just removing their private CMD_SAVEENV logic. So introduce an alternative to env_save_ptr, which for lack of a better name is simply uppercased, allowing one to update storage drivers piecemeal to both reduce their ifdeffery and honour CONFIG_SPL_SAVEENV. Signed-off-by: Rasmus Villemoes --- include/env_internal.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/env_internal.h b/include/env_internal.h index 90a4df8a72..e89fbdb1b7 100644 --- a/include/env_internal.h +++ b/include/env_internal.h @@ -207,6 +207,8 @@ struct env_driver { #define env_save_ptr(x) NULL #endif +#define ENV_SAVE_PTR(x) (CONFIG_IS_ENABLED(SAVEENV) ? (x) : NULL) + extern struct hsearch_data env_htab; #endif /* DO_DEPS_ONLY */ -- cgit From c738adb8dbbf28a34f8574239a241e85d46f3877 Mon Sep 17 00:00:00 2001 From: Kever Yang Date: Mon, 30 Mar 2020 11:56:17 +0800 Subject: tool: Move ALIGN_MASK to header as common MACRO The ALIGN code is need by many files who need handle structure or image align, so move the macro to imagetool.h file. Signed-off-by: Kever Yang Reviewed-by: Punit Agrawal Reviewed-by: Tom Rini --- include/imx8image.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/imx8image.h b/include/imx8image.h index 68ec9f5fcd..00c614ab6c 100644 --- a/include/imx8image.h +++ b/include/imx8image.h @@ -11,7 +11,6 @@ #include #include #include "imagetool.h" -#include "linux/kernel.h" #define __packed __attribute__((packed)) -- cgit From 10d887ddfa4f94aa94cf7a6d3dd4f28a339a2f13 Mon Sep 17 00:00:00 2001 From: Kever Yang Date: Mon, 30 Mar 2020 11:56:23 +0800 Subject: libfdt: Make fdtdec_get_child_count() available for HOST The tool need to use fdtdec_get_child_count(), make it available for HOST_CC. Signed-off-by: Kever Yang Reviewed-by: Punit Agrawal Reviewed-by: Simon Glass --- include/fdt_support.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include') diff --git a/include/fdt_support.h b/include/fdt_support.h index ba14acd7f6..2eff311fa4 100644 --- a/include/fdt_support.h +++ b/include/fdt_support.h @@ -343,6 +343,15 @@ int fdt_get_cells_len(const void *blob, char *nr_cells_name); #ifdef USE_HOSTCC int fdtdec_get_int(const void *blob, int node, const char *prop_name, int default_val); + +/* + * Count child nodes of one parent node. + * + * @param blob FDT blob + * @param node parent node + * @return number of child node; 0 if there is not child node + */ +int fdtdec_get_child_count(const void *blob, int node); #endif #ifdef CONFIG_FMAN_ENET int fdt_update_ethernet_dt(void *blob); -- cgit From ec8eef5e71e4d876324aa81b3c394822d8ef1eb6 Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Fri, 3 Apr 2020 19:58:24 -0700 Subject: fvp: Add support for loading Android boot images via semihosting FVP now loads an Android boot image named boot.img if available, otherwise it falls back to the existing code path. Signed-off-by: Peter Collingbourne Reviewed-by: Ryan Harkin Reviewed-by: Linus Walleij --- include/configs/vexpress_aemv8a.h | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) (limited to 'include') diff --git a/include/configs/vexpress_aemv8a.h b/include/configs/vexpress_aemv8a.h index 9a9cec414c..4f3a792f49 100644 --- a/include/configs/vexpress_aemv8a.h +++ b/include/configs/vexpress_aemv8a.h @@ -177,16 +177,26 @@ "initrd_addr=0x88000000\0" \ "fdtfile=devtree.dtb\0" \ "fdt_addr=0x83000000\0" \ - "fdt_high=0xffffffffffffffff\0" \ - "initrd_high=0xffffffffffffffff\0" - -#define CONFIG_BOOTCOMMAND "smhload ${kernel_name} ${kernel_addr}; " \ - "smhload ${fdtfile} ${fdt_addr}; " \ - "smhload ${initrd_name} ${initrd_addr} "\ - "initrd_end; " \ - "fdt addr ${fdt_addr}; fdt resize; " \ - "fdt chosen ${initrd_addr} ${initrd_end}; " \ - "booti $kernel_addr - $fdt_addr" + "boot_name=boot.img\0" \ + "boot_addr=0x8007f800\0" + +#define CONFIG_BOOTCOMMAND "if smhload ${boot_name} ${boot_addr}; then " \ + " set bootargs; " \ + " abootimg addr ${boot_addr}; " \ + " abootimg get dtb --index=0 fdt_addr; " \ + " bootm ${boot_addr} ${boot_addr} " \ + " ${fdt_addr}; " \ + "else; " \ + " set fdt_high 0xffffffffffffffff; " \ + " set initrd_high 0xffffffffffffffff; " \ + " smhload ${kernel_name} ${kernel_addr}; " \ + " smhload ${fdtfile} ${fdt_addr}; " \ + " smhload ${initrd_name} ${initrd_addr} "\ + " initrd_end; " \ + " fdt addr ${fdt_addr}; fdt resize; " \ + " fdt chosen ${initrd_addr} ${initrd_end}; " \ + " booti $kernel_addr - $fdt_addr; " \ + "fi" #endif -- cgit