Bug#685134: Bug#684909: Bug#685134: [s390-tools] please add patch from qemu

Dimitri John Ledkov <[email protected]>
Newsgroups gmane.linux.debian.ports.s390
Message-ID <CANBHLUj6ccfGDNzxaaZPTTwy-A_JBR+3fj5CNizCrANTt5YsNg__12511.3816153773$1510751911$gmane$org@mail.gmail.com>
On 19 October 2017 at 20:53, Aurelien Jarno <[email protected]> wrote:
> On 2017-10-19 16:31, Philipp Kern wrote:
>> On 10/19/2017 03:06 PM, Michael Tokarev wrote:
>> > Debian has much stricter policy wrt blobs (DFSG),
>> > and debian builds for more architectures (the firmware,
>> > if it is part of qemu-system-s390 package, needs to be
>> > built on all architectures where this binary package
>> > builts, or it needs to be a separate arch-all package).
>>
>> Note that the arch:all autobuilders are amd64. gcc-*-s390x-linux-gnu
>> exists in Debian, although only on i386 and amd64. I don't think there's
>> a policy today that precludes you from forcing users to build arch:all
>> on amd64 for technical reasons.
>

Well, depwait state is valid, no? E.g. i'm sure we have many arch:all
packages that cannot be built on some architectures if e.g. arch:all
source package has an arch:all build dependency that is not
installable on some architectures.

As long as arch:all is buildable on a few common architectures, that's
good enough, no?

> Indeed that's one option to build it, that's for example the solution
> chosen to build slof using gcc-powerpc64-linux-gnu. So far nobody
> complained it's buildable only on amd64, i386, ppc64el and x32.
>

Note there are now two s390 firmwares in qemu: ccw and netboot. The
netboot one needs SLOF sources.

> The other alternative is to build a cross-compiler using binutils-source
> and gcc-source (that requires that the none or elf os is supported for
> this architecture). This has the advantage of ignoring all the flags
> that debhelper tries to push that make a firmware to not build or break.
> That's the solution chosen for example for openbios.
>

Would the attached patch be acceptable for debian?

* It drops stripping roms/SLOF

* Adds Build-Depends-Indep: crossbuild-essential-s390x
(such that it is needed only on the arch:all debian builder, or when
building with -A, meaning it is not needed when doing arch builds,
tested that arch-only build doesn't require this)
(maybe we can add a build profile <!no-firmware> or like <!no-cross>
for this too, to exclude this step, and thus enable people to manually
build arch-all & arch-any packages, without the crosstoolchainy bits)

* Adds code to compile s390 firmwares and install them into
qemu-s390-firmware arch:all package
(package name is arbitrary - it did not feel right to call it bios...
any better name suggestions are welcome)

Given that roms/SLOF code is needed by two firmwares, maybe we can
explore collapsing src:qemu-slof into src:qemu too, using strategy
similar to the above one.

Installing s390x cross toolchain, and compiling s390 firmware adds
trivial amount of extra build-time, given how long/big the full
src:qemu build already is.

-- 
Regards,

Dimitri.
s390-firmware.patch (text/x-patch, 4.4 KB)
diff -ru debian/qemu-2.10.0+dfsg/debian/changelog qemu-2.10.0+dfsg/debian/changelog
--- debian/qemu-2.10.0+dfsg/debian/changelog	2017-10-08 10:51:09.000000000 +0100
+++ qemu-2.10.0+dfsg/debian/changelog	2017-11-14 20:57:02.000000000 +0000
@@ -1,3 +1,10 @@
+qemu (1:2.10.0+dfsg-2.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Compile and provide s390 ccw & netboot firmware.
+
+ -- Dimitri John Ledkov <[email protected]>  Tue, 14 Nov 2017 20:56:50 +0000
+
 qemu (1:2.10.0+dfsg-2) unstable; urgency=medium
 
   * update to upstream 2.10.1 point release
diff -ru debian/qemu-2.10.0+dfsg/debian/control qemu-2.10.0+dfsg/debian/control
--- debian/qemu-2.10.0+dfsg/debian/control	2017-10-08 10:51:09.000000000 +0100
+++ qemu-2.10.0+dfsg/debian/control	2017-11-15 13:01:01.624664678 +0000
@@ -106,6 +106,7 @@
 ##--enable-netmap todo bsd
 ##--enable-quorum todo needs gcrypt
 ##--enable-xen-pci-passthrough todo
+Build-Depends-Indep: crossbuild-essential-s390x
 Build-Conflicts: oss4-dev
 Standards-Version: 3.9.8
 Homepage: http://www.qemu.org/
@@ -482,3 +483,11 @@
  Please note that old qemu-kvm configuration files (in /etc/kvm/) are
  no longer used.
 
+Package: qemu-s390-firware
+Architecture: all
+Depends: ${misc:Depends}
+Enhances: qemu-system-misc
+Description: QEMU s390 ccw and pxeboot firmware images
+ QEMU is a fast processor emulator. This package provides ccw (virtio) and
+ netboot (pxeboot) firmware for the s390 system emulator.
+
diff -ru debian/qemu-2.10.0+dfsg/debian/control-in qemu-2.10.0+dfsg/debian/control-in
--- debian/qemu-2.10.0+dfsg/debian/control-in	2017-10-08 10:35:23.000000000 +0100
+++ qemu-2.10.0+dfsg/debian/control-in	2017-11-15 13:01:00.724667246 +0000
@@ -107,6 +107,7 @@
 ##--enable-netmap todo bsd
 ##--enable-quorum todo needs gcrypt
 ##--enable-xen-pci-passthrough todo
+Build-Depends-Indep: crossbuild-essential-s390x
 Build-Conflicts: oss4-dev
 Standards-Version: 3.9.8
 Homepage: http://www.qemu.org/
@@ -529,6 +530,17 @@
  Please note that old qemu-kvm configuration files (in /etc/kvm/) are
  no longer used.
 
+Package: qemu-s390-firware
+Architecture: all
+Depends: ${misc:Depends}
+:ubuntu:Breaks: qemu-system-s390x (<< 1:2.10+dfsg-3~)
+:ubuntu:Replaces: qemu-system-s390x (<< 1:2.10+dfsg-3~)
+:ubuntu:Enhances: qemu-system-s390x
+:debian:Enhances: qemu-system-misc
+Description: QEMU s390 ccw and pxeboot firmware images
+ QEMU is a fast processor emulator. This package provides ccw (virtio) and
+ netboot (pxeboot) firmware for the s390 system emulator.
+
 :ubuntu:Package: qemu-system-aarch64
 :ubuntu:Architecture: arm64
 :ubuntu:Multi-Arch: foreign
diff -ru debian/qemu-2.10.0+dfsg/debian/get-orig-source.sh qemu-2.10.0+dfsg/debian/get-orig-source.sh
--- debian/qemu-2.10.0+dfsg/debian/get-orig-source.sh	2017-09-23 14:27:00.000000000 +0100
+++ qemu-2.10.0+dfsg/debian/get-orig-source.sh	2017-11-14 21:45:34.000000000 +0000
@@ -44,7 +44,6 @@
 dir roms/qemu-palcode
 dir roms/seabios
 dir roms/sgabios
-dir roms/SLOF
 dir roms/vgabios
 dir roms/u-boot
 
Only in qemu-2.10.0+dfsg/debian/patches: fix-s390-ccw-cross.patch
diff -ru debian/qemu-2.10.0+dfsg/debian/patches/series qemu-2.10.0+dfsg/debian/patches/series
--- debian/qemu-2.10.0+dfsg/debian/patches/series	2017-10-08 10:48:17.000000000 +0100
+++ qemu-2.10.0+dfsg/debian/patches/series	2017-11-15 12:14:57.000000000 +0000
@@ -3,3 +3,4 @@
 qemu-2.10.1.diff
 9pfs-use-g_malloc0-to-allocate-space-for-xattr-CVE-2017-15038.patch
 remove-trailing-whitespace-from-qemu-options.hx.patch
+fix-s390-ccw-cross.patch
Only in qemu-2.10.0+dfsg/debian/: qemu-s390-firmware.install
diff -ru debian/qemu-2.10.0+dfsg/debian/rules qemu-2.10.0+dfsg/debian/rules
--- debian/qemu-2.10.0+dfsg/debian/rules	2017-10-08 10:35:23.000000000 +0100
+++ qemu-2.10.0+dfsg/debian/rules	2017-11-15 12:14:21.000000000 +0000
@@ -115,7 +115,7 @@
 
 build: build-arch build-indep
 build-arch: build-stamp
-build-indep: build-stamp
+build-indep: build-stamp build-stamp-indep
 build-stamp: configure-stamp
 	dh_testdir
 
@@ -135,10 +135,14 @@
 clean:	debian/control
 	dh_testdir
 	rm -rf qemu-build user-static-build
-	rm -f configure-stamp build-stamp
+	rm -f configure-stamp build-stamp build-stamp-indep
 	find scripts/ -name '*.pyc' -delete || :
 	dh_clean
 
+build-stamp-indep: build-stamp
+	$(MAKE) -C qemu-build/pc-bios/s390-ccw V=${V} CC=s390x-linux-gnu-gcc STRIP=s390x-linux-gnu-strip
+	touch $@
+
 # define ${ai} variable to be one of -i (indep), -a (arch) or nothing (both)
 ai :=
 binary-indep: ai := -i
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.