diff options
author | Poul-Henning Kamp <phk@FreeBSD.org> | 2002-10-07 21:36:06 +0000 |
---|---|---|
committer | Poul-Henning Kamp <phk@FreeBSD.org> | 2002-10-07 21:36:06 +0000 |
commit | 15cfc1833c833343931f44ce32ac3ae46552af47 (patch) | |
tree | da55d98ee3373c49090ec99d0a43298cb9b76394 /sys | |
parent | 5b0f380cdd2042d8c5ef0f17488a9fcb43fbcb12 (diff) | |
download | src-15cfc1833c833343931f44ce32ac3ae46552af47.tar.gz src-15cfc1833c833343931f44ce32ac3ae46552af47.zip |
Conditionalize the number of sectors loaded by boot1.s on UFS1/UFS12.
Conditionalize the "XX bytes left" checks reference on UFS1/UFS12.
Conditionally build the necessary 64bit math for boot2 if UFS12.
Sponsored by: DARPA & NAI Labs.
Notes
Notes:
svn path=/head/; revision=104635
Diffstat (limited to 'sys')
-rw-r--r-- | sys/boot/i386/boot2/Makefile | 33 | ||||
-rw-r--r-- | sys/boot/i386/boot2/boot1.S | 9 | ||||
-rw-r--r-- | sys/boot/i386/boot2/boot1.s | 9 | ||||
-rw-r--r-- | sys/boot/i386/boot2/boot2.c | 6 | ||||
-rw-r--r-- | sys/boot/i386/gptboot/Makefile | 33 | ||||
-rw-r--r-- | sys/boot/i386/gptboot/gptboot.c | 6 |
6 files changed, 84 insertions, 12 deletions
diff --git a/sys/boot/i386/boot2/Makefile b/sys/boot/i386/boot2/Makefile index 4526d15b300f..05567c1724fa 100644 --- a/sys/boot/i386/boot2/Makefile +++ b/sys/boot/i386/boot2/Makefile @@ -7,7 +7,7 @@ BINDIR?= /boot BINMODE= 444 CLEANFILES+= boot1 boot1.out boot1.o \ boot2.ldr boot2.bin boot2.ld boot2.out boot2.o boot2.h \ - boot2.s sio.o + boot2.s sio.o divdi3.o moddi3.o qdivrem.o NM?= nm @@ -27,6 +27,10 @@ BTX= ${.CURDIR}/../btx ORG1= 0x7c00 ORG2= 0x1000 +# Setting this to anything else gives UFS1+2 support and larger +# boot2 binary. +BOOT2_UFS?= UFS1_ONLY + CFLAGS= -elf -ffreestanding -Os -fno-builtin \ -fno-guess-branch-probability \ -mrtd \ @@ -36,7 +40,11 @@ CFLAGS= -elf -ffreestanding -Os -fno-builtin \ -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \ -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings -CFLAGS+= -DUFS1_ONLY +.if ${BOOT2_UFS} == "UFS1_ONLY" +CFLAGS+= -D${BOOT2_UFS} +.else + +.endif LDFLAGS=-nostdlib -static -N @@ -66,9 +74,15 @@ boot2.h: boot1.out boot2: boot2.ldr boot2.bin ${BTX}/btx/btx btxld -v -E ${ORG2} -f bin -b ${BTX}/btx/btx -l boot2.ldr \ -o boot2.ld -P 1 boot2.bin +.if ${BOOT2_UFS} == "UFS1_ONLY" @ls -l boot2.ld | awk '{ x = 7680 - $$5; \ print x " bytes available"; if (x < 0) exit 1 }' dd if=boot2.ld of=${.TARGET} obs=7680 conv=osync 2>/dev/null +.else + @ls -l boot2.ld | awk '{ x = 9728 - $$5; \ + print x " bytes available"; if (x < 0) exit 1 }' + dd if=boot2.ld of=${.TARGET} obs=9728 conv=osync 2>/dev/null +.endif boot2.ldr: dd if=/dev/zero of=${.TARGET} bs=512 count=1 2>/dev/null @@ -76,9 +90,13 @@ boot2.ldr: boot2.bin: boot2.out objcopy -S -O binary boot2.out ${.TARGET} +.if ${BOOT2_UFS} == "UFS1_ONLY" boot2.out: boot2.o sio.o +.else +boot2.out: boot2.o sio.o divdi3.o moddi3.o qdivrem.o +.endif ${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} \ - ${BTX}/lib/crt0.o boot2.o sio.o + ${BTX}/lib/crt0.o ${.ALLSRC} boot2.o: boot2.h @@ -88,6 +106,15 @@ sio.o: sio.s --defsym SIOSPD=${BOOT_COMCONSOLE_SPEED} \ ${.IMPSRC} -o ${.TARGET} +moddi3.o: ${.CURDIR}/../../../libkern/moddi3.c + ${CC} ${CFLAGS} -I${.CURDIR}/../../../ -c ${.IMPSRC} + +divdi3.o: ${.CURDIR}/../../../libkern/divdi3.c + ${CC} ${CFLAGS} -I${.CURDIR}/../../../ -c ${.IMPSRC} + +qdivrem.o: ${.CURDIR}/../../../libkern/qdivrem.c + ${CC} ${CFLAGS} -I${.CURDIR}/../../../ -c ${.IMPSRC} + install: ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ boot1 ${DESTDIR}${BINDIR}/boot1 diff --git a/sys/boot/i386/boot2/boot1.S b/sys/boot/i386/boot2/boot1.S index 29f9560c4eff..c9079fe40411 100644 --- a/sys/boot/i386/boot2/boot1.S +++ b/sys/boot/i386/boot2/boot1.S @@ -37,6 +37,11 @@ .set SIZ_PAG,0x1000 // Page size .set SIZ_SEC,0x200 // Sector size +#ifdef UFS1_ONLY + .set NSECT,0x10 +#else + .set NSECT,0x14 +#endif .globl start .globl xread .code16 @@ -181,13 +186,13 @@ main.4: xor %dx,%dx // Partition:drive // entry point is relative to MEM_USR; thus boot2.bin starts at 0xb000. // main.5: mov %dx,MEM_ARG // Save args - movb $0x14,%dh // Sector count + movb $NSECT,%dh // Sector count callw nread // Read disk mov $MEM_BTX,%bx // BTX mov 0xa(%bx),%si // Get BTX length and set add %bx,%si // %si to start of boot2.bin mov $MEM_USR+SIZ_PAG,%di // Client page 1 - mov $MEM_BTX+0x12*SIZ_SEC,%cx // Byte + mov $MEM_BTX+(NSECT-2)*SIZ_SEC,%cx // Byte sub %si,%cx // count rep // Relocate movsb // client diff --git a/sys/boot/i386/boot2/boot1.s b/sys/boot/i386/boot2/boot1.s index 29f9560c4eff..c9079fe40411 100644 --- a/sys/boot/i386/boot2/boot1.s +++ b/sys/boot/i386/boot2/boot1.s @@ -37,6 +37,11 @@ .set SIZ_PAG,0x1000 // Page size .set SIZ_SEC,0x200 // Sector size +#ifdef UFS1_ONLY + .set NSECT,0x10 +#else + .set NSECT,0x14 +#endif .globl start .globl xread .code16 @@ -181,13 +186,13 @@ main.4: xor %dx,%dx // Partition:drive // entry point is relative to MEM_USR; thus boot2.bin starts at 0xb000. // main.5: mov %dx,MEM_ARG // Save args - movb $0x14,%dh // Sector count + movb $NSECT,%dh // Sector count callw nread // Read disk mov $MEM_BTX,%bx // BTX mov 0xa(%bx),%si // Get BTX length and set add %bx,%si // %si to start of boot2.bin mov $MEM_USR+SIZ_PAG,%di // Client page 1 - mov $MEM_BTX+0x12*SIZ_SEC,%cx // Byte + mov $MEM_BTX+(NSECT-2)*SIZ_SEC,%cx // Byte sub %si,%cx // count rep // Relocate movsb // client diff --git a/sys/boot/i386/boot2/boot2.c b/sys/boot/i386/boot2/boot2.c index cc858c817457..fdc88ae96bc6 100644 --- a/sys/boot/i386/boot2/boot2.c +++ b/sys/boot/i386/boot2/boot2.c @@ -269,7 +269,11 @@ main(void) /* Present the user with the boot2 prompt. */ for (;;) { - printf(" \n>> FreeBSD/i386 BOOT\n" +#ifdef UFS1_ONLY + printf(" \n>> FreeBSD/i386/UFS1 BOOT\n" +#else + printf(" \n>> FreeBSD/i386/UFS[12] BOOT\n" +#endif "Default: %u:%s(%u,%c)%s\n" "boot: ", dsk.drive & DRV_MASK, dev_nm[dsk.type], dsk.unit, diff --git a/sys/boot/i386/gptboot/Makefile b/sys/boot/i386/gptboot/Makefile index 4526d15b300f..05567c1724fa 100644 --- a/sys/boot/i386/gptboot/Makefile +++ b/sys/boot/i386/gptboot/Makefile @@ -7,7 +7,7 @@ BINDIR?= /boot BINMODE= 444 CLEANFILES+= boot1 boot1.out boot1.o \ boot2.ldr boot2.bin boot2.ld boot2.out boot2.o boot2.h \ - boot2.s sio.o + boot2.s sio.o divdi3.o moddi3.o qdivrem.o NM?= nm @@ -27,6 +27,10 @@ BTX= ${.CURDIR}/../btx ORG1= 0x7c00 ORG2= 0x1000 +# Setting this to anything else gives UFS1+2 support and larger +# boot2 binary. +BOOT2_UFS?= UFS1_ONLY + CFLAGS= -elf -ffreestanding -Os -fno-builtin \ -fno-guess-branch-probability \ -mrtd \ @@ -36,7 +40,11 @@ CFLAGS= -elf -ffreestanding -Os -fno-builtin \ -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \ -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings -CFLAGS+= -DUFS1_ONLY +.if ${BOOT2_UFS} == "UFS1_ONLY" +CFLAGS+= -D${BOOT2_UFS} +.else + +.endif LDFLAGS=-nostdlib -static -N @@ -66,9 +74,15 @@ boot2.h: boot1.out boot2: boot2.ldr boot2.bin ${BTX}/btx/btx btxld -v -E ${ORG2} -f bin -b ${BTX}/btx/btx -l boot2.ldr \ -o boot2.ld -P 1 boot2.bin +.if ${BOOT2_UFS} == "UFS1_ONLY" @ls -l boot2.ld | awk '{ x = 7680 - $$5; \ print x " bytes available"; if (x < 0) exit 1 }' dd if=boot2.ld of=${.TARGET} obs=7680 conv=osync 2>/dev/null +.else + @ls -l boot2.ld | awk '{ x = 9728 - $$5; \ + print x " bytes available"; if (x < 0) exit 1 }' + dd if=boot2.ld of=${.TARGET} obs=9728 conv=osync 2>/dev/null +.endif boot2.ldr: dd if=/dev/zero of=${.TARGET} bs=512 count=1 2>/dev/null @@ -76,9 +90,13 @@ boot2.ldr: boot2.bin: boot2.out objcopy -S -O binary boot2.out ${.TARGET} +.if ${BOOT2_UFS} == "UFS1_ONLY" boot2.out: boot2.o sio.o +.else +boot2.out: boot2.o sio.o divdi3.o moddi3.o qdivrem.o +.endif ${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} \ - ${BTX}/lib/crt0.o boot2.o sio.o + ${BTX}/lib/crt0.o ${.ALLSRC} boot2.o: boot2.h @@ -88,6 +106,15 @@ sio.o: sio.s --defsym SIOSPD=${BOOT_COMCONSOLE_SPEED} \ ${.IMPSRC} -o ${.TARGET} +moddi3.o: ${.CURDIR}/../../../libkern/moddi3.c + ${CC} ${CFLAGS} -I${.CURDIR}/../../../ -c ${.IMPSRC} + +divdi3.o: ${.CURDIR}/../../../libkern/divdi3.c + ${CC} ${CFLAGS} -I${.CURDIR}/../../../ -c ${.IMPSRC} + +qdivrem.o: ${.CURDIR}/../../../libkern/qdivrem.c + ${CC} ${CFLAGS} -I${.CURDIR}/../../../ -c ${.IMPSRC} + install: ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ boot1 ${DESTDIR}${BINDIR}/boot1 diff --git a/sys/boot/i386/gptboot/gptboot.c b/sys/boot/i386/gptboot/gptboot.c index cc858c817457..fdc88ae96bc6 100644 --- a/sys/boot/i386/gptboot/gptboot.c +++ b/sys/boot/i386/gptboot/gptboot.c @@ -269,7 +269,11 @@ main(void) /* Present the user with the boot2 prompt. */ for (;;) { - printf(" \n>> FreeBSD/i386 BOOT\n" +#ifdef UFS1_ONLY + printf(" \n>> FreeBSD/i386/UFS1 BOOT\n" +#else + printf(" \n>> FreeBSD/i386/UFS[12] BOOT\n" +#endif "Default: %u:%s(%u,%c)%s\n" "boot: ", dsk.drive & DRV_MASK, dev_nm[dsk.type], dsk.unit, |