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

Bug#602770: marked as done (build kFreeBSD on GNU/Linux)



Your message dated Sun, 29 May 2011 22:04:37 +0200
with message-id <20110529200437.GA9875@gaara.hadrons.org>
and subject line Re: Bug#602770: new patch
has caused the Debian Bug report #602770,
regarding build kFreeBSD on GNU/Linux
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
602770: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=602770
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: kfreebsd-8
Severity: wishlist
Tags: patch

This patch makes it possible to build kFreeBSD on GNU/Linux.  A fix in
freebsd-buildutils, and a port of libsbuf-dev is also required.

I've tested the resulting binary and it works perfectly.

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-amd64 (SMP w/2 CPU cores)
Locale: LANG=ca_AD.UTF-8, LC_CTYPE=ca_AD.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
diff -x '*~' -x patches -x control -Nur kfreebsd-8-8.1/debian/control.flavor.in kfreebsd-8-8.1.new/debian/control.flavor.in
--- kfreebsd-8-8.1/debian/control.flavor.in	2010-11-07 21:56:17.000000000 +0100
+++ kfreebsd-8-8.1.new/debian/control.flavor.in	2010-11-07 15:29:24.000000000 +0100
@@ -1,5 +1,5 @@
 Package: kfreebsd-image-@version@-@abiname@-@flavor@
-Architecture: kfreebsd-@arch@
+Architecture: any-@arch@
 Depends: freebsd-utils (>= 5), kldutils (>= 7.1), ${misc:Depends}
 Conflicts: kfreebsd-loader (<< 5.4-1.3)
 Provides: kfreebsd-image-@major@, kfreebsd-image
@@ -11,14 +11,14 @@
  This package is compiled for a @flavor@-class machine.
 
 Package: kfreebsd-image-@major@-@flavor@
-Architecture: kfreebsd-@arch@
+Architecture: any-@arch@
 Depends: kfreebsd-image-@version@-@abiname@-@flavor@, ${misc:Depends}
 Description: kernel of FreeBSD @major@ image
  This package depends on the latest binary image for kernel of FreeBSD @major@ on
  @flavor@-class machines.
 
 Package: kfreebsd-headers-@version@-@abiname@-@flavor@
-Architecture: kfreebsd-@arch@
+Architecture: any-@arch@
 Provides: kfreebsd-headers-@major@
 Depends: kfreebsd-headers-@version@-@abiname@ (= ${binary:Version}), ${misc:Depends}
 Description: header files for kernel of FreeBSD @version@
@@ -29,7 +29,7 @@
  kfreebsd-image-@version@-@abiname@-@flavor@ package.
 
 Package: kfreebsd-headers-@major@-@flavor@
-Architecture: kfreebsd-@arch@
+Architecture: any-@arch@
 Depends: kfreebsd-headers-@version@-@abiname@-@flavor@, ${misc:Depends}
 Description: header files for kernel of FreeBSD @major@
  This package depends on the latest header files for kernel of FreeBSD @major@ on
diff -x '*~' -x patches -x control -Nur kfreebsd-8-8.1/debian/control.in kfreebsd-8-8.1.new/debian/control.in
--- kfreebsd-8-8.1/debian/control.in	2010-11-07 21:56:17.000000000 +0100
+++ kfreebsd-8-8.1.new/debian/control.in	2010-11-07 18:52:52.000000000 +0100
@@ -6,8 +6,8 @@
 Vcs-Browser: http://svn.debian.org/wsvn/glibc-bsd/trunk/kfreebsd-@major@/
 Vcs-Svn: svn://svn.debian.org/glibc-bsd/trunk/kfreebsd-@major@/
 Build-Depends: debhelper (>= 5.0.0), bzip2, quilt, sharutils, flex-old | flex,
- freebsd-buildutils (>= 7) [kfreebsd-any], gcc-4.3 [kfreebsd-any], libdb-dev,
- libbsd-dev [kfreebsd-any], libsbuf-dev [kfreebsd-any]
+ freebsd-buildutils (>= 7), gcc-4.3, libdb-dev,
+ libbsd-dev, libsbuf-dev
 Standards-Version: 3.9.1
 
 Package: kfreebsd-source-@version@
@@ -20,7 +20,7 @@
  a GNU/kFreeBSD system.
 
 Package: kfreebsd-headers-@version@-@abiname@
-Architecture: kfreebsd-any
+Architecture: any
 Depends: ${misc:Depends}
 Description: Common architecture-specific header files for kernel of FreeBSD @version@
  This package provides the architecture-specific common kernel header files for 
diff -x '*~' -x patches -x control -Nur kfreebsd-8-8.1/debian/rules kfreebsd-8-8.1.new/debian/rules
--- kfreebsd-8-8.1/debian/rules	2010-11-07 21:56:17.000000000 +0100
+++ kfreebsd-8-8.1.new/debian/rules	2010-11-07 21:59:30.000000000 +0100
@@ -12,12 +12,12 @@
 version		:= $(shell echo $(full_version) | sed -e 's/[~+-].*//g')
 major           := $(shell echo $(version) | sed -e 's/\..*//g')
 revision	:= $(shell echo $(full_version) | sed -e 's/^[^+-]*//g')
-os		:= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
 cpu		:= $(shell dpkg-architecture -qDEB_HOST_ARCH_CPU)
 config_files	:= $(wildcard debian/arch/$(cpu)/*.config)
 flavours	:= $(config_files:debian/arch/$(cpu)/%.config=%)
 configfile	:= DEBCUSTOM
 abiname		:= 1
+ld_target	:= $(shell ld --help | sed -ne "s/^ld: supported targets: \([^ ]*\) .*/\1/p")
 
 SVN		:= http://svn.freebsd.org/base/release/$(version).0
 #SVN		:= http://svn.freebsd.org/base/stable/8
@@ -74,11 +75,14 @@
 	mkdir $(CURDIR)/src
 	cp -af $(CURDIR)/sys $(CURDIR)/usr.sbin $(CURDIR)/src
 
-	set -e ; find src -type f | (while read i ; do \
+	set -e ; find src/sys -type f | (while read i ; do \
 		sed -i $$i \
-		-e 's/defined\( \|\t\)*(\( \|\t\)*__FreeBSD__\( \|\t\)*)/defined(__FreeBSD_kernel__)/g' \
-		-e 's/#\( \|\t\)*ifdef\( \|\t\)*__FreeBSD__/#ifdef __FreeBSD_kernel__/g' \
-		-e 's/#\( \|\t\)*ifndef\( \|\t\)*__FreeBSD__/#ifndef __FreeBSD_kernel__/g' \
+		-e 's/defined\( \|\t\)*(\( \|\t\)*__FreeBSD__\( \|\t\)*)/1/g' \
+		-e 's/#\( \|\t\)*ifdef\( \|\t\)*__FreeBSD__/#if 1/g' \
+		-e 's/#\( \|\t\)*ifndef\( \|\t\)*__FreeBSD__/#if 0/g' \
+		-e 's/defined\( \|\t\)*(\( \|\t\)*\(__linux__\|linux\)\( \|\t\)*)/0/g' \
+		-e 's/#\( \|\t\)*ifdef\( \|\t\)*\(__linux__\|linux\)/#if 0/g' \
+		-e 's/#\( \|\t\)*ifndef\( \|\t\)*\(__linux__\|linux\)/#if 1/g' \
 		-e 's/__FreeBSD__/$(major)/g' \
 		-e 's,#\( \|\t\)*include\( \|\t\)*<sys/device.h>,,g' \
 		-e 's,#\( \|\t\)*include\( \|\t\)*<dev/rndvar.h>,,g' \
@@ -100,11 +104,7 @@
 
 	touch build-indep-stamp
 
-ifeq ($(os), kfreebsd)
 build: build-arch build-indep
-else
-build: build-indep
-endif
 
 install-indep: install-indep-stamp
 install-indep-stamp: build-indep
@@ -119,14 +119,17 @@
 
 	touch install-indep-stamp
 
-config: src
+config: config-stamp
+config-stamp: src
 	cp -af src/usr.sbin/config config
-	$(MAKE) -C config
+	CFLAGS="-D__va_list=__builtin_va_list" $(MAKE) -C config
+	touch $@
 
 build-arch: $(foreach flavor,$(flavours),build-flavor-$(flavor)-stamp)
-build-flavor-%-stamp: src config
+src-flavor-%-stamp: src config
 	cp -af src $(FLAVOR_DIR)-$*
-
+	touch $@
+build-flavor-%-stamp: src-flavor-%-stamp
 	# Add the abiname and the flavor to the kernel version
 	sed -i -e 's/^RELEASE=".*"/RELEASE="$(version)-$(abiname)-$*"/g' $(FLAVOR_DIR)-$*/sys/conf/newvers.sh
 
@@ -137,6 +140,14 @@
 	sed -i -e 's,^KODIR?=.*,KODIR="/lib/modules/$(version)-$(abiname)-$*",g' $(FLAVOR_DIR)-$*/sys/conf/kern.pre.mk
 	sed -i -e '/^static char linker_path/s,".*","/lib/modules/$(version)-$(abiname)-$*",g' $(FLAVOR_DIR)-$*/sys/kern/kern_linker.c 
 
+	# Always set explicit link target to match with ld's implicit target (needed
+	# to build on non-kFreeBSD)
+ifeq ($(cpu), amd64)
+	sed -i -e 's/elf64-x86-64-freebsd/$(ld_target)/g' $(FLAVOR_DIR)-$*/sys/conf/ldscript.amd64
+else ifeq ($(cpu), i386)
+	sed -i -e 's/elf32-i386-freebsd/$(ld_target)/g' $(FLAVOR_DIR)-$*/sys/conf/ldscript.i386
+endif
+
 	# Configure the kernel
 	cp debian/arch/$(cpu)/$*.config $(FLAVOR_DIR)-$*/sys/$(cpu)/conf/
 	cat $(FLAVOR_DIR)-$*/sys/$(cpu)/conf/GENERIC >> $(FLAVOR_DIR)-$*/sys/$(cpu)/conf/$*.config
@@ -253,7 +264,6 @@
 	dh_builddeb -i
 
 # Build architecture-dependent files here.
-ifeq ($(os), kfreebsd)
 binary-arch: build-arch install-arch
 	dh_testdir
 	dh_testroot
@@ -269,10 +279,6 @@
 	dh_gencontrol -s
 	dh_md5sums -s
 	dh_builddeb -s
-else
-binary-arch:
-	# We have nothing to do
-endif
 
 binary: binary-indep binary-arch
 

--- End Message ---
--- Begin Message ---
Version: 8.2-1

Hi!

Marking the bug as done (otherwise the BTS will not be able to archive
it).

thanks,
guillem


--- End Message ---

Reply to: