Bug 32671

Summary: Patch to generate usbdevs.h automatically in kernel build
Product: Base System Reporter: ebakke <ebakke>
Component: kernAssignee: Warner Losh <imp>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 5.0-CURRENT   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description ebakke 2001-12-10 13:30:01 UTC
	This patch will make sure usbdevs.h and usbdevs_data.h are
	regenerated automatically when a kernel is built.  It is
	done from the depend target, so the files will be present and
	updated as early as possible in the build process.
	This eliminates the need for separately checked in and maintained
	versions of these files.
Comment 1 Bruce Evans 2001-12-11 01:06:26 UTC
On Mon, 10 Dec 2001, Erik H. Bakke wrote:

> >Description:
> 	This patch will make sure usbdevs.h and usbdevs_data.h are
> 	regenerated automatically when a kernel is built.  It is
> 	done from the depend target, so the files will be present and
> 	updated as early as possible in the build process.
> 	This eliminates the need for separately checked in and maintained
> 	versions of these files.
>
> >How-To-Repeat:
>
> >Fix:
>
> --- kern.post.mk.bak	Sun Nov 11 07:16:53 2001
> +++ kern.post.mk	Mon Dec 10 14:10:39 2001
> @@ -76,7 +76,12 @@
>
>  ${SYSTEM_OBJS} genassym.o vers.o: opt_global.h
>
> -kernel-depend:
> +# This rule makes sure usbdevs.h and usbdevs_data.h are updated from
> +# usbdevs
> +usbdevs:
> +	cd ../../../dev/usb && ${MAKE} -f Makefile.usbdevs
> +
> +kernel-depend: usbdevs
>  .if defined(EXTRA_KERNELDEP)
>  	${EXTRA_KERNELDEP}
>  .endif

Er, this clobbers the src tree at kernel build time and has other
problems (it doesn't work unless "make depend" is run first...).
Generated files need to be handled something like the *if.h files, but
without the dependency bugs in that handling.  Dependencies for the
latter were broken by excessively zealous cleanups in sys/conf/files*,
so there are only enough dependencies for things to work right if
either "make depend" is run first or .depend doesn't exist (when .depend
doesn't exist, the fudged dependency of all objects on all headers
gives enough dependencies).  In general, generated headers must be in
BEFORE_DEPENDS and in all relevant places in .depend for things to
work right.

Bruce
Comment 2 Warner Losh freebsd_committer freebsd_triage 2001-12-11 09:30:31 UTC
Responsible Changed
From-To: freebsd-bugs->imp

I'll look into this.  However, I share Bruce's concerns, as well as the 
ability to build usb modules outside the tree.  One really needs to make 
all instances of dev/usb/usbdevs*.h into "usbdevs*.h" and generate it 
at kernel build time in the kernel build directory (since the kernel tree may 
be read only).  One further needs to ensure that drivers build outside the 
tree will work as well.  This is an ugly problem. 

Warner
Comment 3 Sheldon Hearn 2001-12-11 09:43:51 UTC
Interesting feedback from Warner Losh...

----- Original Message -----

Date:  Tue, 11 Dec 2001 02:36:40 -0700
From:  Warner Losh <imp@harmony.village.org>
cc:  "Erik H. Bakke" <ebakke@trolltech.com>,
       "Sheldon Hearn" <sheldonh@starjuice.net>, cvs-committers@FreeBSD.org,
       cvs-all@FreeBSD.org
Subject:  Re: cvs commit: src/sys/dev/usb usbdevs.h usbdevs_data.h 


> In message <200112110923.fBB9NYM25866@harmony.village.org> Warner Losh writes:
> : In message <010b01c18181$0ac4f9d0$5b3bcbd5@breiflabb> "Erik H. Bakke" writes:
> : : I just submitted pr kern/32671 which works fine on my system.
> : 
> : Including modules?  And in read only kernel sources?
> 
> I just took ownership of this problem, since I have the same problem
> with pccarddevs.  It is ugly.  Your patches I don't think will work
> for building modules w/o first building the kernel, for modules
> outside the kernel source tree, a read only kernel source tree, plus
> suffers from the dependency issues that I alluded to in my last email
> and that Bruce explicitly referred to in his followup to the bug.
> 
> Warner
Comment 4 sanpei 2004-05-28 23:20:17 UTC
Hi
Warner-san

  May I close this PR?

  I think you commit some code about usbdevs.

---
MIHIRA, Sanpei Yoshiro
Tokyo, Japan.
Comment 5 M. Warner Losh 2004-05-29 02:38:50 UTC
In message: <20040529.072017.119935332.sanpei@sanpei.org>
            MIHIRA Sanpei Yoshiro <sanpei@sanpei.org> writes:
: Hi
: Warner-san
: 
:   May I close this PR?
: 
:   I think you commit some code about usbdevs.

Not just yet.  I did 1/2 of the commit, but bde and I have been
working to make it better.  I have something similar to this PR in my
tree, but since it isn't yet in current it is best to keep it open.

Warner
Comment 6 Warner Losh freebsd_committer freebsd_triage 2004-06-29 16:06:25 UTC
State Changed
From-To: open->closed

I've managed to get this done