From: Andrew F. Davis Date: Wed, 8 Feb 2017 10:33:31 -0600 Subject: [U-Boot] [PATCH] spl: net: Add FIT image support over network boot In-Reply-To: <4362e51e-e1f4-9c72-5339-29223f4456ed@ti.com> References: <20170207225914.23376-1-afd@ti.com> <4362e51e-e1f4-9c72-5339-29223f4456ed@ti.com> Message-ID: <7d2a5523-eb2b-9706-8abe-e77194ac99b9@ti.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 >> --- >> 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 >> #include >> #include >> +#include >> >> 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 >