tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: debugging a kernel that doesn't start



>> The simplest way to debug something is using a serial port, do you
>> have access to the one on this machine?
> Yes, there is one.  It seems to sort-of mirror the on-screen messages
> up to the point the NetBSD boot runs. I tried
> 	consdev com0,9600
> from the boot prompt but that hung the machine.

That could be a strong clue or it could be unrelated.  In particular, I
consider it depressingly likely that the serial port is not a real
serial port but actually a USB-to-serial chip hanging off an internal
USB hub, in which case com0 may not find it - "consdev com0,9600" may
well have worked fine, in a sense, but be sending its output somewhere
that doesn't actually go out any hardware connector anywhere.  That
would look like hanging the machine, even if it technically isn't.

But if it's a real serial port, then the machine wedging at that point
is a strong clue, and you have a much simpler environment to chase
things down in when you're working in the bootblocks themselves.

If you have a real serial port - or a real parallel port, or even a
GPIO pin you can connect an LED to - then you can bypass all the
worries of using BIOS routines or whatnot and just poke the hardware
directly.  Even if you have to hardwire a bunch of addresses and
bitmasks, that's fine at this point; for this kind of debugging,
anything that exfiltrates data is useful.  In the early days of my
playing with next68k hardware I did a lot of poking data into hardwired
addresses that accessed the the framebuffer.  (If you have a GPIO pin,
in theory you could even turn it into an output-only data-pin-only
serial port by using fixed delay-loop constants.)

That paradigm fails as soon as you start meddling with the MMU, because
that can cut you off from access to the hardware.  But it can help if
your issues manifest before that, and, even if not, you've narrowed
things down - and with care you may be able to map the hardware again.

/~\ The ASCII				  Mouse
\ / Ribbon Campaign
 X  Against HTML		mouse%rodents-montreal.org@localhost
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B


Home | Main Index | Thread Index | Old Index