From nobody@FreeBSD.org  Sat Oct 20 03:02:12 2012
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id B8B917C7
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 20 Oct 2012 03:02:12 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id A1A128FC14
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 20 Oct 2012 03:02:12 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.5/8.14.5) with ESMTP id q9K32CaR084122
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 20 Oct 2012 03:02:12 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.5/8.14.5/Submit) id q9K32Clh084121;
	Sat, 20 Oct 2012 03:02:12 GMT
	(envelope-from nobody)
Message-Id: <201210200302.q9K32Clh084121@red.freebsd.org>
Date: Sat, 20 Oct 2012 03:02:12 GMT
From: Richard Yao <ryao@gentoo.org>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Out-of-tree kernel module compilation with GNU xargs in $PATH
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         172894
>Category:       kern
>Synopsis:       Out-of-tree kernel module compilation with GNU xargs in $PATH
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bapt
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Oct 20 03:10:01 UTC 2012
>Closed-Date:    
>Last-Modified:  Thu Nov 15 23:26:24 UTC 2012
>Originator:     Richard Yao
>Release:        FreeBSD 9.1-BETA1
>Organization:
Gentoo BSD Team
>Environment:
FreeBSD freebsd 9.1-BETA1 FreeBSD 9.1-BETA1 #0: Fri Jul 20 21:39:23 EDT 2012     root@freebsd:/usr/obj/usr/src/sys/GENERIC  amd64
>Description:
I was working on a port of a Linux kernel module to FreeBSD. I decided to
rebase on FreeBSD 9.1-BETA1. I installed Gentoo Prefix so that I would
be able to work on this port in a more familiar development environment.

Unfortunately, there was an issue where /usr/src/sys/conf/kmod.mk invokes
xargs with -J, which Gentoo Prefix's GNU xargs does not support. I have
written a patch for kmod.mk that will attempt shell substitution in
place of xargs when the current command that relies on xargs fails.

This report was originally submitted to hackers@FreeBSD.org three months ago. Eitan Adler requested that I file a problem report.
>How-To-Repeat:
1. Install Gentoo Prefix
2. Start Prefix Shell  (to put GNU xargs in $PATH)
3. Try building an out-of-tree kernel module.
>Fix:
--- /usr/src/sys/conf/kmod.mk.orig	2012-08-02 23:49:09.749192513 -0400
+++ /usr/src/sys/conf/kmod.mk	2012-08-04 08:57:25.719110508 -0400
@@ -217,7 +217,8 @@ ${FULLPROG}: ${OBJS}
 	grep -v '^#' < ${EXPORT_SYMS} > export_syms
 .endif
 	awk -f ${SYSDIR}/conf/kmod_syms.awk ${.TARGET} \
-	    export_syms | xargs -J% ${OBJCOPY} % ${.TARGET}
+	    export_syms | xargs -J% ${OBJCOPY} % ${.TARGET} || \
+	    ${OBJCOPY} $(awk -f ${SYSDIR}/conf/kmod_syms.awk ${.TARGET} export_syms) ${.TARGET}
 .endif
 .endif
 .if !defined(DEBUG_FLAGS) && ${__KLD_SHARED} == no

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->bapt 
Responsible-Changed-By: bapt 
Responsible-Changed-When: Thu Nov 15 23:26:23 UTC 2012 
Responsible-Changed-Why:  
I'll take it. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=172894 
>Unformatted:
