--- trunk/grubby/grubby.c 2014/07/16 10:38:09 2685 +++ trunk/grubby/grubby.c 2014/07/16 10:52:01 2700 @@ -60,6 +60,12 @@ int isEfi = 0; +#if defined(__aarch64__) +#define isEfiOnly 1 +#else +#define isEfiOnly 0 +#endif + char *saved_command_line = NULL; /* comments get lumped in with indention */ @@ -155,6 +161,7 @@ int defaultIsVariable; int defaultSupportSaved; int defaultIsSaved; + int defaultIsUnquoted; enum lineType_e entryStart; enum lineType_e entryEnd; int needsBootPrefix; @@ -630,6 +637,7 @@ .needsBootPrefix = 1, .maxTitleLength = 255, .mbAllowExtraInitRds = 1, + .defaultIsUnquoted = 1, }; struct grubConfig { @@ -721,9 +729,9 @@ if (isEfi && cfi == &grub2ConfigType) { switch (type) { case LT_KERNEL: - return LT_KERNEL_EFI; + return isEfiOnly ? LT_KERNEL : LT_KERNEL_EFI; case LT_INITRD: - return LT_INITRD_EFI; + return isEfiOnly ? LT_INITRD : LT_INITRD_EFI; default: return type; } @@ -1185,16 +1193,13 @@ cfg->flags &= ~GRUB_CONFIG_NO_DEFAULT; defaultLine = line; } - } else if (line->type == LT_DEFAULT && line->numElements == 2) { - cfg->flags &= ~GRUB_CONFIG_NO_DEFAULT; - defaultLine = line; } else if (iskernel(line->type)) { /* if by some freak chance this is multiboot and the "module" * lines came earlier in the template, make sure to use LT_HYPER * instead of LT_KERNEL now */ - if (entry->multiboot) + if (entry && entry->multiboot) line->type = LT_HYPER; } else if (line->type == LT_MBMODULE) { @@ -1220,8 +1225,9 @@ cfg->fallbackImage = strtol(line->elements[1].item, &end, 10); if (*end) cfg->fallbackImage = -1; - } else if (line->type == LT_TITLE && line->numElements > 1) { - /* make the title a single argument (undoing our parsing) */ + } else if ((line->type == LT_DEFAULT && cfi->defaultIsUnquoted) || + (line->type == LT_TITLE && line->numElements > 1)) { + /* make the title/default a single argument (undoing our parsing) */ len = 0; for (int i = 1; i < line->numElements; i++) { len += strlen(line->elements[i].item); @@ -1328,6 +1334,11 @@ } } + if (line->type == LT_DEFAULT && line->numElements == 2) { + cfg->flags &= ~GRUB_CONFIG_NO_DEFAULT; + defaultLine = line; + } + /* If we find a generic config option which should live at the top of the file, move it there. Old versions of grubby were probably responsible for putting new images in the wrong