Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 6 Apr 2001 12:48:56 -0700 (PDT)
From:      Doug Ambrisko <ambrisko@whistle.com>
To:        John Baldwin <jhb@FreeBSD.org>
Cc:        mark@whistle.com, dhw@whistle.com, freebsd-hackers@FreeBSD.org
Subject:   Re: Fix for CDROM boot for IBM PC desktops
Message-ID:  <200104061948.MAA75143@whistle.com>
In-Reply-To: <XFMail.010406115604.jhb@FreeBSD.org> from John Baldwin at "Apr 6, 2001 11:56:04 am"

next in thread | previous in thread | raw e-mail | index | archive | help
John Baldwin writes:
| On 06-Apr-01 Doug Ambrisko wrote:
| > On on IBM PC desktops a FreeBSD bootable CDROM won't boot and it hangs.  
| > This has been reported in several places.
| > 
| > The problem is that some BIOSes namely IBM's writes to the boot sector
| > of the floppy to potentially update the parameters for the emulated
| > floppy used for the El Torrito boot.  Since we do not allocate space
| > for a typical MSDOS "Boot Sector" when the BIOS updates this area
| > it then ends up modifying the boot code which is not a good thing.
| > The boot code then fails in random ways.  I also did a work-around
| > for linking the address of "xread" into boot2.c.
| > 
| > The fix is in PR i386/26382:
| >       http://www.freebsd.org/cgi/query-pr.cgi?pr=26382
| > This would be great to get into 4.3 but probably won't make it.
| 
| Ewwww, gross. :)  Bad BIOS, no cookie.  I don't think the perl script is
| needed, simple a one time adjustment of the xread offset in boot2.c should be
| enough.  These programs change very rarely

I also have an update to the patch to make it work on IBM ThinkPads so
that we can boot a FreeBSD CD on a ThinkPad.  The problem on the ThinkPad
is that it reads the values from the defined MSDOS boot sector and
uses them to figure out how to do the emulation.  Which in our cause
is random code values.  Since the BIOS didn't see the media type defined 
as a floppy it made it a IDE device somewhere (such as ad11).  This 
confused the 3rd stage loader.

Here is the updated structure in boot1.s:
  /*  From OpenBSD biosboot.S with tuned values from Doug Ambrisko so 
      ThinkPads can boot from CDROM.  I think the critical part
      is setting the media type.
  */
          .org 0x03, 0x00
          .asciz  "FreeBSD"
          /* BPB */
          .org 0x0b, 0x00
  bpb:    .word   512             /* sector size */
          .byte   1               /* sectors/cluster */
          .word   1               /* reserved sectors */
          .byte   2               /* # of FAT */
          .word   224             /* root entries */
          .word   2880            /* small sectors */
          .byte   0xf0            /* media type (fd) */
          .word   144             /* sectors/fat */
          .word   18              /* sectors per track */
          .word   2               /* # of heads */
  
          /* EBPB */
          .org 0x1c, 0x00
  ebpb:   .long   16              /* hidden sectors */
          .long   0               /* large sectors */

Mark, wanted me to clarify the the BIOS is only changing stuff in
the emulated image and not the media itself.

I think something needs to be done for the linking because it is
really frustrating when stuff changes and there are no warnings
or hints why things just all of a sudden break when a simple change
is made.  Either that or huge warnings saying:

	/* "xread" is a hardcoded value in boot2.c, if you change 
	   the layout in boot1.s figure out what the new value is
	   and then update it in boot2.c */

I like computers to think for me so I don't have to.  I tend to 
make more mistakes then they do!

Thanks for looking at it, any idea on what needs to be done to get this
commited?  I'm currently testing my final patch for ThinkPads but
it takes a while to burn a FreeBSD release CD on a slow 2X burner.

Obviously it would make our lives easier if we can just load things
on the IBM hardware we have around here and reduce traffic on -questions!

Doug A.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200104061948.MAA75143>