public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Lukasz Majewski <l.majewski@majess.pl>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 7/8] dfu: command: Provide support for 'dfutftp' command to handle receiving data via TFTP
Date: Mon, 20 Jul 2015 19:59:47 +0200	[thread overview]
Message-ID: <20150720195947.711edf57@jawa> (raw)
In-Reply-To: <CANr=Z=YHmzt0kd0QkePoeuTHYhqEYRKp1Hm1PHb6ivgHkHb11w@mail.gmail.com>

Hi Joe,

> Hi Lukasz,
> 
> On Thu, Jul 16, 2015 at 3:26 PM, Lukasz Majewski
> <l.majewski@majess.pl> wrote:
> > Hi Joe,
> >
> >
> >> Hi Lukasz,
> >>
> >> On Sun, Jul 12, 2015 at 10:30 AM, Lukasz Majewski
> >> <l.majewski@majess.pl> 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.
> 
> That's true, but it seems a simple thing to have an ifdef in the
> command list.
> 
> You could even keep the sub-command implementation in a separate file.

If I've understood you correctly - you propose extending cmd_dfu.c to
support tftp.

In this way we would have following dfu command syntax:

dfu [tftp] <usb/eth controller> <medium> <medium number> 

e.g. dfu [tftp] 0 mmc 1

And implementation of [tftp] part should go to another file?


> 
> >> > Signed-off-by: Lukasz Majewski <l.majewski@majess.pl>
> >> > ---
> >> >  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 <l.majewski@majess.pl>
> >> > + *
> >> > + * SPDX-License-Identifier:    GPL-2.0+
> >> > + */
> >> > +
> >> > +#include <common.h>
> >> > +#include <net.h>
> >> > +
> >> > +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",
> >> > +          "<ETH_controller> <interface> <dev>\n"
> >> > +          "  - device firmware upgrade via <ETH_controller>\n"
> >> > +          "    using TFTP protocol on device <dev>, attached\n"
> >> > +          "    to interface <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

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: <http://lists.denx.de/pipermail/u-boot/attachments/20150720/14f937af/attachment.sig>

  reply	other threads:[~2015-07-20 17:59 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-12 15:30 [U-Boot] [PATCH 0/8] dfu: tftp: update: Support for DFU upgrades via ETH (TFTP) Lukasz Majewski
2015-07-12 15:30 ` [U-Boot] [PATCH 1/8] doc: dfu: tftp: README entry for TFTP extension of DFU Lukasz Majewski
2015-07-15 18:14   ` Joe Hershberger
2015-07-16 19:59     ` Lukasz Majewski
2015-07-17 19:28       ` Joe Hershberger
2015-07-20 18:59         ` Lukasz Majewski
2015-07-20 19:17           ` Joe Hershberger
2015-07-20 20:09             ` Tormod Volden
2015-07-21 21:55             ` Lukasz Majewski
2015-07-12 15:30 ` [U-Boot] [PATCH 2/8] net: tftp: Move tftp.h file from ./net to ./include Lukasz Majewski
2015-07-15 18:17   ` Joe Hershberger
2015-07-16 20:02     ` Lukasz Majewski
2015-07-12 15:30 ` [U-Boot] [PATCH 3/8] tftp: update: Allow some parts of the code to be reused when CONFIG_SYS_NO_FLASH is set Lukasz Majewski
2015-07-15 18:19   ` Joe Hershberger
2015-07-12 15:30 ` [U-Boot] [PATCH 4/8] dfu: tftp: update: Provide tftp support for the DFU subsystem Lukasz Majewski
2015-07-15 18:24   ` Joe Hershberger
2015-07-16 20:06     ` Lukasz Majewski
2015-07-17 19:35       ` Joe Hershberger
2015-07-20 19:03         ` Lukasz Majewski
2015-07-12 15:30 ` [U-Boot] [PATCH 5/8] dfu: tftp: update: Add dfu_write_from_mem_addr() function Lukasz Majewski
2015-07-15 18:33   ` Joe Hershberger
2015-07-16 20:07     ` Lukasz Majewski
2015-07-12 15:30 ` [U-Boot] [PATCH 6/8] update: tftp: dfu: Extend update_tftp() function to support DFU Lukasz Majewski
2015-07-15 18:35   ` Joe Hershberger
2015-07-16 20:11     ` Lukasz Majewski
2015-07-17 19:38       ` Joe Hershberger
2015-07-20 19:05         ` Lukasz Majewski
2015-07-12 15:30 ` [U-Boot] [PATCH 7/8] dfu: command: Provide support for 'dfutftp' command to handle receiving data via TFTP Lukasz Majewski
2015-07-15 18:39   ` Joe Hershberger
2015-07-16 20:26     ` Lukasz Majewski
2015-07-17 19:40       ` Joe Hershberger
2015-07-20 17:59         ` Lukasz Majewski [this message]
2015-07-20 18:11           ` Joe Hershberger
2015-07-12 15:30 ` [U-Boot] [PATCH 8/8] config: bbb: Configs necessary for running update via TFTP on Beagle Bone Black Lukasz Majewski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150720195947.711edf57@jawa \
    --to=l.majewski@majess.pl \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox