NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: port-amd64/54430: installboot(8) fails with GPT PMBR



The following reply was made to PR port-amd64/54430; it has been noted by GNATS.

From: Martin Husemann <martin%netbsd.org@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: port-amd64/54430: installboot(8) fails with GPT PMBR
Date: Sat, 3 Aug 2019 11:41:20 +0000

 Ok, not my fault directly - dk0 was configured at the point of failure,
 and installboot does it's thing:
 
 (gdb) 
 416             if (!(params->flags & IB_FORCE)) {
 (gdb) 
 423                     if (bootstrap.b[0] != 0xeb || bootstrap.b[2] != 0x90) {
 (gdb) p bootstrap.b[0]
 $2 = 235 '\353'
 (gdb) p/x bootstrap.b[0]
 $3 = 0xeb
 (gdb) p/x bootstrap.b[2]
 $4 = 0x90
 (gdb) n
 439                     if (disk_buf.b[0] == 0xeb && disk_buf.b[1] >= 9 &&
 (gdb) p/x disk_buf.b[0]
 $5 = 0xeb
 (gdb) p/x disk_buf.b[1]
 $6 = 0x3c
 (gdb) n
 441                         !is_zero(disk_buf.b + 3 + 8, disk_buf.b[1] - 1 - 8)) {
 (gdb) 
 440                         disk_buf.b[2] == 0x90 &&
 (gdb) 
 444                             u = le16toh(bpb->bpbBytesPerSec)
 (gdb) 
 445                                 * le16toh(bpb->bpbResSectors);
 (gdb) 
 446                             if (u != 0 && u < params->s1stat.st_size) {
 (gdb) p u
 $7 = 512
 (gdb) p params->s1stat.st_size
 $8 = 6656
 (gdb) n
 447                                     warnx("Insufficient reserved space before FAT "
 
 
 (in usr.sbin/installboot/arch/i386.c)
 
 Doing
 
  # dd if=/dev/zero of=/dev/rdk0 bs=1m count=10
 
 before the installboot makes it work. I guess there could be better checks
 for more magic values (apparently this is random stuff on the disk midway
 inside some old partition that got removed and the new added).
 
 I will make sysinst do something like that on all partitions it requires for
 booting (and also the whole disk, when we are creating partitions from
 scratch).
 
 Martin
 


Home | Main Index | Thread Index | Old Index