[U-Boot] [PATCH 2/5] net: Re-check prerequisites when autoloading

Alexander Graf agraf at suse.de
Wed Jul 4 09:20:21 UTC 2018


On 07/04/2018 02:36 AM, Joe Hershberger wrote:
> With net autoload, we check the prerequisites for the initial command,
> but the greater prerequisites when autoloading are not checked.
>
> If we would attempt to autoload, check those prerequisites too.
>
> If we are not expecting a serverip from the server, then don't worry
> about it not being set, but don't attempt to load if it isn't.
>
> Signed-off-by: Joe Hershberger <joe.hershberger at ni.com>
> ---
>
>   net/net.c | 20 ++++++++++++++++++++
>   1 file changed, 20 insertions(+)
>
> diff --git a/net/net.c b/net/net.c
> index bff3e9c5b5..42a50e60f8 100644
> --- a/net/net.c
> +++ b/net/net.c
> @@ -332,6 +332,16 @@ void net_auto_load(void)
>   	const char *s = env_get("autoload");
>   
>   	if (s != NULL && strcmp(s, "NFS") == 0) {
> +		if (net_check_prereq(NFS)) {
> +/* We aren't expecting to get a serverip, so just accept the assigned IP */
> +#ifdef CONFIG_BOOTP_SERVERIP
> +			net_set_state(NETLOOP_SUCCESS);
> +#else
> +			printf("Cannot autoload with NFS\n");
> +			net_set_state(NETLOOP_FAIL);
> +#endif

I don't understand the #ifdef. In the CONFIG_BOOTP_SERVERIP case, you 
should already have net_server_ip set from the variable setter, so when 
do you realistically get into the case where net_check_prereq() fails 
here? I can only see that happening when serverip is not set (read: 
net_server_ip == 0.0.0.0) in which case we should also error out in the 
CONFIG_BOOTP_SERVERIP case, no?


Alex




More information about the U-Boot mailing list