-# $OpenBSD: Makefile,v 1.20 2023/04/28 18:14:59 krw Exp $
+# $OpenBSD: Makefile,v 1.21 2023/06/11 14:00:04 krw Exp $
FS= floppy${OSrev}.img
FSSIZE= 2880
-FSDISKTYPE= floppy3
MOUNT_POINT= /mnt
MTREE= ${UTILS}/mtree.conf
RAMDISK= RAMDISK
${FS}: bsd.gz
dd if=/dev/zero of=${FS} bs=512 count=${FSSIZE}
vnconfig -v ${FS} > vnd
- disklabel -w `cat vnd` ${FSDISKTYPE}
+ echo '/ *' | disklabel -wAT- `cat vnd`
newfs -O 1 -m 0 -o space -i 524288 -c ${FSSIZE} -b 4096 -f 512 /dev/r`cat vnd`a
mount /dev/`cat vnd`a ${MOUNT_POINT}
objcopy -S -R .comment ${DESTDIR}/usr/mdec/fdboot ${.OBJDIR}/boot
-# $OpenBSD: Makefile,v 1.21 2023/04/28 18:14:59 krw Exp $
+# $OpenBSD: Makefile,v 1.22 2023/06/11 14:00:04 krw Exp $
FS= floppy${OSrev}.img
FSSIZE= 2880
-FSDISKTYPE= floppy3
MOUNT_POINT= /mnt
MTREE= ${UTILS}/mtree.conf
RAMDISK= RAMDISK
${FS}: bsd.gz
dd if=/dev/zero of=${FS} bs=512 count=${FSSIZE}
vnconfig -v ${FS} > vnd
- disklabel -w `cat vnd` ${FSDISKTYPE}
+ echo '/ *' | disklabel -wAT- `cat vnd`
newfs -O 1 -m 0 -o space -i 524288 -c ${FSSIZE} -b 4096 -f 512 /dev/r`cat vnd`a
mount /dev/`cat vnd`a ${MOUNT_POINT}
objcopy -S -R .comment ${DESTDIR}/usr/mdec/fdboot ${.OBJDIR}/boot
-/* $OpenBSD: i386_installboot.c,v 1.45 2023/04/26 18:04:21 kn Exp $ */
+/* $OpenBSD: i386_installboot.c,v 1.46 2023/06/11 14:00:04 krw Exp $ */
/* $NetBSD: installboot.c,v 1.5 1995/11/17 23:23:50 gwr Exp $ */
/*
{
struct stat sb;
u_int8_t *secbuf;
- u_int start = 0;
+ u_int start;
/* Write patched proto bootblock(s) into the superblock. */
if (fstat(devfd, &sb) == -1)
}
/*
- * Find OpenBSD partition. Floppies are special, getting an
- * everything-in-one /boot starting at sector 0.
+ * Find bootstrap sector.
*/
- if (dl->d_type != DTYPE_FLOPPY) {
- start = findopenbsd(devfd, dl);
- if (start == (u_int)-1)
- errx(1, "no OpenBSD partition");
- }
-
- if (verbose)
+ start = findopenbsd(devfd, dl);
+ if (verbose) {
+ if (start == 0)
+ fprintf(stderr, "no MBR, ");
fprintf(stderr, "%s will be written at sector %u\n",
stage1, start);
+ }
if (start + (blksize / dl->d_secsize) > BOOTBIOS_MAXSEC)
warnx("%s extends beyond sector %u. OpenBSD might not boot.",
exit(1);
}
+/*
+ * a) For media w/o an MBR use sector 0.
+ * b) For media with an MBR and an OpenBSD (A6) partition use the first
+ * sector of the OpenBSD partition.
+ * c) For media with an MBR and no OpenBSD partition error out.
+ */
u_int
findopenbsd(int devfd, struct disklabel *dl)
{
if (verbose)
fprintf(stderr, "Traversed more than %d Extended Boot "
"Records (EBRs)\n", DOS_MAXEBR);
- return ((u_int)-1);
+ goto done;
}
if (verbose)
bcopy(secbuf, &mbr, sizeof(mbr));
free(secbuf);
- if (mbr.dmbr_sign != DOSMBR_SIGNATURE)
+ if (mbr.dmbr_sign != DOSMBR_SIGNATURE) {
+ if (mbroff == DOSBBSECTOR)
+ return 0;
errx(1, "invalid boot record signature (0x%04X) @ sector %u",
mbr.dmbr_sign, mbroff);
+ }
nextebr = 0;
for (i = 0; i < NDOSPART; i++) {
goto again;
}
- return ((u_int)-1);
+ done:
+ errx(1, "no OpenBSD partition");
}
/*