Merge from trunk
This commit is contained in:
commit
37ba589a4e
90 changed files with 2241 additions and 3762 deletions
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2004,2005,2006,2007,2008 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2004,2005,2006,2007,2008,2009 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -31,6 +31,9 @@
|
|||
#include <grub/util/resolve.h>
|
||||
#include <grub/kernel.h>
|
||||
#include <grub/cpu/kernel.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
#include "progname.h"
|
||||
|
||||
#define GRUB_IEEE1275_NOTE_NAME "PowerPC"
|
||||
#define GRUB_IEEE1275_NOTE_TYPE 0x1275
|
||||
|
@ -325,10 +328,10 @@ static void
|
|||
usage (int status)
|
||||
{
|
||||
if (status)
|
||||
fprintf (stderr, "Try ``grub-mkimage --help'' for more information.\n");
|
||||
fprintf (stderr, "Try ``%s --help'' for more information.\n", program_name);
|
||||
else
|
||||
printf ("\
|
||||
Usage: grub-mkimage -o FILE [OPTION]... [MODULES]\n\
|
||||
Usage: %s -o FILE [OPTION]... [MODULES]\n\
|
||||
\n\
|
||||
Make a bootable image of GRUB.\n\
|
||||
\n\
|
||||
|
@ -342,7 +345,7 @@ Make a bootable image of GRUB.\n\
|
|||
-v, --verbose print verbose messages\n\
|
||||
\n\
|
||||
Report bugs to <%s>.\n\
|
||||
", GRUB_LIBDIR, PACKAGE_BUGREPORT);
|
||||
", program_name, GRUB_LIBDIR, PACKAGE_BUGREPORT);
|
||||
|
||||
exit (status);
|
||||
}
|
||||
|
@ -357,7 +360,10 @@ main (int argc, char *argv[])
|
|||
char *memdisk = NULL;
|
||||
int chrp = 0;
|
||||
|
||||
progname = "grub-mkimage";
|
||||
set_program_name (argv[0]);
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
while (1)
|
||||
{
|
||||
|
|
|
@ -546,7 +546,7 @@ grub_util_get_grub_dev (const char *os_dev)
|
|||
if (q)
|
||||
*q = ',';
|
||||
|
||||
asprintf (&grub_dev, "md%s", p);
|
||||
grub_dev = xasprintf ("md%s", p);
|
||||
free (p);
|
||||
}
|
||||
else if (os_dev[7] == '/' && os_dev[8] == 'd')
|
||||
|
@ -561,7 +561,7 @@ grub_util_get_grub_dev (const char *os_dev)
|
|||
if (q)
|
||||
*q = ',';
|
||||
|
||||
asprintf (&grub_dev, "md%s", p);
|
||||
grub_dev = xasprintf ("md%s", p);
|
||||
free (p);
|
||||
}
|
||||
else if (os_dev[7] >= '0' && os_dev[7] <= '9')
|
||||
|
@ -574,7 +574,7 @@ grub_util_get_grub_dev (const char *os_dev)
|
|||
if (q)
|
||||
*q = ',';
|
||||
|
||||
asprintf (&grub_dev, "md%s", p);
|
||||
grub_dev = xasprintf ("md%s", p);
|
||||
free (p);
|
||||
}
|
||||
else if (os_dev[7] == '/' && os_dev[8] >= '0' && os_dev[8] <= '9')
|
||||
|
@ -587,7 +587,7 @@ grub_util_get_grub_dev (const char *os_dev)
|
|||
if (q)
|
||||
*q = ',';
|
||||
|
||||
asprintf (&grub_dev, "md%s", p);
|
||||
grub_dev = xasprintf ("md%s", p);
|
||||
free (p);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <grub/util/misc.h>
|
||||
#include <grub/lib/envblk.h>
|
||||
#include <grub/handler.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
@ -29,6 +30,8 @@
|
|||
#include <stdlib.h>
|
||||
#include <getopt.h>
|
||||
|
||||
#include "progname.h"
|
||||
|
||||
#define DEFAULT_ENVBLK_SIZE 1024
|
||||
|
||||
void
|
||||
|
@ -104,7 +107,7 @@ create_envblk_file (const char *name)
|
|||
if (! buf)
|
||||
grub_util_error ("out of memory");
|
||||
|
||||
asprintf (&namenew, "%s.new", name);
|
||||
namenew = xasprintf ("%s.new", name);
|
||||
fp = fopen (namenew, "wb");
|
||||
if (! fp)
|
||||
grub_util_error ("cannot open the file %s", namenew);
|
||||
|
@ -252,7 +255,10 @@ main (int argc, char *argv[])
|
|||
char *filename;
|
||||
char *command;
|
||||
|
||||
progname = "grub-editenv";
|
||||
set_program_name (argv[0]);
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
/* Check for options. */
|
||||
while (1)
|
||||
|
@ -269,7 +275,7 @@ main (int argc, char *argv[])
|
|||
break;
|
||||
|
||||
case 'V':
|
||||
printf ("%s (%s) %s\n", progname, PACKAGE_NAME, PACKAGE_VERSION);
|
||||
printf ("%s (%s) %s\n", program_name, PACKAGE_NAME, PACKAGE_VERSION);
|
||||
return 0;
|
||||
|
||||
case 'v':
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2003,2004,2005,2006,2007,2008 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2003,2004,2005,2006,2007,2008,2009 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -36,19 +36,22 @@
|
|||
#include <grub/util/getroot.h>
|
||||
#include <grub/env.h>
|
||||
#include <grub/partition.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
#include <grub_emu_init.h>
|
||||
|
||||
#include "progname.h"
|
||||
|
||||
/* Used for going back to the main function. */
|
||||
static jmp_buf main_env;
|
||||
|
||||
/* Store the prefix specified by an argument. */
|
||||
static char *prefix = 0;
|
||||
static char *prefix = NULL;
|
||||
|
||||
grub_addr_t
|
||||
grub_arch_modules_addr (void)
|
||||
{
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
grub_err_t
|
||||
|
@ -155,7 +158,10 @@ main (int argc, char *argv[])
|
|||
volatile int hold = 0;
|
||||
int opt;
|
||||
|
||||
progname = "grub-emu";
|
||||
set_program_name (argv[0]);
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
while ((opt = getopt_long (argc, argv, "r:d:m:vH:hV", options, 0)) != -1)
|
||||
switch (opt)
|
||||
|
@ -178,7 +184,7 @@ main (int argc, char *argv[])
|
|||
case 'h':
|
||||
return usage (0);
|
||||
case 'V':
|
||||
printf ("%s (%s) %s\n", progname, PACKAGE_NAME, PACKAGE_VERSION);
|
||||
printf ("%s (%s) %s\n", program_name, PACKAGE_NAME, PACKAGE_VERSION);
|
||||
return 0;
|
||||
default:
|
||||
return usage (1);
|
||||
|
@ -193,7 +199,7 @@ main (int argc, char *argv[])
|
|||
/* Wait until the ARGS.HOLD variable is cleared by an attached debugger. */
|
||||
if (hold && verbosity > 0)
|
||||
printf ("Run \"gdb %s %d\", and set ARGS.HOLD to zero.\n",
|
||||
progname, (int) getpid ());
|
||||
program_name, (int) getpid ());
|
||||
while (hold)
|
||||
{
|
||||
if (hold > 0)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* grub-fstest.c - debug tool for filesystem driver */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2008,2009 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -31,6 +31,7 @@
|
|||
#include <grub/lib/hexdump.h>
|
||||
#include <grub/lib/crc.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
#include <grub_fstest_init.h>
|
||||
|
||||
|
@ -40,6 +41,8 @@
|
|||
#include <stdlib.h>
|
||||
#include <getopt.h>
|
||||
|
||||
#include "progname.h"
|
||||
|
||||
void
|
||||
grub_putchar (int c)
|
||||
{
|
||||
|
@ -82,7 +85,7 @@ execute_command (char *name, int n, char **args)
|
|||
|
||||
#define BUF_SIZE 32256
|
||||
|
||||
static grub_off_t skip, leng;
|
||||
static grub_disk_addr_t skip, leng;
|
||||
|
||||
static void
|
||||
read_file (char *pathname, int (*hook) (grub_off_t ofs, char *buf, int len))
|
||||
|
@ -137,7 +140,7 @@ read_file (char *pathname, int (*hook) (grub_off_t ofs, char *buf, int len))
|
|||
|
||||
if (skip > file->size)
|
||||
{
|
||||
grub_util_error ("invalid skip value %d.");
|
||||
grub_util_error ("invalid skip value %lld.", (unsigned long long) skip);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -346,10 +349,10 @@ static void
|
|||
usage (int status)
|
||||
{
|
||||
if (status)
|
||||
fprintf (stderr, "Try ``grub-fstest --help'' for more information.\n");
|
||||
fprintf (stderr, "Try ``%s --help'' for more information.\n", program_name);
|
||||
else
|
||||
printf ("\
|
||||
Usage: grub-fstest [OPTION]... IMAGE_PATH COMMANDS\n\
|
||||
Usage: %s [OPTION]... IMAGE_PATH COMMANDS\n\
|
||||
\n\
|
||||
Debug tool for filesystem driver.\n\
|
||||
\nCommands:\n\
|
||||
|
@ -369,7 +372,7 @@ Debug tool for filesystem driver.\n\
|
|||
-V, --version print version information and exit\n\
|
||||
-v, --verbose print verbose messages\n\
|
||||
\n\
|
||||
Report bugs to <%s>.\n", PACKAGE_BUGREPORT);
|
||||
Report bugs to <%s>.\n", program_name, PACKAGE_BUGREPORT);
|
||||
|
||||
exit (status);
|
||||
}
|
||||
|
@ -377,10 +380,13 @@ Report bugs to <%s>.\n", PACKAGE_BUGREPORT);
|
|||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
char *debug_str = 0, *root = 0, *default_root, *alloc_root;
|
||||
char *debug_str = NULL, *root = NULL, *default_root, *alloc_root;
|
||||
int i, cmd, num_opts, image_index, num_disks = 1;
|
||||
|
||||
progname = "grub-fstest";
|
||||
set_program_name (argv[0]);
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
/* Find the first non option entry. */
|
||||
for (num_opts = 1; num_opts < argc; num_opts++)
|
||||
|
@ -442,7 +448,7 @@ main (int argc, char *argv[])
|
|||
break;
|
||||
|
||||
case 'V':
|
||||
printf ("%s (%s) %s\n", progname, PACKAGE_NAME, PACKAGE_VERSION);
|
||||
printf ("%s (%s) %s\n", program_name, PACKAGE_NAME, PACKAGE_VERSION);
|
||||
return 0;
|
||||
|
||||
case 'v':
|
||||
|
|
|
@ -249,6 +249,14 @@ if [ "${target_cpu}-${platform}" = "i386-pc" ] || [ "${target_cpu}-${platform}"
|
|||
done
|
||||
fi
|
||||
|
||||
# Copy gettext files
|
||||
mkdir -p ${grubdir}/locale/
|
||||
for file in ${grubdir}/locale/*.mo ${pkglibdir}/locale/*.mo; do
|
||||
if test -f "$file"; then
|
||||
cp -f "$file" ${grubdir}/locale/
|
||||
fi
|
||||
done
|
||||
|
||||
# Write device to a variable so we don't have to traverse /dev every time.
|
||||
grub_device=`$grub_probe --target=device ${grubdir}`
|
||||
|
||||
|
|
|
@ -24,8 +24,12 @@ bindir=@bindir@
|
|||
sbindir=@sbindir@
|
||||
pkgdatadir=${datadir}/`echo @PACKAGE_TARNAME@ | sed "${transform}"`
|
||||
|
||||
grub_probe=${sbindir}/`echo grub-probe | sed ${transform}`
|
||||
grub_mkrelpath=${bindir}/`echo grub-mkrelpath | sed ${transform}`
|
||||
if test "x$grub_probe" = x; then
|
||||
grub_probe=${sbindir}/`echo grub-probe | sed ${transform}`
|
||||
fi
|
||||
if test "x$grub_mkrelpath" = x; then
|
||||
grub_mkrelpath=${bindir}/`echo grub-mkrelpath | sed ${transform}`
|
||||
fi
|
||||
|
||||
grub_warn ()
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* grub-mkdevicemap.c - make a device map file automatically */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2007,2008 Free Software Foundation, Inc.
|
||||
* Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2007,2008,2009 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -31,10 +31,13 @@
|
|||
|
||||
#include <grub/util/misc.h>
|
||||
#include <grub/util/deviceiter.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
#define _GNU_SOURCE 1
|
||||
#include <getopt.h>
|
||||
|
||||
#include "progname.h"
|
||||
|
||||
static void
|
||||
make_device_map (const char *device_map, int floppy_disks)
|
||||
{
|
||||
|
@ -81,10 +84,10 @@ usage (int status)
|
|||
{
|
||||
if (status)
|
||||
fprintf (stderr,
|
||||
"Try ``grub-mkdevicemap --help'' for more information.\n");
|
||||
"Try ``%s --help'' for more information.\n", program_name);
|
||||
else
|
||||
printf ("\
|
||||
Usage: grub-mkdevicemap [OPTION]...\n\
|
||||
Usage: %s [OPTION]...\n\
|
||||
\n\
|
||||
Generate a device map file automatically.\n\
|
||||
\n\
|
||||
|
@ -96,7 +99,7 @@ Generate a device map file automatically.\n\
|
|||
-v, --verbose print verbose messages\n\
|
||||
\n\
|
||||
Report bugs to <%s>.\n\
|
||||
",
|
||||
", program_name,
|
||||
DEFAULT_DEVICE_MAP, PACKAGE_BUGREPORT);
|
||||
|
||||
exit (status);
|
||||
|
@ -108,7 +111,10 @@ main (int argc, char *argv[])
|
|||
char *dev_map = 0;
|
||||
int floppy_disks = 1;
|
||||
|
||||
progname = "grub-mkdevicemap";
|
||||
set_program_name (argv[0]);
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
/* Check for options. */
|
||||
while (1)
|
||||
|
@ -140,7 +146,7 @@ main (int argc, char *argv[])
|
|||
break;
|
||||
|
||||
case 'V':
|
||||
printf ("%s (%s) %s\n", progname, PACKAGE_NAME, PACKAGE_VERSION);
|
||||
printf ("%s (%s) %s\n", program_name, PACKAGE_NAME, PACKAGE_VERSION);
|
||||
return 0;
|
||||
|
||||
case 'v':
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include <config.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/util/misc.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -29,6 +30,8 @@
|
|||
#include FT_FREETYPE_H
|
||||
#include <freetype/ftsynth.h>
|
||||
|
||||
#include "progname.h"
|
||||
|
||||
#define GRUB_FONT_DEFAULT_SIZE 16
|
||||
|
||||
#define GRUB_FONT_RANGE_BLOCK 1024
|
||||
|
@ -90,10 +93,10 @@ static void
|
|||
usage (int status)
|
||||
{
|
||||
if (status)
|
||||
fprintf (stderr, "Try ``grub-mkfont --help'' for more information.\n");
|
||||
fprintf (stderr, "Try ``%s --help'' for more information.\n", program_name);
|
||||
else
|
||||
printf ("\
|
||||
Usage: grub-mkfont [OPTIONS] FONT_FILES\n\
|
||||
Usage: %s [OPTIONS] FONT_FILES\n\
|
||||
\nOptions:\n\
|
||||
-o, --output=FILE_NAME set output file name\n\
|
||||
-i, --index=N set face index\n\
|
||||
|
@ -109,7 +112,7 @@ Usage: grub-mkfont [OPTIONS] FONT_FILES\n\
|
|||
-V, --version print version information and exit\n\
|
||||
-v, --verbose print verbose messages\n\
|
||||
\n\
|
||||
Report bugs to <%s>.\n", PACKAGE_BUGREPORT);
|
||||
Report bugs to <%s>.\n", program_name, PACKAGE_BUGREPORT);
|
||||
|
||||
exit (status);
|
||||
}
|
||||
|
@ -363,8 +366,8 @@ write_font (struct grub_font_info *font_info, char *output_file)
|
|||
if (! style_name[0])
|
||||
strcpy (style_name, " Regular");
|
||||
|
||||
asprintf (&font_name, "%s %s %d", font_info->name, &style_name[1],
|
||||
font_info->size);
|
||||
font_name = xasprintf ("%s %s %d", font_info->name, &style_name[1],
|
||||
font_info->size);
|
||||
|
||||
write_string_section ("NAME", font_name, &offset, file);
|
||||
write_string_section ("FAMI", font_info->name, &offset, file);
|
||||
|
@ -472,7 +475,10 @@ main (int argc, char *argv[])
|
|||
|
||||
memset (&font_info, 0, sizeof (font_info));
|
||||
|
||||
progname = "grub-mkfont";
|
||||
set_program_name (argv[0]);
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
/* Check for options. */
|
||||
while (1)
|
||||
|
@ -560,7 +566,7 @@ main (int argc, char *argv[])
|
|||
break;
|
||||
|
||||
case 'V':
|
||||
printf ("%s (%s) %s\n", progname, PACKAGE_NAME, PACKAGE_VERSION);
|
||||
printf ("%s (%s) %s\n", program_name, PACKAGE_NAME, PACKAGE_VERSION);
|
||||
return 0;
|
||||
|
||||
case 'v':
|
||||
|
|
|
@ -18,8 +18,11 @@
|
|||
*/
|
||||
|
||||
#include <grub/util/misc.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <getopt.h>
|
||||
|
||||
#include "progname.h"
|
||||
|
||||
static struct option options[] =
|
||||
{
|
||||
{"help", no_argument, 0, 'h'},
|
||||
|
@ -30,10 +33,10 @@ static void
|
|||
usage (int status)
|
||||
{
|
||||
if (status)
|
||||
fprintf (stderr, "Try ``grub-mkrelpath --help'' for more information.\n");
|
||||
fprintf (stderr, "Try ``%s --help'' for more information.\n", program_name);
|
||||
else
|
||||
printf ("\
|
||||
Usage: grub-mkrelpath [OPTIONS] PATH\n\
|
||||
Usage: %s [OPTIONS] PATH\n\
|
||||
\n\
|
||||
Make a system path relative to it's root.\n\
|
||||
\n\
|
||||
|
@ -41,7 +44,7 @@ Options:\n\
|
|||
-h, --help display this message and exit\n\
|
||||
-V, --version print version information and exit\n\
|
||||
\n\
|
||||
Report bugs to <%s>.\n", PACKAGE_BUGREPORT);
|
||||
Report bugs to <%s>.\n", program_name, PACKAGE_BUGREPORT);
|
||||
|
||||
exit (status);
|
||||
}
|
||||
|
@ -51,7 +54,10 @@ main (int argc, char *argv[])
|
|||
{
|
||||
char *argument, *relpath;
|
||||
|
||||
progname = "grub-mkrelpath";
|
||||
set_program_name (argv[0]);
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
/* Check for options. */
|
||||
while (1)
|
||||
|
@ -68,7 +74,7 @@ main (int argc, char *argv[])
|
|||
break;
|
||||
|
||||
case 'V':
|
||||
printf ("%s (%s) %s\n", progname, PACKAGE_NAME, PACKAGE_VERSION);
|
||||
printf ("%s (%s) %s\n", program_name, PACKAGE_NAME, PACKAGE_VERSION);
|
||||
return 0;
|
||||
|
||||
default:
|
||||
|
|
|
@ -100,6 +100,13 @@ process_input_dir ()
|
|||
cp -f "$file" ${iso9660_dir}/boot/grub/${target_cpu}-${platform}/
|
||||
fi
|
||||
done
|
||||
|
||||
mkdir -p ${iso9660_dir}/boot/grub/locale
|
||||
for file in ${input_dir}/po/*.mo; do
|
||||
if test -f "$file"; then
|
||||
cp -f "$file" ${iso9660_dir}/boot/grub/locale/
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
if [ "${override_dir}" = "" ] ; then
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* grub-pe2elf.c - tool to convert pe image to elf. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2008,2009 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -40,10 +40,10 @@ static void
|
|||
usage (int status)
|
||||
{
|
||||
if (status)
|
||||
fprintf (stderr, "Try ``grub-pe2elf --help'' for more information.\n");
|
||||
fprintf (stderr, "Try ``%s --help'' for more information.\n", program_name);
|
||||
else
|
||||
printf ("\
|
||||
Usage: grub-pe2elf [OPTIONS] input [output]\n\
|
||||
Usage: %s [OPTIONS] input [output]\n\
|
||||
\n\
|
||||
Tool to convert pe image to elf.\n\
|
||||
\nOptions:\n\
|
||||
|
@ -51,7 +51,7 @@ Tool to convert pe image to elf.\n\
|
|||
-V, --version print version information and exit\n\
|
||||
-v, --verbose print verbose messages\n\
|
||||
\n\
|
||||
Report bugs to <%s>.\n", PACKAGE_BUGREPORT);
|
||||
Report bugs to <%s>.\n", program_name, PACKAGE_BUGREPORT);
|
||||
|
||||
exit (status);
|
||||
}
|
||||
|
@ -467,7 +467,7 @@ main (int argc, char *argv[])
|
|||
char *image;
|
||||
FILE* fp;
|
||||
|
||||
progname = "grub-pe2elf";
|
||||
set_program_name (argv[0]);
|
||||
|
||||
/* Check for options. */
|
||||
while (1)
|
||||
|
@ -484,7 +484,7 @@ main (int argc, char *argv[])
|
|||
break;
|
||||
|
||||
case 'V':
|
||||
printf ("%s (%s) %s\n", progname, PACKAGE_NAME, PACKAGE_VERSION);
|
||||
printf ("%s (%s) %s\n", program_name, PACKAGE_NAME, PACKAGE_VERSION);
|
||||
return 0;
|
||||
|
||||
case 'v':
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include <grub/term.h>
|
||||
#include <grub/env.h>
|
||||
#include <grub/raid.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
#include <grub_probe_init.h>
|
||||
|
||||
|
@ -43,6 +44,8 @@
|
|||
#define _GNU_SOURCE 1
|
||||
#include <getopt.h>
|
||||
|
||||
#include "progname.h"
|
||||
|
||||
enum {
|
||||
PRINT_FS,
|
||||
PRINT_FS_UUID,
|
||||
|
@ -235,33 +238,36 @@ probe (const char *path, char *device_name)
|
|||
|
||||
if (print == PRINT_FS)
|
||||
{
|
||||
struct stat st;
|
||||
if (path)
|
||||
{
|
||||
struct stat st;
|
||||
|
||||
stat (path, &st);
|
||||
stat (path, &st);
|
||||
|
||||
if (S_ISREG (st.st_mode))
|
||||
{
|
||||
/* Regular file. Verify that we can read it properly. */
|
||||
if (S_ISREG (st.st_mode))
|
||||
{
|
||||
/* Regular file. Verify that we can read it properly. */
|
||||
|
||||
grub_file_t file;
|
||||
char *rel_path;
|
||||
grub_util_info ("reading %s via OS facilities", path);
|
||||
filebuf_via_sys = grub_util_read_image (path);
|
||||
grub_file_t file;
|
||||
char *rel_path;
|
||||
grub_util_info ("reading %s via OS facilities", path);
|
||||
filebuf_via_sys = grub_util_read_image (path);
|
||||
|
||||
rel_path = make_system_path_relative_to_its_root (path);
|
||||
asprintf (&grub_path, "(%s)%s", drive_name, rel_path);
|
||||
free (rel_path);
|
||||
grub_util_info ("reading %s via GRUB facilities", grub_path);
|
||||
file = grub_file_open (grub_path);
|
||||
if (! file)
|
||||
grub_util_error ("can not open %s via GRUB facilities", grub_path);
|
||||
filebuf_via_grub = xmalloc (file->size);
|
||||
grub_file_read (file, filebuf_via_grub, file->size);
|
||||
rel_path = make_system_path_relative_to_its_root (path);
|
||||
grub_path = xasprintf ("(%s)%s", drive_name, rel_path);
|
||||
free (rel_path);
|
||||
grub_util_info ("reading %s via GRUB facilities", grub_path);
|
||||
file = grub_file_open (grub_path);
|
||||
if (! file)
|
||||
grub_util_error ("can not open %s via GRUB facilities", grub_path);
|
||||
filebuf_via_grub = xmalloc (file->size);
|
||||
grub_file_read (file, filebuf_via_grub, file->size);
|
||||
|
||||
grub_util_info ("comparing");
|
||||
grub_util_info ("comparing");
|
||||
|
||||
if (memcmp (filebuf_via_grub, filebuf_via_sys, file->size))
|
||||
grub_util_error ("files differ");
|
||||
if (memcmp (filebuf_via_grub, filebuf_via_sys, file->size))
|
||||
grub_util_error ("files differ");
|
||||
}
|
||||
}
|
||||
|
||||
printf ("%s\n", fs->name);
|
||||
|
@ -303,10 +309,10 @@ usage (int status)
|
|||
{
|
||||
if (status)
|
||||
fprintf (stderr,
|
||||
"Try ``grub-probe --help'' for more information.\n");
|
||||
"Try ``%s --help'' for more information.\n", program_name);
|
||||
else
|
||||
printf ("\
|
||||
Usage: grub-probe [OPTION]... [PATH|DEVICE]\n\
|
||||
Usage: %s [OPTION]... [PATH|DEVICE]\n\
|
||||
\n\
|
||||
Probe device information for a given path (or device, if the -d option is given).\n\
|
||||
\n\
|
||||
|
@ -319,7 +325,7 @@ Probe device information for a given path (or device, if the -d option is given)
|
|||
-v, --verbose print verbose messages\n\
|
||||
\n\
|
||||
Report bugs to <%s>.\n\
|
||||
",
|
||||
", program_name,
|
||||
DEFAULT_DEVICE_MAP, PACKAGE_BUGREPORT);
|
||||
|
||||
exit (status);
|
||||
|
@ -331,7 +337,10 @@ main (int argc, char *argv[])
|
|||
char *dev_map = 0;
|
||||
char *argument;
|
||||
|
||||
progname = "grub-probe";
|
||||
set_program_name (argv[0]);
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
/* Check for options. */
|
||||
while (1)
|
||||
|
@ -376,7 +385,7 @@ main (int argc, char *argv[])
|
|||
break;
|
||||
|
||||
case 'V':
|
||||
printf ("%s (%s) %s\n", progname, PACKAGE_NAME, PACKAGE_VERSION);
|
||||
printf ("%s (%s) %s\n", program_name, PACKAGE_NAME, PACKAGE_VERSION);
|
||||
return 0;
|
||||
|
||||
case 'v':
|
||||
|
|
|
@ -24,7 +24,7 @@ libdir=@libdir@
|
|||
|
||||
. ${bindir}/gettext.sh
|
||||
export TEXTDOMAIN=@PACKAGE@
|
||||
export TEXTDOMAINDIR=@LOCALEDIR@
|
||||
export TEXTDOMAINDIR=@localedir@
|
||||
|
||||
case "${GRUB_DISTRIBUTOR}" in
|
||||
Debian) OS="${GRUB_DISTRIBUTOR} GNU/kFreeBSD" ;;
|
||||
|
@ -38,7 +38,7 @@ kfreebsd_entry ()
|
|||
recovery="$3" # not used yet
|
||||
args="$4" # not used yet
|
||||
title="$(gettext "%s, with kFreeBSD %s")"
|
||||
printf "menuentry \"${title}\" {" ${os} ${version}
|
||||
printf "menuentry \"${title}\" {\n" "${os}" "${version}"
|
||||
if [ -z "${prepare_boot_cache}" ]; then
|
||||
prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/")"
|
||||
fi
|
||||
|
|
|
@ -24,7 +24,7 @@ libdir=@libdir@
|
|||
|
||||
. ${bindir}/gettext.sh
|
||||
export TEXTDOMAIN=@PACKAGE@
|
||||
export TEXTDOMAINDIR=@LOCALEDIR@
|
||||
export TEXTDOMAINDIR=@localedir@
|
||||
|
||||
if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
|
||||
OS=GNU/Linux
|
||||
|
@ -58,7 +58,7 @@ linux_entry ()
|
|||
else
|
||||
title="$(gettext "%s, with Linux %s")"
|
||||
fi
|
||||
printf "menuentry \"${title}\" {" ${os} ${version}
|
||||
printf "menuentry \"${title}\" {\n" "${os}" "${version}"
|
||||
if [ -z "${prepare_boot_cache}" ]; then
|
||||
prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/")"
|
||||
fi
|
||||
|
|
|
@ -679,14 +679,14 @@ make_device_name (int drive, int dos_part, int bsd_part)
|
|||
char *bsd_part_str = NULL;
|
||||
|
||||
if (dos_part >= 0)
|
||||
asprintf (&dos_part_str, ",%d", dos_part + 1);
|
||||
dos_part_str = xasprintf (",%d", dos_part + 1);
|
||||
|
||||
if (bsd_part >= 0)
|
||||
asprintf (&bsd_part_str, ",%c", dos_part + 'a');
|
||||
bsd_part_str = xasprintf (",%c", dos_part + 'a');
|
||||
|
||||
asprintf (&ret, "%s%s%s", map[drive].drive,
|
||||
dos_part_str ? : "",
|
||||
bsd_part_str ? : "");
|
||||
ret = xasprintf ("%s%s%s", map[drive].drive,
|
||||
dos_part_str ? : "",
|
||||
bsd_part_str ? : "");
|
||||
|
||||
if (dos_part_str)
|
||||
free (dos_part_str);
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include <grub/kernel.h>
|
||||
#include <grub/efi/pe32.h>
|
||||
#include <grub/machine/kernel.h>
|
||||
#include "progname.h"
|
||||
|
||||
#if GRUB_TARGET_WORDSIZE == 32
|
||||
# define grub_le_to_cpu(val) grub_le_to_cpu32(val)
|
||||
|
@ -54,12 +55,12 @@ align_pe32_section (Elf_Addr addr)
|
|||
/* Read the whole kernel image. Return the pointer to a read image,
|
||||
and store the size in bytes in *SIZE. */
|
||||
static char *
|
||||
read_kernel_module (const char *dir, size_t *size)
|
||||
read_kernel_image (const char *dir, size_t *size)
|
||||
{
|
||||
char *kernel_image;
|
||||
char *kernel_path;
|
||||
|
||||
kernel_path = grub_util_get_path (dir, "kernel.mod");
|
||||
kernel_path = grub_util_get_path (dir, "kernel.img");
|
||||
*size = grub_util_get_image_size (kernel_path);
|
||||
kernel_image = grub_util_read_image (kernel_path);
|
||||
free (kernel_path);
|
||||
|
@ -944,7 +945,7 @@ convert_elf (const char *dir, char *prefix, FILE *out, char *mods[])
|
|||
int i;
|
||||
|
||||
/* Get the kernel image and check the format. */
|
||||
kernel_image = read_kernel_module (dir, &kernel_size);
|
||||
kernel_image = read_kernel_image (dir, &kernel_size);
|
||||
e = (Elf_Ehdr *) kernel_image;
|
||||
if (! check_elf_header (e, kernel_size))
|
||||
grub_util_error ("invalid ELF header");
|
||||
|
@ -1056,7 +1057,7 @@ main (int argc, char *argv[])
|
|||
char *dir = NULL;
|
||||
char *prefix = NULL;
|
||||
|
||||
progname = "grub-mkimage";
|
||||
program_name = "grub-mkimage";
|
||||
|
||||
while (1)
|
||||
{
|
||||
|
|
56
util/misc.c
56
util/misc.c
|
@ -39,6 +39,8 @@
|
|||
#include <grub/term.h>
|
||||
#include <grub/time.h>
|
||||
|
||||
#include "progname.h"
|
||||
|
||||
/* Include malloc.h, only if memalign is available. It is known that
|
||||
memalign is declared in malloc.h in all systems, if present. */
|
||||
#ifdef HAVE_MEMALIGN
|
||||
|
@ -50,7 +52,6 @@
|
|||
#include <winioctl.h>
|
||||
#endif
|
||||
|
||||
char *progname = 0;
|
||||
int verbosity = 0;
|
||||
|
||||
void
|
||||
|
@ -58,7 +59,7 @@ grub_util_warn (const char *fmt, ...)
|
|||
{
|
||||
va_list ap;
|
||||
|
||||
fprintf (stderr, "%s: warn: ", progname);
|
||||
fprintf (stderr, "%s: warn: ", program_name);
|
||||
va_start (ap, fmt);
|
||||
vfprintf (stderr, fmt, ap);
|
||||
va_end (ap);
|
||||
|
@ -73,7 +74,7 @@ grub_util_info (const char *fmt, ...)
|
|||
{
|
||||
va_list ap;
|
||||
|
||||
fprintf (stderr, "%s: info: ", progname);
|
||||
fprintf (stderr, "%s: info: ", program_name);
|
||||
va_start (ap, fmt);
|
||||
vfprintf (stderr, fmt, ap);
|
||||
va_end (ap);
|
||||
|
@ -87,7 +88,7 @@ grub_util_error (const char *fmt, ...)
|
|||
{
|
||||
va_list ap;
|
||||
|
||||
fprintf (stderr, "%s: error: ", progname);
|
||||
fprintf (stderr, "%s: error: ", program_name);
|
||||
va_start (ap, fmt);
|
||||
vfprintf (stderr, fmt, ap);
|
||||
va_end (ap);
|
||||
|
@ -369,6 +370,19 @@ grub_arch_sync_caches (void *address __attribute__ ((unused)),
|
|||
{
|
||||
}
|
||||
|
||||
#ifndef HAVE_VASPRINTF
|
||||
|
||||
int
|
||||
vasprintf (char **buf, const char *fmt, va_list ap)
|
||||
{
|
||||
/* Should be large enough. */
|
||||
*buf = xmalloc (512);
|
||||
|
||||
return vsprintf (*buf, fmt, ap);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_ASPRINTF
|
||||
|
||||
int
|
||||
|
@ -377,11 +391,8 @@ asprintf (char **buf, const char *fmt, ...)
|
|||
int status;
|
||||
va_list ap;
|
||||
|
||||
/* Should be large enough. */
|
||||
*buf = xmalloc (512);
|
||||
|
||||
va_start (ap, fmt);
|
||||
status = vsprintf (*buf, fmt, ap);
|
||||
status = vasprintf (*buf, fmt, ap);
|
||||
va_end (ap);
|
||||
|
||||
return status;
|
||||
|
@ -389,6 +400,23 @@ asprintf (char **buf, const char *fmt, ...)
|
|||
|
||||
#endif
|
||||
|
||||
char *
|
||||
xasprintf (const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
char *result;
|
||||
|
||||
va_start (ap, fmt);
|
||||
if (vasprintf (&result, fmt, ap) < 0)
|
||||
{
|
||||
if (errno == ENOMEM)
|
||||
grub_util_error ("out of memory");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifdef __MINGW32__
|
||||
|
||||
void sync (void)
|
||||
|
@ -499,7 +527,17 @@ make_system_path_relative_to_its_root (const char *path)
|
|||
|
||||
/* buf is another filesystem; we found it. */
|
||||
if (st.st_dev != num)
|
||||
break;
|
||||
{
|
||||
/* offset == 0 means path given is the mount point. */
|
||||
if (offset == 0)
|
||||
{
|
||||
free (buf);
|
||||
free (buf2);
|
||||
return strdup ("/");
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
offset = p - buf;
|
||||
/* offset == 1 means root directory. */
|
||||
|
|
|
@ -202,17 +202,17 @@ static const struct ld_option ld_options[] =
|
|||
{ {"all-files", no_argument, NULL, 'a'},
|
||||
'a', NULL, N_("Process all files (don't skip backup files)"), ONE_DASH },
|
||||
{ {"abstract", required_argument, NULL, OPTION_ABSTRACT},
|
||||
'\0', "FILE", N_("Set Abstract filename"), ONE_DASH },
|
||||
'\0', N_("FILE"), N_("Set Abstract filename"), ONE_DASH },
|
||||
{ {"appid", required_argument, NULL, 'A'},
|
||||
'A', "ID", N_("Set Application ID"), ONE_DASH },
|
||||
'A', N_("ID"), N_("Set Application ID"), ONE_DASH },
|
||||
{ {"biblio", required_argument, NULL, OPTION_BIBLIO},
|
||||
'\0', "FILE", N_("Set Bibliographic filename"), ONE_DASH },
|
||||
'\0', N_("FILE"), N_("Set Bibliographic filename"), ONE_DASH },
|
||||
{ {"copyright", required_argument, NULL, OPTION_COPYRIGHT},
|
||||
'\0', "FILE", N_("Set Copyright filename"), ONE_DASH },
|
||||
'\0', N_("FILE"), N_("Set Copyright filename"), ONE_DASH },
|
||||
{ {"eltorito-boot", required_argument, NULL, 'b'},
|
||||
'b', "FILE", N_("Set El Torito boot image name"), ONE_DASH },
|
||||
'b', N_("FILE"), N_("Set El Torito boot image name"), ONE_DASH },
|
||||
{ {"eltorito-catalog", required_argument, NULL, 'c'},
|
||||
'c', "FILE", N_("Set El Torito boot catalog name"), ONE_DASH },
|
||||
'c', N_("FILE"), N_("Set El Torito boot catalog name"), ONE_DASH },
|
||||
{ {"boot-info-table", no_argument, NULL, OPTION_BOOT_INFO_TABLE },
|
||||
'\0', NULL, N_("Patch Boot Info Table in El Torito boot image"), ONE_DASH },
|
||||
{ {"no-emul-boot", no_argument, NULL, OPTION_NO_EMUL_BOOT },
|
||||
|
@ -220,7 +220,7 @@ static const struct ld_option ld_options[] =
|
|||
{ {"eltorito-emul-floppy", no_argument, NULL, OPTION_ELTORITO_EMUL_FLOPPY },
|
||||
'\0', NULL, N_("Enable floppy drive emulation for El Torito"), TWO_DASHES },
|
||||
{ {"cdwrite-params", required_argument, NULL, 'C'},
|
||||
'C', "PARAMS", N_("Magic parameters from cdrecord"), ONE_DASH },
|
||||
'C', N_("PARAMS"), N_("Magic parameters from cdrecord"), ONE_DASH },
|
||||
{ {"omit-period", no_argument, NULL, 'd'},
|
||||
'd', NULL, N_("Omit trailing periods from filenames"), ONE_DASH },
|
||||
{ {"disable-deep-relocation", no_argument, NULL, 'D'},
|
||||
|
@ -234,11 +234,11 @@ static const struct ld_option ld_options[] =
|
|||
{ {"version", no_argument, NULL, OPTION_VERSION},
|
||||
'\0', NULL, N_("Print version information and exit"), TWO_DASHES },
|
||||
{ {"hide", required_argument, NULL, OPTION_I_HIDE},
|
||||
'\0', "GLOBFILE", N_("Hide ISO9660/RR file"), ONE_DASH },
|
||||
'\0', N_("GLOBFILE"), N_("Hide ISO9660/RR file"), ONE_DASH },
|
||||
{ {"hide-joliet", required_argument, NULL, OPTION_J_HIDE},
|
||||
'\0', "GLOBFILE", N_("Hide Joliet file"), ONE_DASH },
|
||||
'\0', N_("GLOBFILE"), N_("Hide Joliet file"), ONE_DASH },
|
||||
{ {NULL, required_argument, NULL, 'i'},
|
||||
'i', "ADD_FILES", N_("No longer supported"), TWO_DASHES },
|
||||
'i', N_("ADD_FILES"), N_("No longer supported"), TWO_DASHES },
|
||||
{ {"joliet", no_argument, NULL, 'J'},
|
||||
'J', NULL, N_("Generate Joliet directory information"), ONE_DASH },
|
||||
{ {"full-iso9660-filenames", no_argument, NULL, 'l'},
|
||||
|
@ -246,11 +246,11 @@ static const struct ld_option ld_options[] =
|
|||
{ {"allow-leading-dots", no_argument, NULL, 'L'},
|
||||
'L', NULL, N_("Allow iso9660 filenames to start with '.'"), ONE_DASH },
|
||||
{ {"log-file", required_argument, NULL, OPTION_LOG_FILE},
|
||||
'\0', "LOG_FILE", N_("Re-direct messages to LOG_FILE"), ONE_DASH },
|
||||
'\0', N_("LOG_FILE"), N_("Re-direct messages to LOG_FILE"), ONE_DASH },
|
||||
{ {"exclude", required_argument, NULL, 'm'},
|
||||
'm', "GLOBFILE", N_("Exclude file name"), ONE_DASH },
|
||||
'm', N_("GLOBFILE"), N_("Exclude file name"), ONE_DASH },
|
||||
{ {"prev-session", required_argument, NULL, 'M'},
|
||||
'M', "FILE", N_("Set path to previous session to merge"), ONE_DASH },
|
||||
'M', N_("FILE"), N_("Set path to previous session to merge"), ONE_DASH },
|
||||
{ {"omit-version-number", no_argument, NULL, 'N'},
|
||||
'N', NULL, N_("Omit version number from iso9660 filename"), ONE_DASH },
|
||||
{ {"no-split-symlink-components", no_argument, NULL, 0},
|
||||
|
@ -258,13 +258,13 @@ static const struct ld_option ld_options[] =
|
|||
{ {"no-split-symlink-fields", no_argument, NULL, 0},
|
||||
0, NULL, N_("Inhibit splitting symlink fields"), ONE_DASH },
|
||||
{ {"output", required_argument, NULL, 'o'},
|
||||
'o', "FILE", N_("Set output file name"), ONE_DASH },
|
||||
'o', N_("FILE"), N_("Set output file name"), ONE_DASH },
|
||||
{ {"preparer", required_argument, NULL, 'p'},
|
||||
'p', "PREP", N_("Set Volume preparer"), ONE_DASH },
|
||||
'p', N_("PREP"), N_("Set Volume preparer"), ONE_DASH },
|
||||
{ {"print-size", no_argument, NULL, OPTION_PRINT_SIZE},
|
||||
'\0', NULL, N_("Print estimated filesystem size and exit"), ONE_DASH },
|
||||
{ {"publisher", required_argument, NULL, 'P'},
|
||||
'P', "PUB", N_("Set Volume publisher"), ONE_DASH },
|
||||
'P', N_("PUB"), N_("Set Volume publisher"), ONE_DASH },
|
||||
{ {"quiet", no_argument, NULL, OPTION_QUIET},
|
||||
'\0', NULL, N_("Run quietly"), ONE_DASH },
|
||||
{ {"rational-rock", no_argument, NULL, 'r'},
|
||||
|
@ -274,21 +274,21 @@ static const struct ld_option ld_options[] =
|
|||
{ {"split-output", no_argument, NULL, OPTION_SPLIT_OUTPUT},
|
||||
'\0', NULL, N_("Split output into files of approx. 1GB size"), ONE_DASH },
|
||||
{ {"sysid", required_argument, NULL, OPTION_SYSID},
|
||||
'\0', "ID", N_("Set System ID"), ONE_DASH },
|
||||
'\0', N_("ID"), N_("Set System ID"), ONE_DASH },
|
||||
{ {"translation-table", no_argument, NULL, 'T'},
|
||||
'T', NULL, N_("Generate translation tables for systems that don't understand long filenames"), ONE_DASH },
|
||||
{ {"verbose", no_argument, NULL, 'v'},
|
||||
'v', NULL, N_("Verbose"), ONE_DASH },
|
||||
{ {"volid", required_argument, NULL, 'V'},
|
||||
'V', "ID", N_("Set Volume ID"), ONE_DASH },
|
||||
'V', N_("ID"), N_("Set Volume ID"), ONE_DASH },
|
||||
{ {"volset", required_argument, NULL, OPTION_VOLSET},
|
||||
'\0', "ID", N_("Set Volume set ID"), ONE_DASH },
|
||||
'\0', N_("ID"), N_("Set Volume set ID"), ONE_DASH },
|
||||
{ {"volset-size", required_argument, NULL, OPTION_VOLSET_SIZE},
|
||||
'\0', "#", N_("Set Volume set size"), ONE_DASH },
|
||||
{ {"volset-seqno", required_argument, NULL, OPTION_VOLSET_SEQ_NUM},
|
||||
'\0', "#", N_("Set Volume set sequence number"), ONE_DASH },
|
||||
{ {"old-exclude", required_argument, NULL, 'x'},
|
||||
'x', "FILE", N_("Exclude file name (deprecated)"), ONE_DASH },
|
||||
'x', N_("FILE"), N_("Exclude file name (deprecated)"), ONE_DASH },
|
||||
#ifdef ERIC_neverdef
|
||||
{ {"transparent-compression", no_argument, NULL, 'z'},
|
||||
'z', NULL, "Enable transparent compression of files", ONE_DASH },
|
||||
|
@ -481,6 +481,7 @@ void usage(){
|
|||
int comma;
|
||||
int len;
|
||||
unsigned int j;
|
||||
char *arg;
|
||||
|
||||
printf (" ");
|
||||
|
||||
|
@ -502,8 +503,9 @@ void usage(){
|
|||
putchar (' ');
|
||||
++len;
|
||||
}
|
||||
printf ("%s", ld_options[j].arg);
|
||||
len += strlen (ld_options[j].arg);
|
||||
arg = gettext (ld_options[j].arg);
|
||||
printf ("%s", arg);
|
||||
len += strlen (arg);
|
||||
}
|
||||
comma = TRUE;
|
||||
}
|
||||
|
@ -527,8 +529,9 @@ void usage(){
|
|||
+ strlen (ld_options[j].opt.name));
|
||||
if (ld_options[j].arg != NULL)
|
||||
{
|
||||
printf (" %s", ld_options[j].arg);
|
||||
len += 1 + strlen (ld_options[j].arg);
|
||||
arg = gettext (ld_options[j].arg);
|
||||
printf (" %s", arg);
|
||||
len += 1 + strlen (arg);
|
||||
}
|
||||
comma = TRUE;
|
||||
}
|
||||
|
|
76
util/pci.c
Normal file
76
util/pci.c
Normal file
|
@ -0,0 +1,76 @@
|
|||
/* pci.c - Generic PCI interfaces. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2007,2009 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB 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 GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/pci.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/util/misc.h>
|
||||
|
||||
grub_pci_address_t
|
||||
grub_pci_make_address (grub_pci_device_t dev, int reg)
|
||||
{
|
||||
grub_pci_address_t ret;
|
||||
ret.dev = dev;
|
||||
ret.pos = reg << 2;
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
grub_pci_iterate (grub_pci_iteratefunc_t hook)
|
||||
{
|
||||
struct pci_device_iterator *iter;
|
||||
struct pci_slot_match slot;
|
||||
struct pci_device *dev;
|
||||
slot.domain = PCI_MATCH_ANY;
|
||||
slot.bus = PCI_MATCH_ANY;
|
||||
slot.dev = PCI_MATCH_ANY;
|
||||
slot.func = PCI_MATCH_ANY;
|
||||
iter = pci_slot_match_iterator_create (&slot);
|
||||
while ((dev = pci_device_next (iter)))
|
||||
hook (dev, dev->vendor_id | (dev->device_id << 16));
|
||||
pci_iterator_destroy (iter);
|
||||
}
|
||||
|
||||
void *
|
||||
grub_pci_device_map_range (grub_pci_device_t dev, grub_addr_t base,
|
||||
grub_size_t size)
|
||||
{
|
||||
void *addr;
|
||||
int err;
|
||||
err = pci_device_map_range (dev, base, size, PCI_DEV_MAP_FLAG_WRITABLE, &addr);
|
||||
if (err)
|
||||
grub_util_error ("mapping 0x%x failed (error %d)\n", base, err);
|
||||
return addr;
|
||||
}
|
||||
|
||||
void
|
||||
grub_pci_device_unmap_range (grub_pci_device_t dev, void *mem,
|
||||
grub_size_t size)
|
||||
{
|
||||
pci_device_unmap_range (dev, mem, size);
|
||||
}
|
||||
|
||||
GRUB_MOD_INIT (pci)
|
||||
{
|
||||
pci_system_init ();
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI (pci)
|
||||
{
|
||||
pci_system_cleanup ();
|
||||
}
|
276
util/sparc64/ieee1275/grub-install.in
Normal file
276
util/sparc64/ieee1275/grub-install.in
Normal file
|
@ -0,0 +1,276 @@
|
|||
#! /bin/sh
|
||||
|
||||
# Install GRUB on your drive.
|
||||
# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009 Free Software Foundation, Inc.
|
||||
#
|
||||
# GRUB 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# GRUB 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 GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Initialize some variables.
|
||||
transform="@program_transform_name@"
|
||||
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
sbindir=@sbindir@
|
||||
bindir=@bindir@
|
||||
libdir=@libdir@
|
||||
PACKAGE_NAME=@PACKAGE_NAME@
|
||||
PACKAGE_TARNAME=@PACKAGE_TARNAME@
|
||||
PACKAGE_VERSION=@PACKAGE_VERSION@
|
||||
target_cpu=@target_cpu@
|
||||
platform=@platform@
|
||||
pkglibdir=${libdir}/`echo ${PACKAGE_TARNAME}/${target_cpu}-${platform} | sed ${transform}`
|
||||
|
||||
grub_setup=${sbindir}/`echo grub-setup | sed ${transform}`
|
||||
grub_mkimage=${bindir}/`echo grub-mkimage | sed ${transform}`
|
||||
grub_mkdevicemap=${sbindir}/`echo grub-mkdevicemap | sed ${transform}`
|
||||
grub_probe=${sbindir}/`echo grub-probe | sed ${transform}`
|
||||
rootdir=
|
||||
grub_prefix=`echo /boot/grub | sed ${transform}`
|
||||
modules=
|
||||
|
||||
install_device=
|
||||
no_floppy=
|
||||
force_lba=
|
||||
recheck=no
|
||||
debug=no
|
||||
|
||||
# Usage: usage
|
||||
# Print the usage.
|
||||
usage () {
|
||||
cat <<EOF
|
||||
Usage: grub-install [OPTION] install_device
|
||||
Install GRUB on your drive.
|
||||
|
||||
-h, --help print this message and exit
|
||||
-v, --version print the version information and exit
|
||||
--modules=MODULES pre-load specified modules MODULES
|
||||
--root-directory=DIR install GRUB images under the directory DIR
|
||||
instead of the root directory
|
||||
--grub-setup=FILE use FILE as grub-setup
|
||||
--grub-mkimage=FILE use FILE as grub-mkimage
|
||||
--grub-mkdevicemap=FILE use FILE as grub-mkdevicemap
|
||||
--grub-probe=FILE use FILE as grub-probe
|
||||
--no-floppy do not probe any floppy drive
|
||||
--recheck probe a device map even if it already exists
|
||||
|
||||
INSTALL_DEVICE can be a GRUB device name or a system device filename.
|
||||
|
||||
grub-install copies GRUB images into the DIR/boot directory specified by
|
||||
--root-directory, and uses grub-setup to install grub into the boot
|
||||
sector.
|
||||
|
||||
Report bugs to <bug-grub@gnu.org>.
|
||||
EOF
|
||||
}
|
||||
|
||||
# Check the arguments.
|
||||
for option in "$@"; do
|
||||
case "$option" in
|
||||
-h | --help)
|
||||
usage
|
||||
exit 0 ;;
|
||||
-v | --version)
|
||||
echo "grub-install (GNU GRUB ${PACKAGE_VERSION})"
|
||||
exit 0 ;;
|
||||
--modules=*)
|
||||
modules=`echo "$option" | sed 's/--modules=//'` ;;
|
||||
--root-directory=*)
|
||||
rootdir=`echo "$option" | sed 's/--root-directory=//'` ;;
|
||||
--grub-setup=*)
|
||||
grub_setup=`echo "$option" | sed 's/--grub-setup=//'` ;;
|
||||
--grub-mkimage=*)
|
||||
grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;;
|
||||
--grub-mkdevicemap=*)
|
||||
grub_mkdevicemap=`echo "$option" | sed 's/--grub-mkdevicemap=//'` ;;
|
||||
--grub-probe=*)
|
||||
grub_probe=`echo "$option" | sed 's/--grub-probe=//'` ;;
|
||||
--no-floppy)
|
||||
no_floppy="--no-floppy" ;;
|
||||
--recheck)
|
||||
recheck=yes ;;
|
||||
# This is an undocumented feature...
|
||||
--debug)
|
||||
debug=yes ;;
|
||||
-*)
|
||||
echo "Unrecognized option \`$option'" 1>&2
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
if test "x$install_device" != x; then
|
||||
echo "More than one install_devices?" 1>&2
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
install_device="${option}" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# for make_system_path_relative_to_its_root()
|
||||
. ${libdir}/grub/grub-mkconfig_lib
|
||||
|
||||
if test "x$install_device" = x; then
|
||||
echo "install_device not specified." 1>&2
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# If the debugging feature is enabled, print commands.
|
||||
setup_verbose=
|
||||
if test $debug = yes; then
|
||||
set -x
|
||||
setup_verbose="--verbose"
|
||||
fi
|
||||
|
||||
# Initialize these directories here, since ROOTDIR was initialized.
|
||||
bootdir=${rootdir}/boot
|
||||
grubdir=${bootdir}/`echo grub | sed ${transform}`
|
||||
device_map=${grubdir}/device.map
|
||||
|
||||
grub_probe="${grub_probe} --device-map=${device_map}"
|
||||
|
||||
# Check if GRUB is installed.
|
||||
set $grub_setup dummy
|
||||
if test -f "$1"; then
|
||||
:
|
||||
else
|
||||
echo "$1: Not found." 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
set $grub_mkimage dummy
|
||||
if test -f "$1"; then
|
||||
:
|
||||
else
|
||||
echo "$1: Not found." 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
set $grub_mkdevicemap dummy
|
||||
if test -f "$1"; then
|
||||
:
|
||||
else
|
||||
echo "$1: Not found." 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create the GRUB directory if it is not present.
|
||||
test -d "$bootdir" || mkdir "$bootdir" || exit 1
|
||||
test -d "$grubdir" || mkdir "$grubdir" || exit 1
|
||||
|
||||
# If --recheck is specified, remove the device map, if present.
|
||||
if test $recheck = yes; then
|
||||
rm -f $device_map
|
||||
fi
|
||||
|
||||
# Create the device map file if it is not present.
|
||||
if test -f "$device_map"; then
|
||||
:
|
||||
else
|
||||
# Create a safe temporary file.
|
||||
test -n "$mklog" && log_file=`$mklog`
|
||||
|
||||
$grub_mkdevicemap --device-map=$device_map $no_floppy || exit 1
|
||||
fi
|
||||
|
||||
# Make sure that there is no duplicated entry.
|
||||
tmp=`sed -n '/^([fh]d[0-9]*)/s/\(^(.*)\).*/\1/p' $device_map \
|
||||
| sort | uniq -d | sed -n 1p`
|
||||
if test -n "$tmp"; then
|
||||
echo "The drive $tmp is defined multiple times in the device map $device_map" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Copy the GRUB images to the GRUB directory.
|
||||
for file in ${grubdir}/*.mod ${grubdir}/*.lst ${grubdir}/*.img; do
|
||||
if test -f $file && [ "`basename $file`" != menu.lst ]; then
|
||||
rm -f $file || exit 1
|
||||
fi
|
||||
done
|
||||
for file in ${pkglibdir}/*.mod ${pkglibdir}/*.lst; do
|
||||
cp -f $file ${grubdir} || exit 1
|
||||
done
|
||||
|
||||
for file in ${pkglibdir}/*.img; do
|
||||
cp -f $file ${grubdir} || exit 1
|
||||
done
|
||||
|
||||
# Write device to a variable so we don't have to traverse /dev every time.
|
||||
grub_device=`$grub_probe --target=device ${grubdir}`
|
||||
|
||||
# Create the core image. First, auto-detect the filesystem module.
|
||||
fs_module=`$grub_probe --target=fs --device ${grub_device}`
|
||||
if test "x$fs_module" = x -a "x$modules" = x; then
|
||||
echo "Auto-detection of a filesystem module failed." 1>&2
|
||||
echo "Please specify the module with the option \`--modules' explicitly." 1>&2
|
||||
exit 1
|
||||
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 ${grub_device} 2> /dev/null`
|
||||
|
||||
# Device abstraction module, if any (lvm, raid).
|
||||
devabstraction_module=`$grub_probe --target=abstraction --device ${grub_device}`
|
||||
|
||||
modules="$modules $fs_module $partmap_module $devabstraction_module"
|
||||
|
||||
prefix_drive=
|
||||
if [ "x${devabstraction_module}" = "x" ] ; then
|
||||
if echo "${install_device}" | grep -qx "(.*)" ; then
|
||||
install_drive="${install_device}"
|
||||
else
|
||||
install_drive="`$grub_probe --target=drive --device ${install_device}`"
|
||||
fi
|
||||
grub_drive="`$grub_probe --target=drive --device ${grub_device}`"
|
||||
|
||||
# Strip partition number
|
||||
install_drive="`echo ${install_drive} | sed -e 's/\([^\]\),[0-9]*/\1/g'`"
|
||||
grub_drive="`echo ${grub_drive} | sed -e 's/\([^\]\),[0-9]*/\1/g'`"
|
||||
if [ "x${grub_drive}" != "x${install_drive}" ] ; then
|
||||
uuid="`$grub_probe --target=fs_uuid --device ${grub_device}`"
|
||||
if [ "x${uuid}" = "x" ] ; then
|
||||
echo "You attempted a cross-disk install, but the filesystem containing ${grubdir} does not support UUIDs." 1>&2
|
||||
exit 1
|
||||
fi
|
||||
prefix_drive="(UUID=${uuid})"
|
||||
modules="$modules fs_uuid"
|
||||
fi
|
||||
else
|
||||
prefix_drive=`$grub_probe --target=drive --device ${grub_device}`
|
||||
fi
|
||||
|
||||
relative_grubdir=`make_system_path_relative_to_its_root ${grubdir}` || exit 1
|
||||
if [ "x${relative_grubdir}" = "x" ] ; then
|
||||
relative_grubdir=/
|
||||
fi
|
||||
|
||||
$grub_mkimage --output=${grubdir}/core.img --prefix=${prefix_drive}${relative_grubdir} $modules || exit 1
|
||||
|
||||
# Now perform the installation.
|
||||
$grub_setup ${setup_verbose} --directory=${grubdir} --device-map=${device_map} \
|
||||
${install_device} || exit 1
|
||||
|
||||
# Prompt the user to check if the device map is correct.
|
||||
echo "Installation finished. No error reported."
|
||||
echo "This is the contents of the device map $device_map."
|
||||
echo "Check if this is correct or not. If any of the lines is incorrect,"
|
||||
echo "fix it and re-run the script \`grub-install'."
|
||||
echo
|
||||
|
||||
cat $device_map
|
||||
|
||||
# Bye.
|
||||
exit 0
|
|
@ -21,6 +21,7 @@
|
|||
#include <grub/machine/boot.h>
|
||||
#include <grub/machine/kernel.h>
|
||||
#include <grub/kernel.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/disk.h>
|
||||
#include <grub/util/misc.h>
|
||||
#include <grub/util/resolve.h>
|
||||
|
@ -34,6 +35,8 @@
|
|||
#define _GNU_SOURCE 1
|
||||
#include <getopt.h>
|
||||
|
||||
#include "progname.h"
|
||||
|
||||
static void
|
||||
compress_kernel (char *kernel_img, size_t kernel_size,
|
||||
char **core_img, size_t *core_size)
|
||||
|
@ -188,10 +191,10 @@ static void
|
|||
usage (int status)
|
||||
{
|
||||
if (status)
|
||||
fprintf (stderr, "Try ``grub-mkimage --help'' for more information.\n");
|
||||
fprintf (stderr, "Try ``%s --help'' for more information.\n", program_name);
|
||||
else
|
||||
printf ("\
|
||||
Usage: grub-mkimage [OPTION]... [MODULES]\n\
|
||||
Usage: %s [OPTION]... [MODULES]\n\
|
||||
\n\
|
||||
Make a bootable image of GRUB.\n\
|
||||
\n\
|
||||
|
@ -204,7 +207,7 @@ Make a bootable image of GRUB.\n\
|
|||
-v, --verbose print verbose messages\n\
|
||||
\n\
|
||||
Report bugs to <%s>.\n\
|
||||
", GRUB_LIBDIR, DEFAULT_DIRECTORY, PACKAGE_BUGREPORT);
|
||||
", program_name, GRUB_LIBDIR, DEFAULT_DIRECTORY, PACKAGE_BUGREPORT);
|
||||
|
||||
exit (status);
|
||||
}
|
||||
|
@ -218,7 +221,11 @@ main (int argc, char *argv[])
|
|||
char *memdisk = NULL;
|
||||
FILE *fp = stdout;
|
||||
|
||||
progname = "grub-mkimage";
|
||||
set_program_name (argv[0]);
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
while (1)
|
||||
{
|
||||
int c = getopt_long (argc, argv, "d:p:m:o:hVv", options, 0);
|
||||
|
|
|
@ -20,15 +20,22 @@
|
|||
#include <grub/util/misc.h>
|
||||
#include <grub/util/ofpath.h>
|
||||
|
||||
#include <grub/i18n.h>
|
||||
|
||||
#include "progname.h"
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char *of_path;
|
||||
|
||||
progname = "grub-ofpathname";
|
||||
set_program_name (argv[0]);
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
if (argc != 2)
|
||||
{
|
||||
printf("Usage: grub-ofpathname DEVICE\n");
|
||||
printf("Usage: %s DEVICE\n", program_name);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include <grub/types.h>
|
||||
#include <grub/util/misc.h>
|
||||
#include <grub/device.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/disk.h>
|
||||
#include <grub/file.h>
|
||||
#include <grub/fs.h>
|
||||
|
@ -49,6 +50,8 @@
|
|||
#define _GNU_SOURCE 1
|
||||
#include <getopt.h>
|
||||
|
||||
#include "progname.h"
|
||||
|
||||
/* This program fills in various fields inside of the 'boot' and 'core'
|
||||
* image files.
|
||||
*
|
||||
|
@ -401,10 +404,10 @@ static void
|
|||
usage (int status)
|
||||
{
|
||||
if (status)
|
||||
fprintf (stderr, "Try ``grub-setup --help'' for more information.\n");
|
||||
fprintf (stderr, "Try ``%s --help'' for more information.\n", program_name);
|
||||
else
|
||||
printf ("\
|
||||
Usage: grub-setup [OPTION]... DEVICE\n\
|
||||
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\
|
||||
|
@ -419,7 +422,7 @@ DEVICE must be a GRUB device (e.g. ``(hd0,1)'').\n\
|
|||
-v, --verbose print verbose messages\n\
|
||||
\n\
|
||||
Report bugs to <%s>.\n\
|
||||
",
|
||||
", program_name,
|
||||
DEFAULT_BOOT_FILE, DEFAULT_CORE_FILE, DEFAULT_DIRECTORY,
|
||||
DEFAULT_DEVICE_MAP, PACKAGE_BUGREPORT);
|
||||
|
||||
|
@ -616,7 +619,10 @@ main (int argc, char *argv[])
|
|||
{
|
||||
struct grub_setup_info ginfo;
|
||||
|
||||
progname = "grub-setup";
|
||||
set_program_name (argv[0]);
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
init_info (&ginfo);
|
||||
if (!parse_options (&ginfo, argc, argv))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue