Subject: Re: cannot configure wd0i as dump device
To: Christian Groessler <cpg@aladdin.de>
From: Quentin Garnier <cube@cubidou.net>
List: port-i386
Date: 10/10/2006 22:57:23
--ZJcv+A0YCCLh2VIg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Tue, Oct 10, 2006 at 09:15:41PM +0200, Christian Groessler wrote:
[...]
> I have this line in my config:
>=20
> ---------
> config          netbsd  root on ? type ffs dumps on wd0i
> ---------
>=20
> I get an error when I try to configure the kernel:
>=20
> ---------
> $ /usr/local/tools/bin/nbconfig POLLY
> POLLY:229: netbsd: invalid dumps device name `wd0i'
> POLLY has no configurations!
> *** Stop.
> $=20
> ---------
>=20
> If I remove the "dumps on wd0i" in the configuration file it works.
[...]
> Seems to be a bug in the config program?

Actually, no.  It's a very embarrassing bug, though.

Here is the story:  config(1) is expected to resolve the name you give
in the config line.  That means finding the major and minor numbers of
the device.

The minor number is assigned the following way:

  minor =3D device_unit * maxpartitions + partition_number

So config(1) uses the maxpartitions parameters (found in files.${ARCH})
to calculate the minor number.

There's one dreadful arch for which it doesn't work.  In old days,
i386 had maxpartitions set to 8, like I guess all archs.  At some point
it wasn't enough anymore and one poor decision was made:  not to annoy
i386 users at the time.  While understandable, it does cause trouble.

On i386, to allow 16 partitions, minor numbers are calculated in a more
complicated way so that people with very old /dev don't have to rebuild
it.

The problem is, config(1) doesn't know about that, and cannot really
know either.  So maxpartitions in files.i386 is still 8 so that minor
numbers are calculated correctly--as long as you don't specify a
partition beyond xdNh...

The workaround is to specify the major and minor numbers instead of the
name of the device, i.e.:

config netbsd root on ? type ffs dumps on major 0 minor 524288

I don't really favour adding code to config(1) to make it know about
that issue...  I'd rather see a way to resolve the device at run time,
which should probably be doable.

I really hate that awful hack.  It will probably prevent booting an
amd64 kernel on an i386 userland for as long as we lack devfs...

--=20
Quentin Garnier - cube@cubidou.net - cube@NetBSD.org
"You could have made it, spitting out benchmarks
Owe it to yourself not to fail"
Amplifico, Spitting Out Benchmarks, Hometakes Vol. 2, 2005.

--ZJcv+A0YCCLh2VIg
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (NetBSD)

iQEVAwUBRSwJM9goQloHrPnoAQIxeggAv5P5Fvtw57q3Wiyid1cxcg52H67L9RAt
lR1ikT8ED3xam3qktE0s2oRpBe7Mf4FepQEWEfzzX13Mj0rgIK6yYPiedm4xNr4Z
v9jO2tfq8dGBahzt3OJVPlbvq42uEFiZskY8yiCskloqtmn/uLltt3rGEHHXZ9gX
YdvsRI1pn0xbHsAHoNV8kfBxDcDr3fyx3AB1Frpb6CD4KBhyMvBHFbEaRUPvyoxN
JsTO4EN7T58Jjjn9s4tNPE+emYRgYQB/hJ9r0irt/LpDGpzytfyOsSO3gHfbPHQV
Jv2p3rwz/phK6OH1zTJKAqvSZZtilVAB5HPsZWLHYrJu45wSWy25yg==
=vpW/
-----END PGP SIGNATURE-----

--ZJcv+A0YCCLh2VIg--