Current-Users archive

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

Re: i386/amd64 image generated trough mkimage stuck on primary bootsrap at boot



On Thursday, July 7th, 2022 at 11:25 PM, Mike Pumford <mpumford%mudcovered.org.uk@localhost> wrote:

> On 07/07/2022 15:40, br0nko wrote:
>
> > Hi,
> >
> > 0: NetBSD (sysid 169)
> > start 63, size 1568384 (766 MB, Cyls 0/1/1-97/160/62), Active
> > beg: cylinder 0, head 1, sector 1
> > end: cylinder 97, head 160, sector 62
> > Information from PBR:
> > Not bootable: All bytes are identical (0x00)
> > Not bootable: Bad magic number (0x0000)
>
> No MBR boot code in the partition table.
>
> fdisk -i /dev/rvnd0
>
> should resolve that I think.

I did give a try, using an amd64 mkimage image build from current tree (9.99.98/amd64):

=====================================================================
bash-5.1# vndconfig vnd0 example-amd64-image.img
bash-5.1# fdisk -vv /dev/rvnd0
Disk: /dev/rvnd0
NetBSD disklabel disk geometry:
cylinders: 1157, heads: 64, sectors/track: 32 (2048 sectors/cylinder)
total sectors: 2369536, bytes/sector: 512

BIOS disk geometry:
cylinders: 148, heads: 255, sectors/track: 63 (16065 sectors/cylinder)
total sectors: 2369536

Partitions aligned to 2048 sector boundaries, offset 63

Partition table:
0: NetBSD (sysid 169)
    start 63, size 2312129 (1129 MB, Cyls 0/1/1-143/236/29), Active
        beg: cylinder    0, head   1, sector  1
        end: cylinder  143, head 236, sector 29
        Information from PBR:
            Not bootable: All bytes are identical (0x00)
            Not bootable: Bad magic number (0x0000)
1: <UNUSED> (sysid 0)
    start 0, size 0
        beg: cylinder    0, head   0, sector  0
        end: cylinder    0, head   0, sector  0
2: <UNUSED> (sysid 0)
    start 0, size 0
        beg: cylinder    0, head   0, sector  0
        end: cylinder    0, head   0, sector  0
3: <UNUSED> (sysid 0)
    start 0, size 0
        beg: cylinder    0, head   0, sector  0
        end: cylinder    0, head   0, sector  0
First active partition: 0
Drive serial number: 0 (0x00000000)

bash-5.1# disklabel  /dev/rvnd0
# /dev/rvnd0:
type: SCSI
disk: STORAGE DEVICE
label: fictitious
flags: removable
bytes/sector: 512
sectors/track: 32
tracks/cylinder: 64
sectors/cylinder: 2048
cylinders: 1157
total sectors: 2369536
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0           # microseconds
track-to-track seek: 0  # microseconds
drivedata: 0

8 partitions:
#        size    offset     fstype [fsize bsize cpg/sgs]
 a:   2369473        63     4.2BSD      0     0     0  # (Cyl.      0*-   1156)
 c:   2312129        63     unused      0     0        # (Cyl.      0*-   1128)
 d:   2369536         0     unused      0     0        # (Cyl.      0 -   1156)


bash-5.1# fdisk -i /dev/rvnd0
Update the bootcode from /usr/mdec/mbr? [n] y

We haven't written the MBR back to disk yet.  This is your last chance.
Should we write new partition table? [n] y

=====================================================================

Testing in qemu, I get "NetBSD MBR boot / Error No operating system"

fdisk look the same:


=====================================================================
bash-5.1# fdisk -vv /dev/rvnd0
Disk: /dev/rvnd0
NetBSD disklabel disk geometry:
cylinders: 1157, heads: 64, sectors/track: 32 (2048 sectors/cylinder)
total sectors: 2369536, bytes/sector: 512

BIOS disk geometry:
cylinders: 148, heads: 255, sectors/track: 63 (16065 sectors/cylinder)
total sectors: 2369536

Partitions aligned to 2048 sector boundaries, offset 63

Partition table:
0: NetBSD (sysid 169)
    start 63, size 2312129 (1129 MB, Cyls 0/1/1-143/236/29), Active
        beg: cylinder    0, head   1, sector  1
        end: cylinder  143, head 236, sector 29
        Information from PBR:
            Not bootable: All bytes are identical (0x00)
            Not bootable: Bad magic number (0x0000)
1: <UNUSED> (sysid 0)
    start 0, size 0
        beg: cylinder    0, head   0, sector  0
        end: cylinder    0, head   0, sector  0
2: <UNUSED> (sysid 0)
    start 0, size 0
        beg: cylinder    0, head   0, sector  0
        end: cylinder    0, head   0, sector  0
3: <UNUSED> (sysid 0)
    start 0, size 0
        beg: cylinder    0, head   0, sector  0
        end: cylinder    0, head   0, sector  0
Bootselector disabled.
First active partition: 0
Drive serial number: 0 (0x00000000)
=====================================================================

Reinstalling primary bootstrap show a better fdisk output:

=====================================================================
bash-5.1# installboot -v -o timeout=5 /dev/rvnd0a /usr/mdec/bootxx_ffsv1
File system:         /dev/rvnd0a
Primary bootstrap:   /usr/mdec/bootxx_ffsv1
Ignoring PBR with invalid magic in sector 0 of `/dev/rvnd0a'
Boot options:        timeout 5, flags 0, speed 9600, ioaddr 0, console pc

Disk: /dev/rvnd0
NetBSD disklabel disk geometry:
cylinders: 1157, heads: 64, sectors/track: 32 (2048 sectors/cylinder)
total sectors: 2369536, bytes/sector: 512

BIOS disk geometry:
cylinders: 148, heads: 255, sectors/track: 63 (16065 sectors/cylinder)
total sectors: 2369536

Partitions aligned to 2048 sector boundaries, offset 63

Partition table:
0: NetBSD (sysid 169)
    start 63, size 2312129 (1129 MB, Cyls 0/1/1-143/236/29), Active
        beg: cylinder    0, head   1, sector  1
        end: cylinder  143, head 236, sector 29
        Information from PBR:
            PBR appears to be bootable
            OEM name: "NetBSD60"
1: <UNUSED> (sysid 0)
    start 0, size 0
        beg: cylinder    0, head   0, sector  0
        end: cylinder    0, head   0, sector  0
2: <UNUSED> (sysid 0)
    start 0, size 0
        beg: cylinder    0, head   0, sector  0
        end: cylinder    0, head   0, sector  0
3: <UNUSED> (sysid 0)
    start 0, size 0
        beg: cylinder    0, head   0, sector  0
        end: cylinder    0, head   0, sector  0
Bootselector disabled.
First active partition: 0
Drive serial number: 0 (0x00000000)
=====================================================================

Testing in qemu, I'm back to the original problem and stuck on primary bootstrap.
Either I'm missing one option to parse to the mkimage script to make the image bootable or there might be a trick to post proces the image afterward so that it can boot.
Image generated trough "build.sh live-image" work out the box:

bash-5.1# vndconfig vnd1 NetBSD-9.2-amd64-live.img
bash-5.1# fdisk -vv /dev/rvnd1
Disk: /dev/rvnd1
NetBSD disklabel disk geometry:
cylinders: 1536, heads: 64, sectors/track: 32 (2048 sectors/cylinder)
total sectors: 3145728, bytes/sector: 512

BIOS disk geometry:
cylinders: 196, heads: 255, sectors/track: 63 (16065 sectors/cylinder)
total sectors: 3145728

Partitions aligned to 2048 sector boundaries, offset 2048

Partition table:
0: NetBSD (sysid 169)
    start 2048, size 3143680 (1535 MB, Cyls 0/32/33-195/207/12), Active
        beg: cylinder    0, head  32, sector 33
        end: cylinder  195, head 207, sector 12
        Information from PBR:
            PBR appears to be bootable
            OEM name: "NetBSD60"
1: <UNUSED> (sysid 0)
    start 0, size 0
        beg: cylinder    0, head   0, sector  0
        end: cylinder    0, head   0, sector  0
2: <UNUSED> (sysid 0)
    start 0, size 0
        beg: cylinder    0, head   0, sector  0
        end: cylinder    0, head   0, sector  0
3: <UNUSED> (sysid 0)
    start 0, size 0
        beg: cylinder    0, head   0, sector  0
        end: cylinder    0, head   0, sector  0
Bootselector disabled.
First active partition: 0
Drive serial number: 0 (0x00000000)

bash-5.1# disklabel /dev/rvnd1
# /dev/rvnd1:
type: ESDI
disk: image
label:
flags:
bytes/sector: 512
sectors/track: 32
tracks/cylinder: 64
sectors/cylinder: 2048
cylinders: 1536
total sectors: 3145728
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0           # microseconds
track-to-track seek: 0  # microseconds
drivedata: 0

8 partitions:
#        size    offset     fstype [fsize bsize cpg/sgs]
 a:   2881536      2048     4.2BSD   1024  8192    16  # (Cyl.      1 -   1407)
 b:    262144   2883584       swap                     # (Cyl.   1408 -   1535)
 c:   3143680      2048     unused      0     0        # (Cyl.      1 -   1535)
 d:   3145728         0     unused      0     0        # (Cyl.      0 -   1535)

br0nko






Home | Main Index | Thread Index | Old Index