All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luca Ceresoli <luca.ceresoli@comelit.it>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 6/6] TFTP: add tftpsrv command
Date: Mon, 18 Apr 2011 18:19:54 +0200	[thread overview]
Message-ID: <1303143594-5345-7-git-send-email-luca.ceresoli@comelit.it> (raw)
In-Reply-To: <1302796377-3321-1-git-send-email-luca.ceresoli@comelit.it>

Signed-off-by: Luca Ceresoli <luca.ceresoli@comelit.it>
Cc: Wolfgang Denk <wd@denx.de>
---
Changes in v2: none.

 README           |    1 +
 common/cmd_net.c |   14 ++++++++++++++
 include/net.h    |    3 ++-
 net/net.c        |   10 ++++++++--
 4 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/README b/README
index b9b0fcb..83dcb2a 100644
--- a/README
+++ b/README
@@ -685,6 +685,7 @@ The following options need to be configured:
 					  (requires CONFIG_CMD_MEMORY)
 		CONFIG_CMD_SOURCE	  "source" command Support
 		CONFIG_CMD_SPI		* SPI serial bus support
+		CONFIG_CMD_TFTPSRV	* TFTP transfer in server mode
 		CONFIG_CMD_USB		* USB support
 		CONFIG_CMD_VFD		* VFD support (TRAB)
 		CONFIG_CMD_CDP		* Cisco Discover Protocol support
diff --git a/common/cmd_net.c b/common/cmd_net.c
index 8c6f5c8..053162a 100644
--- a/common/cmd_net.c
+++ b/common/cmd_net.c
@@ -52,6 +52,20 @@ U_BOOT_CMD(
 	"[loadAddress] [[hostIPaddr:]bootfilename]"
 );
 
+#ifdef CONFIG_CMD_TFTPSRV
+int do_tftpsrv(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+	return netboot_common(TFTPSRV, cmdtp, argc, argv);
+}
+
+U_BOOT_CMD(
+	tftpsrv,	2,	1,	do_tftpsrv,
+	"boot image via network acting as a TFTP server",
+	"[loadAddress]"
+);
+#endif
+
+
 #ifdef CONFIG_CMD_RARP
 int do_rarpb (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
diff --git a/include/net.h b/include/net.h
index 01f7159..018a744 100644
--- a/include/net.h
+++ b/include/net.h
@@ -364,7 +364,8 @@ extern int		NetState;		/* Network loop state		*/
 extern int		NetRestartWrap;		/* Tried all network devices	*/
 #endif
 
-typedef enum { BOOTP, RARP, ARP, TFTP, DHCP, PING, DNS, NFS, CDP, NETCONS, SNTP } proto_t;
+typedef enum { BOOTP, RARP, ARP, TFTP, DHCP, PING, DNS, NFS, CDP, NETCONS, SNTP,
+	       TFTPSRV } proto_t;
 
 /* from net/net.c */
 extern char	BootFile[128];			/* Boot File name		*/
diff --git a/net/net.c b/net/net.c
index 132f99b..17eb06f 100644
--- a/net/net.c
+++ b/net/net.c
@@ -388,7 +388,11 @@ restart:
 			/* always use ARP to get server ethernet address */
 			TftpStart();
 			break;
-
+#ifdef CONFIG_CMD_TFTPSRV
+		case TFTPSRV:
+			TftpStartServer();
+			break;
+#endif
 #if defined(CONFIG_CMD_DHCP)
 		case DHCP:
 			BootpTry = 0;
@@ -1731,7 +1735,9 @@ static int net_check_prereq (proto_t protocol)
 #if defined(CONFIG_CMD_PING) || defined(CONFIG_CMD_SNTP)
     common:
 #endif
-
+#ifdef CONFIG_CMD_TFTPSRV
+	case TFTPSRV:
+#endif
 		if (NetOurIP == 0) {
 			puts ("*** ERROR: `ipaddr' not set\n");
 			return (1);
-- 
1.7.1

  parent reply	other threads:[~2011-04-18 16:19 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-13  9:08 [U-Boot] [RFC] Act as a TFTP server Luca Ceresoli
2011-04-13 11:37 ` Wolfgang Denk
2011-04-13 12:47   ` Luca Ceresoli
2011-04-30 19:53     ` Wolfgang Denk
2011-05-03 12:23       ` Luca Ceresoli
2011-05-03 12:36         ` Wolfgang Denk
2011-05-16 20:57           ` Luca Ceresoli
2011-04-14 10:31 ` Luca Ceresoli
2011-04-14 15:52 ` [U-Boot] [PATCH 0/6] " Luca Ceresoli
2011-04-14 16:13   ` Albert ARIBAUD
2011-04-18 16:19   ` [U-Boot] [PATCH v2 " Luca Ceresoli
2011-04-19 14:05     ` Detlev Zundel
2011-05-17 10:03     ` [U-Boot] [PATCH v3 0/5] " Luca Ceresoli
2011-05-17 10:03     ` [U-Boot] [PATCH v3 1/5] TFTP: replace "server" with "remote" in local variable names Luca Ceresoli
2011-05-19  8:11       ` Detlev Zundel
2011-05-19 19:39       ` Wolfgang Denk
2011-05-17 10:03     ` [U-Boot] [PATCH v3 2/5] TFTP: rename STATE_RRQ to STATE_SEND_RRQ Luca Ceresoli
2011-05-19  8:12       ` Detlev Zundel
2011-05-19 19:39       ` Wolfgang Denk
2011-05-17 10:03     ` [U-Boot] [PATCH v3 3/5] TFTP: net/tftp.c: add server mode receive Luca Ceresoli
2011-05-19  8:13       ` Detlev Zundel
2011-05-19 19:48       ` Wolfgang Denk
2011-05-17 10:03     ` [U-Boot] [PATCH v3 4/5] TFTP: add tftpsrv command Luca Ceresoli
2011-05-19  8:12       ` Detlev Zundel
2011-05-19 19:48       ` Wolfgang Denk
2011-05-17 10:03     ` [U-Boot] [PATCH v3 5/5] net/tftp.c: fix typo Luca Ceresoli
2011-05-19  8:13       ` Detlev Zundel
2011-05-19 19:48       ` Wolfgang Denk
2011-04-18 16:19   ` [U-Boot] [PATCH v2 1/6] README: remove spurious line Luca Ceresoli
2011-04-19 14:07     ` Detlev Zundel
2011-04-18 16:19   ` [U-Boot] [PATCH v2 2/6] NET: pass source IP address to packet handlers Luca Ceresoli
2011-04-19 14:15     ` Detlev Zundel
2011-04-19 15:26       ` Luca Ceresoli
2011-05-12 17:38     ` Wolfgang Denk
2011-04-18 16:19   ` [U-Boot] [PATCH v2 3/6] TFTP: rename "server" to "remote" Luca Ceresoli
2011-04-19 14:18     ` Detlev Zundel
2011-04-19 15:29       ` Luca Ceresoli
2011-04-19 16:28         ` Detlev Zundel
2011-04-19 21:56           ` Luca Ceresoli
2011-04-20  8:17             ` Detlev Zundel
2011-05-04  7:58               ` Luca Ceresoli
2011-05-04 10:37                 ` Detlev Zundel
2011-04-20  8:41         ` Detlev Zundel
2011-04-20 10:55           ` Luca Ceresoli
2011-04-20 13:27             ` [U-Boot] checkpatch - theory and practice [was: [PATCH v2 3/6] TFTP: rename "server" to "remote"] Detlev Zundel
2011-05-16 20:35         ` [U-Boot] [PATCH v2 3/6] TFTP: rename "server" to "remote" Luca Ceresoli
2011-05-17  9:38           ` Detlev Zundel
2011-04-30  4:36     ` Mike Frysinger
2011-05-16 20:16       ` Luca Ceresoli
2011-05-12 17:46     ` Wolfgang Denk
2011-05-13  7:36       ` Luca Ceresoli
2011-05-14 16:07         ` Luca Ceresoli
2011-04-18 16:19   ` [U-Boot] [PATCH v2 4/6] TFTP: rename STATE_RRQ to STATE_SEND_RRQ Luca Ceresoli
2011-04-19 14:22     ` Detlev Zundel
2011-04-18 16:19   ` [U-Boot] [PATCH v2 5/6] TFTP: net/tftp.c: add server mode receive Luca Ceresoli
2011-04-19 14:37     ` Detlev Zundel
2011-05-17  8:06       ` Luca Ceresoli
2011-05-17  9:41         ` Detlev Zundel
2011-04-18 16:19   ` Luca Ceresoli [this message]
2011-04-19 14:39     ` [U-Boot] [PATCH v2 6/6] TFTP: add tftpsrv command Detlev Zundel
2011-04-30  4:32     ` Mike Frysinger
2011-05-04  7:02     ` Mike Frysinger
2011-04-14 15:52 ` [U-Boot] [PATCH 1/6] README: remove spurious line Luca Ceresoli
2011-04-30 20:19   ` Wolfgang Denk
2011-04-14 15:52 ` [U-Boot] [PATCH 2/6] NET: pass source IP address to packet handlers Luca Ceresoli
2011-04-30 20:22   ` Wolfgang Denk
2011-04-30 20:24   ` Wolfgang Denk
2011-05-03  8:54     ` Luca Ceresoli
2011-04-14 15:52 ` [U-Boot] [PATCH 3/6] TFTP: rename "server" to "remote" Luca Ceresoli
2011-04-14 15:52 ` [U-Boot] [PATCH 4/6] TFTP: rename STATE_RRQ to STATE_SEND_RRQ Luca Ceresoli
2011-04-14 15:52 ` [U-Boot] [PATCH 5/6] TFTP: net/tftp.c: add server mode receive Luca Ceresoli
2011-04-14 15:52 ` [U-Boot] [PATCH 6/6] TFTP: add tftpsrv command Luca Ceresoli

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=1303143594-5345-7-git-send-email-luca.ceresoli@comelit.it \
    --to=luca.ceresoli@comelit.it \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.