[U-Boot] [PATCH v7 RESEND 4/5] Put common autoload code into auto_load() function

Eric Bénard eric at eukrea.com
Fri Jun 10 23:53:41 CEST 2011


Hi Simon,

On 10/06/2011 17:04, Simon Glass wrote:
> This is a small clean-up patch.
>
> Signed-off-by: Simon Glass<sjg at chromium.org>
> ---
>   net/bootp.c |   75 +++++++++++++++++++++++++---------------------------------
>   1 files changed, 32 insertions(+), 43 deletions(-)
>
> diff --git a/net/bootp.c b/net/bootp.c
> index 4db63cb..4774624 100644
> --- a/net/bootp.c
> +++ b/net/bootp.c
> @@ -138,6 +138,35 @@ static int truncate_sz (const char *name, int maxlen, int curlen)
>   	return (curlen);
>   }
>
> +/*
> + * Check if autoload is enabled. If so, use either NFS or TFTP to download
> + * the boot file.
> + */
> +static void auto_load(void)
> +{
> +	const char *s = getenv("autoload");
> +
> +	if (s != NULL) {
> +		if (*s == 'n') {
> +			/*
> +			 * Just use BOOTP to configure system;
> +			 * Do not use TFTP to load the bootfile.
> +			 */
> +			NetState = NETLOOP_SUCCESS;
> +			return;
> +		}
> +#if defined(CONFIG_CMD_NFS)
> +		if (strcmp(s, "NFS") == 0) {
> +			/*
> +			 * Use NFS to load the bootfile.
> +			 */
> +			NfsStart();
> +			return;
> +		}
> +#endif
> +	TftpStart();
> +}

a "}" is missing here

Eric


More information about the U-Boot mailing list