Subject: Re: failiure to boot 1.0-i386
To: Dave Edmondson <dme@zigzag.org>
From: Manuel Bouyer <bouyer@ensta.fr>
List: current-users
Date: 11/04/1994 18:50:38
Dave Edmondson wrote:
>
> i decided to try and install 1.0 on my Toshiba T1950CT. the system doesn't
> even get as far as the Boot prompt. it spits `Read error' about 2 seconds
> after starting to read the boot floppy, and then hangs (no ctrl-alt-del).
>
Sorry to have been so long to anserw.
A friend of mine had the same problem on a T4700. The problem is that the
bios doesn't call the boot program whith the rigth arguments (i.e. an id
for the device which boots). He had to hardcode the boot device in
boot blocks.
Here are the diffs:
diff -bcrNP /sys/arch/i386/boot/Makefile newboot/Makefile
*** /sys/arch/i386/boot/Makefile Wed Nov 2 23:06:26 1994
--- newboot/Makefile Thu Nov 3 10:44:53 1994
***************
*** 41,47 ****
-rm -f ${MACHINE_ARCH} && \
ln -s ${.CURDIR}/../include ${MACHINE_ARCH}
! all: machine-links biosboot bootbios
NOPROG= noprog
NOMAN= noman
--- 41,54 ----
-rm -f ${MACHINE_ARCH} && \
ln -s ${.CURDIR}/../include ${MACHINE_ARCH}
! PRODUCTS= machine-links biosboot bootbios \
! fd0-boot boot-fd0 \
! wd0-boot boot-wd0 \
! wd1-boot boot-wd1 \
! i2s-boot boot-i2s
!
! all: $(PRODUCTS)
!
NOPROG= noprog
NOMAN= noman
***************
*** 50,59 ****
CFLAGS+=-DDO_BAD144 -I. -I${.CURDIR} -I$S -I${.CURDIR}/../..
# start.o should be first
! OBJS= start.o table.o boot2.o boot.o asm.o bios.o io.o disk.o sys.o version.o
! boot: ${OBJS} ${LIBKERN}
! ${LD} -Bstatic -e start -N -T 0 -o boot ${OBJS} ${LIBKERN}
cp boot boot.sym
@strip boot
@sh ${.CURDIR}/rmaouthdr boot boot.tmp
--- 57,71 ----
CFLAGS+=-DDO_BAD144 -I. -I${.CURDIR} -I$S -I${.CURDIR}/../..
# start.o should be first
! OBJS= start.o start-fd0.o start-wd0.o start-wd1.o table.o boot2.o boot.o boot.i2s.o asm.o bios.o io.o disk.o sys.o version.o
! OBJS_no= start.o table.o boot2.o boot.o asm.o bios.o io.o disk.o sys.o version.o
! OBJS_fd0= start-fd0.o table.o boot2.o boot.o asm.o bios.o io.o disk.o sys.o version.o
! OBJS_wd0= start-wd0.o table.o boot2.o boot.o asm.o bios.o io.o disk.o sys.o version.o
! OBJS_wd1= start-wd1.o table.o boot2.o boot.o asm.o bios.o io.o disk.o sys.o version.o
! OBJS_i2s= start.o table.o boot2.o boot.i2s.o asm.o bios.o io.o disk.o sys.o version.o
! boot: ${OBJS_no} ${LIBKERN}
! ${LD} -Bstatic -e start -N -T 0 -o boot ${OBJS_no} ${LIBKERN}
cp boot boot.sym
@strip boot
@sh ${.CURDIR}/rmaouthdr boot boot.tmp
***************
*** 66,71 ****
--- 78,154 ----
bootbios: boot
dd if=boot of=bootbios skip=1
+ start-fd0.o: start.S
+ $(CC) $(CFLAGS) -DBOOT_ADDRESS='$$0x00' -c -o start-fd0.o start.S
+
+ boot~fd0: $(OBJS_fd0)
+ $(LD) -Bstatic -e start -N -T 0 -o boot~fd0 $(OBJS_fd0) $(LIBS)
+ cp boot~fd0 boot~fd0.sym
+ @strip boot~fd0
+ @sh ${.CURDIR}/rmaouthdr boot~fd0 boot~fd0.tmp
+ @mv -f boot~fd0.tmp boot~fd0
+ @ls -l boot~fd0
+
+ fd0-boot: boot~fd0
+ dd if=boot~fd0 of=fd0-boot count=1
+
+ boot-fd0: boot~fd0
+ dd if=boot~fd0 of=boot-fd0 skip=1
+
+ start-wd0.o: start.S
+ $(CC) $(CFLAGS) -DBOOT_ADDRESS='$$0x80' -c -o start-wd0.o start.S
+
+ boot~wd0: $(OBJS_wd0)
+ $(LD) -Bstatic -e start -N -T 0 -o boot~wd0 $(OBJS_wd0) $(LIBS)
+ cp boot~wd0 boot~wd0.sym
+ @strip boot~wd0
+ @sh ${.CURDIR}/rmaouthdr boot~wd0 boot~wd0.tmp
+ @mv -f boot~wd0.tmp boot~wd0
+ @ls -l boot~wd0
+
+ wd0-boot: boot~wd0
+ dd if=boot~wd0 of=wd0-boot count=1
+
+ boot-wd0: boot~wd0
+ dd if=boot~wd0 of=boot-wd0 skip=1
+
+ start-wd1.o: start.S
+ $(CC) $(CFLAGS) -DBOOT_ADDRESS='$$0x81' -c -o start-wd1.o start.S
+
+ boot~wd1: $(OBJS_wd1)
+ $(LD) -Bstatic -e start -N -T 0 -o boot~wd1 $(OBJS_wd1) $(LIBS)
+ cp boot~wd1 boot~wd1.sym
+ @strip boot~wd1
+ @sh ${.CURDIR}/rmaouthdr boot~wd1 boot~wd1.tmp
+ @mv -f boot~wd1.tmp boot~wd1
+ @ls -l boot~wd1
+
+ wd1-boot: boot~wd1
+ dd if=boot~wd1 of=wd1-boot count=1
+
+ boot-wd1: boot~wd1
+ dd if=boot~wd1 of=boot-wd1 skip=1
+
+ boot.i2s.o: boot.c
+ $(CC) $(CFLAGS) $(INC) -DIDE2SCSI -c -o boot.i2s.o boot.c
+
+ start-i2s.o: start.S
+ $(CC) $(CFLAGS) -DBOOT_ADDRESS='$$i2s' -c -o start-i2s.o start.S
+
+ boot~i2s: $(OBJS_i2s)
+ $(LD) -Bstatic -e start -N -T 0 -o boot~i2s $(OBJS_i2s) $(LIBS)
+ cp boot~i2s boot~i2s.sym
+ @strip boot~i2s
+ @sh ${.CURDIR}/rmaouthdr boot~i2s boot~i2s.tmp
+ @mv -f boot~i2s.tmp boot~i2s
+ @ls -l boot~i2s
+
+ i2s-boot: boot~i2s
+ dd if=boot~i2s of=i2s-boot count=1
+
+ boot-i2s: boot~i2s
+ dd if=boot~i2s of=boot-i2s skip=1
+
${DESTDIR}/usr/mdec/bootsd: bootbios
cp bootbios ${DESTDIR}/usr/mdec/bootsd
***************
*** 92,99 ****
wd: ${DESTDIR}/usr/mdec/bootwd ${DESTDIR}/usr/mdec/wdboot
fd: ${DESTDIR}/usr/mdec/bootfd ${DESTDIR}/usr/mdec/fdboot
! install: wd sd fd
! CLEANFILES+=bootbios boot biosboot boot.sym machine ${MACHINE_ARCH}
.include <bsd.prog.mk>
--- 175,213 ----
wd: ${DESTDIR}/usr/mdec/bootwd ${DESTDIR}/usr/mdec/wdboot
fd: ${DESTDIR}/usr/mdec/bootfd ${DESTDIR}/usr/mdec/fdboot
! ${DESTDIR}/usr/mdec/boot-fd0: boot-fd0
! cp boot-fd0 ${DESTDIR}/usr/mdec/boot-fd0
!
! ${DESTDIR}/usr/mdec/fd0-boot: fd0-boot
! cp fd0-boot ${DESTDIR}/usr/mdec/fd0-boot
!
! ${DESTDIR}/usr/mdec/boot-wd0: boot-wd0
! cp boot-wd0 ${DESTDIR}/usr/mdec/boot-wd0
!
! ${DESTDIR}/usr/mdec/wd0-boot: wd0-boot
! cp wd0-boot ${DESTDIR}/usr/mdec/wd0-boot
!
! ${DESTDIR}/usr/mdec/boot-wd1: boot-wd1
! cp boot-wd1 ${DESTDIR}/usr/mdec/boot-wd1
!
! ${DESTDIR}/usr/mdec/wd1-boot: wd1-boot
! cp wd1-boot ${DESTDIR}/usr/mdec/wd1-boot
!
! ${DESTDIR}/usr/mdec/boot-i2s: boot-i2s
! cp boot-i2s ${DESTDIR}/usr/mdec/boot-i2s
!
! ${DESTDIR}/usr/mdec/i2s-boot: i2s-boot
! cp i2s-boot ${DESTDIR}/usr/mdec/i2s-boot
!
! fd0: ${DESTDIR}/usr/mdec/boot-fd0 ${DESTDIR}/usr/mdec/fd0-boot
! wd0: ${DESTDIR}/usr/mdec/boot-wd0 ${DESTDIR}/usr/mdec/wd0-boot
! wd1: ${DESTDIR}/usr/mdec/boot-wd1 ${DESTDIR}/usr/mdec/wd1-boot
! i2s: ${DESTDIR}/usr/mdec/boot-i2s ${DESTDIR}/usr/mdec/i2s-boot
!
!
!
! install: wd sd fd fd0 wd0 wd1 i2s
! CLEANFILES+=bootbios boot biosboot boot.sym machine ${MACHINE_ARCH} $(PRODUCTS)
.include <bsd.prog.mk>
diff -bcrNP /sys/arch/i386/boot/boot.c newboot/boot.c
*** /sys/arch/i386/boot/boot.c Wed Nov 2 23:06:25 1994
--- newboot/boot.c Thu Nov 3 10:35:06 1994
***************
*** 91,96 ****
--- 91,105 ----
part = 0;
unit = drive&0x7f;
maj = (drive&0x80 ? 0 : 2); /* a good first bet */
+
+ #ifdef IDE2SCSI
+ /* Je boote sur IDE mais je veux lancer par defaut le SCSI !!! */
+
+ if (maj == 0) {
+ maj = 1;
+ unit = 1;
+ }
+ #endif IDE2SCSI
name = names[currname++];
diff -bcrNP /sys/arch/i386/boot/start.S newboot/start.S
*** /sys/arch/i386/boot/start.S Wed Nov 2 23:06:26 1994
--- newboot/start.S Thu Nov 3 10:35:07 1994
***************
*** 94,99 ****
--- 94,113 ----
call message
#endif
+ #ifdef ANALYSE
+ pushl %eax
+ movb %dl, %al
+ data32
+ call print_byte
+ data32
+ call outcrlf
+ popl %eax
+ #endif ANALYSE
+
+ #ifdef BOOT_ADDRESS
+ movb BOOT_ADDRESS, %dl
+ #endif BOOT_ADDRESS
+
# bootstrap passes us drive number in %dl
cmpb $0x80, %dl
data32
***************
*** 187,192 ****
--- 201,208 ----
movl %es:2(%ebx), %ecx /*sect, cyl (+ 2 bytes junk in top word) */
load:
+
+ #ifndef ONE_SHOT
movb $0x2, %ah /* function 2 */
movb $LOADSZ, %al /* number of blocks */
xorl %ebx, %ebx /* %bx = 0, put it at 0 in the BOOTSEG */
***************
*** 194,199 ****
--- 210,274 ----
data32
jb read_error
+ #else ONE_SHOT
+
+ data32
+ movl $BOOTSEG, %eax
+ movl %ax, %es
+ pushl %eax
+ xorl %ebx, %ebx /* %bx = 0, put it at 0 in the BOOTSEG */
+ pushl %ebx
+ read_one:
+ movb $0x2, %ah /* function 2 */
+ movb $0x1, %al /* 1 block only */
+
+ #ifdef ANALYSE
+
+ pushl %eax
+ /* %ah = 0x2 %al = number of sectors */
+ data32
+ call print_word
+ data32
+ call outcrlf
+ /* %ch = cylinder %cl = sector */
+ movl %cx, %ax
+ data32
+ call print_word
+ data32
+ call outcrlf
+ /* %dh = head %dl = drive (0x80 for hard disk, 0x0 for floppy disk) */
+ movl %dx, %ax
+ data32
+ call print_word
+ data32
+ call outcrlf
+ popl %eax
+
+ #endif ANALYSE
+
+ int $0x13
+ jb read_error
+
+ #ifdef DEBUG
+ data32
+ movl $why, %esi
+ data32
+ call message
+ #endif
+
+ popl %ebx
+ addl $0x1000, %ebx
+ popl %eax
+ addl $0x1000, %eax
+ movl %ax, %es
+ pushl %eax
+ pushl %ebx
+
+ cmpl $0xf000, %eax
+ jne read_one
+
+ #endif ONE_SHOT
+
# ljmp to the second stage boot loader (boot2).
# After ljmp, %cs is BOOTSEG and boot1 (512 bytes) will be used
# as an internal buffer "intbuf".
***************
*** 207,212 ****
--- 282,343 ----
data32
ljmp $BOOTSEG, $ EXT(boot2)
+ #ifdef ANALYSE
+
+ /**
+ print_long: # long in eax
+ pushl %eax
+ data32
+ shrl $16, %eax # MS word
+ data32
+ call print_byte
+ data32
+ pop %eax # LS word
+ **/
+
+ print_word: # word in al
+ push %ax
+ movb %ah, %al # MS byte
+ data32
+ call print_byte
+ pop %ax # LS byte
+
+ print_byte: # byte in al
+ push %ax
+ shrb $4, %al # MS nibble
+ data32
+ call print_nibble
+ pop %ax # LS nibble
+
+ print_nibble: # LS nibble in al
+ andb $0x0f, %al
+ addb $'0', %al
+ cmpb $'9', %al
+ jbe outc
+ addb $'A'-'0'-10, %al
+
+ outc:
+ pushl %eax
+ pushl %ebx
+ data32
+ movl $0x0001, %ebx
+ movb $0x0e, %ah
+ int $0x10
+ popl %ebx
+ popl %eax
+ data32
+ ret
+
+ outcrlf:
+ movb $0x0D, %al
+ data32
+ call outc
+ movb $0x0A, %al
+ data32
+ jmp outc
+
+ #endif ANALYSE
+
#
# read_error
#
***************
*** 270,275 ****
--- 401,409 ----
five: .asciz "5\r\n"
six: .asciz "6\r\n"
seven: .asciz "7\r\n"
+ #if ONE_SHOT
+ why: .asciz "Y\r\n"
+ #endif ONE_SHOT
#endif DEBUG
eread: .asciz "Read error\r\n"
enoboot: .asciz "No bootable partition\r\n"
--
--
Manuel Bouyer, Ecole Nationale Superieure de Techniques Avancees, Paris
email: bouyer@ensta.fr
--