On x86: $ /usr/mdec/installboot -n -v /boot /usr/mdec/biosboot sd0 boot: /boot proto: /usr/mdec/biosboot device: /dev/rsd0c /boot is 5 blocks x 16384 bytes fs block shift 2; part offset 63; inode block 112, offset 3496 master boot record (MBR) at sector 0 partition 3: type 0xA6 offset 63 size 293041602 /boot will be written at sector 63
That last line is misleading. It is biosboot that is written to sector 63, not /boot. While there, I noticed that loadproto() also puts the wrong file into some error messages. ok? Index: arch/amd64/stand/installboot/installboot.c =================================================================== RCS file: /cvs/src/sys/arch/amd64/stand/installboot/installboot.c,v retrieving revision 1.24 diff -u -p -r1.24 installboot.c --- arch/amd64/stand/installboot/installboot.c 13 Nov 2011 14:52:30 -0000 1.24 +++ arch/amd64/stand/installboot/installboot.c 5 Jan 2013 18:09:55 -0000 @@ -235,7 +235,7 @@ write_bootblocks(int devfd, struct diskl /* * Find OpenBSD partition. Floppies are special, getting an - * everything-in-one /boot starting at sector 0. + * everything-in-one biosboot starting at sector 0. */ if (dl->d_type != DTYPE_FLOPPY) { start = findopenbsd(devfd, dl); @@ -244,11 +244,12 @@ write_bootblocks(int devfd, struct diskl } if (verbose) - fprintf(stderr, "/boot will be written at sector %u\n", start); + fprintf(stderr, "%s will be written at sector %u\n", proto, + start); if (start + (protosize / dl->d_secsize) > BOOTBIOS_MAXSEC) - warnx("/boot extends beyond sector %u. OpenBSD might not boot.", - BOOTBIOS_MAXSEC); + warnx("%s extends beyond sector %u. OpenBSD might not boot.", + proto, BOOTBIOS_MAXSEC); if (!nowrite) { if (lseek(devfd, (off_t)start * dl->d_secsize, SEEK_SET) < 0) @@ -352,7 +353,7 @@ loadproto(char *fname, long *size) if (!IS_ELF(eh)) errx(1, "%s: bad magic: 0x%02x%02x%02x%02x", - boot, + fname, eh.e_ident[EI_MAG0], eh.e_ident[EI_MAG1], eh.e_ident[EI_MAG2], eh.e_ident[EI_MAG3]); @@ -365,7 +366,7 @@ loadproto(char *fname, long *size) /* Program load header. */ if (eh.e_phnum != 1) errx(1, "%s: %u ELF load sections (only support 1)", - boot, eh.e_phnum); + fname, eh.e_phnum); phsize = eh.e_phnum * sizeof(Elf_Phdr); ph = malloc(phsize); @@ -375,7 +376,7 @@ loadproto(char *fname, long *size) lseek(fd, eh.e_phoff, SEEK_SET); if (read(fd, ph, phsize) != phsize) - errx(1, "%s: can't read header", boot); + errx(1, "%s: can't read header", fname); tdsize = ph->p_filesz; Index: arch/i386/stand/installboot/installboot.c =================================================================== RCS file: /cvs/src/sys/arch/i386/stand/installboot/installboot.c,v retrieving revision 1.67 diff -u -p -r1.67 installboot.c --- arch/i386/stand/installboot/installboot.c 13 Nov 2011 14:52:30 -0000 1.67 +++ arch/i386/stand/installboot/installboot.c 5 Jan 2013 18:17:02 -0000 @@ -231,7 +231,7 @@ write_bootblocks(int devfd, struct diskl /* * Find OpenBSD partition. Floppies are special, getting an - * everything-in-one /boot starting at sector 0. + * everything-in-one biosboot starting at sector 0. */ if (dl->d_type != DTYPE_FLOPPY) { start = findopenbsd(devfd, dl); @@ -240,11 +240,12 @@ write_bootblocks(int devfd, struct diskl } if (verbose) - fprintf(stderr, "/boot will be written at sector %u\n", start); + fprintf(stderr, "%s will be written at sector %u\n", proto, + start); if (start + (protosize / dl->d_secsize) > BOOTBIOS_MAXSEC) - warnx("/boot extends beyond sector %u. OpenBSD might not boot.", - BOOTBIOS_MAXSEC); + warnx("%s extends beyond sector %u. OpenBSD might not boot.", + proto, BOOTBIOS_MAXSEC); if (!nowrite) { if (lseek(devfd, (off_t)start * dl->d_secsize, SEEK_SET) < 0) @@ -348,7 +349,7 @@ loadproto(char *fname, long *size) if (!IS_ELF(eh)) errx(1, "%s: bad magic: 0x%02x%02x%02x%02x", - boot, + fname, eh.e_ident[EI_MAG0], eh.e_ident[EI_MAG1], eh.e_ident[EI_MAG2], eh.e_ident[EI_MAG3]); @@ -361,7 +362,7 @@ loadproto(char *fname, long *size) /* Program load header. */ if (eh.e_phnum != 1) errx(1, "%s: %u ELF load sections (only support 1)", - boot, eh.e_phnum); + fname, eh.e_phnum); phsize = eh.e_phnum * sizeof(Elf_Phdr); ph = malloc(phsize); @@ -371,7 +372,7 @@ loadproto(char *fname, long *size) lseek(fd, eh.e_phoff, SEEK_SET); if (read(fd, ph, phsize) != phsize) - errx(1, "%s: can't read header", boot); + errx(1, "%s: can't read header", fname); tdsize = ph->p_filesz; -- Christian "naddy" Weisgerber na...@mips.inka.de