CompactFlash / new GEOM / boot fails on certain brand / Soekris
Luigi Rizzo
rizzo at icir.org
Sat May 3 07:59:38 PDT 2003
On Sat, May 03, 2003 at 12:42:17PM +0200, Dirk-Willem van Gulik wrote:
>
> Not sure if I am chasing a FreeBSD problem or a deficiency in certain ATA
> flash cards which lack, say sector 0, or something.
>
> On 5.0 release - on a soekris.com 4521.
i had similar problems in the past with 4.7-based sources on a
soekris 4501, and i tracked the problem to the bios returning an
error when reading multiple sectors at once from the flash card.
The same card works fine in a Lex System box and in a CF-ATA
adapter on my desktop machine, so i don't know if the bios
on the latter retries with single block reads or what.
This is what i posted. The patch goes to /sys/boot/i386/boot2/boot1.s
(it is inefficient because it always reads one sector at a time;
at the time i believe i found a way to read the full track on
the first attempt abd one sector on subsequent ones, but did not
save the actual patch).
hope this helps
cheers
luigi
> From: Luigi Rizzo <rizzo at xorpc.icir.org>
> To: soekris-tech at lists.soekris.com
> Cc: small at freebsd.org
> Bcc: Luigi Rizzo <rizzo at xorpc.icir.org>
> Subject: summary and patch for CF problems in booting the 4501
> Message-ID: <20030218164802.A484 at xorpc.icir.org>
>
>
> A quick and dirty patch to fix the problem in the FreeBSD loader
> (boot1) and the Etherboot loader (boot1a.bin) consists in forcing
> the loader to load one sector at a time. Fortunately the code is
> already structured to support something similar on crossing track
> boundaries, so it suffices to replace the sequence:
>
> jb read.2 # this
> movb %ah,%al # track
> with the sequence
> movb $1, %al
> nop
> nop
>
> right before the 'read.2' label.
> The string to be replaced is \0162\02\0210\0340
> and the replacement is \0260\01\0220\0220
>
> A binary patch is the following (the location of the code changes
> in /boot/boot1 and /boot/boot1a.bin):
>
> ofs=328 # for boot1
> ofs=335 # for boot1a.bin
> file="/boot/boot1a.bin"
>
> sh -c "echo -e '\0260\01\0220\0220'" | \
> dd of=${file} bs=1 count=4 oseek=${ofs} conv=notrunc
>
> I am not sure if this is a complete fix, i.e. there might be
> other parts of the kernel which use the BIOS to access the
> CF loading multiple sectors at once.
>
> cheers
> luigi
More information about the freebsd-hackers
mailing list