Here's a new patch, my previous one had some bits missing.
-- Robert Millan
diff -Nur kfreebsd-8-8.1/debian.old/control.flavor.in kfreebsd-8-8.1/debian/control.flavor.in --- kfreebsd-8-8.1/debian.old/control.flavor.in 2010-11-08 15:56:45.000000000 +0100 +++ kfreebsd-8-8.1/debian/control.flavor.in 2010-11-08 16:00:02.000000000 +0100 @@ -1,5 +1,5 @@ Package: kfreebsd-ima...@version@-...@abiname@-...@flavor@ -Architecture: kfreeb...@arch@ +Architecture: a...@arch@ Depends: freebsd-utils (>= 5), kldutils (>= 7.1), ${misc:Depends} Conflicts: kfreebsd-loader (<< 5.4-1.3) Provides: kfreebsd-ima...@major@, kfreebsd-image @@ -11,14 +11,14 @@ This package is compiled for a @fla...@-class machine. Package: kfreebsd-ima...@major@-...@flavor@ -Architecture: kfreeb...@arch@ +Architecture: a...@arch@ Depends: kfreebsd-ima...@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 @fla...@-class machines. Package: kfreebsd-heade...@version@-...@abiname@-...@flavor@ -Architecture: kfreeb...@arch@ +Architecture: a...@arch@ Provides: kfreebsd-heade...@major@ Depends: kfreebsd-heade...@version@-...@abiname@ (= ${binary:Version}), ${misc:Depends} Description: header files for kernel of FreeBSD @version@ @@ -29,7 +29,7 @@ kfreebsd-ima...@version@-...@abiname@-...@flavor@ package. Package: kfreebsd-heade...@major@-...@flavor@ -Architecture: kfreeb...@arch@ +Architecture: a...@arch@ Depends: kfreebsd-heade...@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 -Nur kfreebsd-8-8.1/debian.old/control.in kfreebsd-8-8.1/debian/control.in --- kfreebsd-8-8.1/debian.old/control.in 2010-11-08 15:56:45.000000000 +0100 +++ kfreebsd-8-8.1/debian/control.in 2010-11-08 16:00:02.000000000 +0100 @@ -6,8 +6,8 @@ Vcs-Browser: http://svn.debian.org/wsvn/glibc-bsd/trunk/kfreeb...@major@/ Vcs-Svn: svn://svn.debian.org/glibc-bsd/trunk/kfreeb...@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-sour...@version@ @@ -20,7 +20,7 @@ a GNU/kFreeBSD system. Package: kfreebsd-heade...@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 -Nur kfreebsd-8-8.1/debian.old/patches/008_config.diff kfreebsd-8-8.1/debian/patches/008_config.diff --- kfreebsd-8-8.1/debian.old/patches/008_config.diff 2010-11-08 15:56:45.000000000 +0100 +++ kfreebsd-8-8.1/debian/patches/008_config.diff 2010-11-08 16:06:09.000000000 +0100 @@ -3,22 +3,16 @@ Status: gotta uncomment WARNS (see #351366), and find a portable way to add "-lbsd". after this it can be sent upstream. ---- a/usr.sbin/config/Makefile -+++ b/usr.sbin/config/Makefile -@@ -9,11 +9,11 @@ - kernconf.c: kernconf.tmpl - file2c 'char kernconfstr[] = {' ',0};' < ${.CURDIR}/kernconf.tmpl > kernconf.c - --WARNS?= 6 --CFLAGS+= -I. -I${.CURDIR} -+#WARNS?= 6 -+CFLAGS+= -I. -I${.CURDIR} -D_GNU_SOURCE - - DPADD= ${LIBL} ${LIBSBUF} --LDADD= -ll -lsbuf -+LDADD= -ll -lsbuf -lbsd - - CLEANFILES+= kernconf.c +--- a/usr.sbin/config/config.h ++++ b/usr.sbin/config/config.h +@@ -34,7 +34,7 @@ + * Config. + */ + #include <sys/types.h> +-#include <sys/queue.h> ++#include <bsd/sys/queue.h> + #include <stdlib.h> + #include <string.h> --- a/usr.sbin/config/main.c +++ b/usr.sbin/config/main.c @@ -29,7 +23,8 @@ +#include <stdarg.h> #include <sys/types.h> #include <sys/stat.h> - #include <sys/sbuf.h> +-#include <sys/sbuf.h> ++#include <sbuf.h> #include <sys/file.h> #include <sys/mman.h> -#include <sys/param.h> @@ -41,7 +36,7 @@ #include <assert.h> #include <ctype.h> -@@ -605,7 +610,11 @@ +@@ -607,7 +612,11 @@ if ((dirp = opendir(p)) == NULL) err(EX_OSERR, "opendir %s", p); while ((dp = readdir(dirp)) != NULL) { @@ -53,3 +48,20 @@ /* Skip non-headers */ if (dp->d_name[i] != '.' || dp->d_name[i + 1] != 'h') continue; +--- a/usr.sbin/config/Makefile ++++ b/usr.sbin/config/Makefile +@@ -9,11 +9,11 @@ + kernconf.c: kernconf.tmpl + file2c 'char kernconfstr[] = {' ',0};' < ${.CURDIR}/kernconf.tmpl > kernconf.c + +-WARNS?= 6 +-CFLAGS+= -I. -I${.CURDIR} ++#WARNS?= 6 ++CFLAGS+= -I. -I${.CURDIR} -D_GNU_SOURCE + + DPADD= ${LIBL} ${LIBSBUF} +-LDADD= -ll -lsbuf ++LDADD= -ll -lsbuf -lbsd + + CLEANFILES+= kernconf.c + diff -Nur kfreebsd-8-8.1/debian.old/rules kfreebsd-8-8.1/debian/rules --- kfreebsd-8-8.1/debian.old/rules 2010-11-08 15:56:45.000000000 +0100 +++ kfreebsd-8-8.1/debian/rules 2010-11-08 16:00:27.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 +74,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 +103,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 +118,18 @@ touch install-indep-stamp -config: src +config: config-stamp +config-stamp: src + rm -rf config 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