Subject: Re: workaround for FreeBSD binary that hardcodes a device major (was: Re: CVS commit: src/sys/conf)
To: Emmanuel Dreyfus <manu@netbsd.org>
From: Simon Burge <simonb@NetBSD.org>
List: source-changes
Date: 09/24/2006 14:44:02
Emmanuel Dreyfus wrote:

> Simon Burge <simonb@NetBSD.org> wrote:
> 
> [About http://mail-index.NetBSD.org/source-changes/2006/09/23/0110.html]
> > This would seem to break all kernel configs that don't have a twa
> > device.  At least for evbppc/WALNUT I get:
> > 
> >       #      link  WALNUT/netbsd
> >        [ ... ]
> >       devsw.o:(.data+0x590): undefined reference to `twa_cdevsw'
> 
> I backed the change out to restore the build, but I wonder how this
> should be fixed.
> 
> 3ware's tw_cli is only available as a FreeBSD or Linux binary. The
> FreeBSD version hardcodes the twa major at 187. There is the same
> problem for twe at major 146. I see 3 options
> 
> 1) Tag the major 187 as reserved in the MI range and only define it on
> i386
> 2) Use a MD major for twa, and patch freebsd_sys_mknod() so that 187
> gets translated into the right major
> 3) Use a MD major for twa, and patch the tw_cli binary so that the right
> major gets used. 
> 
> What's the best way?

I'm not sure at all, because the way config currently works I think you
need the twa device to be present if you define the major number in any
majors file.

The current problem wasn't that the "twa" major is in the MI majors
file, but that it was referenced for a kernel config that didn't have
a twa device.  So even if you put it in the i386 majors file and have
a kernel that doesn't have twa (like say GENERIC_LAPTOP) you'll still
lose.

Simon.