diff mbox series

[02/10] Makefile: Enable CMD_ELF for SPL as well

Message ID 20200110102333.22767-3-j-keerthy@ti.com
State New
Headers show
Series arm: k3: Add support for loading main_r5fss0_core0 | expand

Commit Message

Keerthy Jan. 10, 2020, 10:23 a.m. UTC
Enable CMD_ELF for SPL as well. While at it stub out
code not relevant for SPL.

Signed-off-by: Keerthy <j-keerthy at ti.com>
---
 cmd/Makefile | 2 +-
 cmd/elf.c    | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

Comments

Simon Goldschmidt Jan. 10, 2020, 10:30 a.m. UTC | #1
On Fri, Jan 10, 2020 at 11:24 AM Keerthy <j-keerthy at ti.com> wrote:
>
> Enable CMD_ELF for SPL as well. While at it stub out
> code not relevant for SPL.
>
> Signed-off-by: Keerthy <j-keerthy at ti.com>
> ---
>  cmd/Makefile | 2 +-
>  cmd/elf.c    | 2 ++
>  2 files changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/cmd/Makefile b/cmd/Makefile
> index 8df39f3a19..95bb87c6db 100644
> --- a/cmd/Makefile
> +++ b/cmd/Makefile
> @@ -53,7 +53,6 @@ obj-$(CONFIG_ENV_IS_IN_EEPROM) += eeprom.o
>  obj-$(CONFIG_CMD_EEPROM) += eeprom.o
>  obj-$(CONFIG_EFI_STUB) += efi.o
>  obj-$(CONFIG_CMD_EFIDEBUG) += efidebug.o
> -obj-$(CONFIG_CMD_ELF) += elf.o
>  obj-$(CONFIG_HUSH_PARSER) += exit.o
>  obj-$(CONFIG_CMD_EXT4) += ext4.o
>  obj-$(CONFIG_CMD_EXT2) += ext2.o
> @@ -187,6 +186,7 @@ endif # !CONFIG_SPL_BUILD
>  # core command
>  obj-y += nvedit.o
>
> +obj-$(CONFIG_CMD_ELF) += elf.o
>  obj-$(CONFIG_TI_COMMON_CMD_OPTIONS) += ti/
>
>  filechk_data_gz = (echo "static const char data_gz[] ="; cat $< | scripts/bin2c; echo ";")
> diff --git a/cmd/elf.c b/cmd/elf.c
> index ea76fb42aa..8b3889f134 100644
> --- a/cmd/elf.c
> +++ b/cmd/elf.c
> @@ -322,6 +322,7 @@ int do_bootelf(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>         return rcode;
>  }
>
> +#ifndef CONFIG_SPL_BUILD

Unless I read it wrong, what you want is the elf parsing code, but not the
commands?

This patch and 2/10 look to me as it would be much cleaner to separate the upper
half of this file into a different file that does not live in cmd/.

Regards,
Simon

>  /*
>   * Interpreter command to boot VxWorks from a memory image.  The image can
>   * be either an ELF image or a raw binary.  Will attempt to setup the
> @@ -542,3 +543,4 @@ U_BOOT_CMD(
>         "Boot vxWorks from an ELF image",
>         " [address] - load address of vxWorks ELF image."
>  );
> +#endif
> --
> 2.17.1
>
Keerthy Jan. 10, 2020, 10:40 a.m. UTC | #2
On 1/10/2020 4:00 PM, Simon Goldschmidt wrote:
> On Fri, Jan 10, 2020 at 11:24 AM Keerthy <j-keerthy at ti.com> wrote:
>>
>> Enable CMD_ELF for SPL as well. While at it stub out
>> code not relevant for SPL.
>>
>> Signed-off-by: Keerthy <j-keerthy at ti.com>
>> ---
>>   cmd/Makefile | 2 +-
>>   cmd/elf.c    | 2 ++
>>   2 files changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/cmd/Makefile b/cmd/Makefile
>> index 8df39f3a19..95bb87c6db 100644
>> --- a/cmd/Makefile
>> +++ b/cmd/Makefile
>> @@ -53,7 +53,6 @@ obj-$(CONFIG_ENV_IS_IN_EEPROM) += eeprom.o
>>   obj-$(CONFIG_CMD_EEPROM) += eeprom.o
>>   obj-$(CONFIG_EFI_STUB) += efi.o
>>   obj-$(CONFIG_CMD_EFIDEBUG) += efidebug.o
>> -obj-$(CONFIG_CMD_ELF) += elf.o
>>   obj-$(CONFIG_HUSH_PARSER) += exit.o
>>   obj-$(CONFIG_CMD_EXT4) += ext4.o
>>   obj-$(CONFIG_CMD_EXT2) += ext2.o
>> @@ -187,6 +186,7 @@ endif # !CONFIG_SPL_BUILD
>>   # core command
>>   obj-y += nvedit.o
>>
>> +obj-$(CONFIG_CMD_ELF) += elf.o
>>   obj-$(CONFIG_TI_COMMON_CMD_OPTIONS) += ti/
>>
>>   filechk_data_gz = (echo "static const char data_gz[] ="; cat $< | scripts/bin2c; echo ";")
>> diff --git a/cmd/elf.c b/cmd/elf.c
>> index ea76fb42aa..8b3889f134 100644
>> --- a/cmd/elf.c
>> +++ b/cmd/elf.c
>> @@ -322,6 +322,7 @@ int do_bootelf(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>>          return rcode;
>>   }
>>
>> +#ifndef CONFIG_SPL_BUILD
> 
> Unless I read it wrong, what you want is the elf parsing code, but not the
> commands?

Yes. We will not need commands in SPL.

> 
> This patch and 2/10 look to me as it would be much cleaner to separate the upper
> half of this file into a different file that does not live in cmd/.

Any specific place you recommend? Something under lib?

> 
> Regards,
> Simon
> 
>>   /*
>>    * Interpreter command to boot VxWorks from a memory image.  The image can
>>    * be either an ELF image or a raw binary.  Will attempt to setup the
>> @@ -542,3 +543,4 @@ U_BOOT_CMD(
>>          "Boot vxWorks from an ELF image",
>>          " [address] - load address of vxWorks ELF image."
>>   );
>> +#endif
>> --
>> 2.17.1
>>
Simon Goldschmidt Jan. 10, 2020, 11:55 a.m. UTC | #3
On Fri, Jan 10, 2020 at 11:41 AM keerthy <j-keerthy at ti.com> wrote:
>
>
>
> On 1/10/2020 4:00 PM, Simon Goldschmidt wrote:
> > On Fri, Jan 10, 2020 at 11:24 AM Keerthy <j-keerthy at ti.com> wrote:
> >>
> >> Enable CMD_ELF for SPL as well. While at it stub out
> >> code not relevant for SPL.
> >>
> >> Signed-off-by: Keerthy <j-keerthy at ti.com>
> >> ---
> >>   cmd/Makefile | 2 +-
> >>   cmd/elf.c    | 2 ++
> >>   2 files changed, 3 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/cmd/Makefile b/cmd/Makefile
> >> index 8df39f3a19..95bb87c6db 100644
> >> --- a/cmd/Makefile
> >> +++ b/cmd/Makefile
> >> @@ -53,7 +53,6 @@ obj-$(CONFIG_ENV_IS_IN_EEPROM) += eeprom.o
> >>   obj-$(CONFIG_CMD_EEPROM) += eeprom.o
> >>   obj-$(CONFIG_EFI_STUB) += efi.o
> >>   obj-$(CONFIG_CMD_EFIDEBUG) += efidebug.o
> >> -obj-$(CONFIG_CMD_ELF) += elf.o
> >>   obj-$(CONFIG_HUSH_PARSER) += exit.o
> >>   obj-$(CONFIG_CMD_EXT4) += ext4.o
> >>   obj-$(CONFIG_CMD_EXT2) += ext2.o
> >> @@ -187,6 +186,7 @@ endif # !CONFIG_SPL_BUILD
> >>   # core command
> >>   obj-y += nvedit.o
> >>
> >> +obj-$(CONFIG_CMD_ELF) += elf.o
> >>   obj-$(CONFIG_TI_COMMON_CMD_OPTIONS) += ti/
> >>
> >>   filechk_data_gz = (echo "static const char data_gz[] ="; cat $< | scripts/bin2c; echo ";")
> >> diff --git a/cmd/elf.c b/cmd/elf.c
> >> index ea76fb42aa..8b3889f134 100644
> >> --- a/cmd/elf.c
> >> +++ b/cmd/elf.c
> >> @@ -322,6 +322,7 @@ int do_bootelf(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
> >>          return rcode;
> >>   }
> >>
> >> +#ifndef CONFIG_SPL_BUILD
> >
> > Unless I read it wrong, what you want is the elf parsing code, but not the
> > commands?
>
> Yes. We will not need commands in SPL.

Still you need to enable CMD_ELF in the config. That looks indeed wrong.

There were (and still are) bogus dependencies like this in the code, but please
don't add a new one.

>
> >
> > This patch and 2/10 look to me as it would be much cleaner to separate the upper
> > half of this file into a different file that does not live in cmd/.
>
> Any specific place you recommend? Something under lib?

Yes, lib should be good.

Regards,
Simon

>
> >
> > Regards,
> > Simon
> >
> >>   /*
> >>    * Interpreter command to boot VxWorks from a memory image.  The image can
> >>    * be either an ELF image or a raw binary.  Will attempt to setup the
> >> @@ -542,3 +543,4 @@ U_BOOT_CMD(
> >>          "Boot vxWorks from an ELF image",
> >>          " [address] - load address of vxWorks ELF image."
> >>   );
> >> +#endif
> >> --
> >> 2.17.1
> >>
diff mbox series

Patch

diff --git a/cmd/Makefile b/cmd/Makefile
index 8df39f3a19..95bb87c6db 100644
--- a/cmd/Makefile
+++ b/cmd/Makefile
@@ -53,7 +53,6 @@  obj-$(CONFIG_ENV_IS_IN_EEPROM) += eeprom.o
 obj-$(CONFIG_CMD_EEPROM) += eeprom.o
 obj-$(CONFIG_EFI_STUB) += efi.o
 obj-$(CONFIG_CMD_EFIDEBUG) += efidebug.o
-obj-$(CONFIG_CMD_ELF) += elf.o
 obj-$(CONFIG_HUSH_PARSER) += exit.o
 obj-$(CONFIG_CMD_EXT4) += ext4.o
 obj-$(CONFIG_CMD_EXT2) += ext2.o
@@ -187,6 +186,7 @@  endif # !CONFIG_SPL_BUILD
 # core command
 obj-y += nvedit.o
 
+obj-$(CONFIG_CMD_ELF) += elf.o
 obj-$(CONFIG_TI_COMMON_CMD_OPTIONS) += ti/
 
 filechk_data_gz = (echo "static const char data_gz[] ="; cat $< | scripts/bin2c; echo ";")
diff --git a/cmd/elf.c b/cmd/elf.c
index ea76fb42aa..8b3889f134 100644
--- a/cmd/elf.c
+++ b/cmd/elf.c
@@ -322,6 +322,7 @@  int do_bootelf(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	return rcode;
 }
 
+#ifndef CONFIG_SPL_BUILD
 /*
  * Interpreter command to boot VxWorks from a memory image.  The image can
  * be either an ELF image or a raw binary.  Will attempt to setup the
@@ -542,3 +543,4 @@  U_BOOT_CMD(
 	"Boot vxWorks from an ELF image",
 	" [address] - load address of vxWorks ELF image."
 );
+#endif