From owner-freebsd-hackers@FreeBSD.ORG Sat May 3 07:59:38 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5D39937B401 for ; Sat, 3 May 2003 07:59:38 -0700 (PDT) Received: from xorpc.icir.org (xorpc.icir.org [192.150.187.68]) by mx1.FreeBSD.org (Postfix) with ESMTP id C10C843FAF for ; Sat, 3 May 2003 07:59:37 -0700 (PDT) (envelope-from rizzo@xorpc.icir.org) Received: from xorpc.icir.org (localhost [127.0.0.1]) by xorpc.icir.org (8.12.8p1/8.12.3) with ESMTP id h43ExWOH010829; Sat, 3 May 2003 07:59:32 -0700 (PDT) (envelope-from rizzo@xorpc.icir.org) Received: (from rizzo@localhost) by xorpc.icir.org (8.12.8p1/8.12.3/Submit) id h43ExWGv010828; Sat, 3 May 2003 07:59:32 -0700 (PDT) (envelope-from rizzo) Date: Sat, 3 May 2003 07:59:32 -0700 From: Luigi Rizzo To: Dirk-Willem van Gulik Message-ID: <20030503075932.A10701@xorpc.icir.org> References: <20030503123757.W62023-100000@foem> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <20030503123757.W62023-100000@foem>; from dirkx@webweaving.org on Sat, May 03, 2003 at 12:42:17PM +0200 cc: freebsd-hackers@freebsd.org Subject: Re: CompactFlash / new GEOM / boot fails on certain brand / Soekris X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 May 2003 14:59:38 -0000 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 > To: soekris-tech@lists.soekris.com > Cc: small@freebsd.org > Bcc: Luigi Rizzo > Subject: summary and patch for CF problems in booting the 4501 > Message-ID: <20030218164802.A484@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