[U-Boot] [PATCH 3/3] spl: dfu: reduce spl-dfu MLO size

B, Ravi ravibabu at ti.com
Thu Apr 27 07:22:29 UTC 2017


Hi Tom

>> Since spl-dfu does not dfu-reset, there is no need of run_command_cli, 
>> hence compiling out cli.c and cli_hush.c to reduce the spl-dfu memory 
>> foot print.
>> 
>> Signed-off-by: Ravi Babu <ravibabu at ti.com>
[snip]
>> diff --git a/drivers/dfu/Makefile b/drivers/dfu/Makefile index 
>> 61f2b71..ef48f36 100644
>> --- a/drivers/dfu/Makefile
>> +++ b/drivers/dfu/Makefile
>> @@ -6,8 +6,10 @@
>>  #
>>  
>>  obj-$(CONFIG_USB_FUNCTION_DFU) += dfu.o
>> +ifndef CONFIG_SPL_BUILD
>>  obj-$(CONFIG_DFU_MMC) += dfu_mmc.o
>>  obj-$(CONFIG_DFU_NAND) += dfu_nand.o
>> -obj-$(CONFIG_DFU_RAM) += dfu_ram.o
>>  obj-$(CONFIG_DFU_SF) += dfu_sf.o
>>  obj-$(CONFIG_DFU_TFTP) += dfu_tftp.o
>> +endif
>> +obj-$(CONFIG_DFU_RAM) += dfu_ram.o

>We should discard at link time the unreachable parts here in SPL, no?

Yes you are correct. 
But what is happening here is, the CONFIG_DFU_<MMC/NAND/SF/TFTP> selected through Kconfig/Menuconfig is applicable for both SPL and U-Boot.
Hence CONFIG_DFU_MMC/NAND/SF gets compiled for SPL as well, which needs run_command(). Actually CONFIG_DFU_MMC/NAND/etc is not scoped for SPL-DFU.
As we have aligned, not to increase the SPL size, user shall use SPL-DFU feature to boot to u-boot, then utilize the full featured DFU to flash MMC/NAND/SF.

I get undefined reference to common function run_command(),  "dfu_fill_entitiy_<mmc/nand/sf>" in driver/dfu/dfu.c. 
The dfu.c is common for both SPL-DFU and U-boot.

>> diff --git a/include/dfu.h b/include/dfu.h index f39d3f1..b53ae80 
>> 100644
>> --- a/include/dfu.h
>> +++ b/include/dfu.h
>> @@ -203,7 +203,7 @@ static inline void dfu_set_defer_flush(struct 
>> dfu_entity *dfu)  int dfu_write_from_mem_addr(struct dfu_entity *dfu, 
>> void *buf, int size);
>>  
>>  /* Device specific */
>> -#ifdef CONFIG_DFU_MMC
>> +#if defined(CONFIG_DFU_MMC) && !defined(CONFIG_SPL_BUILD)

>I don't like the initial condition we have here, adding the !SPL_BUILD test makes this even worse, lets not do that.

I did not find better solution to reduce the SPL size by removing cli.c/cli_hush.c and compiling out CONFIG_DFU_<MMC/NAND/SF> for SPL altogether. 

Regards
Ravi 


More information about the U-Boot mailing list