Merge mainline into bidi
This commit is contained in:
commit
e8d0a8f85c
271 changed files with 14187 additions and 16216 deletions
|
@ -28,14 +28,14 @@
|
|||
#include <grub/msdos_partition.h>
|
||||
#include <grub/gpt_partition.h>
|
||||
#include <grub/env.h>
|
||||
#include <grub/util/hostdisk.h>
|
||||
#include <grub/emu/hostdisk.h>
|
||||
#include <grub/machine/boot.h>
|
||||
#include <grub/machine/kernel.h>
|
||||
#include <grub/term.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/util/raid.h>
|
||||
#include <grub/util/lvm.h>
|
||||
#include <grub/util/getroot.h>
|
||||
#include <grub/emu/getroot.h>
|
||||
|
||||
static const grub_gpt_part_type_t grub_gpt_partition_type_bios_boot = GRUB_GPT_PARTITION_TYPE_BIOS_BOOT;
|
||||
|
||||
|
@ -57,6 +57,13 @@ static const grub_gpt_part_type_t grub_gpt_partition_type_bios_boot = GRUB_GPT_P
|
|||
#define DEFAULT_BOOT_FILE "boot.img"
|
||||
#define DEFAULT_CORE_FILE "core.img"
|
||||
|
||||
#define grub_target_to_host16(x) grub_le_to_cpu16(x)
|
||||
#define grub_target_to_host32(x) grub_le_to_cpu32(x)
|
||||
#define grub_target_to_host64(x) grub_le_to_cpu64(x)
|
||||
#define grub_host_to_target16(x) grub_cpu_to_le16(x)
|
||||
#define grub_host_to_target32(x) grub_cpu_to_le32(x)
|
||||
#define grub_host_to_target64(x) grub_cpu_to_le64(x)
|
||||
|
||||
void
|
||||
grub_xputs_real (const char *str)
|
||||
{
|
||||
|
@ -71,9 +78,6 @@ grub_getkey (void)
|
|||
return -1;
|
||||
}
|
||||
|
||||
struct grub_handler_class grub_term_input_class;
|
||||
struct grub_handler_class grub_term_output_class;
|
||||
|
||||
void
|
||||
grub_refresh (void)
|
||||
{
|
||||
|
@ -97,6 +101,7 @@ setup (const char *dir,
|
|||
struct grub_boot_blocklist *first_block, *block;
|
||||
grub_int32_t *install_dos_part, *install_bsd_part;
|
||||
grub_int32_t dos_part, bsd_part;
|
||||
char *prefix;
|
||||
char *tmp_img;
|
||||
int i;
|
||||
grub_disk_addr_t first_sector;
|
||||
|
@ -121,8 +126,8 @@ setup (const char *dir,
|
|||
/* There's always an embed region, and it starts right after the MBR. */
|
||||
embed_region.start = 1;
|
||||
|
||||
if (embed_region.end > p->start)
|
||||
embed_region.end = p->start;
|
||||
if (embed_region.end > grub_partition_get_start (p))
|
||||
embed_region.end = grub_partition_get_start (p);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -142,8 +147,8 @@ setup (const char *dir,
|
|||
/* If there's an embed region, it is in a dedicated partition. */
|
||||
if (! memcmp (&gptdata.type, &grub_gpt_partition_type_bios_boot, 16))
|
||||
{
|
||||
embed_region.start = p->start;
|
||||
embed_region.end = p->start + p->len;
|
||||
embed_region.start = grub_partition_get_start (p);
|
||||
embed_region.end = grub_partition_get_start (p) + grub_partition_get_len (p);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -228,6 +233,8 @@ setup (const char *dir,
|
|||
+ GRUB_KERNEL_MACHINE_INSTALL_DOS_PART);
|
||||
install_bsd_part = (grub_int32_t *) (core_img + GRUB_DISK_SECTOR_SIZE
|
||||
+ GRUB_KERNEL_MACHINE_INSTALL_BSD_PART);
|
||||
prefix = (char *) (core_img + GRUB_DISK_SECTOR_SIZE +
|
||||
GRUB_KERNEL_MACHINE_PREFIX);
|
||||
|
||||
/* Open the root device and the destination device. */
|
||||
root_dev = grub_device_open (root);
|
||||
|
@ -303,6 +310,18 @@ setup (const char *dir,
|
|||
dos_part = root_dev->disk->partition->number;
|
||||
bsd_part = -1;
|
||||
}
|
||||
|
||||
if (prefix[0] != '(')
|
||||
{
|
||||
char *root_part_name, *new_prefix;
|
||||
|
||||
root_part_name =
|
||||
grub_partition_get_name (root_dev->disk->partition);
|
||||
new_prefix = xasprintf ("(,%s)%s", root_part_name, prefix);
|
||||
strcpy (prefix, new_prefix);
|
||||
free (new_prefix);
|
||||
free (root_part_name);
|
||||
}
|
||||
}
|
||||
else
|
||||
dos_part = bsd_part = -1;
|
||||
|
@ -356,7 +375,7 @@ setup (const char *dir,
|
|||
else
|
||||
grub_util_error (_("No DOS-style partitions found"));
|
||||
|
||||
if (embed_region.end == embed_region.start)
|
||||
if (embed_region.end <= embed_region.start)
|
||||
{
|
||||
if (! strcmp (dest_partmap, "msdos"))
|
||||
grub_util_warn (_("This msdos-style partition label has no post-MBR gap; embedding won't be possible!"));
|
||||
|
@ -425,7 +444,7 @@ unable_to_embed:
|
|||
/* Make sure that GRUB reads the identical image as the OS. */
|
||||
tmp_img = xmalloc (core_size);
|
||||
core_path_dev_full = grub_util_get_path (dir, core_file);
|
||||
core_path_dev = make_system_path_relative_to_its_root (core_path_dev_full);
|
||||
core_path_dev = grub_make_system_path_relative_to_its_root (core_path_dev_full);
|
||||
free (core_path_dev_full);
|
||||
|
||||
/* It is a Good Thing to sync two times. */
|
||||
|
@ -591,6 +610,8 @@ Usage: %s [OPTION]... DEVICE\n\
|
|||
\n\
|
||||
Set up images to boot from DEVICE.\n\
|
||||
DEVICE must be a GRUB device (e.g. `(hd0,1)').\n\
|
||||
\n\
|
||||
You should not normally run %s directly. Use grub-install instead.\n\
|
||||
\n\
|
||||
-b, --boot-image=FILE use FILE as the boot image [default=%s]\n\
|
||||
-c, --core-image=FILE use FILE as the core image [default=%s]\n\
|
||||
|
@ -605,7 +626,7 @@ DEVICE must be a GRUB device (e.g. `(hd0,1)').\n\
|
|||
\n\
|
||||
Report bugs to <%s>.\n\
|
||||
"),
|
||||
program_name,
|
||||
program_name, program_name,
|
||||
DEFAULT_BOOT_FILE, DEFAULT_CORE_FILE, DEFAULT_DIRECTORY,
|
||||
DEFAULT_DEVICE_MAP, PACKAGE_BUGREPORT);
|
||||
|
||||
|
@ -697,7 +718,7 @@ main (int argc, char *argv[])
|
|||
break;
|
||||
|
||||
case 'V':
|
||||
printf ("grub-setup (%s) %s\n", PACKAGE_NAME, PACKAGE_VERSION);
|
||||
printf ("%s (%s) %s\n", program_name, PACKAGE_NAME, PACKAGE_VERSION);
|
||||
return 0;
|
||||
|
||||
case 'v':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue