Date: Fri, 16 Feb 2001 21:09:33 -0800 (PST) From: Luigi Rizzo <rizzo@aciri.org> To: hackers@freebsd.org Cc: rizzo@aciri.org (Luigi Rizzo) Subject: boot1 changes and etherboot support Message-ID: <200102170509.f1H59cA08731@iguana.aciri.org>
next in thread | raw e-mail | index | archive | help
sorry if this is not the most appropriate forum to discuss this, redirects appreciated. I have spent some time trying to put etherboot[1] code onto the hard disk so that it can be selected using the FreeBSD boot manager. I ended up doing it with a small amt of modifications to the "boot1" code, for which a patch is attached. Maybe it could be interesting in applying this patch to the standard boot1 code (apart for the PRT_BSD change, which should be unmodified). While at it, i noticed that fdisk seems to be more "smart" than i'd like, and likes to move the begin and end of partition to align it to a track boundary. This is kind of annoying, 1) because if you change the geometry in a way that has no effect for the loading of the kernel, it can still screw up your partition, and 2) because i would like to squeeze the boot1+etherboot in the spare 62 sectors between the MBR (boot0) and the beginning of the first partition on the disk. Is there any bad side effect in having a slice which starts at sector 1 and is 62 sectors long ? cheers luigi [1] Etherboot code is basically a boot ROM image of reasonably small size (16 or 32K depending on card type), and as part of its standard distribution can be loaded from a floppy using a special-purpose boot sector which is prepended to the image itself. Unfortunately the loader that comes with etherboot assumes the use of a floppy and does not work from a hard drive. [2] The patch for boot1.s is below. --- boot1.s Fri Jul 7 14:12:32 2000 +++ boot1a.s Fri Feb 16 18:39:20 2001 @@ -28,7 +28,7 @@ # Partition Constants .set PRT_OFF,0x1be # Partition offset .set PRT_NUM,0x4 # Partitions - .set PRT_BSD,0xa5 # Partition type + .set PRT_BSD,0x1 # Partition type # Flag Bits .set FL_PACKET,0x80 # Packet mode @@ -147,9 +147,18 @@ # when we use btxld create boot2, we use an entry point of 0x1000. That # entry point is relative to MEM_USR; thus boot2.bin starts at 0xb000. # main.5: mov %dx,MEM_ARG # Save args movb $0x10,%dh # Sector count callw nread # Read disk + cmpw $0xaa55, MEM_BUF+0x200 # rom signature ? + jnz load_btx + movb MEM_BUF+0x202,%dh # Sector count + incb %dh + mov $0x7e00, %bx + callw nreadbx # Read disk + ljmp $0x800,$6 # enter the rom code + +load_btx: mov $MEM_BTX,%bx # BTX mov 0xa(%bx),%si # Get BTX length and set add %bx,%si # %si to start of boot2.bin @@ -184,6 +193,7 @@ # Trampoline used to call read from within boot1. # nread: mov $MEM_BUF,%bx # Transfer buffer +nreadbx: # same but address is in bx mov 0x8(%si),%ax # Get mov 0xa(%si),%cx # LBA push %cs # Read from ----------------------------------+----------------------------------------- Luigi RIZZO, luigi@iet.unipi.it . ACIRI/ICSI (on leave from Univ. di Pisa) http://www.iet.unipi.it/~luigi/ . 1947 Center St, Berkeley CA 94704 Phone: (510) 666 2927 ----------------------------------+----------------------------------------- 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?200102170509.f1H59cA08731>