From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lukasz Majewski Date: Thu, 16 Jul 2015 22:26:51 +0200 Subject: [U-Boot] [PATCH 7/8] dfu: command: Provide support for 'dfutftp' command to handle receiving data via TFTP In-Reply-To: References: <1436715044-18706-1-git-send-email-l.majewski@majess.pl> <1436715044-18706-8-git-send-email-l.majewski@majess.pl> Message-ID: <20150716222651.41410bb7@jawa> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Joe, > Hi Lukasz, > > On Sun, Jul 12, 2015 at 10:30 AM, Lukasz Majewski > wrote: > > The new 'dfutftp' command has syntax similar to 'dfu' command. > > This new command however, requires some extra env variables to allow > > update_tftp() code to work properly. For more explanation, please > > consult ./doc/README.dfutftp > > It would be great if it didn't require them. I've described reasoning for them in the previous reply. > It would also be great if > there were just a dfu command and "tftp" were a subcommand. It's a > more common pattern now instead of adding new, top-level commands. Good point. However, I've tried to avoid #ifdefs in the cmd_dfu.c code. Some boards only use USB and they would not need support for tftp in the cmd_dfu.c command. Separate command allows adding the code only when it is needed. > > > Signed-off-by: Lukasz Majewski > > --- > > common/Makefile | 1 + > > common/cmd_dfutftp.c | 43 > > +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 > > insertions(+) create mode 100644 common/cmd_dfutftp.c > > > > diff --git a/common/Makefile b/common/Makefile > > index d6c1d48..483905c 100644 > > --- a/common/Makefile > > +++ b/common/Makefile > > @@ -211,6 +211,7 @@ obj-$(CONFIG_UPDATE_TFTP) += update.o > > obj-$(CONFIG_USB_KEYBOARD) += usb_kbd.o > > obj-$(CONFIG_CMD_DFU) += cmd_dfu.o > > obj-$(CONFIG_CMD_GPT) += cmd_gpt.o > > +obj-$(CONFIG_CMD_DFUTFTP) += cmd_dfutftp.o > > > > # Power > > obj-$(CONFIG_CMD_PMIC) += cmd_pmic.o > > diff --git a/common/cmd_dfutftp.c b/common/cmd_dfutftp.c > > new file mode 100644 > > index 0000000..2b75a09 > > --- /dev/null > > +++ b/common/cmd_dfutftp.c > > @@ -0,0 +1,43 @@ > > +/* > > + * cmd_dfutftp.c -- dfutftp command > > + * > > + * Copyright (C) 2015 > > + * Lukasz Majewski > > + * > > + * SPDX-License-Identifier: GPL-2.0+ > > + */ > > + > > +#include > > +#include > > + > > +static > > +int do_dfutftp(cmd_tbl_t *cmdtp, int flag, int argc, char * const > > argv[]) +{ > > + unsigned long addr = 0; > > + > > + if (argc < 4 || argc > 5) > > + return CMD_RET_USAGE; > > + > > + char *interface = argv[2]; > > + char *devstring = argv[3]; > > + > > + if (argc == 5) > > + addr = simple_strtoul(argv[4], NULL, 0); > > + > > + /* Below env variables are descibed in detail > > at ./doc/README.dfutftp */ > > + setenv("update_tftp_exec_at_boot", "true"); > > + setenv("update_tftp_dfu", "true"); > > + setenv("update_tftp_dfu_interface", interface); > > + setenv("update_tftp_dfu_devstring", devstring); > > + > > + return update_tftp(addr); > > +} > > + > > +U_BOOT_CMD(dfutftp, CONFIG_SYS_MAXARGS, 1, do_dfutftp, > > + "Device Firmware Upgrade via TFTP", > > + " \n" > > + " - device firmware upgrade via \n" > > + " using TFTP protocol on device , attached\n" > > + " to interface \n" > > + " [addr] - address where FIT image has been stored\n" > > +); > > -- > > 2.1.4 > > > > _______________________________________________ > > U-Boot mailing list > > U-Boot at lists.denx.de > > http://lists.denx.de/mailman/listinfo/u-boot Best regards, Lukasz Majewski -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 181 bytes Desc: OpenPGP digital signature URL: