NetBSD-Users archive

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

Re: GPT BIOS boot



Greg Troxel <gdt%lexort.com@localhost> wrote:

> You could add a third thing that tries
> 
>    RF_PROTECTED_SECTORS + /* XXX typical first GPT place */ 64
> 
> and rebuild.  Or add something that parses gpt to find the right
> partition, logically matching what the mbr code.

See at the end of message for the change I did. The putstr tells me 

NetBSD/x86 ffsv2 Primary Bootstrap
try +RF_PROTECTED_SECTORS
try +GPT_PROTECTED_SECTORS                             
found!                       

Then the secondary bootstrap launches, which is an improvement.
Unfortunately it seems unable to see files in the RAID volume. It does
not load boot.cfg and ls shows nothing.

> dev
disk hd0 size 5589 GB
  hd0a(unknown) hd0b(RAID) hd0c(swap)
disk hd1 size 5589 GB
  hd1a(unknown) hd1b(RAID) hd1c(swap)
disk hd2 size 15 GB
  hd2a(4.2BSD)
disk fd0
  fd0a
disk fd1
  fd1a    
> dev hd0b:
> ls
ls: No such file or directory 
> dev hd1b:
> ls
ls: No such file or directory  
                                                          

--- boot1.c     6 Jan 2011 01:08:48 -0000       1.20
+++ boot1.c     30 May 2019 00:47:18 -0000
@@ -85,12 +85,30 @@
         * add in size of raidframe header and try again.
         * (Maybe this should only be done if the filesystem
         * magic number is absent.)
         */
+       putstr("try +RF_PROTECTED_SECTORS\n");
        bios_sector += RF_PROTECTED_SECTORS;
        fd = ob();
        if (fd != -1)
                goto done;
+
+       /* 
+        * Try to skip a GPT at the beginning of a raid set.
+        * The layout is as below, with 34 sectors to skip:
+        *     start         size  index  contents
+        *         0            1         PMBR (active)
+        *         1            1         Pri GPT header
+        *         2           32         Pri GPT table
+         *        34      .......         GPT part - NetBSD FFSv1/FFSv2
+        */
+       #define GPT_PROTECTED_SECTORS 34
+       putstr("try +GPT_PROTECTED_SECTORS\n");
+       bios_sector += GPT_PROTECTED_SECTORS;
+       fd = ob();
+       if (fd != -1)
+               goto done;
+       putstr("try disklabel\n");
        /*
         * Nothing at the start of the MBR partition, fallback on
         * partition 'a' from the disklabel in this MBR partition.
         */
@@ -108,8 +126,9 @@
 done:
        /* if we fail here, so will fstat, so keep going */
        if (fd == -1 || fstat(fd, &sb) == -1)
                return "Can't open /boot\r\n";
+       putstr("found!\n");
 
        biosdev = (uint32_t)sb.st_size;
 #if 0
        if (biosdev > SECONDARY_MAX_LOAD)



-- 
Emmanuel Dreyfus
http://hcpnet.free.fr/pubz
manu%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index