summaryrefslogtreecommitdiffstats
path: root/sys/boot
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2002-12-14 19:44:13 +0000
committerphk <phk@FreeBSD.org>2002-12-14 19:44:13 +0000
commitbb0e8ad59aab5cf40ac2ec9d26d8d6ae7daf76ac (patch)
tree2857198281c41e5b88be3d8e3dc25dece1e35847 /sys/boot
parent49ede28a1f9965bb9ec2ec8bc81433622085e282 (diff)
downloadFreeBSD-src-bb0e8ad59aab5cf40ac2ec9d26d8d6ae7daf76ac.zip
FreeBSD-src-bb0e8ad59aab5cf40ac2ec9d26d8d6ae7daf76ac.tar.gz
Employ the unused bytes after the disklabel in the second sector. This makes
it possible to make UFS1_ONLY and UFS2_ONLY versions which fit inside the traditional 16 sectors. Remove assorted now unneeded hackery. UFS1_AND_UFS2 still needs another 150 bytes to work, and that is probably not within our reach, ever.
Diffstat (limited to 'sys/boot')
-rw-r--r--sys/boot/i386/boot2/Makefile21
-rw-r--r--sys/boot/i386/boot2/boot1.S14
-rw-r--r--sys/boot/i386/boot2/boot1.s14
-rw-r--r--sys/boot/i386/gptboot/Makefile21
4 files changed, 22 insertions, 48 deletions
diff --git a/sys/boot/i386/boot2/Makefile b/sys/boot/i386/boot2/Makefile
index aed315f..1045754 100644
--- a/sys/boot/i386/boot2/Makefile
+++ b/sys/boot/i386/boot2/Makefile
@@ -28,25 +28,22 @@ REL1= 0x700
ORG1= 0x7c00
ORG2= 0x2000
-# Setting this to anything else gives UFS1+2 support and larger
-# boot2 binary.
+# Decide Level of UFS support. UFS1_AND_UFS2 doesn't fit.
+
+# BOOT2_UFS?= UFS2_ONLY
+# BOOT2_UFS?= UFS1_AND_UFS2
BOOT2_UFS?= UFS1_ONLY
CFLAGS= -elf -ffreestanding -Os -fno-builtin \
-fno-guess-branch-probability \
-mrtd \
+ -D${BOOT2_UFS} \
-I${.CURDIR}/../../common \
-I${.CURDIR}/../btx/lib -I. \
-Wall -Waggregate-return -Wbad-function-cast -Wcast-align \
-Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
-Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings
-.if ${BOOT2_UFS} == "UFS1_ONLY"
-CFLAGS+= -D${BOOT2_UFS}
-.else
-# nothing here
-.endif
-
LDFLAGS=-nostdlib -static -N
all: boot1 boot2
@@ -77,18 +74,12 @@ 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
+ dd if=/dev/zero of=${.TARGET} bs=276 count=1 2>/dev/null
boot2.bin: boot2.out
objcopy -S -O binary boot2.out ${.TARGET}
diff --git a/sys/boot/i386/boot2/boot1.S b/sys/boot/i386/boot2/boot1.S
index 61a7b8d..e6cdab0 100644
--- a/sys/boot/i386/boot2/boot1.S
+++ b/sys/boot/i386/boot2/boot1.S
@@ -19,7 +19,7 @@
.set MEM_REL,0x700 // Relocation address
.set MEM_ARG,0x900 // Arguments
.set MEM_ORG,0x7c00 // Origin
- .set MEM_BUF,0x8c00 // Load area
+ .set MEM_BUF,0x8cec // Load area
.set MEM_BTX,0x9000 // BTX start
.set MEM_JMP,0x9010 // BTX entry point
.set MEM_USR,0xa000 // Client start
@@ -37,11 +37,7 @@
.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
@@ -175,9 +171,9 @@ main.4: xor %dx,%dx // Partition:drive
// Ok, we have a slice and drive in %dx now, so use that to locate and load
// boot2. %si references the start of the slice we are looking for, so go
// ahead and load up the first 16 sectors (boot1 + boot2) from that. When
-// we read it in, we conveniently use 0x8c00 as our transfer buffer. Thus,
-// boot1 ends up at 0x8c00, and boot2 starts at 0x8c00 + 0x200 = 0x8e00.
-// The first part of boot2 is the disklabel, which is 0x200 bytes long.
+// we read it in, we conveniently use 0x8cec as our transfer buffer. Thus,
+// boot1 ends up at 0x8cec, and boot2 starts at 0x8cec + 0x200 = 0x8eec.
+// The first part of boot2 is the disklabel, which is 0x114 bytes long.
// The second part is BTX, which is thus loaded into 0x9000, which is where
// it also runs from. The boot2.bin binary starts right after the end of
// BTX, so we have to figure out where the start of it is and then move the
@@ -192,7 +188,7 @@ main.5: mov %dx,MEM_ARG // Save args
mov 0xa(%bx),%si // Get BTX length and set
add %bx,%si // %si to start of boot2.bin
mov $MEM_USR+SIZ_PAG*2,%di // Client page 2
- mov $MEM_BTX+(NSECT-2)*SIZ_SEC,%cx // Byte
+ mov $MEM_BTX+(NSECT-1)*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 61a7b8d..e6cdab0 100644
--- a/sys/boot/i386/boot2/boot1.s
+++ b/sys/boot/i386/boot2/boot1.s
@@ -19,7 +19,7 @@
.set MEM_REL,0x700 // Relocation address
.set MEM_ARG,0x900 // Arguments
.set MEM_ORG,0x7c00 // Origin
- .set MEM_BUF,0x8c00 // Load area
+ .set MEM_BUF,0x8cec // Load area
.set MEM_BTX,0x9000 // BTX start
.set MEM_JMP,0x9010 // BTX entry point
.set MEM_USR,0xa000 // Client start
@@ -37,11 +37,7 @@
.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
@@ -175,9 +171,9 @@ main.4: xor %dx,%dx // Partition:drive
// Ok, we have a slice and drive in %dx now, so use that to locate and load
// boot2. %si references the start of the slice we are looking for, so go
// ahead and load up the first 16 sectors (boot1 + boot2) from that. When
-// we read it in, we conveniently use 0x8c00 as our transfer buffer. Thus,
-// boot1 ends up at 0x8c00, and boot2 starts at 0x8c00 + 0x200 = 0x8e00.
-// The first part of boot2 is the disklabel, which is 0x200 bytes long.
+// we read it in, we conveniently use 0x8cec as our transfer buffer. Thus,
+// boot1 ends up at 0x8cec, and boot2 starts at 0x8cec + 0x200 = 0x8eec.
+// The first part of boot2 is the disklabel, which is 0x114 bytes long.
// The second part is BTX, which is thus loaded into 0x9000, which is where
// it also runs from. The boot2.bin binary starts right after the end of
// BTX, so we have to figure out where the start of it is and then move the
@@ -192,7 +188,7 @@ main.5: mov %dx,MEM_ARG // Save args
mov 0xa(%bx),%si // Get BTX length and set
add %bx,%si // %si to start of boot2.bin
mov $MEM_USR+SIZ_PAG*2,%di // Client page 2
- mov $MEM_BTX+(NSECT-2)*SIZ_SEC,%cx // Byte
+ mov $MEM_BTX+(NSECT-1)*SIZ_SEC,%cx // Byte
sub %si,%cx // count
rep // Relocate
movsb // client
diff --git a/sys/boot/i386/gptboot/Makefile b/sys/boot/i386/gptboot/Makefile
index aed315f..1045754 100644
--- a/sys/boot/i386/gptboot/Makefile
+++ b/sys/boot/i386/gptboot/Makefile
@@ -28,25 +28,22 @@ REL1= 0x700
ORG1= 0x7c00
ORG2= 0x2000
-# Setting this to anything else gives UFS1+2 support and larger
-# boot2 binary.
+# Decide Level of UFS support. UFS1_AND_UFS2 doesn't fit.
+
+# BOOT2_UFS?= UFS2_ONLY
+# BOOT2_UFS?= UFS1_AND_UFS2
BOOT2_UFS?= UFS1_ONLY
CFLAGS= -elf -ffreestanding -Os -fno-builtin \
-fno-guess-branch-probability \
-mrtd \
+ -D${BOOT2_UFS} \
-I${.CURDIR}/../../common \
-I${.CURDIR}/../btx/lib -I. \
-Wall -Waggregate-return -Wbad-function-cast -Wcast-align \
-Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
-Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings
-.if ${BOOT2_UFS} == "UFS1_ONLY"
-CFLAGS+= -D${BOOT2_UFS}
-.else
-# nothing here
-.endif
-
LDFLAGS=-nostdlib -static -N
all: boot1 boot2
@@ -77,18 +74,12 @@ 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
+ dd if=/dev/zero of=${.TARGET} bs=276 count=1 2>/dev/null
boot2.bin: boot2.out
objcopy -S -O binary boot2.out ${.TARGET}
OpenPOWER on IntegriCloud