[U-Boot] [PATCH] spl: net: Add FIT image support over network boot

Andrew F. Davis afd at ti.com
Wed Feb 8 16:33:31 UTC 2017


On 02/08/2017 08:05 AM, Lokesh Vutla wrote:
> 
> 
> On Wednesday 08 February 2017 04:29 AM, Andrew F. Davis wrote:
>> FIT support in the net boot case is much like the RAM boot case in that
>> we load our image to "load_addr" and pass a dummy read function into
>> "spl_load_simple_fit()". As the load address is no longer hard-coded to
>> the final execution address, RAW image loading will rely on "load_addr"
>> pointing to the execution address as they should have before.
>>
>> Signed-off-by: Andrew F. Davis <afd at ti.com>
>> ---
>>  common/spl/spl_net.c | 30 +++++++++++++++++++++++++++---
>>  1 file changed, 27 insertions(+), 3 deletions(-)
>>
>> diff --git a/common/spl/spl_net.c b/common/spl/spl_net.c
>> index 0fba0172ea..b7a4a89198 100644
>> --- a/common/spl/spl_net.c
>> +++ b/common/spl/spl_net.c
>> @@ -11,19 +11,29 @@
>>  #include <errno.h>
>>  #include <spl.h>
>>  #include <net.h>
>> +#include <libfdt.h>
>>  
>>  DECLARE_GLOBAL_DATA_PTR;
>>  
>> +static ulong spl_net_load_read(struct spl_load_info *load, ulong sector,
>> +			       ulong count, void *buf)
>> +{
>> +	debug("%s: sector %lx, count %lx, buf %lx\n",
>> +	      __func__, sector, count, (ulong)buf);
>> +	memcpy(buf, (void *)(load_addr + sector), count);
>> +	return count;
>> +}
>> +
>>  #if defined(CONFIG_SPL_ETH_SUPPORT) || defined(CONFIG_SPL_USBETH_SUPPORT)
>>  static int spl_net_load_image(struct spl_image_info *spl_image,
>>  			      struct spl_boot_device *bootdev)
>>  {
>> +	struct image_header *header = (struct image_header *)load_addr;
> 
> Just wondering what is the default load_addr or who sets load_addr
> before doing tftp? have you verified both FIT and not FIT case?
> 

The default is set to CONFIG_SYS_LOAD_ADDR, this is where the other SPL
loaders put the image, spl_net was the odd case before this patch.

The Legacy image, like FIT encodes the relocation address, RAW images
would have never worked with netboot due to the hard-coded shift to
compensate for the legacy image header.

Andrew

> Thanks and regards,
> Lokesh
> 


More information about the U-Boot mailing list