Debian – Why grub-mkrescue doesn’t accept the “–core-compress=xz” option

debiangrub2

Is lack some package or lack some other options? or just a bug of grub-mkresuce? Is some example for the --core-compress= option?

$ grub-mkrescue --core-compress=xz --compress=xz -o grub.iso ./iso
grub-mkrescue: --core-compress: (PROGRAM ERROR) Option should have been recognized!?
Try 'grub-mkrescue --help' or 'grub-mkrescue --usage' for more information.

Best Answer

It seems that option --core-compress is declared but not implemented. If you use an option unknown to grub-mkrescue and its helpers, then this option gets forwarded to xorriso, which will complain if it does not know the option either:


xorriso : FAILURE : -as mkisofs: Unrecognized option '--XYZ-compress=xz'

But you see a GRUB "PROGRAM ERROR", because include/grub/util/install.h has


  {"core-compress", GRUB_INSTALL_OPTIONS_INSTALL_CORE_COMPRESS,         \
      "xz|none|auto",                                           \
      0, N_("choose the compression to use for core image"), 2},        \

If you use the option, it gets translated into the number code GRUB_INSTALL_OPTIONS_INSTALL_CORE_COMPRESS. Now GRUB should somewhere have a piece of code which recognizes that number, reads the argument "xz", and registers the user's wish.

It is done with "--compress=xz". install.h has:


  { "compress", GRUB_INSTALL_OPTIONS_INSTALL_COMPRESS,            \
    "no|xz|gz|lzo", 0,                            \
    N_("compress GRUB files [optional]"), 1 },                            \

and util/grub-install-common.c has:


    case GRUB_INSTALL_OPTIONS_INSTALL_COMPRESS:
      if (strcmp (arg, "no") == 0
      ...
      if (strcmp (arg, "gz") == 0)
      ...
      if (strcmp (arg, "xz") == 0)

But for GRUB_INSTALL_OPTIONS_INSTALL_CORE_COMPRESS, there is no such code nowhere.

Related Question