merged with mainline

This commit is contained in:
BVK Chaitanya 2010-04-12 20:47:25 +05:30
commit 8f33d5549f
163 changed files with 22923 additions and 4101 deletions

View file

@ -15,7 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
if [ x$1 == x ]; then
if [ "x$1" = "x" ]; then
echo "Filename required".
fi

View file

@ -165,8 +165,7 @@ else
fi
# Create the GRUB directory if it is not present.
test -d "$bootdir" || mkdir "$bootdir" || exit 1
test -d "$grubdir" || mkdir "$grubdir" || exit 1
mkdir -p "$grubdir" || exit 1
# If --recheck is specified, remove the device map, if present.
if test $recheck = yes; then
@ -223,7 +222,10 @@ fi
# Then the partition map module. In order to support partition-less media,
# this command is allowed to fail (--target=fs already grants us that the
# filesystem will be accessible).
partmap_module=`$grub_probe --target=partmap --device-map=${device_map} ${grubdir} 2> /dev/null`
partmap_module=
for x in `$grub_probe --target=partmap --device ${grub_device} 2> /dev/null`; do
partmap_module="$partmap_module part_$x";
done
# Device abstraction module, if any (lvm, raid).
devabstraction_module=`$grub_probe --target=abstraction --device-map=${device_map} ${grubdir}`

View file

@ -116,15 +116,10 @@ setup (const char *dir,
int NESTED_FUNC_ATTR find_usable_region_msdos (grub_disk_t disk __attribute__ ((unused)),
const grub_partition_t p)
{
struct grub_msdos_partition *pcdata = p->data;
/* There's always an embed region, and it starts right after the MBR. */
embed_region.start = 1;
/* For its end offset, include as many dummy partitions as we can. */
if (! grub_msdos_partition_is_empty (pcdata->dos_type)
&& ! grub_msdos_partition_is_bsd (pcdata->dos_type)
&& embed_region.end > p->start)
if (embed_region.end > p->start)
embed_region.end = p->start;
return 0;
@ -135,17 +130,21 @@ setup (const char *dir,
int NESTED_FUNC_ATTR find_usable_region_gpt (grub_disk_t disk __attribute__ ((unused)),
const grub_partition_t p)
{
struct grub_gpt_partentry *gptdata = p->data;
struct grub_gpt_partentry gptdata;
disk->partition = p->parent;
if (grub_disk_read (disk, p->offset, p->index,
sizeof (gptdata), &gptdata))
return 0;
/* If there's an embed region, it is in a dedicated partition. */
if (! memcmp (&gptdata->type, &grub_gpt_partition_type_bios_boot, 16))
if (! memcmp (&gptdata.type, &grub_gpt_partition_type_bios_boot, 16))
{
embed_region.start = p->start;
embed_region.end = p->start + p->len;
return 1;
}
return 0;
}
@ -289,22 +288,19 @@ setup (const char *dir,
/* Embed information about the installed location. */
if (root_dev->disk->partition)
{
if (strcmp (root_dev->disk->partition->partmap->name,
"part_msdos") == 0)
{
struct grub_msdos_partition *pcdata =
root_dev->disk->partition->data;
dos_part = pcdata->dos_part;
bsd_part = pcdata->bsd_part;
}
else if (strcmp (root_dev->disk->partition->partmap->name,
"part_gpt") == 0)
{
dos_part = root_dev->disk->partition->index;
bsd_part = -1;
}
if (root_dev->disk->partition->parent)
{
if (root_dev->disk->partition->parent->parent)
grub_util_error ("Installing on doubly nested partitions is "
"not supported");
dos_part = root_dev->disk->partition->parent->number;
bsd_part = root_dev->disk->partition->number;
}
else
grub_util_error (_("no DOS-style partitions found"));
{
dos_part = root_dev->disk->partition->number;
bsd_part = -1;
}
}
else
dos_part = bsd_part = -1;
@ -337,6 +333,8 @@ setup (const char *dir,
int NESTED_FUNC_ATTR identify_partmap (grub_disk_t disk __attribute__ ((unused)),
const grub_partition_t p)
{
if (p->parent)
return 0;
dest_partmap = p->partmap->name;
return 1;
}
@ -349,16 +347,16 @@ setup (const char *dir,
goto unable_to_embed;
}
if (strcmp (dest_partmap, "part_msdos") == 0)
if (strcmp (dest_partmap, "msdos") == 0)
grub_partition_iterate (dest_dev->disk, find_usable_region_msdos);
else if (strcmp (dest_partmap, "part_gpt") == 0)
else if (strcmp (dest_partmap, "gpt") == 0)
grub_partition_iterate (dest_dev->disk, find_usable_region_gpt);
else
grub_util_error (_("No DOS-style partitions found"));
if (embed_region.end == embed_region.start)
{
if (! strcmp (dest_partmap, "part_msdos"))
if (! strcmp (dest_partmap, "msdos"))
grub_util_warn (_("This msdos-style partition label has no post-MBR gap; embedding won't be possible!"));
else
grub_util_warn (_("This GPT partition label has no BIOS Boot Partition; embedding won't be possible!"));