Re: [Qemu-devel] [PATCH 0/5] s390x: network boot

2017-02-21 Thread Viktor Mihajlovski
On 20.02.2017 17:01, Alexander Graf wrote:
> 
> 
> On 20/02/2017 07:43, Thomas Huth wrote:
>> On 20.02.2017 15:19, Cornelia Huck wrote:
>>> This patchset implements network boot for s390x. You need to build
>>> a s390-netboot.img to actually perform the work (not included).
>>
>> Do you plan to include this into the upstream QEMU repository later, or
>> will this stay an external binary?
>>
>>> Basically, we add support for virtio-net devices into the ipl code
>>> and update the ccw bios to handle this as well.
>>
>> Just out of curiosity: What's the reason for shipping an additional
>> binary here? Couldn't it be linked into the ccw bios as well (so that
>> it's easier for the user to select a different version with the -bios
>> parameter)?
> 
> The "other binary" (s390-netboot.img) is the equivalent of grub or
> pxelinux in an x86 network boot environment. That one usually comes from
> a different entity and different department :).
I'd rather compare the other binary to an option ROM.
At this point in time we there's no netboot ROM, but a set of
instructions on how to build a netboot binary from a kernel and a
ramdisk, the series coverletter contains a brief version of that.

> 
> I haven't looked at the patches in detail, but do they follow the
> "normal" PXE boot flow? Do they do a DHCP request, send a proper
> Vendor-Class-Identifier for s390x, fetch the binary described by the
> "filename" property in the DHCP ack via TFTP from next-server and run
> that one then?
It's currently not described with that level of detail, but the idea is
to skip the step of loading a syslinux equivalent, and to immediately
fetch the PXELINUX config file from the TFT next server aka siaddr and
load the kernel and ramdisk specified therein.
I.e. a simulation of the PXELINUX process is done in a similar fashion
to petitboot PXE boot.
> 
> It would be very good to stick to that flow, so that you don't confuse
> your network admins :).
> 
> 
> Alex
> 


-- 

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




Re: [Qemu-devel] [PATCH 0/5] s390x: network boot

2017-02-20 Thread Alexander Graf



On 20/02/2017 07:43, Thomas Huth wrote:

On 20.02.2017 15:19, Cornelia Huck wrote:

This patchset implements network boot for s390x. You need to build
a s390-netboot.img to actually perform the work (not included).


Do you plan to include this into the upstream QEMU repository later, or
will this stay an external binary?


Basically, we add support for virtio-net devices into the ipl code
and update the ccw bios to handle this as well.


Just out of curiosity: What's the reason for shipping an additional
binary here? Couldn't it be linked into the ccw bios as well (so that
it's easier for the user to select a different version with the -bios
parameter)?


The "other binary" (s390-netboot.img) is the equivalent of grub or 
pxelinux in an x86 network boot environment. That one usually comes from 
a different entity and different department :).


I haven't looked at the patches in detail, but do they follow the 
"normal" PXE boot flow? Do they do a DHCP request, send a proper 
Vendor-Class-Identifier for s390x, fetch the binary described by the 
"filename" property in the DHCP ack via TFTP from next-server and run 
that one then?


It would be very good to stick to that flow, so that you don't confuse 
your network admins :).



Alex



Re: [Qemu-devel] [PATCH 0/5] s390x: network boot

2017-02-20 Thread Thomas Huth
On 20.02.2017 15:19, Cornelia Huck wrote:
> This patchset implements network boot for s390x. You need to build
> a s390-netboot.img to actually perform the work (not included).

Do you plan to include this into the upstream QEMU repository later, or
will this stay an external binary?

> Basically, we add support for virtio-net devices into the ipl code
> and update the ccw bios to handle this as well.

Just out of curiosity: What's the reason for shipping an additional
binary here? Couldn't it be linked into the ccw bios as well (so that
it's easier for the user to select a different version with the -bios
parameter)?

 Thomas




[Qemu-devel] [PATCH 0/5] s390x: network boot

2017-02-20 Thread Cornelia Huck
This patchset implements network boot for s390x. You need to build
a s390-netboot.img to actually perform the work (not included).

Basically, we add support for virtio-net devices into the ipl code
and update the ccw bios to handle this as well.

For the first patch (elf loading) I'd like to get an ack.

A s390-netboot.img can be built by bundling some shell scripts, busybox
and the kexec binary bundled into an initial ramdisk and append that to
a kernel image. An existing s390 system can be used as source.

The init process can be a simple shell script that mounts a few
essential filesystems, like /dev, /proc, /sys, ..., starts a DHCP client
(busybox udchpc) and then invokes another script to do the actual
network boot.

udchpc will invoke the script /usr/share/udhcpc/default.script in
response to DHCP server messages to configure interfaces. The sample
busybox default.script can be used for that, but needs to also extract
the DHCP options like the tftp server address and pass that on to the
boot script.

The boot script itself has to retrieve the PXELINUX configuration from
the tftp server as in [1], then retrieve the remote kernel and initial
ramdisk and finally use kexec to boot the network kernel.

In a nutshell:

1. Create a skeleton initramfs directory structure
2. Create the init script, the PXE boot scripts and the DHCP default
   script
3. Copy kexec and its dependencies from the source system into the
   initramfs
4. Copy virtio network and block modules from the source system into
   the initramfs
5. Copy the busybox binaries into the initramfs
6. Build the ramdisk (in compressed CPIO format)
7. Concatenate the kernel image and the initial ramdisk
8. Update the 8 bytes at location 66568 with the offset value of the
   ramdisk in the new binary, and the 8 bytes at location 66576 with the
   size of the ramdisk. Both values need to be updated in binary, big
   endian format.

[1]
http://www.syslinux.org/wiki/index.php?title=PXELINUX#Configuration_filename


Cornelia Huck (1):
  pc-bios/s390-ccw.img: rebuild image

Farhan Ali (4):
  elf-loader: Allow late loading of elf
  s390x/ipl: Extend S390IPLState to support network boot
  s390x/ipl: Load network boot image
  pc-bios/s390-ccw: Use the ccw bios to start the network boot

 hw/core/loader.c   |  17 +++--
 hw/s390x/ipl.c |  87 +
 hw/s390x/ipl.h |   5 ++-
 hw/s390x/s390-virtio-ccw.c |   3 +-
 hw/s390x/s390-virtio.c |   2 ++
 hw/s390x/s390-virtio.h |   1 +
 include/hw/elf_ops.h   |  13 ---
 include/hw/loader.h|  13 ++-
 pc-bios/s390-ccw.img   | Bin 26392 -> 26456 bytes
 pc-bios/s390-ccw/bootmap.c |   8 -
 pc-bios/s390-ccw/iplb.h|   3 +-
 pc-bios/s390-ccw/main.c|  20 +++
 pc-bios/s390-ccw/virtio.c  |   1 +
 pc-bios/s390-ccw/virtio.h  |   1 +
 14 files changed, 157 insertions(+), 17 deletions(-)

-- 
2.11.0