Commit d4420e70 authored by Tomeu Vizoso's avatar Tomeu Vizoso Committed by Ricardo Cañuelo Navarro

cli: add tftpboot command

Add the tftpboot command to interactively provide a TFTP server IPv4
address and the relative paths to a kernel image and command line
file.  This is then passed on to the netboot() function.

BUG=none
BRANCH=master
TEST=flash netboot, enet dhcp, tftpboot 10.42.0.1 vmlinuz cmdline.txt

Change-Id: I458bd27d5fd7f6bf12774c8dd2d368ef15178d87
Signed-off-by: Tomeu Vizoso's avatarTomeu Vizoso <tomeu.vizoso@collabora.com>
Signed-off-by: Guillaume Tucker's avatarGuillaume Tucker <guillaume.tucker@collabora.com>
Reviewed-on: https://chromium-review.googlesource.com/451382
Commit-Ready: Guillaume Tucker <guillaume.tucker@gmail.com>
Tested-by: default avatarGuillaume Tucker <guillaume.tucker@gmail.com>
Reviewed-by: default avatarJulius Werner <jwerner@chromium.org>
parent 0c084919
......@@ -31,4 +31,5 @@ depthcharge-y += storage.c
depthcharge-y += timer.c
depthcharge-y += tpm.c
netboot-y += net.c
netboot-y += enet.c
/*
* Copyright (C) 2017 Google Inc.
* Copyright (C) 2017, 2018 Collabora Limited
*
* Author: Tomeu Vizoso <tomeu.vizoso@collabora.com>
* Author: Guillaume Tucker <guillaume.tucker@collabora.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but without any warranty; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
/*
* Boot support
*/
#include "common.h"
#include "netboot/netboot.h"
#include "net/uiplib.h"
#define MAX_ARGS_LEN 4096
static void * const payload = (void *)(uintptr_t)CONFIG_KERNEL_START;
int do_tftpboot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
char *address;
char *bootfile;
char *argsfile;
uip_ipaddr_t tftp_ip;
if (argc != 4)
return CMD_RET_USAGE;
address = argv[1];
bootfile = argv[2];
argsfile = argv[3];
if (!uiplib_ipaddrconv(address, &tftp_ip)) {
printf("Invalid IPv4 address: %s\n", address);
return CMD_RET_USAGE;
}
netboot(&tftp_ip, bootfile, argsfile, NULL);
/* netboot() only returns if it failed */
return CMD_RET_FAILURE;
}
U_BOOT_CMD(
tftpboot, 4, 1,
"boot image via network using TFTP protocol",
"[host IP addr] [boot file] [args file]"
);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment