in all grub-install flavours.
+2013-12-07 Vladimir Serbinenko <phcoder@gmail.com>
+
+ Transform -C option to grub-mkstandalone to --core-compress available
+ in all grub-install flavours.
+
2013-12-07 Vladimir Serbinenko <phcoder@gmail.com>
Merge GRUBFS and GRUB_FS variables.
{ "compress", GRUB_INSTALL_OPTIONS_INSTALL_COMPRESS, \
"no,xz,gz,lzo", OPTION_ARG_OPTIONAL, \
N_("compress GRUB files [optional]"), 1 }, \
+ {"core-compress", GRUB_INSTALL_OPTIONS_INSTALL_CORE_COMPRESS, \
+ N_("xz|none|auto"), \
+ 0, N_("choose the compression to use for core image"), 2}, \
/* TRANSLATORS: platform here isn't identifier. It can be translated. */ \
{ "directory", 'd', N_("DIR"), 0, \
N_("use images and modules under DIR [default=%s/<platform>]"), 1 }, \
GRUB_INSTALL_OPTIONS_DIRECTORY2,
GRUB_INSTALL_OPTIONS_LOCALE_DIRECTORY,
GRUB_INSTALL_OPTIONS_THEMES_DIRECTORY,
- GRUB_INSTALL_OPTIONS_GRUB_MKIMAGE
+ GRUB_INSTALL_OPTIONS_GRUB_MKIMAGE,
+ GRUB_INSTALL_OPTIONS_INSTALL_CORE_COMPRESS
};
extern char *grub_install_source_directory;
grub_install_make_image_wrap (const char *dir, const char *prefix,
const char *outname, char *memdisk_path,
char *config_path,
- const char *format, int note,
- grub_compression_t comp);
+ const char *format, int note);
void
grub_install_make_image_wrap_file (const char *dir, const char *prefix,
FILE *fp, const char *outname,
char *memdisk_path,
char *config_path,
- const char *mkimage_target, int note,
- grub_compression_t comp);
+ const char *mkimage_target, int note);
int
grub_install_copy_file (const char *src,
static char **pubkeys;
static size_t npubkeys;
+static grub_compression_t compression;
int
grub_install_parse (int key, char *arg)
{
switch (key)
{
+ case 'C':
+ if (grub_strcmp (arg, "xz") == 0)
+ {
+#ifdef HAVE_LIBLZMA
+ compression = GRUB_COMPRESSION_XZ;
+#else
+ grub_util_error ("%s",
+ _("grub-mkimage is compiled without XZ support"));
+#endif
+ }
+ else if (grub_strcmp (arg, "none") == 0)
+ compression = GRUB_COMPRESSION_NONE;
+ else if (grub_strcmp (arg, "auto") == 0)
+ compression = GRUB_COMPRESSION_AUTO;
+ else
+ grub_util_error (_("Unknown compression format %s"), arg);
+ return 1;
case 'k':
pubkeys = xrealloc (pubkeys,
sizeof (pubkeys[0])
FILE *fp, const char *outname,
char *memdisk_path,
char *config_path,
- const char *mkimage_target, int note,
- grub_compression_t comp)
+ const char *mkimage_target, int note)
{
const struct grub_install_image_target_desc *tgt;
const char *const compnames[] =
"--format '%s' --compression '%s' %s %s\n",
dir, prefix,
outname, mkimage_target,
- compnames[comp], note ? "--note" : "", s);
+ compnames[compression], note ? "--note" : "", s);
tgt = grub_install_get_image_target (mkimage_target);
if (!tgt)
grub_install_generate_image (dir, prefix, fp, outname,
modules.entries, memdisk_path,
pubkeys, npubkeys, config_path, tgt,
- note, comp);
+ note, compression);
while (dc--)
grub_install_pop_module ();
}
grub_install_make_image_wrap (const char *dir, const char *prefix,
const char *outname, char *memdisk_path,
char *config_path,
- const char *mkimage_target, int note,
- grub_compression_t comp)
+ const char *mkimage_target, int note)
{
FILE *fp;
strerror (errno));
grub_install_make_image_wrap_file (dir, prefix, fp, outname,
memdisk_path, config_path,
- mkimage_target, note, comp);
+ mkimage_target, note);
grub_util_file_sync (fp);
fclose (fp);
}
/* output */ imgfile,
/* memdisk */ NULL,
have_load_cfg ? load_cfg : NULL,
- /* image target */ mkimage_target,
- 0, GRUB_COMPRESSION_AUTO);
+ /* image target */ mkimage_target, 0);
/* Backward-compatibility kludges. */
switch (platform)
{
/* output */ dst,
/* memdisk */ NULL,
have_load_cfg ? load_cfg : NULL,
- /* image target */ mkimage_target,
- 0, GRUB_COMPRESSION_AUTO);
+ /* image target */ mkimage_target, 0);
}
break;
case GRUB_INSTALL_PLATFORM_ARM_EFI:
output = grub_util_path_concat_ext (2, grubdir, "core", targets[platform].ext);
grub_install_make_image_wrap (input_dir, prefix, output,
0, load_cfg,
- targets[platform].mkimage_target, 0,
- GRUB_COMPRESSION_AUTO);
+ targets[platform].mkimage_target, 0);
grub_install_pop_module ();
/* TRANSLATORS: First %s is replaced by platform name. Second one by filename. */
static void
make_image_abs (enum grub_install_plat plat,
const char *mkimage_target,
- const char *output,
- grub_compression_t compress)
+ const char *output)
{
char *load_cfg;
FILE *load_cfg_f;
grub_install_push_module ("iso9660");
grub_install_make_image_wrap (source_dirs[plat], "/boot/grub", output,
0, load_cfg,
- mkimage_target, 0,
- compress);
+ mkimage_target, 0);
grub_install_pop_module ();
grub_install_pop_module ();
grub_util_unlink (load_cfg);
static void
make_image (enum grub_install_plat plat,
const char *mkimage_target,
- const char *output_sub,
- grub_compression_t compress)
+ const char *output_sub)
{
char *out = grub_util_path_concat (2, boot_grub, output_sub);
- make_image_abs (plat, mkimage_target,
- out, GRUB_COMPRESSION_AUTO);
+ make_image_abs (plat, mkimage_target, out);
free (out);
}
grub_install_push_module ("iso9660");
grub_install_make_image_wrap (source_dirs[plat], "()/boot/grub", output,
- 0, load_cfg, mkimage_target, 0,
- GRUB_COMPRESSION_AUTO);
+ 0, load_cfg, mkimage_target, 0);
grub_install_pop_module ();
}
grub_install_make_image_wrap (source_dirs[GRUB_INSTALL_PLATFORM_I386_PC],
"/boot/grub", output,
0, load_cfg,
- "i386-pc-eltorito", 0,
- GRUB_COMPRESSION_AUTO);
+ "i386-pc-eltorito", 0);
xorriso_push ("-b");
xorriso_push ("boot/grub/i386-pc/eltorito.img");
grub_install_make_image_wrap (source_dirs[GRUB_INSTALL_PLATFORM_I386_PC],
"/boot/grub", output,
0, load_cfg,
- "i386-pc", 0,
- GRUB_COMPRESSION_AUTO);
+ "i386-pc", 0);
sz = ftello (sa);
fflush (sa);
grub_util_fd_sync (fileno (sa));
grub_install_push_module ("pata");
grub_install_push_module ("ahci");
grub_install_push_module ("at_keyboard");
- make_image (GRUB_INSTALL_PLATFORM_I386_MULTIBOOT, "i386-multiboot", "i386-multiboot/core.elf", GRUB_COMPRESSION_AUTO);
+ make_image (GRUB_INSTALL_PLATFORM_I386_MULTIBOOT, "i386-multiboot", "i386-multiboot/core.elf");
grub_install_pop_module ();
grub_install_pop_module ();
grub_install_pop_module ();
make_image_fwdisk (GRUB_INSTALL_PLATFORM_MIPSEL_ARC, "mipsel-arc", "arc.exe");
grub_install_push_module ("pata");
- make_image (GRUB_INSTALL_PLATFORM_MIPSEL_QEMU_MIPS, "mipsel-qemu_mips-elf", "roms/mipsel-qemu_mips.elf", GRUB_COMPRESSION_AUTO);
+ make_image (GRUB_INSTALL_PLATFORM_MIPSEL_QEMU_MIPS, "mipsel-qemu_mips-elf", "roms/mipsel-qemu_mips.elf");
- make_image (GRUB_INSTALL_PLATFORM_MIPSEL_LOONGSON, "mipsel-loongson-elf", "loongson.elf", GRUB_COMPRESSION_XZ);
+ make_image (GRUB_INSTALL_PLATFORM_MIPSEL_LOONGSON, "mipsel-loongson-elf", "loongson.elf");
- make_image (GRUB_INSTALL_PLATFORM_MIPSEL_LOONGSON, "mipsel-yeeloong-flash", "mipsel-yeeloong.bin", GRUB_COMPRESSION_XZ);
- make_image (GRUB_INSTALL_PLATFORM_MIPSEL_LOONGSON, "mipsel-fuloong2f-flash", "mipsel-fuloong2f.bin", GRUB_COMPRESSION_XZ);
+ make_image (GRUB_INSTALL_PLATFORM_MIPSEL_LOONGSON, "mipsel-yeeloong-flash", "mipsel-yeeloong.bin");
+ make_image (GRUB_INSTALL_PLATFORM_MIPSEL_LOONGSON, "mipsel-fuloong2f-flash", "mipsel-fuloong2f.bin");
- make_image (GRUB_INSTALL_PLATFORM_MIPS_QEMU_MIPS, "mips-qemu_mips-elf", "roms/mips-qemu_mips.elf", GRUB_COMPRESSION_AUTO);
+ make_image (GRUB_INSTALL_PLATFORM_MIPS_QEMU_MIPS, "mips-qemu_mips-elf", "roms/mips-qemu_mips.elf");
grub_install_push_module ("at_keyboard");
- make_image (GRUB_INSTALL_PLATFORM_I386_QEMU, "i386-qemu", "roms/qemu.img", GRUB_COMPRESSION_AUTO);
+ make_image (GRUB_INSTALL_PLATFORM_I386_QEMU, "i386-qemu", "roms/qemu.img");
grub_install_push_module ("ahci");
- make_image (GRUB_INSTALL_PLATFORM_I386_COREBOOT, "i386-coreboot", "roms/coreboot.elf", GRUB_COMPRESSION_AUTO);
+ make_image (GRUB_INSTALL_PLATFORM_I386_COREBOOT, "i386-coreboot", "roms/coreboot.elf");
grub_install_pop_module ();
grub_install_pop_module ();
grub_install_pop_module ();
#include <argp.h>
#include <string.h>
-static grub_compression_t compression;
static char *output_image;
static char **files;
static int nfiles;
enum
{
OPTION_OUTPUT = 'o',
- OPTION_FORMAT = 'C',
- OPTION_COMPRESION = 'C'
+ OPTION_FORMAT = 'O'
};
static struct argp_option options[] = {
{"output", 'o', N_("FILE"),
0, N_("save output in FILE [required]"), 2},
{"format", 'O', N_("FILE"), 0, 0, 2},
- {"compression", 'C', N_("xz|none|auto"),
- 0, N_("choose the compression to use for core image"), 2},
+ {"compression", 'C', N_("xz|none|auto"), OPTION_HIDDEN, 0, 2},
{0, 0, 0, 0, 0, 0}
};
static error_t
argp_parser (int key, char *arg, struct argp_state *state)
{
+ if (key == 'C')
+ key = GRUB_INSTALL_OPTIONS_INSTALL_CORE_COMPRESS;
+
if (grub_install_parse (key, arg))
return 0;
break;
}
- case 'C':
- if (grub_strcmp (arg, "xz") == 0)
- {
-#ifdef HAVE_LIBLZMA
- compression = GRUB_COMPRESSION_XZ;
-#else
- grub_util_error ("%s",
- _("grub-mkimage is compiled without XZ support"));
-#endif
- }
- else if (grub_strcmp (arg, "none") == 0)
- compression = GRUB_COMPRESSION_NONE;
- else if (grub_strcmp (arg, "auto") == 0)
- compression = GRUB_COMPRESSION_AUTO;
- else
- grub_util_error (_("Unknown compression format %s"), arg);
- break;
case ARGP_KEY_ARG:
files[nfiles++] = xstrdup (arg);
break;
grub_install_make_image_wrap (grub_install_source_directory,
"(memdisk)/boot/grub", output_image,
memdisk_img, NULL,
- grub_util_get_target_name (format), 0,
- compression);
+ grub_util_get_target_name (format), 0);
grub_util_unlink (memdisk_img);
return 0;