From: Thomas Huth <thuth@redhat.com>
To: Christian Borntraeger <borntraeger@de.ibm.com>,
qemu-s390x@nongnu.org,
Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
Cc: Cornelia Huck <cohuck@redhat.com>,
qemu-devel@nongnu.org, Collin Walling <walling@linux.ibm.com>
Subject: [Qemu-devel] [PATCH v1 for-2.13 4/4] pc-bios/s390-ccw/net: Add support for .INS config files
Date: Wed, 18 Apr 2018 14:31:47 +0200 [thread overview]
Message-ID: <1524054707-20663-5-git-send-email-thuth@redhat.com> (raw)
In-Reply-To: <1524054707-20663-1-git-send-email-thuth@redhat.com>
The .INS config files can normally be found on CD-ROM ISO images,
so by supporting these files, it is now possible to boot directly
when the TFTP server is set up with the contents of such an CD-ROM
image.
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
pc-bios/s390-ccw/netmain.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 51 insertions(+)
diff --git a/pc-bios/s390-ccw/netmain.c b/pc-bios/s390-ccw/netmain.c
index fa62bfe..e52e17d 100644
--- a/pc-bios/s390-ccw/netmain.c
+++ b/pc-bios/s390-ccw/netmain.c
@@ -441,6 +441,55 @@ static int net_try_pxelinux_cfgs(filename_ip_t *fn_ip)
return -1;
}
+/**
+ * Load via information from a .INS file (which can be found on CD-ROMs
+ * for example)
+ */
+static int handle_ins_cfg(filename_ip_t *fn_ip, char *cfg, int cfgsize)
+{
+ char *ptr;
+ int rc = -1, llen;
+ void *destaddr;
+ char *insbuf = cfg;
+
+ ptr = strchr(insbuf, '\n');
+ if (!ptr) {
+ puts("Does not seem to be a valid .INS file");
+ return -1;
+ }
+
+ *ptr = 0;
+ printf("\nParsing .INS file:\n %s\n", &insbuf[2]);
+
+ insbuf = ptr + 1;
+ while (*insbuf && insbuf < cfg + cfgsize) {
+ ptr = strchr(insbuf, '\n');
+ if (ptr) {
+ *ptr = 0;
+ }
+ llen = strlen(insbuf);
+ if (!llen) {
+ insbuf = ptr + 1;
+ continue;
+ }
+ ptr = strchr(insbuf, ' ');
+ if (!ptr) {
+ puts("Missing space separator in .INS file");
+ return -1;
+ }
+ *ptr = 0;
+ strncpy((char *)fn_ip->filename, insbuf, sizeof(fn_ip->filename));
+ destaddr = (char *)atol(ptr + 1);
+ rc = tftp_load(fn_ip, destaddr, (long)_start - (long)destaddr);
+ if (rc <= 0) {
+ break;
+ }
+ insbuf += llen + 1;
+ }
+
+ return rc;
+}
+
static int net_try_direct_tftp_load(filename_ip_t *fn_ip)
{
int rc;
@@ -455,6 +504,8 @@ static int net_try_direct_tftp_load(filename_ip_t *fn_ip)
if (!strncasecmp("default", cfgbuf, 7) || !strncmp("# ", cfgbuf, 2)) {
/* Looks like it is a pxelinux.cfg */
return handle_pxelinux_cfg(fn_ip, cfgbuf, rc);
+ } else if (!strncmp("* ", cfgbuf, 2)) {
+ return handle_ins_cfg(fn_ip, cfgbuf, rc);
}
}
--
1.8.3.1
next prev parent reply other threads:[~2018-04-18 12:32 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-18 12:31 [Qemu-devel] [PATCH v1 for-2.13 0/4] pc-bios/s390-ccw: Network boot improvements Thomas Huth
2018-04-18 12:31 ` [Qemu-devel] [PATCH v1 for-2.13 1/4] pc-bios/s390-ccw/net: Split up net_load() into init, load and uninit parts Thomas Huth
2018-04-18 18:11 ` Farhan Ali
2018-04-19 5:20 ` [Qemu-devel] [qemu-s390x] " Thomas Huth
2018-04-18 12:31 ` [Qemu-devel] [PATCH v1 for-2.13 2/4] pc-bios/s390-ccw/net: Stop virtio-net device before jumping into the OS Thomas Huth
2018-04-19 15:49 ` Christian Borntraeger
2018-04-20 6:31 ` Thomas Huth
2018-04-20 7:25 ` Christian Borntraeger
2018-04-18 12:31 ` [Qemu-devel] [PATCH v1 for-2.13 3/4] pc-bios/s390-ccw/net: Add support for pxelinux-style config files Thomas Huth
2018-04-19 7:41 ` Viktor VM Mihajlovski
2018-04-19 8:17 ` Thomas Huth
2018-04-19 12:40 ` Viktor VM Mihajlovski
2018-04-19 16:55 ` [Qemu-devel] [qemu-s390x] " Thomas Huth
2018-04-20 6:53 ` Viktor VM Mihajlovski
2018-04-20 7:36 ` Thomas Huth
2018-04-20 7:54 ` Viktor VM Mihajlovski
2018-04-20 8:40 ` Thomas Huth
2018-04-20 12:11 ` Viktor VM Mihajlovski
2018-04-18 12:31 ` Thomas Huth [this message]
2018-04-19 8:02 ` [Qemu-devel] [PATCH v1 for-2.13 4/4] pc-bios/s390-ccw/net: Add support for .INS " Viktor VM Mihajlovski
2018-04-19 8:20 ` Thomas Huth
2018-04-18 18:21 ` [Qemu-devel] [PATCH v1 for-2.13 0/4] pc-bios/s390-ccw: Network boot improvements Farhan Ali
2018-04-19 5:27 ` [Qemu-devel] [qemu-s390x] " Thomas Huth
2018-04-19 12:03 ` Farhan Ali
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=1524054707-20663-5-git-send-email-thuth@redhat.com \
--to=thuth@redhat.com \
--cc=borntraeger@de.ibm.com \
--cc=cohuck@redhat.com \
--cc=mihajlov@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=walling@linux.ibm.com \
/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;
as well as URLs for NNTP newsgroup(s).