[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#805988: aboot : cross-compile aboot-base



Le mercredi 18 janvier à 18h 54mn 10s (+0100), Santiago Vila a écrit :
> On Wed, Jan 18, 2017 at 06:38:44PM +0100, jhcha54008 wrote:
> 
> > I wonder if the following solution would be accepted (see the two patches 
> > attached) : let the source package ship the two binaries (bootlx and 
> > net_aboot.nh). [...]
> 
> Hmm, but this is like removing a hack and creating another one in another place.
> 
> The previous package was a "fake" Arch:all package, so to speak, and now
> we would have a "fake" source package, as it would include binaries.
> 
> We don't want binaries inside source packages (and I think ftpmasters
> would surely agree on this).
> 
> If alpha is not a release architecture, would it really be a problem
> to remove this from testing before the release of stretch while we keep it in
> unstable?
> 
> We could meet the release goal of all packages being buildable
> in our Arch:all autobuilder that way without causing a major headache
> to users of alpha.
> 
> Alternatively, there is also the possibility of asking the Release
> Managers for permission to use stretch-ignore here.
> 
> Thanks.

Hi, 

I was able to build aboot-base on amd64 with the two attached patches.
(dpkg-buildpackage -A -uc -us builds successfully on amd64, i386 and alpha)
I have tested the resulting package to boot a real alpha workstation
(both CDROM- and TFTP-boot).

A build-dependency on gcc-alpha-linux-gnu was added.
Three (possibly different) compilers are needed :
1. a native one to compile helpers which are run during the build
2. one to generate Alpha code to build aboot-base (and possibly aboot)
3. one to generate $DEB_HOST_ARCH code to build aboot-cross
debian/rules sets variables for each.

Cross-building the alpha specific aboot binary package on amd64
requires some manual tweaking :
* libc6.1:alpha is needed when dh_shlibdeps is run, and is currently
(Version: 2.24-5) not co-installable (libc6:amd64 is Version: 2.24-9)
* opensp:alpha is flagged as a missing build-dependency (opensp is 
Arch: any and not Multi-Arch). It is currently uninstallable because
libc6.1:alpha is.
As a workaround, one may enable the alpha architecture
(dpkg --add-architecture alpha), unpack (and not install)
libc6.1:alpha and run dpkg-buildpackage -a alpha -d

I hope it will help to find an acceptable solution !

Regards,
JH Chatenet
Description: Build-depends on opensp instead of sp (deprecated, removed)
 This is the concatenation of two patches from the thread of bug
 #832491 (see the discussion therein). Should close #832491
Forwarded: no
Origin: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=832491#5
Origin: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=832491#23
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=832491
Author: Neil Roeth <neil@debian.org>
Author: jhcha54008 <jhcha5408@free.fr>

diff -Naur aboot-1.0~pre20040408.orig/debian/control aboot-1.0~pre20040408/debian/control
--- aboot-1.0~pre20040408.orig/debian/control
+++ aboot-1.0~pre20040408/debian/control
@@ -1,5 +1,5 @@
 Source: aboot
-Build-Depends: debhelper (>= 9), sp, sgmlspl, docbook-utils
+Build-Depends: debhelper (>= 9), opensp, sgmlspl, docbook-utils
 Build-Depends-Indep: sgmltools-lite
 Section: admin
 Priority: standard
diff -Naur aboot-1.0~pre20040408.orig/doc/man/Makefile aboot-1.0~pre20040408/doc/man/Makefile
--- aboot-1.0~pre20040408.orig/doc/man/Makefile
+++ aboot-1.0~pre20040408/doc/man/Makefile
@@ -32,20 +32,20 @@
 	rm -f aboot.8 aboot.conf.5 abootconf.8 isomarkboot.1 sdisklabel.8 netabootwrap.1 manpage.log manpage.links manpage.refs
 
 aboot.8: aboot.sgml
-	nsgmls aboot.sgml | sgmlspl sgmlspl-specs/docbook2man-spec.pl
+	onsgmls aboot.sgml | sgmlspl sgmlspl-specs/docbook2man-spec.pl
 
 aboot.conf.5: aboot.conf.sgml
-	nsgmls aboot.conf.sgml | sgmlspl sgmlspl-specs/docbook2man-spec.pl
+	onsgmls aboot.conf.sgml | sgmlspl sgmlspl-specs/docbook2man-spec.pl
 
 abootconf.8: abootconf.sgml
-	nsgmls abootconf.sgml | sgmlspl sgmlspl-specs/docbook2man-spec.pl
+	onsgmls abootconf.sgml | sgmlspl sgmlspl-specs/docbook2man-spec.pl
 
 isomarkboot.1: isomarkboot.sgml
-	nsgmls isomarkboot.sgml | sgmlspl sgmlspl-specs/docbook2man-spec.pl
+	onsgmls isomarkboot.sgml | sgmlspl sgmlspl-specs/docbook2man-spec.pl
 
 netabootwrap.1: netabootwrap.sgml
-	nsgmls netabootwrap.sgml | sgmlspl sgmlspl-specs/docbook2man-spec.pl
+	onsgmls netabootwrap.sgml | sgmlspl sgmlspl-specs/docbook2man-spec.pl
 
 sdisklabel.8: sdisklabel.sgml
-	nsgmls sdisklabel.sgml | sgmlspl sgmlspl-specs/docbook2man-spec.pl
+	onsgmls sdisklabel.sgml | sgmlspl sgmlspl-specs/docbook2man-spec.pl
 
diff -Naur aboot-1.0~pre20040408.orig/doc/man/README aboot-1.0~pre20040408/doc/man/README
--- aboot-1.0~pre20040408.orig/doc/man/README	2003-05-30 16:57:34.000000000 +0000
+++ aboot-1.0~pre20040408/doc/man/README
@@ -26,7 +26,7 @@
 please contact me.
 
 Technical note:
-To create the nroff version from the SGML sources, nsgml was used like
-        nsgmls abootconf.sgml | sgmlspl sgmlspl-specs/docbook2man-spec.pl
+To create the nroff version from the SGML sources, onsgmls was used like
+        onsgmls abootconf.sgml | sgmlspl sgmlspl-specs/docbook2man-spec.pl
 
 Hannover, Germany, January 17th 2003
diff -Naur aboot-1.0~pre20040408.orig/doc/man/de/Makefile aboot-1.0~pre20040408/doc/man/de/Makefile
--- aboot-1.0~pre20040408.orig/doc/man/de/Makefile
+++ aboot-1.0~pre20040408/doc/man/de/Makefile
@@ -1,35 +1,35 @@
 all:  srmbootraw.de.8 aboot.de.8 aboot.conf.de.5 abootconf.de.8 isomarkboot.de.1 sdisklabel.de.8 srmbootfat.de.1 e2writeboot.de.8 swriteboot.de.8 netabootwrap.de.1
 
 aboot.de.8: aboot.sgml
-	nsgmls aboot.sgml | sgmlspl docbook2man-de-spec.pl
+	onsgmls aboot.sgml | sgmlspl docbook2man-de-spec.pl
 	mv aboot.8 aboot.de.8
 
 aboot.conf.de.5: aboot.conf.sgml
-	nsgmls aboot.conf.sgml | sgmlspl docbook2man-de-spec.pl
+	onsgmls aboot.conf.sgml | sgmlspl docbook2man-de-spec.pl
 	mv aboot.conf.5 aboot.conf.de.5
 
 abootconf.de.8: abootconf.sgml
-	nsgmls abootconf.sgml | sgmlspl docbook2man-de-spec.pl
+	onsgmls abootconf.sgml | sgmlspl docbook2man-de-spec.pl
 	mv abootconf.8 abootconf.de.8
 
 netabootwrap.de.1: netabootwrap.sgml
-	nsgmls netabootwrap.sgml | sgmlspl docbook2man-de-spec.pl
+	onsgmls netabootwrap.sgml | sgmlspl docbook2man-de-spec.pl
 	mv netabootwrap.1 netabootwrap.de.1
 
 isomarkboot.de.1: isomarkboot.sgml
-	nsgmls isomarkboot.sgml | sgmlspl docbook2man-de-spec.pl
+	onsgmls isomarkboot.sgml | sgmlspl docbook2man-de-spec.pl
 	mv isomarkboot.1 isomarkboot.de.1
 
 sdisklabel.de.8: sdisklabel.sgml
-	nsgmls sdisklabel.sgml | sgmlspl docbook2man-de-spec.pl
+	onsgmls sdisklabel.sgml | sgmlspl docbook2man-de-spec.pl
 	mv sdisklabel.8 sdisklabel.de.8
 
 srmbootfat.de.1: srmbootfat.sgml
-	nsgmls srmbootfat.sgml | sgmlspl docbook2man-de-spec.pl
+	onsgmls srmbootfat.sgml | sgmlspl docbook2man-de-spec.pl
 	mv srmbootfat.1 srmbootfat.de.1
 
 srmbootraw.de.8: srmbootraw.sgml
-	nsgmls srmbootraw.sgml | sgmlspl docbook2man-de-spec.pl
+	onsgmls srmbootraw.sgml | sgmlspl docbook2man-de-spec.pl
 	mv srmbootraw.8 srmbootraw.de.8
 
 e2writeboot.de.8: e2writeboot.8
diff -Naur aboot-1.0~pre20040408.orig/doc/man/de/docbook2man-de-spec.pl aboot-1.0~pre20040408/doc/man/de/docbook2man-de-spec.pl
--- aboot-1.0~pre20040408.orig/doc/man/de/docbook2man-de-spec.pl
+++ aboot-1.0~pre20040408/doc/man/de/docbook2man-de-spec.pl
@@ -7,7 +7,7 @@
 The SGMLSpm package from CPAN.  This contains the sgmlspl script which
 is used to grok this file.  Use it like this:
 
-nsgmls some-docbook-document.sgml | sgmlspl sgmlspl-specs/docbook2man-spec.pl
+onsgmls some-docbook-document.sgml | sgmlspl sgmlspl-specs/docbook2man-spec.pl
 
 =head1 OPTIONS
 
diff -Naur aboot-1.0~pre20040408.orig/srmbootfat/Makefile aboot-1.0~pre20040408/srmbootfat/Makefile
--- aboot-1.0~pre20040408.orig/srmbootfat/Makefile
+++ aboot-1.0~pre20040408/srmbootfat/Makefile
@@ -14,10 +14,10 @@
 	$(CC) $(CFLAGS) $(LDFLAGS) -o srmbootraw srmbootraw.c
 
 srmbootfat.1: srmbootfat.sgml
-	nsgmls srmbootfat.sgml | sgmlspl sgmlspl-specs/docbook2man-spec.pl
+	onsgmls srmbootfat.sgml | sgmlspl sgmlspl-specs/docbook2man-spec.pl
 
 srmbootraw.8: srmbootraw.sgml
-	nsgmls srmbootraw.sgml | sgmlspl sgmlspl-specs/docbook2man-spec.pl
+	onsgmls srmbootraw.sgml | sgmlspl sgmlspl-specs/docbook2man-spec.pl
 
 clean:
 	rm -f srmbootfat srmbootraw srmbootfat.1 srmbootraw.8 manpage.links manpage.log manpage.refs
Description: cross-compilation support with gcc-alpha-linux-gnu
 The source package now depends on gcc-alpha-linux-gnu on arch !alpha
 .
 Three (possibly different) compilers are needed :
 1. a native one to compile helpers which are run during the build
 2. one to generate Alpha code to build aboot-base (and possibly aboot)
 3. one to generate $DEB_HOST_ARCH code to build aboot-cross
 debian/rules sets variables for each.
 .
 One may build aboot-base on amd64 with dpkg-buildpackage -A.
 .
 Cross-compilation support proper (ie. to build the alpha specific aboot 
 binary package on another architecture) is preliminary because of
 some dependencies (opensp, libc6.1). In the mean-time, one may enable 
 the alpha architecture (dpkg --add-architecture alpha), unpack 
 libc6.1:alpha and run dpkg-buildpackage -a alpha -d
 .
 This patch was tested so far on amd64, i386 and alpha and should work
 on little-endian architectures where sizeof(int) == 4.
Forwarded: not-needed
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=805988
Author: jhcha54008 <jhcha5408@free.fr>

diff -Naur aboot-1.0~pre20040408.orig/debian/control aboot-1.0~pre20040408/debian/control
--- aboot-1.0~pre20040408.orig/debian/control
+++ aboot-1.0~pre20040408/debian/control
@@ -1,5 +1,5 @@
 Source: aboot
-Build-Depends: debhelper (>= 9), opensp, sgmlspl, docbook-utils
+Build-Depends: debhelper (>= 9), opensp, sgmlspl, docbook-utils, gcc-alpha-linux-gnu [!alpha], libc6.1-dev-alpha-cross [!alpha]
 Build-Depends-Indep: sgmltools-lite
 Section: admin
 Priority: standard
diff -Naur aboot-1.0~pre20040408.orig/debian/rules aboot-1.0~pre20040408/debian/rules
--- aboot-1.0~pre20040408.orig/debian/rules
+++ aboot-1.0~pre20040408/debian/rules
@@ -3,19 +3,36 @@
 DEB_HOST_GNU_CPU  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_CPU)
 DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
 DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+DEB_BUILD_ARCH  ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)
 
 export DEB_CPPFLAGS_MAINT_APPEND = -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
 export DEB_CFLAGS_MAINT_APPEND = -Wall
 
-CC ?= gcc
-ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
-	CC = $(DEB_HOST_GNU_TYPE)-$(CC)
+# CC to compile aboot-cross
+ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE)) # We are cross-compiling
+	CC ?= $(DEB_HOST_GNU_TYPE)-gcc
+else
+	CC ?= gcc
+endif
+
+# CC_ALPHA to compile aboot-base and aboot
+ifeq (alpha-linux-gnu,$(DEB_BUILD_GNU_TYPE))
+	CC_ALPHA ?= gcc
+	LD_ALPHA ?= ld
+	STRIP_ALPHA ?= strip
+else
+	CC_ALPHA ?= alpha-linux-gnu-gcc
+	LD_ALPHA ?= alpha-linux-gnu-ld
+	STRIP_ALPHA ?= alpha-linux-gnu-strip
 endif
 
+# CC_NATIVE to compile helpers which are run during the build
+CC_NATIVE ?= gcc
+
 ifeq (alpha,$(DEB_HOST_GNU_CPU))
 	export DH_OPTIONS=-Naboot-cross
 else
-	export DH_OPTIONS=-paboot-cross
+#	export DH_OPTIONS=-paboot-cross
 endif
 
 ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
@@ -29,20 +46,34 @@
 
 override_dh_auto_build:
 ifeq (alpha,$(DEB_HOST_GNU_CPU))
-	$(MAKE) $(TESTING) all netabootwrap CC=$(CC) $(shell dpkg-buildflags --export=configure)
+ifneq (alpha-linux-gnu,$(DEB_BUILD_GNU_TYPE)) # We are cross-compiling
+# We need to compile two helpers. They are run on the build host to generate bootlx and netabootwrap
+	$(MAKE) -C tools objstrip_native CC_NATIVE=$(CC_NATIVE) $(shell DEB_HOST_ARCH=$$DEB_BUILD_ARCH dpkg-buildflags --export=configure)
+	$(MAKE) b2c_native CC_NATIVE=$(CC_NATIVE) $(shell DEB_HOST_ARCH=$$DEB_BUILD_ARCH dpkg-buildflags --export=configure)
+endif # End of the hacks to cross-compile
+	$(MAKE) $(TESTING) all netabootwrap CC=$(CC_ALPHA) LD=$(LD_ALPHA) STRIP=$(STRIP_ALPHA) $(shell dpkg-buildflags --export=configure)
 	$(MAKE) -C doc/man all
 	$(MAKE) -C doc/man/de all
-	$(MAKE) -C srmbootfat all CC=$(CC) $(shell dpkg-buildflags --export=configure)
-ifneq (,$(filter aboot-base, $(shell dh_listpackages)))
-	$(MAKE) $(TESTING) bootlx net_aboot.nh net_pad CC=$(CC) $(shell dpkg-buildflags --export=configure)
-	$(MAKE) -C doc/faq
-endif
+	$(MAKE) -C srmbootfat all CC=$(CC_ALPHA) LD=$(LD_ALPHA) STRIP=$(STRIP_ALPHA) $(shell dpkg-buildflags --export=configure)
 else
+ifneq (,$(filter aboot-cross, $(shell dh_listpackages)))
 	$(MAKE) -C tools $(TESTING) isomarkboot CC=$(CC) $(shell dpkg-buildflags --export=configure)
 	$(MAKE) -C srmbootfat srmbootfat srmbootfat.1 CC=$(CC) $(shell dpkg-buildflags --export=configure)
 	$(MAKE) -C doc/man isomarkboot.1
 	$(MAKE) -C doc/man/de isomarkboot.de.1 srmbootfat.de.1
 endif
+endif
+ifneq (,$(filter aboot-base, $(shell dh_listpackages)))
+ifneq (alpha-linux-gnu,$(DEB_BUILD_GNU_TYPE)) # We are cross-compiling
+# We need to compile a helper. It is run on the build host to generate bootlx
+	$(MAKE) -C tools objstrip_native CC_NATIVE=$(CC_NATIVE) $(shell DEB_HOST_ARCH=$$DEB_BUILD_ARCH dpkg-buildflags --export=configure)
+endif
+ifneq (alpha-linux-gnu,$(DEB_HOST_GNU_TYPE)) # Clean leftover native objects
+	$(MAKE) -C lib clean
+endif # End of the hacks to cross-compile
+	$(MAKE) $(TESTING) bootlx net_aboot.nh net_pad CC=$(CC_ALPHA) LD=$(LD_ALPHA) STRIP=$(STRIP_ALPHA) $(shell DEB_HOST_ARCH=alpha dpkg-buildflags --export=configure)
+	$(MAKE) -C doc/faq
+endif
 
 override_dh_auto_clean:
 	$(MAKE) distclean
@@ -65,9 +96,11 @@
 	rm -rf debian/aboot/usr/share/man/man1
 endif
 else
+ifneq (,$(filter aboot-cross, $(shell dh_listpackages)))
 	install -m 755 tools/isomarkboot debian/aboot-cross/usr/bin
 	install -m 755 srmbootfat/srmbootfat debian/aboot-cross/usr/bin
 endif
+endif
 ifneq (,$(filter aboot-base, $(shell dh_listpackages)))
 	install -m 644 bootlx debian/aboot-base/boot/bootlx
 	install -m 644 net_aboot.nh debian/aboot-base/boot/
diff -Naur aboot-1.0~pre20040408.orig/Makefile aboot-1.0~pre20040408/Makefile
--- aboot-1.0~pre20040408.orig/Makefile
+++ aboot-1.0~pre20040408/Makefile
@@ -36,6 +36,9 @@
 ifndef $($(CC))
 CC 		= gcc
 endif
+ifndef $($(STRIP))
+STRIP		= strip
+endif
 
 ifeq ($(TESTING),)
 override CPPFLAGS	+= $(CFGDEFS) -I$(TOP)/include
@@ -123,7 +126,7 @@
 	cat net_aboot.nh $(VMLINUXGZ) net_pad > $@
 
 net_aboot.nh: net_aboot tools/objstrip
-	strip net_aboot
+	$(STRIP) net_aboot
 	tools/objstrip -vb net_aboot $@
 
 net_aboot: $(ABOOT_OBJS) $(ABOOT_OBJS) $(NET_OBJS) $(LIBS)
@@ -155,4 +158,8 @@
 include/ksize.h: vmlinux.nh
 	echo "#define KERNEL_SIZE `ls -l vmlinux.nh | awk '{print $$5}'` > $@
 
+.PHONY : b2c_native
+b2c_native:
+	$(CC_NATIVE) -o b2c b2c.c
+
 dep:
diff -Naur aboot-1.0~pre20040408.orig/tools/Makefile aboot-1.0~pre20040408/tools/Makefile
--- aboot-1.0~pre20040408.orig/tools/Makefile
+++ aboot-1.0~pre20040408/tools/Makefile
@@ -20,3 +20,7 @@
 
 e2writeboot.o:	e2lib.h
 e2lib.o: e2lib.h
+
+.PHONY : objstrip_native
+objstrip_native:
+	$(CC_NATIVE) -o objstrip -DALPHA_AOUT_H $(CFLAGS) objstrip.c
diff -Naur aboot-1.0~pre20040408.orig/tools/objstrip.c aboot-1.0~pre20040408/tools/objstrip.c
--- aboot-1.0~pre20040408.orig/tools/objstrip.c
+++ aboot-1.0~pre20040408/tools/objstrip.c
@@ -21,7 +21,13 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 
+#ifdef ALPHA_AOUT_H
+/* We need the definition of struct exec on alpha *
+ * in order to compile on another architecture    */
+#include "/usr/alpha-linux-gnu/include/a.out.h"
+#else
 #include <a.out.h>
+#endif
 #include <linux/coff.h>
 #include <linux/param.h>
 #include <string.h>

Reply to: