[PATCH 24/26] test: spl: Add a test for the NET load method

Sean Anderson seanga2 at gmail.com
Thu Oct 12 06:11:20 CEST 2023


On 10/11/23 23:41, Simon Glass wrote:
> On Wed, 11 Oct 2023 at 18:56, Sean Anderson <seanga2 at gmail.com> wrote:
>>
>> Add a test for loading U-Boot over TFTP. As with other sandbox net
>> routines, we need to initialize our packets manually since things like
>> net_set_ether and net_set_udp_header always use "our" addresses. We use
>> BOOTP instead of DHCP, since DHCP has a tag/length-based format which is
>> harder to parse. Our TFTP implementation doesn't define as many constants
>> as I'd like, so I create some here. Note that the TFTP block size is
>> one-based, but offsets are zero-based.
>>
>> In order to avoid address errors, we need to set up/define some additional
>> address information settings. dram_init_banksize would be a good candidate
>> for settig up bi_dram, but it gets called too late in board_init_r.
>>
>> Signed-off-by: Sean Anderson <seanga2 at gmail.com>
>> ---
>>
>>   arch/sandbox/cpu/spl.c           |   3 +
>>   arch/sandbox/include/asm/spl.h   |   1 +
>>   configs/sandbox_noinst_defconfig |   6 +-
>>   test/image/Kconfig               |   9 ++
>>   test/image/Makefile              |   1 +
>>   test/image/spl_load_net.c        | 252 +++++++++++++++++++++++++++++++
>>   6 files changed, 271 insertions(+), 1 deletion(-)
>>   create mode 100644 test/image/spl_load_net.c
>>
> 
> Reviewed-by: Simon Glass <sjg at chromium.org>
> 
>> diff --git a/arch/sandbox/cpu/spl.c b/arch/sandbox/cpu/spl.c
>> index 09e3d10d6a5..8153df18d68 100644
>> --- a/arch/sandbox/cpu/spl.c
>> +++ b/arch/sandbox/cpu/spl.c
>> @@ -126,6 +126,9 @@ void spl_board_init(void)
>>   {
>>          struct sandbox_state *state = state_get_current();
>>
>> +       gd->bd->bi_dram[0].start = gd->ram_base;
>> +       gd->bd->bi_dram[0].size = get_effective_memsize();
> 
> These could use a common as to why they are needed here.

OK.

--Sean


More information about the U-Boot mailing list