]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
2007-06-04 Robert Millan <rmh@aybabtu.com>
authorrobertmh <robertmh@localhost>
Mon, 4 Jun 2007 18:58:17 +0000 (18:58 +0000)
committerrobertmh <robertmh@localhost>
Mon, 4 Jun 2007 18:58:17 +0000 (18:58 +0000)
* conf/powerpc-ieee1275.rmk: Enable grub-mkdevicemap and grub-probe.

* include/grub/partition.h: Declare grub_apple_partition_map_init and
grub_apple_partition_map_fini.

* util/biosdisk.c
(grub_util_biosdisk_open): Replace BLKGETSIZE with BLKGETSIZE64 (needed
to access >2 TiB disks).

Print disk->total_sectors with %llu instead of %lu, since this
variable is always 64-bit (prevents wrong disk size from being displayed
on either >2 TiB disk or big-endian CPU).

(grub_util_biosdisk_get_grub_dev): Convert gpt_partition_map handling
into a generic case that supports all (sane) partition maps.

Stop using grub_cpu_to_le32() on dos_part / bsd_part since it actually
breaks big-endian.

* util/grub-probe.c: Call grub_apple_partition_map_init() before probe()
and grub_apple_partition_map_fini() after that.

ChangeLog
conf/powerpc-ieee1275.rmk
include/grub/partition.h
util/biosdisk.c
util/grub-probe.c

index 7c45c3f6e3a842728193d9919bac3bc24454abcf..9a96b58b6050128dde021502b8dbb4e9ee69e3a1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,27 @@
+2007-06-04  Robert Millan  <rmh@aybabtu.com>
+
+       * conf/powerpc-ieee1275.rmk: Enable grub-mkdevicemap and grub-probe.
+
+       * include/grub/partition.h: Declare grub_apple_partition_map_init and
+       grub_apple_partition_map_fini.
+
+       * util/biosdisk.c
+       (grub_util_biosdisk_open): Replace BLKGETSIZE with BLKGETSIZE64 (needed
+       to access >2 TiB disks).
+
+       Print disk->total_sectors with %llu instead of %lu, since this
+       variable is always 64-bit (prevents wrong disk size from being displayed
+       on either >2 TiB disk or big-endian CPU).
+
+       (grub_util_biosdisk_get_grub_dev): Convert gpt_partition_map handling
+       into a generic case that supports all (sane) partition maps.
+
+       Stop using grub_cpu_to_le32() on dos_part / bsd_part since it actually
+       breaks big-endian.
+
+       * util/grub-probe.c: Call grub_apple_partition_map_init() before probe()
+       and grub_apple_partition_map_fini() after that.
+
 2007-06-01  Robert Millan  <rmh@aybabtu.com>
 
        * util/update-grub.in: Export GRUB_CMDLINE_LINUX.
index f7b5086927a9db1ecdd0c053dc41782eff517c20..dad0a2706ffa3627a7aafe602edbe9ddf72d3a86 100644 (file)
@@ -26,14 +26,27 @@ pkgdata_PROGRAMS = kernel.elf
 
 # Utilities.
 bin_UTILITIES = grub-mkimage
+sbin_UTILITIES = grub-mkdevicemap grub-probe
 ifeq ($(enable_grub_emu), yes)
-sbin_UTILITIES = grub-emu
+sbin_UTILITIES += grub-emu
 endif
  
 # For grub-mkimage.
 grub_mkimage_SOURCES = util/powerpc/ieee1275/grub-mkimage.c util/misc.c \
         util/resolve.c 
 
+# For grub-mkdevicemap.
+grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/misc.c
+
+# For grub-probe.
+grub_probe_SOURCES = util/grub-probe.c \
+       util/biosdisk.c util/misc.c util/getroot.c      \
+       kern/device.c kern/disk.c kern/err.c kern/misc.c fs/fat.c       \
+       fs/ext2.c kern/parser.c kern/partition.c partmap/apple.c        \
+       partmap/gpt.c fs/ufs.c fs/minix.c fs/hfs.c fs/jfs.c kern/fs.c   \
+       kern/env.c fs/fshelp.c fs/xfs.c fs/affs.c fs/sfs.c fs/hfsplus.c \
+       disk/lvm.c disk/raid.c
+
 # For grub-emu
 grub_emu_DEPENDENCIES = grub_script.tab.c grub_script.tab.h            \
        grub_modules_init.h
index e09e8bf070d03ab238f0d192cd9cc66b9faa4c11..66211585734d963e08a24e972ff0eb8fe42f4c3c 100644 (file)
@@ -95,6 +95,8 @@ void grub_sun_partition_map_init (void);
 void grub_sun_partition_map_fini (void);
 void grub_gpt_partition_map_init (void);
 void grub_gpt_partition_map_fini (void);
+void grub_apple_partition_map_init (void);
+void grub_apple_partition_map_fini (void);
 #endif
 \f
 static inline grub_disk_addr_t
index c20d4e1cc8b088b47ddf70656500e7f66422e5d7..469c2b13b985915baa50d385078fd35ce5439e16 100644 (file)
@@ -60,9 +60,9 @@ struct hd_geometry
   unsigned long start;
 };
 # endif /* ! HDIO_GETGEO */
-# ifndef BLKGETSIZE
-#  define BLKGETSIZE    _IO(0x12,96)    /* return device size */
-# endif /* ! BLKGETSIZE */
+# ifndef BLKGETSIZE64
+#  define BLKGETSIZE64  _IOR(0x12,114,size_t)    /* return device size */
+# endif /* ! BLKGETSIZE64 */
 # ifndef MAJOR
 #  ifndef MINORBITS
 #   define MINORBITS   8
@@ -164,7 +164,7 @@ grub_util_biosdisk_open (const char *name, grub_disk_t disk)
   /* Get the size.  */
 #ifdef __linux__
   {
-    unsigned long nr;
+    unsigned long long nr;
     int fd;
 
     fd = open (map[drive], O_RDONLY);
@@ -177,16 +177,19 @@ grub_util_biosdisk_open (const char *name, grub_disk_t disk)
        goto fail;
       }
     
-    if (ioctl (fd, BLKGETSIZE, &nr))
+    if (ioctl (fd, BLKGETSIZE64, &nr))
       {
        close (fd);
        goto fail;
       }
 
     close (fd);
-    disk->total_sectors = nr;
+    disk->total_sectors = nr / 512;
+
+    if (nr % 512)
+      grub_util_error ("unaligned device size");
     
-    grub_util_info ("the size of %s is %lu", name, disk->total_sectors);
+    grub_util_info ("the size of %s is %llu", name, disk->total_sectors);
     
     return GRUB_ERR_NONE;
   }
@@ -730,12 +733,9 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev)
                        const grub_partition_t partition)
       {
        struct grub_pc_partition *pcdata = 0;
-       int gpt = 0;
-       
+
        if (strcmp (partition->partmap->name, "pc_partition_map") == 0)
          pcdata = partition->data;
-       else if (strcmp (partition->partmap->name, "gpt_partition_map") == 0)
-         gpt = 1;
          
        if (pcdata)
          {
@@ -747,9 +747,9 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev)
                              pcdata->dos_part, pcdata->bsd_part + 'a',
                              partition->start);
          }
-       else if (gpt)
+       else
          {
-             grub_util_info ("GPT partition %d starts from %lu",
+             grub_util_info ("Partition %d starts from %lu",
                              partition->index, partition->start);
          }
        
@@ -760,15 +760,10 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev)
                dos_part = pcdata->dos_part;
                bsd_part = pcdata->bsd_part;
              }
-           else if (gpt)
-             {
-               dos_part = grub_cpu_to_le32 (partition->index);
-               bsd_part = grub_cpu_to_le32 (-1);
-             }
            else
              {
-               dos_part = 0;
-               bsd_part = 0;
+               dos_part = partition->index;
+               bsd_part = -1;
              }
            return 1;
          }
index 29d0d0a4f6368f38dfdfaa137c0e473f9c8be7a0..26c47f243d81eb7cba99c27b8ba18e1cfbe3e831 100644 (file)
@@ -261,6 +261,7 @@ main (int argc, char *argv[])
   grub_util_biosdisk_init (dev_map ? : DEFAULT_DEVICE_MAP);
   grub_pc_partition_map_init ();
   grub_gpt_partition_map_init ();
+  grub_apple_partition_map_init ();
   grub_raid_init ();
   grub_lvm_init ();
   
@@ -286,6 +287,7 @@ main (int argc, char *argv[])
   grub_lvm_fini ();
   grub_raid_fini ();
   grub_gpt_partition_map_fini ();
+  grub_apple_partition_map_fini ();
   grub_pc_partition_map_fini ();
   grub_util_biosdisk_fini ();