Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

update missing files grub

  • Loading branch information...
commit 97f395aed309a438e30c95a37b7e496d2b0ef2d6 1 parent c763612
@golodhrim golodhrim authored
View
12 sys-boot/grub/files/1.99-call_proper_grub_probe.patch
@@ -0,0 +1,12 @@
+diff -urN grub-1.99/util/grub.d/30_os-prober.in grub-1.99.new/util/grub.d/30_os-prober.in
+--- grub-1.99/util/grub.d/30_os-prober.in 2010-12-25 18:13:57.000000000 +0100
++++ grub-1.99.new/util/grub.d/30_os-prober.in 2011-08-28 12:35:40.965038455 +0200
+@@ -168,7 +168,7 @@
+ done
+ ;;
+ macosx)
+- OSXUUID="`grub-probe --target=fs_uuid --device ${DEVICE} 2> /dev/null`"
++ OSXUUID="`${grub_probe} --target=fs_uuid --device ${DEVICE} 2> /dev/null`"
+ osx_entry xnu_kernel 32
+ osx_entry xnu_kernel64 64
+ ;;
View
65 sys-boot/grub/files/1.99-do_not_stat_so_often.patch
@@ -0,0 +1,65 @@
+--- grub-core/kern/emu/getroot.c 2011-05-18 07:35:47 +0000
++++ grub-core/kern/emu/getroot.c 2011-05-21 05:03:55 +0000
+@@ -358,7 +358,7 @@
+
+ if (S_ISLNK (st.st_mode)) {
+ #ifdef __linux__
+- if (strcmp (dir, "mapper") == 0) {
++ if (strcmp (dir, "mapper") == 0 || strcmp (dir, "/dev/mapper") == 0) {
+ /* Follow symbolic links under /dev/mapper/; the canonical name
+ may be something like /dev/dm-0, but the names under
+ /dev/mapper/ are more human-readable and so we prefer them if
+@@ -609,20 +609,27 @@
+
+ if (os_dev)
+ {
+- if (stat (os_dev, &st) >= 0)
+- dev = st.st_rdev;
+- else
++ char *tmp = os_dev;
++ os_dev = canonicalize_file_name (os_dev);
++ free (tmp);
++ }
++
++ if (os_dev)
++ {
++ if (strncmp (os_dev, "/dev/dm-", sizeof ("/dev/dm-") - 1) != 0)
++ return os_dev;
++ if (stat (os_dev, &st) < 0)
+ grub_util_error ("cannot stat `%s'", os_dev);
+ free (os_dev);
+- }
+- else
+- {
+- if (stat (dir, &st) >= 0)
+- dev = st.st_dev;
+- else
+- grub_util_error ("cannot stat `%s'", dir);
+- }
+-
++ dev = st.st_rdev;
++ return grub_find_device ("/dev/mapper", dev);
++ }
++
++ if (stat (dir, &st) < 0)
++ grub_util_error ("cannot stat `%s'", dir);
++
++ dev = st.st_dev;
++
+ #ifdef __CYGWIN__
+ /* Cygwin specific function. */
+ os_dev = grub_find_device (dir, dev);
+
+--- grub-core/kern/emu/hostdisk.c 2011-05-18 07:35:47 +0000
++++ grub-core/kern/emu/hostdisk.c 2011-05-21 05:03:55 +0000
+@@ -1408,7 +1408,8 @@
+ if (tree)
+ dm_tree_free (tree);
+ free (path);
+- char *ret = grub_find_device (NULL, (major << 8) | minor);
++ char *ret = grub_find_device ("/dev/mapper",
++ (major << 8) | minor);
+ return ret;
+ }
+
+
View
279 sys-boot/grub/files/1.99-improve_devmapper.patch
@@ -0,0 +1,279 @@
+--- grub-core/kern/emu/getroot.c 2011-04-21 09:26:29 +0000
++++ grub-core/kern/emu/getroot.c 2011-05-18 07:35:47 +0000
+@@ -34,6 +34,10 @@
+ #include <stdint.h>
+ #include <grub/util/misc.h>
+
++#ifdef HAVE_DEVICE_MAPPER
++# include <libdevmapper.h>
++#endif
++
+ #ifdef __GNU__
+ #include <hurd.h>
+ #include <hurd/lookup.h>
+@@ -634,32 +638,65 @@
+ }
+
+ static int
+-grub_util_is_dmraid (const char *os_dev)
++grub_util_is_lvm (const char *os_dev)
+ {
+- if (! strncmp (os_dev, "/dev/mapper/nvidia_", 19))
+- return 1;
+- else if (! strncmp (os_dev, "/dev/mapper/isw_", 16))
+- return 1;
+- else if (! strncmp (os_dev, "/dev/mapper/hpt37x_", 19))
+- return 1;
+- else if (! strncmp (os_dev, "/dev/mapper/hpt45x_", 19))
+- return 1;
+- else if (! strncmp (os_dev, "/dev/mapper/via_", 16))
+- return 1;
+- else if (! strncmp (os_dev, "/dev/mapper/lsi_", 16))
+- return 1;
+- else if (! strncmp (os_dev, "/dev/mapper/pdc_", 16))
+- return 1;
+- else if (! strncmp (os_dev, "/dev/mapper/jmicron_", 20))
+- return 1;
+- else if (! strncmp (os_dev, "/dev/mapper/asr_", 16))
+- return 1;
+- else if (! strncmp (os_dev, "/dev/mapper/sil_", 16))
+- return 1;
+- else if (! strncmp (os_dev, "/dev/mapper/ddf1_", 17))
+- return 1;
+-
+- return 0;
++ if ((strncmp ("/dev/mapper/", os_dev, 12) != 0))
++ return 0;
++
++#ifdef HAVE_DEVICE_MAPPER
++ {
++ struct dm_tree *tree;
++ uint32_t maj, min;
++ struct dm_tree_node *node = NULL;
++ const char *node_uuid;
++ struct stat st;
++
++ if (stat (os_dev, &st) < 0)
++ return 0;
++
++ tree = dm_tree_create ();
++ if (! tree)
++ {
++ grub_printf ("Failed to create tree\n");
++ grub_dprintf ("hostdisk", "dm_tree_create failed\n");
++ return 0;
++ }
++
++ maj = major (st.st_rdev);
++ min = minor (st.st_rdev);
++
++ if (! dm_tree_add_dev (tree, maj, min))
++ {
++ grub_dprintf ("hostdisk", "dm_tree_add_dev failed\n");
++ dm_tree_free (tree);
++ return 0;
++ }
++
++ node = dm_tree_find_node (tree, maj, min);
++ if (! node)
++ {
++ grub_dprintf ("hostdisk", "dm_tree_find_node failed\n");
++ dm_tree_free (tree);
++ return 0;
++ }
++ node_uuid = dm_tree_node_get_uuid (node);
++ if (! node_uuid)
++ {
++ grub_dprintf ("hostdisk", "%s has no DM uuid\n", os_dev);
++ dm_tree_free (tree);
++ return 0;
++ }
++ if (strncmp (node_uuid, "LVM-", 4) != 0)
++ {
++ dm_tree_free (tree);
++ return 0;
++ }
++ dm_tree_free (tree);
++ return 1;
++ }
++#else
++ return 1;
++#endif /* HAVE_DEVICE_MAPPER */
+ }
+
+ int
+@@ -671,13 +708,11 @@
+ return GRUB_DEV_ABSTRACTION_NONE;
+
+ /* Check for LVM. */
+- if (!strncmp (os_dev, "/dev/mapper/", 12)
+- && ! grub_util_is_dmraid (os_dev)
+- && strncmp (os_dev, "/dev/mapper/mpath", 17) != 0)
++ if (grub_util_is_lvm (os_dev))
+ return GRUB_DEV_ABSTRACTION_LVM;
+
+ /* Check for RAID. */
+- if (!strncmp (os_dev, "/dev/md", 7))
++ if (!strncmp (os_dev, "/dev/md", 7) && ! grub_util_device_is_mapped (os_dev))
+ return GRUB_DEV_ABSTRACTION_RAID;
+ #endif
+
+
+=== modified file 'grub-core/kern/emu/hostdisk.c'
+--- grub-core/kern/emu/hostdisk.c 2011-05-09 16:59:35 +0000
++++ grub-core/kern/emu/hostdisk.c 2011-05-18 07:35:47 +0000
+@@ -24,6 +24,7 @@
+ #include <grub/err.h>
+ #include <grub/emu/misc.h>
+ #include <grub/emu/hostdisk.h>
++#include <grub/emu/getroot.h>
+ #include <grub/misc.h>
+ #include <grub/i18n.h>
+ #include <grub/list.h>
+@@ -331,18 +332,23 @@
+ return GRUB_ERR_NONE;
+ }
+
++int
++grub_util_device_is_mapped (const char *dev)
++{
+ #ifdef HAVE_DEVICE_MAPPER
+-static int
+-device_is_mapped (const char *dev)
+-{
+ struct stat st;
+
++ if (!grub_device_mapper_supported ())
++ return 0;
++
+ if (stat (dev, &st) < 0)
+ return 0;
+
+ return dm_is_dm_major (major (st.st_rdev));
++#else
++ return 0;
++#endif /* HAVE_DEVICE_MAPPER */
+ }
+-#endif /* HAVE_DEVICE_MAPPER */
+
+ #if defined (__FreeBSD__) || defined(__FreeBSD_kernel__)
+ /* FIXME: geom actually gives us the whole container hierarchy.
+@@ -418,7 +424,7 @@
+ # endif /* !defined(HAVE_DIOCGDINFO) */
+
+ # ifdef HAVE_DEVICE_MAPPER
+- if (grub_device_mapper_supported () && device_is_mapped (dev)) {
++ if (grub_util_device_is_mapped (dev)) {
+ struct dm_task *task = NULL;
+ grub_uint64_t start, length;
+ char *target_type, *params, *space;
+@@ -1149,6 +1155,54 @@
+ return ret;
+ }
+
++#ifdef HAVE_DEVICE_MAPPER
++static int
++grub_util_get_dm_node_linear_info (const char *dev,
++ int *maj, int *min)
++{
++ struct dm_task *dmt;
++ void *next = NULL;
++ uint64_t length, start;
++ char *target, *params;
++ char *ptr;
++ int major, minor;
++
++ dmt = dm_task_create(DM_DEVICE_TABLE);
++ if (!dmt)
++ return 0;
++
++ if (!dm_task_set_name(dmt, dev))
++ return 0;
++ dm_task_no_open_count(dmt);
++ if (!dm_task_run(dmt))
++ return 0;
++ next = dm_get_next_target(dmt, next, &start, &length,
++ &target, &params);
++ if (grub_strcmp (target, "linear") != 0)
++ return 0;
++ major = grub_strtoul (params, &ptr, 10);
++ if (grub_errno)
++ {
++ grub_errno = GRUB_ERR_NONE;
++ return 0;
++ }
++ if (*ptr != ':')
++ return 0;
++ ptr++;
++ minor = grub_strtoul (ptr, 0, 10);
++ if (grub_errno)
++ {
++ grub_errno = GRUB_ERR_NONE;
++ return 0;
++ }
++ if (maj)
++ *maj = major;
++ if (min)
++ *min = minor;
++ return 1;
++}
++#endif
++
+ static char *
+ convert_system_partition_to_system_disk (const char *os_dev, struct stat *st)
+ {
+@@ -1325,9 +1379,39 @@
+ node = NULL;
+ goto devmapper_out;
+ }
+- else if (strncmp (node_uuid, "DMRAID-", 7) != 0)
+- {
++ if (strncmp (node_uuid, "LVM-", 4) == 0)
++ {
++ grub_dprintf ("hostdisk", "%s is an LVM\n", path);
++ node = NULL;
++ goto devmapper_out;
++ }
++ if (strncmp (node_uuid, "mpath-", 6) == 0)
++ {
++ /* Multipath partitions have partN-mpath-* UUIDs, and are
++ linear mappings so are handled by
++ grub_util_get_dm_node_linear_info. Multipath disks are not
++ linear mappings and must be handled specially. */
++ grub_dprintf ("hostdisk", "%s is a multipath disk\n", path);
++ mapper_name = dm_tree_node_get_name (node);
++ goto devmapper_out;
++ }
++ if (strncmp (node_uuid, "DMRAID-", 7) != 0)
++ {
++ int major, minor;
++ const char *node_name;
+ grub_dprintf ("hostdisk", "%s is not DM-RAID\n", path);
++
++ if ((node_name = dm_tree_node_get_name (node))
++ && grub_util_get_dm_node_linear_info (node_name,
++ &major, &minor))
++ {
++ if (tree)
++ dm_tree_free (tree);
++ free (path);
++ char *ret = grub_find_device (NULL, (major << 8) | minor);
++ return ret;
++ }
++
+ node = NULL;
+ goto devmapper_out;
+ }
+
+--- include/grub/emu/misc.h 2010-12-02 13:26:46 +0000
++++ include/grub/emu/misc.h 2011-05-18 07:35:47 +0000
+@@ -54,6 +54,8 @@
+
+ char *grub_make_system_path_relative_to_its_root (const char *path)
+ __attribute__ ((warn_unused_result));
++int
++grub_util_device_is_mapped (const char *dev);
+
+ void * EXPORT_FUNC(xmalloc) (grub_size_t size) __attribute__ ((warn_unused_result));
+ void * EXPORT_FUNC(xrealloc) (void *ptr, grub_size_t size) __attribute__ ((warn_unused_result));
+
View
21 sys-boot/grub/files/1.99-stat_root_device_properly-p1.patch
@@ -0,0 +1,21 @@
+--- grub-core/kern/emu/getroot.c 2011-05-21 05:03:55 +0000
++++ grub-core/kern/emu/getroot.c 2011-06-23 17:50:41 +0000
+@@ -616,13 +616,15 @@
+
+ if (os_dev)
+ {
+- if (strncmp (os_dev, "/dev/dm-", sizeof ("/dev/dm-") - 1) != 0)
++ int dm = (strncmp (os_dev, "/dev/dm-", sizeof ("/dev/dm-") - 1) == 0);
++ int root = (strcmp (os_dev, "/dev/root") == 0);
++ if (!dm && !root)
+ return os_dev;
+ if (stat (os_dev, &st) < 0)
+ grub_util_error ("cannot stat `%s'", os_dev);
+ free (os_dev);
+ dev = st.st_rdev;
+- return grub_find_device ("/dev/mapper", dev);
++ return grub_find_device (dm ? "/dev/mapper" : "/dev", dev);
+ }
+
+ if (stat (dir, &st) < 0)
+
View
21 sys-boot/grub/files/1.99-stat_root_device_properly-p2.patch
@@ -0,0 +1,21 @@
+--- grub-core/kern/emu/getroot.c 2011-06-23 17:50:41 +0000
++++ grub-core/kern/emu/getroot.c 2011-06-24 02:32:54 +0000
+@@ -620,11 +620,13 @@
+ int root = (strcmp (os_dev, "/dev/root") == 0);
+ if (!dm && !root)
+ return os_dev;
+- if (stat (os_dev, &st) < 0)
+- grub_util_error ("cannot stat `%s'", os_dev);
++ if (stat (os_dev, &st) >= 0)
++ {
++ free (os_dev);
++ dev = st.st_rdev;
++ return grub_find_device (dm ? "/dev/mapper" : "/dev", dev);
++ }
+ free (os_dev);
+- dev = st.st_rdev;
+- return grub_find_device (dm ? "/dev/mapper" : "/dev", dev);
+ }
+
+ if (stat (dir, &st) < 0)
+
View
315 sys-boot/grub/files/grub-0.97-gpt.patch
@@ -0,0 +1,315 @@
+diff -ruBbd --unidirectional-new-file grub-0.96/stage2/builtins.c grub-0.96-patched/stage2/builtins.c
+--- grub-0.96/stage2/builtins.c 2004-06-20 09:33:04.000000000 -0400
++++ grub-0.96-patched/stage2/builtins.c 2007-01-04 13:56:06.000000000 -0500
+@@ -1229,14 +1229,15 @@
+ for (drive = 0x80; drive < 0x88; drive++)
+ {
+ unsigned long part = 0xFFFFFF;
+- unsigned long start, len, offset, ext_offset;
+- int type, entry;
++ unsigned long start, len, offset, ext_offset, gpt_offset;
++ int type, entry, gpt_count, gpt_size;
+ char buf[SECTOR_SIZE];
+
+ current_drive = drive;
+ while (next_partition (drive, 0xFFFFFF, &part, &type,
+ &start, &len, &offset, &entry,
+- &ext_offset, buf))
++ &ext_offset, &gpt_offset,
++ &gpt_count, &gpt_size, buf))
+ {
+ if (type != PC_SLICE_TYPE_NONE
+ && ! IS_PC_SLICE_TYPE_BSD (type)
+@@ -2806,8 +2807,8 @@
+ {
+ int new_type;
+ unsigned long part = 0xFFFFFF;
+- unsigned long start, len, offset, ext_offset;
+- int entry, type;
++ unsigned long start, len, offset, ext_offset, gpt_offset;
++ int entry, type, gpt_count, gpt_size;
+ char mbr[512];
+
+ /* Get the drive and the partition. */
+@@ -2844,7 +2845,14 @@
+ /* Look for the partition. */
+ while (next_partition (current_drive, 0xFFFFFF, &part, &type,
+ &start, &len, &offset, &entry,
+- &ext_offset, mbr))
++ &ext_offset, &gpt_offset, &gpt_count, &gpt_size, mbr))
++ /* The partition may not be a GPT partition. */
++ if (gpt_offset != 0)
++ {
++ errnum = ERR_BAD_ARGUMENT;
++ return 1;
++ }
++
+ {
+ if (part == current_partition)
+ {
+diff -ruBbd --unidirectional-new-file grub-0.96/stage2/disk_io.c grub-0.96-patched/stage2/disk_io.c
+--- grub-0.96/stage2/disk_io.c 2004-05-23 12:35:24.000000000 -0400
++++ grub-0.96-patched/stage2/disk_io.c 2007-01-04 14:01:08.000000000 -0500
+@@ -21,6 +21,7 @@
+
+ #include <shared.h>
+ #include <filesys.h>
++#include <gpt.h>
+
+ #ifdef SUPPORT_NETBOOT
+ # define GRUB 1
+@@ -502,8 +503,8 @@
+ set_partition_hidden_flag (int hidden)
+ {
+ unsigned long part = 0xFFFFFF;
+- unsigned long start, len, offset, ext_offset;
+- int entry, type;
++ unsigned long start, len, offset, ext_offset, gpt_offset;
++ int entry, type, gpt_count, gpt_size;
+ char mbr[512];
+
+ /* The drive must be a hard disk. */
+@@ -524,7 +525,14 @@
+ /* Look for the partition. */
+ while (next_partition (current_drive, 0xFFFFFF, &part, &type,
+ &start, &len, &offset, &entry,
+- &ext_offset, mbr))
++ &ext_offset, &gpt_offset, &gpt_count, &gpt_size, mbr))
++ /* The partition may not be a GPT partition. */
++ if (gpt_offset != 0)
++ {
++ errnum = ERR_BAD_ARGUMENT;
++ return 1;
++ }
++
+ {
+ if (part == current_partition)
+ {
+@@ -577,11 +585,14 @@
+ unsigned long *partition, int *type,
+ unsigned long *start, unsigned long *len,
+ unsigned long *offset, int *entry,
+- unsigned long *ext_offset, char *buf)
++ unsigned long *ext_offset,
++ unsigned long *gpt_offset, int *gpt_count,
++ int *gpt_size, char *buf)
+ {
+ /* Forward declarations. */
+ auto int next_bsd_partition (void);
+ auto int next_pc_slice (void);
++ auto int next_gpt_slice(void);
+
+ /* Get next BSD partition in current PC slice. */
+ int next_bsd_partition (void)
+@@ -666,6 +677,40 @@
+ return 0;
+ }
+
++ /* If this is a GPT partition table, read it as such. */
++ if (*entry == -1 && *offset == 0 && PC_SLICE_TYPE (buf, 0) == PC_SLICE_TYPE_GPT)
++ {
++ struct grub_gpt_header *hdr = (struct grub_gpt_header *) buf;
++
++ /* Read in the GPT Partition table header. */
++ if (! rawread (drive, 1, 0, SECTOR_SIZE, buf))
++ return 0;
++
++ if (hdr->magic == GPT_HEADER_MAGIC && hdr->version == 0x10000)
++ {
++ /* Let gpt_offset point to the first entry in the GPT
++ partition table. This can also be used by callers of
++ next_partition to determine if a entry comes from a
++ GPT partition table or not. */
++ *gpt_offset = hdr->partitions;
++ *gpt_count = hdr->maxpart;
++ *gpt_size = hdr->partentry_size;
++
++ return next_gpt_slice();
++ }
++ else
++ {
++ /* This is not a valid header for a GPT partition table.
++ Re-read the MBR or the boot sector of the extended
++ partition. */
++ if (! rawread (drive, *offset, 0, SECTOR_SIZE, buf))
++ return 0;
++ }
++ }
++
++ /* Not a GPT partition. */
++ *gpt_offset = 0;
++
+ /* Increase the entry number. */
+ (*entry)++;
+
+@@ -710,6 +755,43 @@
+ return 1;
+ }
+
++ /* Get the next GPT slice. */
++ int next_gpt_slice (void)
++ {
++ struct grub_gpt_partentry *gptentry = (struct grub_gpt_partentry *) buf;
++ /* Make GPT partitions show up as PC slices. */
++ int pc_slice_no = (*partition & 0xFF0000) >> 16;
++
++ /* If this is the first time... */
++ if (pc_slice_no == 0xFF)
++ {
++ pc_slice_no = -1;
++ *entry = -1;
++ }
++
++ do {
++ (*entry)++;
++
++ if (*entry >= *gpt_count)
++ {
++ errnum = ERR_NO_PART;
++ return 0;
++ }
++ /* Read in the GPT Partition table entry. */
++ if (! rawread (drive, (*gpt_offset) + GPT_ENTRY_SECTOR (*gpt_size, *entry), GPT_ENTRY_INDEX (*gpt_size, *entry), *gpt_size, buf))
++ return 0;
++ } while (! (gptentry->type1 && gptentry->type2));
++
++ pc_slice_no++;
++ *start = gptentry->start;
++ *len = gptentry->end - gptentry->start + 1;
++ *type = PC_SLICE_TYPE_EXT2FS;
++ *entry = pc_slice_no;
++ *partition = (*entry << 16) | 0xFFFF;
++
++ return 1;
++ }
++
+ /* Start the body of this function. */
+
+ #ifndef STAGE1_5
+@@ -717,6 +799,9 @@
+ return 0;
+ #endif
+
++ if (*partition != 0xFFFFFF && *gpt_offset != 0)
++ return next_gpt_slice ();
++
+ /* If previous partition is a BSD partition or a PC slice which
+ contains BSD partitions... */
+ if ((*partition != 0xFFFFFF && IS_PC_SLICE_TYPE_BSD (*type & 0xff))
+@@ -755,6 +840,9 @@
+ unsigned long dest_partition = current_partition;
+ unsigned long part_offset;
+ unsigned long ext_offset;
++ unsigned long gpt_offset;
++ int gpt_count;
++ int gpt_size;
+ int entry;
+ char buf[SECTOR_SIZE];
+ int bsd_part, pc_slice;
+@@ -766,7 +854,8 @@
+ int ret = next_partition (current_drive, dest_partition,
+ &current_partition, &current_slice,
+ &part_start, &part_length,
+- &part_offset, &entry, &ext_offset, buf);
++ &part_offset, &entry, &ext_offset,
++ &gpt_offset, &gpt_count, &gpt_size, buf);
+ bsd_part = (current_partition >> 8) & 0xFF;
+ pc_slice = current_partition >> 16;
+ return ret;
+diff -ruBbd --unidirectional-new-file grub-0.96/stage2/gpt.h grub-0.96-patched/stage2/gpt.h
+--- grub-0.96/stage2/gpt.h 1969-12-31 19:00:00.000000000 -0500
++++ grub-0.96-patched/stage2/gpt.h 2007-01-04 13:52:14.000000000 -0500
+@@ -0,0 +1,68 @@
++/*
++ * GRUB -- GRand Unified Bootloader
++ * Copyright (C) 2002,2005,2006 Free Software Foundation, Inc.
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, write to the Free Software
++ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
++ */
++
++#ifndef _GPT_H
++#define _GPT_H
++
++typedef signed char grub_int8_t;
++typedef signed short grub_int16_t;
++typedef signed int grub_int32_t;
++typedef signed long long int grub_int64_t;
++typedef unsigned char grub_uint8_t;
++typedef unsigned short grub_uint16_t;
++typedef unsigned int grub_uint32_t;
++typedef unsigned long long int grub_uint64_t;
++
++struct grub_gpt_header
++{
++ grub_uint64_t magic;
++ grub_uint32_t version;
++ grub_uint32_t headersize;
++ grub_uint32_t crc32;
++ grub_uint32_t unused1;
++ grub_uint64_t primary;
++ grub_uint64_t backup;
++ grub_uint64_t start;
++ grub_uint64_t end;
++ grub_uint8_t guid[16];
++ grub_uint64_t partitions;
++ grub_uint32_t maxpart;
++ grub_uint32_t partentry_size;
++ grub_uint32_t partentry_crc32;
++} __attribute__ ((packed));
++
++struct grub_gpt_partentry
++{
++ grub_uint64_t type1;
++ grub_uint64_t type2;
++ grub_uint8_t guid[16];
++ grub_uint64_t start;
++ grub_uint64_t end;
++ grub_uint8_t attrib;
++ char name[72];
++} __attribute__ ((packed));
++
++#define GPT_HEADER_MAGIC 0x5452415020494645UL
++
++#define GPT_ENTRY_SECTOR(size,entry) \
++ ((((entry) * (size) + 1) & ~(SECTOR_SIZE - 1)) >> SECTOR_BITS)
++#define GPT_ENTRY_INDEX(size,entry) \
++ ((((entry) * (size) + 1) & (SECTOR_SIZE - 1)) - 1)
++
++#endif /* _GPT_H */
+diff -ruBbd --unidirectional-new-file grub-0.96/stage2/pc_slice.h grub-0.96-patched/stage2/pc_slice.h
+--- grub-0.96/stage2/pc_slice.h 2003-07-09 07:45:53.000000000 -0400
++++ grub-0.96-patched/stage2/pc_slice.h 2007-01-04 13:52:14.000000000 -0500
+@@ -115,6 +115,7 @@
+ #define PC_SLICE_TYPE_LINUX_EXTENDED 0x85
+ #define PC_SLICE_TYPE_VSTAFS 0x9e
+ #define PC_SLICE_TYPE_DELL_UTIL 0xde
++#define PC_SLICE_TYPE_GPT 0xee
+ #define PC_SLICE_TYPE_LINUX_RAID 0xfd
+
+
+diff -ruBbd --unidirectional-new-file grub-0.96/stage2/shared.h grub-0.96-patched/stage2/shared.h
+--- grub-0.96/stage2/shared.h 2004-06-19 12:40:09.000000000 -0400
++++ grub-0.96-patched/stage2/shared.h 2007-01-04 13:52:15.000000000 -0500
+@@ -934,7 +934,9 @@
+ unsigned long *partition, int *type,
+ unsigned long *start, unsigned long *len,
+ unsigned long *offset, int *entry,
+- unsigned long *ext_offset, char *buf);
++ unsigned long *ext_offset,
++ unsigned long *gpt_offset, int *gpt_count,
++ int *gpt_size, char *buf);
+
+ /* Sets device to the one represented by the SAVED_* parameters. */
+ int make_saved_active (void);
View
16 sys-boot/grub/files/grub.conf.gentoo
@@ -0,0 +1,16 @@
+# This is a sample grub.conf for use with Genkernel, per the Gentoo handbook
+# http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1&chap=10#doc_chap2
+# If you are not using Genkernel and you need help creating this file, you
+# should consult the handbook. Alternatively, consult the grub.conf.sample that
+# is included with the Grub documentation.
+
+default 0
+timeout 30
+#splashimage=(hd0,0)/boot/grub/splash.xpm.gz
+
+#title Gentoo Linux 2.6.24-r5
+#root (hd0,0)
+#kernel /boot/kernel-genkernel-x86-2.6.24-gentoo-r5 root=/dev/ram0 real_root=/dev/sda3
+#initrd /boot/initramfs-genkernel-x86-2.6.24-gentoo-r5
+
+# vim:ft=conf:
View
36 sys-boot/grub/files/grub.default
@@ -0,0 +1,36 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-boot/grub/files/grub.default,v 1.2 2011/08/30 06:45:04 scarabeus Exp $
+#
+# To populate all changes in this file you need to regenerate your
+# grub configuration file afterwards:
+# 'grub2-mkconfig -o /boot/grub2/grub.cfg'
+#
+# See the grub info page for documentation on possible variables and
+# their associated values.
+
+GRUB_DEFAULT=0
+GRUB_HIDDEN_TIMEOUT=0
+GRUB_HIDDEN_TIMEOUT_QUIET=true
+GRUB_TIMEOUT=10
+
+GRUB_CMDLINE_LINUX_DEFAULT=""
+GRUB_CMDLINE_LINUX=""
+
+# Uncomment to disable graphical terminal (grub-pc only)
+#GRUB_TERMINAL=console
+
+# The resolution used on graphical terminal.
+# Note that you can use only modes which your graphic card supports via VBE.
+# You can see them in real GRUB with the command `vbeinfo'.
+#GRUB_GFXMODE=640x480
+
+# Background image used on graphical terminal.
+# Can be in various bitmap formats.
+#GRUB_BACKGROUND="/boot/grub2/mybackground.png"
+
+# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to kernel
+#GRUB_DISABLE_LINUX_UUID=true
+
+# Uncomment to disable generation of recovery mode menu entries
+#GRUB_DISABLE_RECOVERY=true
Please sign in to comment.
Something went wrong with that request. Please try again.