diff options
author | rnordier <rnordier@FreeBSD.org> | 1998-10-13 21:35:42 +0000 |
---|---|---|
committer | rnordier <rnordier@FreeBSD.org> | 1998-10-13 21:35:42 +0000 |
commit | 4c49cf46758708072cae6b3b324e0d34beb85300 (patch) | |
tree | 2696d4eac67dd30602683ef0f01b39e99e80d710 /sys/boot/i386/gptboot | |
parent | cdb18fc927f44d49a4444febb4930ffa80075136 (diff) | |
download | FreeBSD-src-4c49cf46758708072cae6b3b324e0d34beb85300.zip FreeBSD-src-4c49cf46758708072cae6b3b324e0d34beb85300.tar.gz |
Change to a 15-sector boot2.
Refine slice-handling.
Diffstat (limited to 'sys/boot/i386/gptboot')
-rw-r--r-- | sys/boot/i386/gptboot/Makefile | 11 | ||||
-rw-r--r-- | sys/boot/i386/gptboot/gptboot.c | 41 |
2 files changed, 30 insertions, 22 deletions
diff --git a/sys/boot/i386/gptboot/Makefile b/sys/boot/i386/gptboot/Makefile index b83b94d..67b21b1 100644 --- a/sys/boot/i386/gptboot/Makefile +++ b/sys/boot/i386/gptboot/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.1.1.1 1998/10/12 21:16:26 rnordier Exp $ +# $Id: Makefile,v 1.2 1998/10/13 18:29:18 rnordier Exp $ M4?= m4 @@ -32,9 +32,10 @@ boot1.o: boot1.m4 boot1.s boot2: boot2.ldr boot2.bin btxld -v -E ${ORG2} -f bin -b ${BTX}/btx/btx -l boot2.ldr \ - -o ${.TARGET} -P 1 boot2.bin - @ls -l boot2 | awk '{ x = 7680 - $$5; print x " bytes free"; \ - if (x < 0) exit 1 }' + -o boot2.ld -P 1 boot2.bin + @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 boot2.ldr: dd if=/dev/zero of=${.TARGET} bs=512 count=1 2>/dev/null @@ -48,4 +49,4 @@ boot2.out: boot2.o clean: rm -f boot1 boot1.out boot1.o boot2 boot2.ldr boot2.bin \ - boot2.out boot2.o + boot2.ld boot2.out boot2.o diff --git a/sys/boot/i386/gptboot/gptboot.c b/sys/boot/i386/gptboot/gptboot.c index 3e476bd..a715d76 100644 --- a/sys/boot/i386/gptboot/gptboot.c +++ b/sys/boot/i386/gptboot/gptboot.c @@ -14,7 +14,7 @@ */ /* - * $Id: boot2.c,v 1.1.1.1 1998/10/12 21:16:26 rnordier Exp $ + * $Id: boot2.c,v 1.2 1998/10/13 17:41:06 rnordier Exp $ */ #include <sys/param.h> @@ -61,7 +61,7 @@ #define DRV_MASK 0x7f #define MAJ_WD 0 -#define MAJ_WFD 1 +#define MAJ_WFD 1 #define MAJ_FD 2 #define MAJ_DA 4 @@ -313,7 +313,7 @@ parse(char *arg) if (q - arg != 2) return -1; for (i = 0; arg[0] != dev_nm[i][0] || - arg[1] != dev_nm[i][1]; i++) + arg[1] != dev_nm[i][1]; i++) if (i == NDEV - 1) return -1; dsk.type = i; @@ -322,8 +322,9 @@ parse(char *arg) return -1; dsk.unit = *arg - '0'; arg += 2; + dsk.slice = WHOLE_DISK_SLICE; if (arg[1] == ',') { - if (*arg < '0' || *arg > '4') + if (*arg < '0' || *arg > '0' + NDOSPART) return -1; if ((dsk.slice = *arg - '0')) dsk.slice++; @@ -502,17 +503,23 @@ dskread(void *buf, unsigned lba, unsigned nblk) if (!sec) sec = malloc(DEV_BSIZE); dsk.start = 0; + if (drvread(sec, DOSBBSECTOR, 1)) + return -1; + dp = (void *)(sec + DOSPARTOFF); sl = dsk.slice; + if (sl < BASE_SLICE) { + for (i = 0; i < NDOSPART; i++) + if (dp[i].dp_typ == DOSPTYP_386BSD && + (dp[i].dp_flag & 0x80 || sl < BASE_SLICE)) { + sl = BASE_SLICE + i; + if (dp[i].dp_flag & 0x80 || + dsk.slice == COMPATIBILITY_SLICE) + break; + } + if (dsk.slice == WHOLE_DISK_SLICE) + dsk.slice = sl; + } if (sl != WHOLE_DISK_SLICE) { - if (drvread(sec, DOSBBSECTOR, 1)) - return -1; - dp = (void *)(sec + DOSPARTOFF); - if (sl == COMPATIBILITY_SLICE) - for (i = 0; i < NDOSPART; i++) - if (dp[i].dp_typ == DOSPTYP_386BSD && - (dp[i].dp_flag & 0x80 || - sl == COMPATIBILITY_SLICE)) - sl = BASE_SLICE + i; if (sl != COMPATIBILITY_SLICE) dp += sl - BASE_SLICE; if (dp->dp_typ != DOSPTYP_386BSD) { @@ -521,17 +528,17 @@ dskread(void *buf, unsigned lba, unsigned nblk) } dsk.start = dp->dp_start; } - if (drvread(sec, dsk.start + LABELSECTOR, 1)) + if (drvread(sec, dsk.start + LABELSECTOR, 1)) return -1; d = (void *)(sec + LABELOFFSET); if (d->d_magic != DISKMAGIC || d->d_magic2 != DISKMAGIC) { if (dsk.part != RAW_PART) { - printf("Invalid %s\n", "label"); - return -1; + printf("Invalid %s\n", "label"); + return -1; } } else { if (!dsk.init) { - if (d->d_type == DTYPE_SCSI) + if (d->d_type == DTYPE_SCSI) dsk.type = MAJ_DA; dsk.init++; } |