diff mbox series

[RFC,15/16] tools/fdtgrep: Include __symbols__ table

Message ID 20231219103418.3445886-16-danishanwar@ti.com
State RFC
Delegated to: Tom Rini
Headers show
Series Introduce ICSSG Ethernet driver | expand

Commit Message

MD Danish Anwar Dec. 19, 2023, 10:34 a.m. UTC
This is required for overlays to work at SPL.

Loading of symbol table depends on DT Overlay support in SPL
so make it compile-time dependent. Without this SPL fails to
boot some platforms where this feature is not enabled
(e.g. dra71-evm.)

Without including the <linux/kconfig.h> file, the symbol
CONFIG_SPL_LOAD_FIT_APPLY_OVERLAY will not be visible and
we will never include the symbol table.

So include <linux/kconfig.h>

Due to some reason it needs to be included after
[#include "fdt_host.h"] otherwise it causes a build error.

Signed-off-by: MD Danish Anwar <danishanwar@ti.com>
---
 tools/fdtgrep.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Simon Glass Dec. 26, 2023, 9:47 a.m. UTC | #1
Hi,

On Tue, Dec 19, 2023 at 10:34 AM MD Danish Anwar <danishanwar@ti.com> wrote:
>
> This is required for overlays to work at SPL.
>
> Loading of symbol table depends on DT Overlay support in SPL
> so make it compile-time dependent. Without this SPL fails to
> boot some platforms where this feature is not enabled
> (e.g. dra71-evm.)
>
> Without including the <linux/kconfig.h> file, the symbol
> CONFIG_SPL_LOAD_FIT_APPLY_OVERLAY will not be visible and
> we will never include the symbol table.
>
> So include <linux/kconfig.h>
>
> Due to some reason it needs to be included after
> [#include "fdt_host.h"] otherwise it causes a build error.
>
> Signed-off-by: MD Danish Anwar <danishanwar@ti.com>
> ---
>  tools/fdtgrep.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/tools/fdtgrep.c b/tools/fdtgrep.c
> index 7eabcab439..706b4a35f4 100644
> --- a/tools/fdtgrep.c
> +++ b/tools/fdtgrep.c
> @@ -22,6 +22,8 @@
>  #include "fdt_host.h"
>  #include "libfdt_internal.h"
>
> +#include <linux/kconfig.h>
> +
>  /* Define DEBUG to get some debugging output on stderr */
>  #ifdef DEBUG
>  #define debug(a, b...) fprintf(stderr, a, ## b)
> @@ -1234,6 +1236,12 @@ int main(int argc, char *argv[])
>                 disp.fout = stdout;
>         }
>
> +       if (IS_ENABLED(CONFIG_SPL_LOAD_FIT_APPLY_OVERLAY)) {
> +               /* include symbol table */
> +               if (value_add(&disp, &disp.value_head, FDT_IS_NODE, 1, "/__symbols__"))
> +                       usage("Cannot add __symbols__ value");
> +       }
> +
>         /* Run the grep and output the results */
>         ret = do_fdtgrep(&disp, filename);
>         if (disp.output_fname)
> --
> 2.34.1
>

I may have replied elsewhere, but please use a new fdtgrep option for this.

Regards,
Simon
MD Danish Anwar Jan. 10, 2024, 9:52 a.m. UTC | #2
Hi Simon,

On 26/12/23 3:17 pm, Simon Glass wrote:
> Hi,
> 
> On Tue, Dec 19, 2023 at 10:34 AM MD Danish Anwar <danishanwar@ti.com> wrote:
>>
>> This is required for overlays to work at SPL.
>>
>> Loading of symbol table depends on DT Overlay support in SPL
>> so make it compile-time dependent. Without this SPL fails to
>> boot some platforms where this feature is not enabled
>> (e.g. dra71-evm.)
>>
>> Without including the <linux/kconfig.h> file, the symbol
>> CONFIG_SPL_LOAD_FIT_APPLY_OVERLAY will not be visible and
>> we will never include the symbol table.
>>
>> So include <linux/kconfig.h>
>>
>> Due to some reason it needs to be included after
>> [#include "fdt_host.h"] otherwise it causes a build error.
>>
>> Signed-off-by: MD Danish Anwar <danishanwar@ti.com>
>> ---
>>  tools/fdtgrep.c | 8 ++++++++
>>  1 file changed, 8 insertions(+)
>>
>> diff --git a/tools/fdtgrep.c b/tools/fdtgrep.c
>> index 7eabcab439..706b4a35f4 100644
>> --- a/tools/fdtgrep.c
>> +++ b/tools/fdtgrep.c
>> @@ -22,6 +22,8 @@
>>  #include "fdt_host.h"
>>  #include "libfdt_internal.h"
>>
>> +#include <linux/kconfig.h>
>> +
>>  /* Define DEBUG to get some debugging output on stderr */
>>  #ifdef DEBUG
>>  #define debug(a, b...) fprintf(stderr, a, ## b)
>> @@ -1234,6 +1236,12 @@ int main(int argc, char *argv[])
>>                 disp.fout = stdout;
>>         }
>>
>> +       if (IS_ENABLED(CONFIG_SPL_LOAD_FIT_APPLY_OVERLAY)) {
>> +               /* include symbol table */
>> +               if (value_add(&disp, &disp.value_head, FDT_IS_NODE, 1, "/__symbols__"))
>> +                       usage("Cannot add __symbols__ value");
>> +       }
>> +
>>         /* Run the grep and output the results */
>>         ret = do_fdtgrep(&disp, filename);
>>         if (disp.output_fname)
>> --
>> 2.34.1
>>
> 
> I may have replied elsewhere, but please use a new fdtgrep option for this.
> 
> Regards,
> Simon

This patch is actually not needed. Without this patch also I am able to
apply overlays at SPL. Even without this patch I see symbols table
getting included while using fdtgrep tool. I will drop this patch in v2.
diff mbox series

Patch

diff --git a/tools/fdtgrep.c b/tools/fdtgrep.c
index 7eabcab439..706b4a35f4 100644
--- a/tools/fdtgrep.c
+++ b/tools/fdtgrep.c
@@ -22,6 +22,8 @@ 
 #include "fdt_host.h"
 #include "libfdt_internal.h"
 
+#include <linux/kconfig.h>
+
 /* Define DEBUG to get some debugging output on stderr */
 #ifdef DEBUG
 #define debug(a, b...) fprintf(stderr, a, ## b)
@@ -1234,6 +1236,12 @@  int main(int argc, char *argv[])
 		disp.fout = stdout;
 	}
 
+	if (IS_ENABLED(CONFIG_SPL_LOAD_FIT_APPLY_OVERLAY)) {
+		/* include symbol table */
+		if (value_add(&disp, &disp.value_head, FDT_IS_NODE, 1, "/__symbols__"))
+			usage("Cannot add __symbols__ value");
+	}
+
 	/* Run the grep and output the results */
 	ret = do_fdtgrep(&disp, filename);
 	if (disp.output_fname)