[Qemu-devel] [PATCH v4 00/11] Implement network booting in the s390-ccw BIOS

Thomas Huth posted 11 patches 6 years, 9 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/1499781397-19749-1-git-send-email-thuth@redhat.com
Test FreeBSD passed
Test checkpatch failed
Test docker passed
Test s390x passed
There is a newer version of this series
pc-bios/s390-ccw/Makefile        |  13 +-
pc-bios/s390-ccw/bootmap.c       |   2 +
pc-bios/s390-ccw/bootmap.h       |  26 ---
pc-bios/s390-ccw/bswap.h         |  30 ++++
pc-bios/s390-ccw/libc.h          |  45 +++++
pc-bios/s390-ccw/main.c          |  14 +-
pc-bios/s390-ccw/netboot.mak     |  51 ++++++
pc-bios/s390-ccw/netmain.c       | 362 +++++++++++++++++++++++++++++++++++++++
pc-bios/s390-ccw/s390-ccw.h      |  33 +---
pc-bios/s390-ccw/sclp.c          |  37 ++--
pc-bios/s390-ccw/virtio-blkdev.c | 296 ++++++++++++++++++++++++++++++++
pc-bios/s390-ccw/virtio-net.c    | 135 +++++++++++++++
pc-bios/s390-ccw/virtio-scsi.c   |   1 +
pc-bios/s390-ccw/virtio.c        | 306 ++++-----------------------------
pc-bios/s390-ccw/virtio.h        |  46 ++---
roms/SLOF                        |   2 +-
16 files changed, 1011 insertions(+), 388 deletions(-)
create mode 100644 pc-bios/s390-ccw/bswap.h
create mode 100644 pc-bios/s390-ccw/libc.h
create mode 100644 pc-bios/s390-ccw/netboot.mak
create mode 100644 pc-bios/s390-ccw/netmain.c
create mode 100644 pc-bios/s390-ccw/virtio-blkdev.c
create mode 100644 pc-bios/s390-ccw/virtio-net.c
[Qemu-devel] [PATCH v4 00/11] Implement network booting in the s390-ccw BIOS
Posted by Thomas Huth 6 years, 9 months ago
It's already possible to do a network boot of an s390x guest with an
external netboot image based on a Linux installation, but it would
be much more convenient if the s390-ccw firmware supported network
booting right out of the box, without the need to assemble such an
external image first.

This patch series now introduces a s390-netboot.img that can be used
for network booting via DHCP and TFTP by re-using the networking stack
from the SLOF firmware (see https://github.com/aik/SLOF/ for details),
and adds a driver for virtio-net-ccw devices.

The code can only be built if the roms/SLOF submodule has been checked
out (there is a sanity check for this in the Makefile). Once it has
been built, you can download a combined kernel + initrd image via TFTP
by starting QEMU for example with:

 qemu-system-s390x ... -device virtio-net,netdev=n1,bootindex=1 \
       -netdev user,id=n1,tftp=/path/to/tftp,bootfile=kernel.img

Note that this version does not support downloading via config
files (i.e. pxelinux config files or .INS config files) yet. This
will be added later.

v4:
 - Cosmetic clean-ups according to the review feedback from v3
 - Fixed bug in the find_dev() function (spotted by Cornelia in v3)
 - Added an additional patch to remove some unused structs from
   virtio.h

v3:
 - Adressed the review feedback from v2
 - The last remaining SLOF patch has now been merged (big thanks to
   Alexey!), so not sending this as RFC anymore - it is ready now for
   integration, I think.

v2:
 - Put the network boot loader into a separate s390-netboot.img
   binary instead of linking it directly into the s390-ccw firmware.
 - Use the SLOF sources from the roms/SLOF/ submodule instead of
   copying them into the pc-bios/s390-ccw folder
 - Removed the .INS config file loading code for now - only support
   combined kernel + initrd images in this initial implementation.

Thomas Huth (11):
  pc-bios/s390-ccw: Move libc functions to separate header
  pc-bios/s390-ccw: Move ebc2asc to sclp.c
  pc-bios/s390-ccw: Move virtio-block related functions into a separate
    file
  pc-bios/s390-ccw: Add a write() function for stdio
  pc-bios/s390-ccw: Move byteswap functions to a separate header
  pc-bios/s390-ccw: Remove unused structs from virtio.h
  pc-bios/s390-ccw: Add code for virtio feature negotiation
  roms/SLOF: Update submodule to latest status
  pc-bios/s390-ccw: Add core files for the network bootloading program
  pc-bios/s390-ccw: Add virtio-net driver code
  pc-bios/s390-ccw: Link libnet into the netboot image and do the TFTP
    load

 pc-bios/s390-ccw/Makefile        |  13 +-
 pc-bios/s390-ccw/bootmap.c       |   2 +
 pc-bios/s390-ccw/bootmap.h       |  26 ---
 pc-bios/s390-ccw/bswap.h         |  30 ++++
 pc-bios/s390-ccw/libc.h          |  45 +++++
 pc-bios/s390-ccw/main.c          |  14 +-
 pc-bios/s390-ccw/netboot.mak     |  51 ++++++
 pc-bios/s390-ccw/netmain.c       | 362 +++++++++++++++++++++++++++++++++++++++
 pc-bios/s390-ccw/s390-ccw.h      |  33 +---
 pc-bios/s390-ccw/sclp.c          |  37 ++--
 pc-bios/s390-ccw/virtio-blkdev.c | 296 ++++++++++++++++++++++++++++++++
 pc-bios/s390-ccw/virtio-net.c    | 135 +++++++++++++++
 pc-bios/s390-ccw/virtio-scsi.c   |   1 +
 pc-bios/s390-ccw/virtio.c        | 306 ++++-----------------------------
 pc-bios/s390-ccw/virtio.h        |  46 ++---
 roms/SLOF                        |   2 +-
 16 files changed, 1011 insertions(+), 388 deletions(-)
 create mode 100644 pc-bios/s390-ccw/bswap.h
 create mode 100644 pc-bios/s390-ccw/libc.h
 create mode 100644 pc-bios/s390-ccw/netboot.mak
 create mode 100644 pc-bios/s390-ccw/netmain.c
 create mode 100644 pc-bios/s390-ccw/virtio-blkdev.c
 create mode 100644 pc-bios/s390-ccw/virtio-net.c

-- 
1.8.3.1


Re: [Qemu-devel] [PATCH v4 00/11] Implement network booting in the s390-ccw BIOS
Posted by no-reply@patchew.org 6 years, 9 months ago
Hi,

This series seems to have some coding style problems. See output below for
more information:

Message-id: 1499781397-19749-1-git-send-email-thuth@redhat.com
Type: series
Subject: [Qemu-devel] [PATCH v4 00/11] Implement network booting in the s390-ccw BIOS

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

git config --local diff.renamelimit 0
git config --local diff.renames True

commits="$(git log --format=%H --reverse $BASE..)"
for c in $commits; do
    echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
    if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
        failed=1
        echo
    fi
    n=$((n+1))
done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 - [tag update]      patchew/1499781397-19749-1-git-send-email-thuth@redhat.com -> patchew/1499781397-19749-1-git-send-email-thuth@redhat.com
 * [new tag]         patchew/1499783493-15911-1-git-send-email-stefanb@linux.vnet.ibm.com -> patchew/1499783493-15911-1-git-send-email-stefanb@linux.vnet.ibm.com
Switched to a new branch 'test'
dfcbff7 pc-bios/s390-ccw: Link libnet into the netboot image and do the TFTP load
3d23b53 pc-bios/s390-ccw: Add virtio-net driver code
e902e4d pc-bios/s390-ccw: Add core files for the network bootloading program
ef33c9b roms/SLOF: Update submodule to latest status
a50b775 pc-bios/s390-ccw: Add code for virtio feature negotiation
3661080 pc-bios/s390-ccw: Remove unused structs from virtio.h
66831e3 pc-bios/s390-ccw: Move byteswap functions to a separate header
74c52d9 pc-bios/s390-ccw: Add a write() function for stdio
bf18612 pc-bios/s390-ccw: Move virtio-block related functions into a separate file
2e9282c pc-bios/s390-ccw: Move ebc2asc to sclp.c
842b66f pc-bios/s390-ccw: Move libc functions to separate header

=== OUTPUT BEGIN ===
Checking PATCH 1/11: pc-bios/s390-ccw: Move libc functions to separate header...
Checking PATCH 2/11: pc-bios/s390-ccw: Move ebc2asc to sclp.c...
Checking PATCH 3/11: pc-bios/s390-ccw: Move virtio-block related functions into a separate file...
Checking PATCH 4/11: pc-bios/s390-ccw: Add a write() function for stdio...
ERROR: externs should be avoided in .c files
#23: FILE: pc-bios/s390-ccw/sclp.c:15:
+long write(int fd, const void *str, size_t len);

total: 1 errors, 0 warnings, 37 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

Checking PATCH 5/11: pc-bios/s390-ccw: Move byteswap functions to a separate header...
Checking PATCH 6/11: pc-bios/s390-ccw: Remove unused structs from virtio.h...
Checking PATCH 7/11: pc-bios/s390-ccw: Add code for virtio feature negotiation...
Checking PATCH 8/11: roms/SLOF: Update submodule to latest status...
Checking PATCH 9/11: pc-bios/s390-ccw: Add core files for the network bootloading program...
ERROR: externs should be avoided in .c files
#121: FILE: pc-bios/s390-ccw/netmain.c:26:
+extern char _start[];

ERROR: externs should be avoided in .c files
#124: FILE: pc-bios/s390-ccw/netmain.c:29:
+IplParameterBlock iplb __attribute__((aligned(PAGE_SIZE)));

total: 2 errors, 0 warnings, 199 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

Checking PATCH 10/11: pc-bios/s390-ccw: Add virtio-net driver code...
Checking PATCH 11/11: pc-bios/s390-ccw: Link libnet into the netboot image and do the TFTP load...
=== OUTPUT END ===

Test command exited with code: 1


---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel@freelists.org
Re: [Qemu-devel] [PATCH v4 00/11] Implement network booting in the s390-ccw BIOS
Posted by Christian Borntraeger 6 years, 9 months ago
On 07/11/2017 03:56 PM, Thomas Huth wrote:
> It's already possible to do a network boot of an s390x guest with an
> external netboot image based on a Linux installation, but it would
> be much more convenient if the s390-ccw firmware supported network
> booting right out of the box, without the need to assemble such an
> external image first.
> 
> This patch series now introduces a s390-netboot.img that can be used
> for network booting via DHCP and TFTP by re-using the networking stack
> from the SLOF firmware (see https://github.com/aik/SLOF/ for details),
> and adds a driver for virtio-net-ccw devices.
> 
> The code can only be built if the roms/SLOF submodule has been checked
> out (there is a sanity check for this in the Makefile). Once it has
> been built, you can download a combined kernel + initrd image via TFTP
> by starting QEMU for example with:
> 
>  qemu-system-s390x ... -device virtio-net,netdev=n1,bootindex=1 \
>        -netdev user,id=n1,tftp=/path/to/tftp,bootfile=kernel.img
> 
> Note that this version does not support downloading via config
> files (i.e. pxelinux config files or .INS config files) yet. This
> will be added later.
> 
> v4:
>  - Cosmetic clean-ups according to the review feedback from v3
>  - Fixed bug in the find_dev() function (spotted by Cornelia in v3)
>  - Added an additional patch to remove some unused structs from
>    virtio.h
> 
> v3:
>  - Adressed the review feedback from v2
>  - The last remaining SLOF patch has now been merged (big thanks to
>    Alexey!), so not sending this as RFC anymore - it is ready now for
>    integration, I think.
> 
> v2:
>  - Put the network boot loader into a separate s390-netboot.img
>    binary instead of linking it directly into the s390-ccw firmware.
>  - Use the SLOF sources from the roms/SLOF/ submodule instead of
>    copying them into the pc-bios/s390-ccw folder
>  - Removed the .INS config file loading code for now - only support
>    combined kernel + initrd images in this initial implementation.
> 
> Thomas Huth (11):
>   pc-bios/s390-ccw: Move libc functions to separate header
>   pc-bios/s390-ccw: Move ebc2asc to sclp.c
>   pc-bios/s390-ccw: Move virtio-block related functions into a separate
>     file
>   pc-bios/s390-ccw: Add a write() function for stdio
>   pc-bios/s390-ccw: Move byteswap functions to a separate header
>   pc-bios/s390-ccw: Remove unused structs from virtio.h
>   pc-bios/s390-ccw: Add code for virtio feature negotiation
>   roms/SLOF: Update submodule to latest status
>   pc-bios/s390-ccw: Add core files for the network bootloading program
>   pc-bios/s390-ccw: Add virtio-net driver code
>   pc-bios/s390-ccw: Link libnet into the netboot image and do the TFTP
>     load
> 
>  pc-bios/s390-ccw/Makefile        |  13 +-
>  pc-bios/s390-ccw/bootmap.c       |   2 +
>  pc-bios/s390-ccw/bootmap.h       |  26 ---
>  pc-bios/s390-ccw/bswap.h         |  30 ++++
>  pc-bios/s390-ccw/libc.h          |  45 +++++
>  pc-bios/s390-ccw/main.c          |  14 +-
>  pc-bios/s390-ccw/netboot.mak     |  51 ++++++
>  pc-bios/s390-ccw/netmain.c       | 362 +++++++++++++++++++++++++++++++++++++++
>  pc-bios/s390-ccw/s390-ccw.h      |  33 +---
>  pc-bios/s390-ccw/sclp.c          |  37 ++--
>  pc-bios/s390-ccw/virtio-blkdev.c | 296 ++++++++++++++++++++++++++++++++
>  pc-bios/s390-ccw/virtio-net.c    | 135 +++++++++++++++
>  pc-bios/s390-ccw/virtio-scsi.c   |   1 +
>  pc-bios/s390-ccw/virtio.c        | 306 ++++-----------------------------
>  pc-bios/s390-ccw/virtio.h        |  46 ++---
>  roms/SLOF                        |   2 +-
>  16 files changed, 1011 insertions(+), 388 deletions(-)
>  create mode 100644 pc-bios/s390-ccw/bswap.h
>  create mode 100644 pc-bios/s390-ccw/libc.h
>  create mode 100644 pc-bios/s390-ccw/netboot.mak
>  create mode 100644 pc-bios/s390-ccw/netmain.c
>  create mode 100644 pc-bios/s390-ccw/virtio-blkdev.c
>  create mode 100644 pc-bios/s390-ccw/virtio-net.c
> 

Was going to apply but then I updated the slof thing but building fails. Not sure yet why.

In file included from /home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/ctype/isdigit.c:13:0:
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/ctype/isdigit.c:15:17: error: expected ‘)’ before ‘ch’
 int isdigit(int ch)
                 ^
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/ctype/isdigit.c:15:5: error: expected expression before ‘)’ token
 int isdigit(int ch)
     ^
In file included from /home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/ctype/isprint.c:13:0:
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/ctype/isprint.c:15:17: error: expected ‘)’ before ‘ch’
 int isprint(int ch)
                 ^
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/ctype/isprint.c:15:5: error: expected expression before ‘)’ token
 int isprint(int ch)
     ^
In file included from /home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/ctype/isxdigit.c:13:0:
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/ctype/isxdigit.c:15:18: error: expected ‘)’ before ‘ch’
 int isxdigit(int ch)
                  ^
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/ctype/isxdigit.c:15:5: error: expected expression before ‘)’ token
 int isxdigit(int ch)
     ^
In file included from /home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/ctype/tolower.c:13:0:
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/ctype/tolower.c:15:5: error: expected identifier or ‘(’ before ‘__extension__’
 int tolower(int c)
     ^
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/ctype/Makefile.inc:20: recipe for target 'isdigit.o' failed
make[1]: *** [isdigit.o] Error 1
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/ctype/Makefile.inc:20: recipe for target 'isprint.o' failed
make[1]: *** [isprint.o] Error 1
In file included from /usr/include/string.h:630:0,
                 from /home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/string/strncmp.c:13:
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/string/strncmp.c:17:1: error: expected identifier or ‘(’ before ‘__extension__’
 strncmp(const char *s1, const char *s2, size_t n)
 ^
In file included from /home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/ctype/isspace.c:13:0:
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/ctype/isspace.c:15:17: error: expected ‘)’ before ‘ch’
 int isspace(int ch)
                 ^
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/ctype/isspace.c:15:5: error: expected expression before ‘)’ token
 int isspace(int ch)
     ^
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/ctype/Makefile.inc:20: recipe for target 'isxdigit.o' failed
make[1]: *** [isxdigit.o] Error 1
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/ctype/Makefile.inc:20: recipe for target 'tolower.o' failed
make[1]: *** [tolower.o] Error 1
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/string/Makefile.inc:22: recipe for target 'strncmp.o' failed
make[1]: *** [strncmp.o] Error 1
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/ctype/Makefile.inc:20: recipe for target 'isspace.o' failed
make[1]: *** [isspace.o] Error 1
In file included from /usr/include/string.h:630:0,
                 from /home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/string/strcmp.c:13:
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/string/strcmp.c:17:1: error: expected identifier or ‘(’ before ‘__extension__’
 strcmp(const char *s1, const char *s2)
 ^
In file included from /usr/include/string.h:630:0,
                 from /home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/string/strchr.c:13:
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/string/strchr.c:16:1: error: expected identifier or ‘(’ before ‘__extension__’
 strchr(const char *s, int c)
 ^
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/string/strcmp.c:17:1: error: expected identifier or ‘(’ before ‘)’ token
 strcmp(const char *s1, const char *s2)
 ^
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/string/Makefile.inc:22: recipe for target 'strchr.o' failed
make[1]: *** [strchr.o] Error 1
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/string/Makefile.inc:22: recipe for target 'strcmp.o' failed
make[1]: *** [strcmp.o] Error 1
In file included from /home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/ctype/toupper.c:14:0:
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/ctype/toupper.c:16:5: error: expected identifier or ‘(’ before ‘__extension__’
 int toupper (int cha)
     ^
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/ctype/Makefile.inc:20: recipe for target 'toupper.o' failed
make[1]: *** [toupper.o] Error 1
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/stdio/fileno.c: In function ‘fileno’:
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/stdio/fileno.c:18:15: error: ‘FILE {aka struct _IO_FILE}’ has no member named ‘fd’
  return stream->fd;
               ^~
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/stdio/Makefile.inc:23: recipe for target 'fileno.o' failed
make[1]: *** [fileno.o] Error 1
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/stdio/putc.c: In function ‘_IO_putc’:
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/stdio/putc.c:21:18: error: ‘FILE {aka struct _IO_FILE}’ has no member named ‘fd’
  if (write(stream->fd, &outchar, 1) == 1)
                  ^~
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/stdio/vfprintf.c: In function ‘vfprintf’:
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/stdio/vfprintf.c:23:14: error: ‘FILE {aka struct _IO_FILE}’ has no member named ‘fd’
  write(stream->fd, buffer, count);
              ^~
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/stdio/Makefile.inc:23: recipe for target 'putc.o' failed
make[1]: *** [putc.o] Error 1
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/stdio/Makefile.inc:23: recipe for target 'vfprintf.o' failed
make[1]: *** [vfprintf.o] Error 1
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/stdio/puts.c: In function ‘puts’:
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/stdio/puts.c:24:20: error: ‘struct _IO_FILE’ has no member named ‘fd’
  ret = write(stdout->fd, str, strlen(str));
                    ^~
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/stdio/puts.c:25:14: error: ‘struct _IO_FILE’ has no member named ‘fd’
  write(stdout->fd, "\r\n", 2);
              ^~
/home/cborntra/REPOS/qemu/pc-bios/s390-ccw/netmain.c:25:18: fatal error: tftp.h: No such file or directory
 #include <tftp.h>
                  ^
compilation terminated.
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/stdio/vsnprintf.c: In function ‘vsnprintf’:
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/stdio/vsnprintf.c:283:15: warning: implicit declaration of function ‘va_arg’ [-Wimplicit-function-declaration]
      formstr, va_arg(arg, void *));
               ^~~~~~
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/stdio/vsnprintf.c:283:27: error: expected expression before ‘void’
      formstr, va_arg(arg, void *));
                           ^~~~
/home/cborntra/REPOS/qemu/rules.mak:66: recipe for target 'netmain.o' failed
make[1]: *** [netmain.o] Error 1
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/stdio/Makefile.inc:23: recipe for target 'puts.o' failed
make[1]: *** [puts.o] Error 1
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/stdio/Makefile.inc:23: recipe for target 'vsnprintf.o' failed
make[1]: *** [vsnprintf.o] Error 1
/home/cborntra/REPOS/qemu/pc-bios/s390-ccw/virtio-net.c:19:22: fatal error: ethernet.h: No such file or directory
 #include <ethernet.h>
                      ^
compilation terminated.
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/stdio/stdchnls.c:18:21: error: unknown field ‘fd’ specified in initializer
 FILE stdin_data = { .fd = 0, .mode = _IOLBF, .pos = 0,
                     ^
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/stdio/stdchnls.c:18:30: error: unknown field ‘mode’ specified in initializer
 FILE stdin_data = { .fd = 0, .mode = _IOLBF, .pos = 0,
                              ^
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/stdio/stdchnls.c:18:38: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
 FILE stdin_data = { .fd = 0, .mode = _IOLBF, .pos = 0,
                                      ^~~~~~
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/stdio/stdchnls.c:18:38: note: (near initialization for ‘stdin_data._IO_read_ptr’)
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/stdio/stdchnls.c:18:46: error: unknown field ‘pos’ specified in initializer
 FILE stdin_data = { .fd = 0, .mode = _IOLBF, .pos = 0,
                                              ^
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/stdio/stdchnls.c:19:7: error: unknown field ‘buf’ specified in initializer
       .buf = stdin_buffer, .bufsiz = BUFSIZ };
       ^
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/stdio/stdchnls.c:19:28: error: unknown field ‘bufsiz’ specified in initializer
       .buf = stdin_buffer, .bufsiz = BUFSIZ };
                            ^
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/stdio/stdchnls.c:19:38: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
       .buf = stdin_buffer, .bufsiz = BUFSIZ };
                                      ^~~~~~
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/stdio/stdchnls.c:19:38: note: (near initialization for ‘stdin_data._IO_write_base’)
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/stdio/stdchnls.c:20:22: error: unknown field ‘fd’ specified in initializer
 FILE stdout_data = { .fd = 1, .mode = _IOLBF, .pos = 0,
                      ^
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/stdio/stdchnls.c:20:31: error: unknown field ‘mode’ specified in initializer
 FILE stdout_data = { .fd = 1, .mode = _IOLBF, .pos = 0,
                               ^
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/stdio/stdchnls.c:20:39: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
 FILE stdout_data = { .fd = 1, .mode = _IOLBF, .pos = 0,
                                       ^~~~~~
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/stdio/stdchnls.c:20:39: note: (near initialization for ‘stdout_data._IO_read_ptr’)
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/stdio/stdchnls.c:20:47: error: unknown field ‘pos’ specified in initializer
 FILE stdout_data = { .fd = 1, .mode = _IOLBF, .pos = 0,
                                               ^
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/stdio/stdchnls.c:21:8: error: unknown field ‘buf’ specified in initializer
        .buf = stdout_buffer, .bufsiz = BUFSIZ };
        ^
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/stdio/stdchnls.c:21:30: error: unknown field ‘bufsiz’ specified in initializer
        .buf = stdout_buffer, .bufsiz = BUFSIZ };
                              ^
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/stdio/stdchnls.c:21:40: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
        .buf = stdout_buffer, .bufsiz = BUFSIZ };
                                        ^~~~~~
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/stdio/stdchnls.c:21:40: note: (near initialization for ‘stdout_data._IO_write_base’)
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/stdio/stdchnls.c:22:22: error: unknown field ‘fd’ specified in initializer
 FILE stderr_data = { .fd = 2, .mode = _IONBF, .pos = 0,
                      ^
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/stdio/stdchnls.c:22:31: error: unknown field ‘mode’ specified in initializer
 FILE stderr_data = { .fd = 2, .mode = _IONBF, .pos = 0,
                               ^
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/stdio/stdchnls.c:22:39: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
 FILE stderr_data = { .fd = 2, .mode = _IONBF, .pos = 0,
                                       ^~~~~~
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/stdio/stdchnls.c:22:39: note: (near initialization for ‘stderr_data._IO_read_ptr’)
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/stdio/stdchnls.c:22:47: error: unknown field ‘pos’ specified in initializer
 FILE stderr_data = { .fd = 2, .mode = _IONBF, .pos = 0,
                                               ^
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/stdio/stdchnls.c:23:8: error: unknown field ‘buf’ specified in initializer
        .buf = NULL, .bufsiz = 0 };
        ^
/home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/stdio/stdchnls.c:23:21: error: unknown field ‘bufsiz’ specified in initializer
        .buf = NULL, .bufsiz = 0 };
                     ^
/home/cborntra/REPOS/qemu/rules.mak:66: recipe for target 'virtio-net.o' failed



Re: [Qemu-devel] [PATCH v4 00/11] Implement network booting in the s390-ccw BIOS
Posted by Thomas Huth 6 years, 9 months ago
On 12.07.2017 10:33, Christian Borntraeger wrote:
> On 07/11/2017 03:56 PM, Thomas Huth wrote:
>> It's already possible to do a network boot of an s390x guest with an
>> external netboot image based on a Linux installation, but it would
>> be much more convenient if the s390-ccw firmware supported network
>> booting right out of the box, without the need to assemble such an
>> external image first.
>>
>> This patch series now introduces a s390-netboot.img that can be used
>> for network booting via DHCP and TFTP by re-using the networking stack
>> from the SLOF firmware (see https://github.com/aik/SLOF/ for details),
>> and adds a driver for virtio-net-ccw devices.
>>
>> The code can only be built if the roms/SLOF submodule has been checked
>> out (there is a sanity check for this in the Makefile). Once it has
>> been built, you can download a combined kernel + initrd image via TFTP
>> by starting QEMU for example with:
>>
>>  qemu-system-s390x ... -device virtio-net,netdev=n1,bootindex=1 \
>>        -netdev user,id=n1,tftp=/path/to/tftp,bootfile=kernel.img
>>
>> Note that this version does not support downloading via config
>> files (i.e. pxelinux config files or .INS config files) yet. This
>> will be added later.
>>
>> v4:
>>  - Cosmetic clean-ups according to the review feedback from v3
>>  - Fixed bug in the find_dev() function (spotted by Cornelia in v3)
>>  - Added an additional patch to remove some unused structs from
>>    virtio.h
>>
>> v3:
>>  - Adressed the review feedback from v2
>>  - The last remaining SLOF patch has now been merged (big thanks to
>>    Alexey!), so not sending this as RFC anymore - it is ready now for
>>    integration, I think.
>>
>> v2:
>>  - Put the network boot loader into a separate s390-netboot.img
>>    binary instead of linking it directly into the s390-ccw firmware.
>>  - Use the SLOF sources from the roms/SLOF/ submodule instead of
>>    copying them into the pc-bios/s390-ccw folder
>>  - Removed the .INS config file loading code for now - only support
>>    combined kernel + initrd images in this initial implementation.
>>
>> Thomas Huth (11):
>>   pc-bios/s390-ccw: Move libc functions to separate header
>>   pc-bios/s390-ccw: Move ebc2asc to sclp.c
>>   pc-bios/s390-ccw: Move virtio-block related functions into a separate
>>     file
>>   pc-bios/s390-ccw: Add a write() function for stdio
>>   pc-bios/s390-ccw: Move byteswap functions to a separate header
>>   pc-bios/s390-ccw: Remove unused structs from virtio.h
>>   pc-bios/s390-ccw: Add code for virtio feature negotiation
>>   roms/SLOF: Update submodule to latest status
>>   pc-bios/s390-ccw: Add core files for the network bootloading program
>>   pc-bios/s390-ccw: Add virtio-net driver code
>>   pc-bios/s390-ccw: Link libnet into the netboot image and do the TFTP
>>     load
>>
>>  pc-bios/s390-ccw/Makefile        |  13 +-
>>  pc-bios/s390-ccw/bootmap.c       |   2 +
>>  pc-bios/s390-ccw/bootmap.h       |  26 ---
>>  pc-bios/s390-ccw/bswap.h         |  30 ++++
>>  pc-bios/s390-ccw/libc.h          |  45 +++++
>>  pc-bios/s390-ccw/main.c          |  14 +-
>>  pc-bios/s390-ccw/netboot.mak     |  51 ++++++
>>  pc-bios/s390-ccw/netmain.c       | 362 +++++++++++++++++++++++++++++++++++++++
>>  pc-bios/s390-ccw/s390-ccw.h      |  33 +---
>>  pc-bios/s390-ccw/sclp.c          |  37 ++--
>>  pc-bios/s390-ccw/virtio-blkdev.c | 296 ++++++++++++++++++++++++++++++++
>>  pc-bios/s390-ccw/virtio-net.c    | 135 +++++++++++++++
>>  pc-bios/s390-ccw/virtio-scsi.c   |   1 +
>>  pc-bios/s390-ccw/virtio.c        | 306 ++++-----------------------------
>>  pc-bios/s390-ccw/virtio.h        |  46 ++---
>>  roms/SLOF                        |   2 +-
>>  16 files changed, 1011 insertions(+), 388 deletions(-)
>>  create mode 100644 pc-bios/s390-ccw/bswap.h
>>  create mode 100644 pc-bios/s390-ccw/libc.h
>>  create mode 100644 pc-bios/s390-ccw/netboot.mak
>>  create mode 100644 pc-bios/s390-ccw/netmain.c
>>  create mode 100644 pc-bios/s390-ccw/virtio-blkdev.c
>>  create mode 100644 pc-bios/s390-ccw/virtio-net.c
>>
> 
> Was going to apply but then I updated the slof thing but building fails. Not sure yet why.
> 
> In file included from /home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/ctype/isdigit.c:13:0:
> /home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/ctype/isdigit.c:15:17: error: expected ‘)’ before ‘ch’
>  int isdigit(int ch)

What a bummer! Sorry, I've only cross-compiled the s390-ccw BIOS so far,
and that worked fine (since s390x machines are a little bit hard to get
here), but seems like there is still something ugly going on when you
build the code natively ... likely somethings wrong in the Makefile ...
I'll try to figure it out ...

 Thomas

Re: [Qemu-devel] [PATCH v4 00/11] Implement network booting in the s390-ccw BIOS
Posted by Viktor Mihajlovski 6 years, 9 months ago
On 12.07.2017 12:53, Thomas Huth wrote:
> On 12.07.2017 10:33, Christian Borntraeger wrote:
>> On 07/11/2017 03:56 PM, Thomas Huth wrote:
>>> It's already possible to do a network boot of an s390x guest with an
>>> external netboot image based on a Linux installation, but it would
>>> be much more convenient if the s390-ccw firmware supported network
>>> booting right out of the box, without the need to assemble such an
>>> external image first.
>>>
>>> This patch series now introduces a s390-netboot.img that can be used
>>> for network booting via DHCP and TFTP by re-using the networking stack
>>> from the SLOF firmware (see https://github.com/aik/SLOF/ for details),
>>> and adds a driver for virtio-net-ccw devices.
>>>
>>> The code can only be built if the roms/SLOF submodule has been checked
>>> out (there is a sanity check for this in the Makefile). Once it has
>>> been built, you can download a combined kernel + initrd image via TFTP
>>> by starting QEMU for example with:
>>>
>>>  qemu-system-s390x ... -device virtio-net,netdev=n1,bootindex=1 \
>>>        -netdev user,id=n1,tftp=/path/to/tftp,bootfile=kernel.img
>>>
>>> Note that this version does not support downloading via config
>>> files (i.e. pxelinux config files or .INS config files) yet. This
>>> will be added later.
>>>
>>> v4:
>>>  - Cosmetic clean-ups according to the review feedback from v3
>>>  - Fixed bug in the find_dev() function (spotted by Cornelia in v3)
>>>  - Added an additional patch to remove some unused structs from
>>>    virtio.h
>>>
>>> v3:
>>>  - Adressed the review feedback from v2
>>>  - The last remaining SLOF patch has now been merged (big thanks to
>>>    Alexey!), so not sending this as RFC anymore - it is ready now for
>>>    integration, I think.
>>>
>>> v2:
>>>  - Put the network boot loader into a separate s390-netboot.img
>>>    binary instead of linking it directly into the s390-ccw firmware.
>>>  - Use the SLOF sources from the roms/SLOF/ submodule instead of
>>>    copying them into the pc-bios/s390-ccw folder
>>>  - Removed the .INS config file loading code for now - only support
>>>    combined kernel + initrd images in this initial implementation.
>>>
>>> Thomas Huth (11):
>>>   pc-bios/s390-ccw: Move libc functions to separate header
>>>   pc-bios/s390-ccw: Move ebc2asc to sclp.c
>>>   pc-bios/s390-ccw: Move virtio-block related functions into a separate
>>>     file
>>>   pc-bios/s390-ccw: Add a write() function for stdio
>>>   pc-bios/s390-ccw: Move byteswap functions to a separate header
>>>   pc-bios/s390-ccw: Remove unused structs from virtio.h
>>>   pc-bios/s390-ccw: Add code for virtio feature negotiation
>>>   roms/SLOF: Update submodule to latest status
>>>   pc-bios/s390-ccw: Add core files for the network bootloading program
>>>   pc-bios/s390-ccw: Add virtio-net driver code
>>>   pc-bios/s390-ccw: Link libnet into the netboot image and do the TFTP
>>>     load
>>>
>>>  pc-bios/s390-ccw/Makefile        |  13 +-
>>>  pc-bios/s390-ccw/bootmap.c       |   2 +
>>>  pc-bios/s390-ccw/bootmap.h       |  26 ---
>>>  pc-bios/s390-ccw/bswap.h         |  30 ++++
>>>  pc-bios/s390-ccw/libc.h          |  45 +++++
>>>  pc-bios/s390-ccw/main.c          |  14 +-
>>>  pc-bios/s390-ccw/netboot.mak     |  51 ++++++
>>>  pc-bios/s390-ccw/netmain.c       | 362 +++++++++++++++++++++++++++++++++++++++
>>>  pc-bios/s390-ccw/s390-ccw.h      |  33 +---
>>>  pc-bios/s390-ccw/sclp.c          |  37 ++--
>>>  pc-bios/s390-ccw/virtio-blkdev.c | 296 ++++++++++++++++++++++++++++++++
>>>  pc-bios/s390-ccw/virtio-net.c    | 135 +++++++++++++++
>>>  pc-bios/s390-ccw/virtio-scsi.c   |   1 +
>>>  pc-bios/s390-ccw/virtio.c        | 306 ++++-----------------------------
>>>  pc-bios/s390-ccw/virtio.h        |  46 ++---
>>>  roms/SLOF                        |   2 +-
>>>  16 files changed, 1011 insertions(+), 388 deletions(-)
>>>  create mode 100644 pc-bios/s390-ccw/bswap.h
>>>  create mode 100644 pc-bios/s390-ccw/libc.h
>>>  create mode 100644 pc-bios/s390-ccw/netboot.mak
>>>  create mode 100644 pc-bios/s390-ccw/netmain.c
>>>  create mode 100644 pc-bios/s390-ccw/virtio-blkdev.c
>>>  create mode 100644 pc-bios/s390-ccw/virtio-net.c
>>>
>>
>> Was going to apply but then I updated the slof thing but building fails. Not sure yet why.
>>
>> In file included from /home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/ctype/isdigit.c:13:0:
>> /home/cborntra/REPOS/qemu/roms/SLOF/lib/libc/ctype/isdigit.c:15:17: error: expected ‘)’ before ‘ch’
>>  int isdigit(int ch)
> 
> What a bummer! Sorry, I've only cross-compiled the s390-ccw BIOS so far,
> and that worked fine (since s390x machines are a little bit hard to get
> here), but seems like there is still something ugly going on when you
> build the code natively ... likely somethings wrong in the Makefile ...
> I'll try to figure it out ...
> 
>  Thomas
> 

I haven't tried recently, but you could consider using one of these here
https://developer.ibm.com/linuxone/

-- 

Mit freundlichen Grüßen/Kind Regards
   Viktor Mihajlovski

IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martina Köderitz
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294