All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: qemu-devel@nongnu.org
Cc: Erwan Velu <erwan.velu@free.fr>
Subject: [Qemu-devel] [PATCH 2/3] Add -bootp option for slip
Date: Sat, 17 Feb 2007 19:04:37 -0600	[thread overview]
Message-ID: <45D7A625.2050503@codemonkey.ws> (raw)
In-Reply-To: <45D7A43B.20808@codemonkey.ws>

[-- Attachment #1: Type: text/plain, Size: 147 bytes --]

The following patch adds a -bootp option.  This option takes a filename 
that will be advertised as the BOOTP filename.

Regards,

Anthony Liguori

[-- Attachment #2: slirp-bootp.diff --]
[-- Type: text/x-patch, Size: 2981 bytes --]

diff -r ea5eb79ade8d slirp/bootp.c
--- a/slirp/bootp.c	Thu Feb 15 16:49:28 2007 -0600
+++ b/slirp/bootp.c	Thu Feb 15 16:49:30 2007 -0600
@@ -38,6 +38,8 @@ typedef struct {
 
 BOOTPClient bootp_clients[NB_ADDR];
 
+const char *bootp_filename;
+
 static const uint8_t rfc1533_cookie[] = { RFC1533_COOKIE };
 
 #ifdef DEBUG
@@ -168,6 +170,10 @@ static void bootp_reply(struct bootp_t *
             goto new_addr;
         }
     }
+
+    if (bootp_filename)
+        snprintf(rbp->bp_file, sizeof(rbp->bp_file), "%s", bootp_filename);
+
     dprintf("offered addr=%08x\n", ntohl(daddr.sin_addr.s_addr));
 
     saddr.sin_addr.s_addr = htonl(ntohl(special_addr.s_addr) | CTL_ALIAS);
diff -r ea5eb79ade8d vl.c
--- a/vl.c	Thu Feb 15 16:49:28 2007 -0600
+++ b/vl.c	Thu Feb 15 16:57:07 2007 -0600
@@ -6488,6 +6488,7 @@ void help(void)
            "\n"
 #ifdef CONFIG_SLIRP
            "-tftp prefix    allow tftp access to files starting with prefix [-net user]\n"
+           "-bootp file     advertise file in BOOTP replies\n"
 #ifndef _WIN32
            "-smb dir        allow SMB access to files in 'dir' [-net user]\n"
 #endif
@@ -6576,6 +6577,7 @@ enum {
 
     QEMU_OPTION_net,
     QEMU_OPTION_tftp,
+    QEMU_OPTION_bootp,
     QEMU_OPTION_smb,
     QEMU_OPTION_redir,
 
@@ -6652,6 +6654,7 @@ const QEMUOption qemu_options[] = {
     { "net", HAS_ARG, QEMU_OPTION_net},
 #ifdef CONFIG_SLIRP
     { "tftp", HAS_ARG, QEMU_OPTION_tftp },
+    { "bootp", HAS_ARG, QEMU_OPTION_bootp },
 #ifndef _WIN32
     { "smb", HAS_ARG, QEMU_OPTION_smb },
 #endif
@@ -7185,6 +7188,9 @@ int main(int argc, char **argv)
             case QEMU_OPTION_tftp:
 		tftp_prefix = optarg;
                 break;
+            case QEMU_OPTION_bootp:
+                bootp_filename = optarg;
+                break;
 #ifndef _WIN32
             case QEMU_OPTION_smb:
 		net_slirp_smb(optarg);
diff -r ea5eb79ade8d vl.h
--- a/vl.h	Thu Feb 15 16:49:28 2007 -0600
+++ b/vl.h	Thu Feb 15 16:49:30 2007 -0600
@@ -163,6 +163,7 @@ extern int no_quit;
 extern int no_quit;
 extern int semihosting_enabled;
 extern int autostart;
+extern const char *bootp_filename;
 
 #define MAX_OPTION_ROMS 16
 extern const char *option_rom[MAX_OPTION_ROMS];
diff -r ea5eb79ade8d qemu-doc.texi
--- a/qemu-doc.texi	Thu Feb 15 16:49:28 2007 -0600
+++ b/qemu-doc.texi	Thu Feb 15 16:57:23 2007 -0600
@@ -445,6 +445,16 @@ guest must be configured in binary mode 
 guest must be configured in binary mode (use the command @code{bin} of
 the Unix TFTP client). The host IP address on the guest is as usual
 10.0.2.2.
+
+@item -bootp file
+When using the user mode network stack, broadcast @var{file} as the BOOTP
+filename.  In conjunction with @option{-tftp}, this can be used to network boot
+a guest from a local directory.
+
+Example (using pxelinux):
+@example
+qemu -hda linux.img -boot n -tftp /path/to/tftp/files -bootp /pxelinux.0
+@end example
 
 @item -smb dir
 When using the user mode network stack, activate a built-in SMB

  parent reply	other threads:[~2007-02-18  1:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-18  0:56 [Qemu-devel] [PATCH 0/3] Make BOOTP work with slirp Anthony Liguori
2007-02-18  1:01 ` [Qemu-devel] [PATCH 1/3] Add OACK support to slirp TFTP server Anthony Liguori
2007-02-18  1:04 ` Anthony Liguori [this message]
2007-02-18  1:07 ` [Qemu-devel] [PATCH 3/3] Change -tftp option to take a root directory Anthony Liguori
2007-02-18 11:29 ` [Qemu-devel] Re: [PATCH 0/3] Make BOOTP work with slirp Erwan Velu

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=45D7A625.2050503@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --cc=erwan.velu@free.fr \
    --cc=qemu-devel@nongnu.org \
    /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.