[ale] homemade bootdisk problems

Joe Steele joe at madewell.com
Fri May 17 14:29:11 EDT 2002


You're doing everything right, except for one problem:

The kernel's boot sector loader is a very primitive piece of code 
(due to the constraint that it must fit in a single 512 byte sector).  
While booting, it uses the system bios to read in the kernel one 
track at a time.  But in order to do that, the loader must tell the 
bios how many sectors are contained on a track.  The loader has no 
easy way of learning this, so it does some guessing.  First it 
guesses 36 sectors per track, then 18, 15, and finally 9.  For each 
guess, it tries to read the last sector of track 0.  If the read 
fails, then it guesses again.

In your case, /dev/fd0u1743 is laid out with 21 sectors per track.  
Consequently, the loader's first guess will fail, but the second 
guess (18 sectors per track) succeeds.  The loader happily proceeds 
reading in the kernel, track by track, 18 sectors at a time.  This 
leaves three sectors on every track unread, which pretty well 
guarantees that the box is going to crash.

Solutions:

1) multiple boot disks.  I presume you don't want this, or you 
wouldn't be attempting the higher density disk.

2)  A boot loader such as lilo.  Again, I presume you don't want 
this, because it will require additional disk space.

3)  Customize your kernel.  In the file 
"linux/arch/i386/boot/bootsect.S", find the lines near the end which 
read:

   disksizes:
           .byte 36,18,15,9

Change the 36 to 21, and all should be well.

4)  For the really adventurous, use vi on your kernel image :-O

Search for the "Loading" string.  On the line above that, at the end 
of the line, you should find the following 5 characters: 

"$^R^O	^M"

(Note that there is a tab character between the ^O and ^M)

If you translate these to their decimal ascii codes, you get:

36 18 15 9 13

These represent the different disk sizes the loader will guess 
(followed by a ^M).  Change the 36 to 21, and you should be set.  The 
36 is the "$".  To get the 21, type ctrl-V ctrl-U.  When done, you 
should have:

"^U^R^O	^M"

Save the file and give it a try.  Other (less adventurous) ways of 
editing the image should work as well.

--Joe


-----Original Message-----
From:	Benjamin Dixon [SMTP:beatle at arches.uga.edu]
Sent:	Thursday, May 16, 2002 8:10 PM
To:	Calvin Harrigan
Cc:	ale at ale.org
Subject:	Re: [ale] homemade bootdisk problems


Nah, I dd'ed using seek to move 338 records to the end of the kernel.
Something like:

dd if=root.img of=/dev/fd0u1743 bs=1k seek=338

Previous to that I dd'ed the kernel:

dd if=kernel.img of=/dev/fd0u1743 bs=1k

then:

rdev /dev/fd0u1743 /dev/fd0u1743
rdev -R /dev/fd0u1743 0
rdev -r /dev/fd0u1743 16722

the 16722 comes from 2^14 + 338 which is the number of records dd spit out
for the kernel rounded up.

Then the root image dd as above.

I thought maybe I had missed a step but I've tried it 4 or 5 times now
with no luck. Then I thought it might be a bios issue (the project
involves older 486 hardware) so I tried it on my P3 and it did the same
thing:

"Loading................................................"
<reboot>

If I DON'T put the root image on the disk, the kernel will boot and halt.
So I I must have done something wrong along the way, I just don't know
where to look exactly.

Ben

On 16 May 2002, Calvin Harrigan wrote:

> When you say you dd'ed the root image right behind the kernel, do you
> actually do something like
> 
> dd if=root.img of=/dev/fd0 BS=XX    ?
> 
> if so you are overwriting the kernel you just put there.
> Could you show the sequence of commands that you enter?
> 
> 
> Calvin...
> 
> 
> On Thu, 2002-05-16 at 18:42, Benjamin Dixon wrote:
> > 
> > Hi all,
> > 
> > I'm trying to put together a custom-made bootdisk for an embedded project
> > and have run into trouble. Ultimately I'd like to have the most basic
> > system plus svgalib on a single floppy so I've been messing with
> > superformat to get 1.68 to 1.7Mb out of a 1.44Mb floppy. I went through
> > and followed the instructions in the bootdisk howto and everything went
> > smoothly. I dd'ed the kernel to the disk, then dd'ed the root image right
> > behind it. However when I try to boot from the disk, it says  "Loading"
> > and thne prints periods all the way across the screen and never gets to
> > decompressing the kernel. However I noticed that if I dd the kernel alone,
> > it will boot and eventually halt. I get the same behaviour with 2.2.20 and
> > 2.4.18 so I think its just something wrong with my procedure. Has anyone
> > run into to the "loading.........etc" problem before? What type of error
> > might that indicate? Has anyone used superformatted floppies for bootdisks
> > before? So far as I know, it should work.
> > 
> > Ben
> > 
> > 
---
This message has been sent through the ALE general discussion list.
See http://www.ale.org/mailing-lists.shtml for more info. Problems should be 
sent to listmaster at ale dot org.






More information about the Ale mailing list