DragonFly kernel List (threaded) for 2008-07
DragonFly BSD
DragonFly kernel List (threaded) for 2008-07
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Ultra nasty hack made to 'gpt' for booting support.


From: Matthew Dillon <dillon@xxxxxxxxxxxxxxxxxxxx>
Date: Tue, 29 Jul 2008 18:04:18 -0700 (PDT)

    I've made a really ultra-nasty hack to gpt to make it possible to boot
    from a gpt, but there are some issues:

    * We don't have an EFI boot yet, so this hack probably only works on
      non-EFI BIOSes (which are most of them).

    * There are a lot of steps to making this thing actually boot.   Very
      little of it is automated or cleaned up yet.

    Here's how it works (using da8 as an example):

    * Destroy any previous gpt or mbr on the disk so you can start fresh.

      dd if=/dev/zero of=/dev/da8 bs=512 count=4

    * Create a fresh gpt for the disk. 

      gpt create da8

    * Create the hacked up special boot partition.  It must be partition 0
      and it will complain if you already have a gpt partition 0:

      gpt boot da8

    * Create a disklabel32 on the boot partition and set up the boot
      filesystem.

      disklabel -B -r -w da8s0 auto
      disklabel -e da8s0
      (add the 'a' partition)

      newfs /dev/da8s0a
      mount /dev/da8s0a /mnt
      cpdup /boot /mnt/boot
      cp /kernel /mnt/kernel

      vi /mnt/boot/loader.conf 
      (add the rootmount line)

	  vfs.root.mountfrom="ufs:da8s1a"

      umount /mnt

    * Add a gpt partition for your root.  This will use up the entire
      remainder of the disk:

      gpt add da8

    * For the moment the root partition does have to be disklabeled, until
      I (or someone) fixed the kernel to allow just a slice to be specified.
      You CAN use either a 32 or a 64 bit disklabel here, and no boot
      blocks are needed (or supported):

      disklabel64 -r -w da1s1 auto
      disklabel64 -e da1s1
      (add the 'a' partition)
      mount /dev/da1s1a /mnt
      cpdup / /mnt
      umount /mnt

    And that's it.  When the machine boots up the loader will see the boot
    partition as a MBR slice, and the kernel will see that whole disk as a
    GPT disk.

    I think it will work with a HAMMER root but I haven't tested that
    yet.

    This may not work on all boxes, and it should be considered HIGHLY
    EXPERIMENTAL.

    --

    If someone would like to take on some easy loader and kernel projects,

    * We want to fix the loader so the boot partition does not have to be
      disklabeled, and

    * We want to fix the kernel so the root partition (specified in the
      vfs.root.mountfrom kernel load variable) does not have to be
      disklabeled.

    This is pretty cool, I have one of my test boxes booting from a USB
    key which I've GPT-partitioned using this hack.

						-Matt




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