Subject: Newbie Kernel Compilation.
To: None <port-arm32@NetBSD.ORG>
From: Daniel Brown <crp02@holyrood.ed.ac.uk>
List: port-arm32
Date: 11/26/1996 21:28:23
Dear folks,

Been busy the last little while having a bash at compiling my very own
SA-aware kernel. The experience turned up a few things that I'm not
certain about, so wanted to air publically, just in case I've done
horrible things to the innards of the computer that'll come back to haunt
me later.

Last night, I busily ftp'd the src-1.2A-111096.tar.gz from kcl, unpacked
the lot, and followed the compile instructions to the letter. At which
point everything started to chuckle away, 99% of the source compiling,
until fpe.c's turn came up.

Thence, screen fulls of errors, concerning it's attempts to dereference an
incomplete type, followed by the whole thing throwing it's hands up in the
air in horror, and exiting.

Aha! (I thought) - let's sup the rest over from NetBSD.org, to see if the
problem's been fixed. So I pulled over the sup set from kcl, unpacked
everything, and... ran around for a while looking for the appropriate
supfile, gave up, and eventually found a working one at NetBSD.org, then
supped to my heart's content.

Re-config'd, made clean, depended, then re-made the kernel. This time the
make fell over at ioconf.c - one of the machine generated config files,
strangely enough. The cfdata[] structure seemed to have excess entries in
it, which cc couldn't handle (but gcc had no problems with).

After trying a few things, I eventually hit on the idea of removing the
last (void, and NULL) entry in the table, and everything chuckled on once
more.

Until fpe.c, which still fell over with the same problems.

Much rummaging around narrowed the problem to the fp_state structs, which
no-longer seem to exist in the world, but can be reasonably replaced by
fpe_sp_state ones instead (which appear to have all the required elements
present and correct).

Compile once more, and meet the second problem in fpe.c - in
initialise_fpe, the install_coproc_handler calls need coproc1_handler,
and coproc2_handler casting into undef_handler_t before it'll pass muster.

Compile once more, and everything zooms through to the linking stage.
Then death once more - autonicetime, and autoniceval referenced but
without storage. 

These crop up in sys/conf/param.c, a file reputedly copied over to
compile/KERNELNAMEHERE. It seems the compile version was missing the last
few lines, in which the autonice* numbers were declared, and defined.

Add these, recompile, and hey-presto. My first netbsd kernel :-)

I'm currently writing this e-mail via telnet, in an xterm, using the
resulting kernel, so it must have a little inside it that still works
after my hackings. Hopefully the above may raise/solve a few hitherto
unraised problems in the arm32 kernel tree.

The reason behind my need for a new kernel - in the source for the driver
for the Ether3 network card, a few lines of code in the eagetpackets
subroutine, the source of the 'rx packet error (xx)' problem that's been
bugging me so far, seem to have been commented out for one reason, or
another.

They appear to automatically reset the card should an rx error occur,
something that emphatically hasn't been happening on my machine, resulting
in a lot of network downtime.

It'd be great to know why these were commented out - on the surface they
appear fine, but the subtleties underneath them certainly aren't apparent,
and may provide a good reason for not doing the reset this way.

(And if they're gonna get me in deep with the local network guys for
whatever reason, that'd be nice to know too ;-)

All the best,

Dan.