Magellan Linux

Diff of /tags/grubby-8_32/grubby.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2258 by niro, Mon Oct 21 14:02:25 2013 UTC revision 2687 by niro, Wed Jul 16 10:41:38 2014 UTC
# Line 90  enum lineType_e { Line 90  enum lineType_e {
90      LT_SET_VARIABLE = 1 << 19,      LT_SET_VARIABLE = 1 << 19,
91      LT_KERNEL_EFI   = 1 << 20,      LT_KERNEL_EFI   = 1 << 20,
92      LT_INITRD_EFI   = 1 << 21,      LT_INITRD_EFI   = 1 << 21,
93      LT_UNKNOWN      = 1 << 22,      LT_KERNEL_16    = 1 << 22,
94        LT_INITRD_16    = 1 << 23,
95        LT_DEVTREE      = 1 << 24,
96        LT_UNKNOWN      = 1 << 25,
97  };  };
98    
99  struct singleLine {  struct singleLine {
# Line 119  struct singleEntry { Line 122  struct singleEntry {
122  #define NEED_ARGS    (1 << 3)  #define NEED_ARGS    (1 << 3)
123  #define NEED_MB      (1 << 4)  #define NEED_MB      (1 << 4)
124  #define NEED_END     (1 << 5)  #define NEED_END     (1 << 5)
125    #define NEED_DEVTREE (1 << 6)
126    
127  #define MAIN_DEFAULT    (1 << 0)  #define MAIN_DEFAULT    (1 << 0)
128  #define DEFAULT_SAVED       -2  #define DEFAULT_SAVED       -2
# Line 182  const char *grubFindConfig(struct config Line 186  const char *grubFindConfig(struct config
186   "/boot/grub/grub.conf",   "/boot/grub/grub.conf",
187   "/boot/grub/menu.lst",   "/boot/grub/menu.lst",
188   "/etc/grub.conf",   "/etc/grub.conf",
189     "/boot/grub2/grub.cfg",
190     "/boot/grub2-efi/grub.cfg",
191   NULL   NULL
192      };      };
193      static int i = -1;      static int i = -1;
# Line 221  struct keywordTypes grub2Keywords[] = { Line 227  struct keywordTypes grub2Keywords[] = {
227      { "fallback",   LT_FALLBACK,    ' ' },      { "fallback",   LT_FALLBACK,    ' ' },
228      { "linux",      LT_KERNEL,      ' ' },      { "linux",      LT_KERNEL,      ' ' },
229      { "linuxefi",   LT_KERNEL_EFI,  ' ' },      { "linuxefi",   LT_KERNEL_EFI,  ' ' },
230        { "linux16",    LT_KERNEL_16,   ' ' },
231      { "initrd",     LT_INITRD,      ' ', ' ' },      { "initrd",     LT_INITRD,      ' ', ' ' },
232      { "initrdefi",  LT_INITRD_EFI,  ' ', ' ' },      { "initrdefi",  LT_INITRD_EFI,  ' ', ' ' },
233        { "initrd16",   LT_INITRD_16,   ' ', ' ' },
234      { "module",     LT_MBMODULE,    ' ' },      { "module",     LT_MBMODULE,    ' ' },
235      { "kernel",     LT_HYPER,       ' ' },      { "kernel",     LT_HYPER,       ' ' },
236        { "devicetree", LT_DEVTREE,  ' ' },
237      { NULL, 0, 0 },      { NULL, 0, 0 },
238  };  };
239    
# Line 273  static char *grub2GetEnv(struct configFi Line 282  static char *grub2GetEnv(struct configFi
282      static char buf[1025];      static char buf[1025];
283      char *s = NULL;      char *s = NULL;
284      char *ret = NULL;      char *ret = NULL;
285      char *envFile = info->envFile ? info->envFile : "/boot/grub2/grubenv";      char *envFile = info->envFile ? info->envFile : "/boot/grub/grubenv";
286      int rc = asprintf(&s, "grub2-editenv %s list | grep '^%s='", envFile, name);      int rc = asprintf(&s, "grub-editenv %s list | grep '^%s='", envFile, name);
287    
288      if (rc < 0)      if (rc < 0)
289   return NULL;   return NULL;
# Line 338  static int grub2SetEnv(struct configFile Line 347  static int grub2SetEnv(struct configFile
347  {  {
348      char *s = NULL;      char *s = NULL;
349      int rc = 0;      int rc = 0;
350      char *envFile = info->envFile ? info->envFile : "/boot/grub2/grubenv";      char *envFile = info->envFile ? info->envFile : "/boot/grub/grubenv";
351    
352      unquote(value);      unquote(value);
353      value = shellEscape(value);      value = shellEscape(value);
354      if (!value)      if (!value)
355      return -1;      return -1;
356    
357      rc = asprintf(&s, "grub2-editenv %s set '%s=%s'", envFile, name, value);      rc = asprintf(&s, "grub-editenv %s set '%s=%s'", envFile, name, value);
358      free(value);      free(value);
359      if (rc <0)      if (rc <0)
360   return -1;   return -1;
# Line 396  static int isquote(char q) Line 405  static int isquote(char q)
405  }  }
406    
407  static int iskernel(enum lineType_e type) {  static int iskernel(enum lineType_e type) {
408      return (type == LT_KERNEL || type == LT_KERNEL_EFI);      return (type == LT_KERNEL || type == LT_KERNEL_EFI || type == LT_KERNEL_16);
409  }  }
410    
411  static int isinitrd(enum lineType_e type) {  static int isinitrd(enum lineType_e type) {
412      return (type == LT_INITRD || type == LT_INITRD_EFI);      return (type == LT_INITRD || type == LT_INITRD_EFI || type == LT_INITRD_16);
413  }  }
414    
415  char *grub2ExtractTitle(struct singleLine * line) {  char *grub2ExtractTitle(struct singleLine * line) {
# Line 711  static enum lineType_e preferredLineType Line 720  static enum lineType_e preferredLineType
720   struct configFileInfo *cfi) {   struct configFileInfo *cfi) {
721      if (isEfi && cfi == &grub2ConfigType) {      if (isEfi && cfi == &grub2ConfigType) {
722   switch (type) {   switch (type) {
723    #if defined(__aarch64__)
724     case LT_KERNEL:
725        return LT_KERNEL;
726     case LT_INITRD:
727        return LT_INITRD;
728    #else
729   case LT_KERNEL:   case LT_KERNEL:
730      return LT_KERNEL_EFI;      return LT_KERNEL_EFI;
731   case LT_INITRD:   case LT_INITRD:
732      return LT_INITRD_EFI;      return LT_INITRD_EFI;
733    #endif
734   default:   default:
735      return type;      return type;
736   }   }
737    #if defined(__i386__) || defined(__x86_64__)
738        } else if (cfi == &grub2ConfigType) {
739     switch (type) {
740     case LT_KERNEL:
741        return LT_KERNEL_16;
742     case LT_INITRD:
743        return LT_INITRD_16;
744     default:
745        return type;
746     }
747    #endif
748      }      }
749      return type;      return type;
750  }  }
# Line 1805  int suitableImage(struct singleEntry * e Line 1832  int suitableImage(struct singleEntry * e
1832   return 0;   return 0;
1833      }      }
1834    
1835      line = getLineByType(LT_KERNEL|LT_HYPER|LT_KERNEL_EFI, entry->lines);      line = getLineByType(LT_KERNEL|LT_HYPER|LT_KERNEL_EFI|LT_KERNEL_16, entry->lines);
1836      if (!line) {      if (!line) {
1837   notSuitablePrintf(entry, 0, "no line found\n");   notSuitablePrintf(entry, 0, "no line found\n");
1838   return 0;   return 0;
# Line 1939  struct singleEntry * findEntryByPath(str Line 1966  struct singleEntry * findEntryByPath(str
1966   entry = findEntryByIndex(config, indexVars[i]);   entry = findEntryByIndex(config, indexVars[i]);
1967   if (!entry) return NULL;   if (!entry) return NULL;
1968    
1969   line = getLineByType(LT_KERNEL|LT_HYPER|LT_KERNEL_EFI, entry->lines);   line = getLineByType(LT_KERNEL|LT_HYPER|LT_KERNEL_EFI|LT_KERNEL_16, entry->lines);
1970   if (!line) return NULL;   if (!line) return NULL;
1971    
1972   if (index) *index = indexVars[i];   if (index) *index = indexVars[i];
# Line 1990  struct singleEntry * findEntryByPath(str Line 2017  struct singleEntry * findEntryByPath(str
2017      for (line = entry->lines; line; line = line->next) {      for (line = entry->lines; line; line = line->next) {
2018   enum lineType_e ct = checkType;   enum lineType_e ct = checkType;
2019   if (entry->multiboot && checkType == LT_KERNEL)   if (entry->multiboot && checkType == LT_KERNEL)
2020      ct = LT_KERNEL|LT_KERNEL_EFI|LT_MBMODULE|LT_HYPER;      ct = LT_KERNEL|LT_KERNEL_EFI|LT_MBMODULE|LT_HYPER|LT_KERNEL_16;
2021   else if (checkType & LT_KERNEL)   else if (checkType & LT_KERNEL)
2022      ct = checkType | LT_KERNEL_EFI;      ct = checkType | LT_KERNEL_EFI | LT_KERNEL_16;
2023   line = getLineByType(ct, line);   line = getLineByType(ct, line);
2024   if (!line)   if (!line)
2025      break;  /* not found in this entry */      break;  /* not found in this entry */
# Line 2014  struct singleEntry * findEntryByPath(str Line 2041  struct singleEntry * findEntryByPath(str
2041       * non-Linux boot entries (could find netbsd etc, though, which is       * non-Linux boot entries (could find netbsd etc, though, which is
2042       * unfortunate)       * unfortunate)
2043       */       */
2044      if (line && getLineByType(LT_KERNEL|LT_HYPER|LT_KERNEL_EFI, entry->lines))      if (line && getLineByType(LT_KERNEL|LT_HYPER|LT_KERNEL_EFI|LT_KERNEL_16, entry->lines))
2045   break; /* found 'im! */   break; /* found 'im! */
2046   }   }
2047    
# Line 2248  void displayEntry(struct singleEntry * e Line 2275  void displayEntry(struct singleEntry * e
2275    
2276      printf("index=%d\n", index);      printf("index=%d\n", index);
2277    
2278      line = getLineByType(LT_KERNEL|LT_HYPER|LT_KERNEL_EFI, entry->lines);      line = getLineByType(LT_KERNEL|LT_HYPER|LT_KERNEL_EFI|LT_KERNEL_16, entry->lines);
2279      if (!line) {      if (!line) {
2280          printf("non linux entry\n");          printf("non linux entry\n");
2281          return;          return;
# Line 2313  void displayEntry(struct singleEntry * e Line 2340  void displayEntry(struct singleEntry * e
2340   printf("root=%s\n", s);   printf("root=%s\n", s);
2341      }      }
2342    
2343      line = getLineByType(LT_INITRD|LT_INITRD_EFI, entry->lines);      line = getLineByType(LT_INITRD|LT_INITRD_EFI|LT_INITRD_16, entry->lines);
2344    
2345      if (line && line->numElements >= 2) {      if (line && line->numElements >= 2) {
2346   if (!strncmp(prefix, line->elements[1].item, strlen(prefix)))   if (!strncmp(prefix, line->elements[1].item, strlen(prefix)))
# Line 2730  struct singleLine * addLineTmpl(struct s Line 2757  struct singleLine * addLineTmpl(struct s
2757   insertElement(newLine, val, 1, cfi);   insertElement(newLine, val, 1, cfi);
2758    
2759   /* but try to keep the rootspec from the template... sigh */   /* but try to keep the rootspec from the template... sigh */
2760   if (tmplLine->type & (LT_HYPER|LT_KERNEL|LT_MBMODULE|LT_INITRD|LT_KERNEL_EFI|LT_INITRD_EFI)) {   if (tmplLine->type & (LT_HYPER|LT_KERNEL|LT_MBMODULE|LT_INITRD|LT_KERNEL_EFI|LT_INITRD_EFI|LT_KERNEL_16|LT_INITRD_16)) {
2761      char * rootspec = getRootSpecifier(tmplLine->elements[1].item);      char * rootspec = getRootSpecifier(tmplLine->elements[1].item);
2762      if (rootspec != NULL) {      if (rootspec != NULL) {
2763   free(newLine->elements[1].item);   free(newLine->elements[1].item);
# Line 3100  int updateActualImage(struct grubConfig Line 3127  int updateActualImage(struct grubConfig
3127      firstElement = 2;      firstElement = 2;
3128    
3129   } else {   } else {
3130      line = getLineByType(LT_KERNEL|LT_MBMODULE|LT_KERNEL_EFI, entry->lines);      line = getLineByType(LT_KERNEL|LT_MBMODULE|LT_KERNEL_EFI|LT_KERNEL_16, entry->lines);
3131      if (!line) {      if (!line) {
3132   /* no LT_KERNEL or LT_MBMODULE in this entry? */   /* no LT_KERNEL or LT_MBMODULE in this entry? */
3133   continue;   continue;
# Line 3256  int updateImage(struct grubConfig * cfg, Line 3283  int updateImage(struct grubConfig * cfg,
3283      return rc;      return rc;
3284  }  }
3285    
3286    int addMBInitrd(struct grubConfig * cfg, const char *newMBKernel,
3287     const char * image, const char * prefix, const char * initrd) {
3288        struct singleEntry * entry;
3289        struct singleLine * line, * kernelLine, *endLine = NULL;
3290        int index = 0;
3291    
3292        if (!image) return 0;
3293    
3294        for (; (entry = findEntryByPath(cfg, newMBKernel, prefix, &index)); index++) {
3295            kernelLine = getLineByType(LT_MBMODULE, entry->lines);
3296            if (!kernelLine) continue;
3297    
3298            if (prefix) {
3299                int prefixLen = strlen(prefix);
3300                if (!strncmp(initrd, prefix, prefixLen))
3301                    initrd += prefixLen;
3302            }
3303     endLine = getLineByType(LT_ENTRY_END, entry->lines);
3304     if (endLine)
3305        removeLine(entry, endLine);
3306            line = addLine(entry, cfg->cfi, preferredLineType(LT_MBMODULE,cfg->cfi),
3307     kernelLine->indent, initrd);
3308            if (!line)
3309        return 1;
3310     if (endLine) {
3311        line = addLine(entry, cfg->cfi, LT_ENTRY_END, "", NULL);
3312                if (!line)
3313     return 1;
3314     }
3315    
3316            break;
3317        }
3318    
3319        return 0;
3320    }
3321    
3322  int updateInitrd(struct grubConfig * cfg, const char * image,  int updateInitrd(struct grubConfig * cfg, const char * image,
3323                   const char * prefix, const char * initrd) {                   const char * prefix, const char * initrd) {
3324      struct singleEntry * entry;      struct singleEntry * entry;
# Line 3265  int updateInitrd(struct grubConfig * cfg Line 3328  int updateInitrd(struct grubConfig * cfg
3328      if (!image) return 0;      if (!image) return 0;
3329    
3330      for (; (entry = findEntryByPath(cfg, image, prefix, &index)); index++) {      for (; (entry = findEntryByPath(cfg, image, prefix, &index)); index++) {
3331          kernelLine = getLineByType(LT_KERNEL|LT_KERNEL_EFI, entry->lines);          kernelLine = getLineByType(LT_KERNEL|LT_KERNEL_EFI|LT_KERNEL_16, entry->lines);
3332          if (!kernelLine) continue;          if (!kernelLine) continue;
3333    
3334          line = getLineByType(LT_INITRD|LT_INITRD_EFI, entry->lines);          line = getLineByType(LT_INITRD|LT_INITRD_EFI|LT_INITRD_16, entry->lines);
3335          if (line)          if (line)
3336              removeLine(entry, line);              removeLine(entry, line);
3337          if (prefix) {          if (prefix) {
# Line 3279  int updateInitrd(struct grubConfig * cfg Line 3342  int updateInitrd(struct grubConfig * cfg
3342   endLine = getLineByType(LT_ENTRY_END, entry->lines);   endLine = getLineByType(LT_ENTRY_END, entry->lines);
3343   if (endLine)   if (endLine)
3344      removeLine(entry, endLine);      removeLine(entry, endLine);
3345          line = addLine(entry, cfg->cfi, preferredLineType(LT_INITRD, cfg->cfi),   enum lineType_e lt;
3346   kernelLine->indent, initrd);   switch(kernelLine->type) {
3347        case LT_KERNEL:
3348            lt = LT_INITRD;
3349     break;
3350        case LT_KERNEL_EFI:
3351            lt = LT_INITRD_EFI;
3352     break;
3353        case LT_KERNEL_16:
3354            lt = LT_INITRD_16;
3355     break;
3356        default:
3357            lt = preferredLineType(LT_INITRD, cfg->cfi);
3358     }
3359            line = addLine(entry, cfg->cfi, lt, kernelLine->indent, initrd);
3360          if (!line)          if (!line)
3361      return 1;      return 1;
3362   if (endLine) {   if (endLine) {
# Line 3639  int addNewKernel(struct grubConfig * con Line 3715  int addNewKernel(struct grubConfig * con
3715   const char * newKernelPath, const char * newKernelTitle,   const char * newKernelPath, const char * newKernelTitle,
3716   const char * newKernelArgs, const char * newKernelInitrd,   const char * newKernelArgs, const char * newKernelInitrd,
3717   const char ** extraInitrds, int extraInitrdCount,   const char ** extraInitrds, int extraInitrdCount,
3718                   const char * newMBKernel, const char * newMBKernelArgs) {                   const char * newMBKernel, const char * newMBKernelArgs,
3719     const char * newDevTreePath) {
3720      struct singleEntry * new;      struct singleEntry * new;
3721      struct singleLine * newLine = NULL, * tmplLine = NULL, * masterLine = NULL;      struct singleLine * newLine = NULL, * tmplLine = NULL, * masterLine = NULL;
3722      int needs;      int needs;
# Line 3680  int addNewKernel(struct grubConfig * con Line 3757  int addNewKernel(struct grubConfig * con
3757          needs |= NEED_MB;          needs |= NEED_MB;
3758          new->multiboot = 1;          new->multiboot = 1;
3759      }      }
3760        if (newDevTreePath && getKeywordByType(LT_DEVTREE, config->cfi))
3761     needs |= NEED_DEVTREE;
3762    
3763      if (template) {      if (template) {
3764   for (masterLine = template->lines;   for (masterLine = template->lines;
# Line 3865  int addNewKernel(struct grubConfig * con Line 3944  int addNewKernel(struct grubConfig * con
3944   newLine = addLineTmpl(new, tmplLine, newLine, NULL,   newLine = addLineTmpl(new, tmplLine, newLine, NULL,
3945   config->cfi);   config->cfi);
3946      }      }
3947        } else if (tmplLine->type == LT_DEVTREE &&
3948           tmplLine->numElements == 2 && newDevTreePath) {
3949            newLine = addLineTmpl(new, tmplLine, newLine,
3950          newDevTreePath + strlen(prefix),
3951          config->cfi);
3952     needs &= ~NEED_DEVTREE;
3953        } else if (tmplLine->type == LT_ENTRY_END && needs & NEED_DEVTREE) {
3954     const char *ndtp = newDevTreePath;
3955     if (!strncmp(newDevTreePath, prefix, strlen(prefix)))
3956        ndtp += strlen(prefix);
3957     newLine = addLine(new, config->cfi, LT_DEVTREE,
3958      config->secondaryIndent,
3959      ndtp);
3960     needs &= ~NEED_DEVTREE;
3961     newLine = addLineTmpl(new, tmplLine, newLine, NULL, config->cfi);
3962      } else {      } else {
3963   /* pass through other lines from the template */   /* pass through other lines from the template */
3964   newLine = addLineTmpl(new, tmplLine, newLine, NULL, config->cfi);   newLine = addLineTmpl(new, tmplLine, newLine, NULL, config->cfi);
# Line 3878  int addNewKernel(struct grubConfig * con Line 3972  int addNewKernel(struct grubConfig * con
3972   switch (config->cfi->entryStart) {   switch (config->cfi->entryStart) {
3973      case LT_KERNEL:      case LT_KERNEL:
3974      case LT_KERNEL_EFI:      case LT_KERNEL_EFI:
3975        case LT_KERNEL_16:
3976   if (new->multiboot && config->cfi->mbHyperFirst) {   if (new->multiboot && config->cfi->mbHyperFirst) {
3977      /* fall through to LT_HYPER */      /* fall through to LT_HYPER */
3978   } else {   } else {
# Line 3984  int addNewKernel(struct grubConfig * con Line 4079  int addNewKernel(struct grubConfig * con
4079   free(initrdVal);   free(initrdVal);
4080   needs &= ~NEED_INITRD;   needs &= ~NEED_INITRD;
4081      }      }
4082        if (needs & NEED_DEVTREE) {
4083     newLine = addLine(new, config->cfi, LT_DEVTREE,
4084      config->secondaryIndent,
4085      newDevTreePath);
4086     needs &= ~NEED_DEVTREE;
4087        }
4088    
4089        /* NEEDS_END must be last on bootloaders that need it... */
4090      if (needs & NEED_END) {      if (needs & NEED_END) {
4091   newLine = addLine(new, config->cfi, LT_ENTRY_END,   newLine = addLine(new, config->cfi, LT_ENTRY_END,
4092   config->secondaryIndent, NULL);   config->secondaryIndent, NULL);
4093   needs &= ~NEED_END;   needs &= ~NEED_END;
4094      }      }
   
4095      if (needs) {      if (needs) {
4096   printf(_("grubby: needs=%d, aborting\n"), needs);   printf(_("grubby: needs=%d, aborting\n"), needs);
4097   abort();   abort();
# Line 4035  int main(int argc, const char ** argv) { Line 4137  int main(int argc, const char ** argv) {
4137      char * newKernelArgs = NULL;      char * newKernelArgs = NULL;
4138      char * newKernelInitrd = NULL;      char * newKernelInitrd = NULL;
4139      char * newKernelTitle = NULL;      char * newKernelTitle = NULL;
4140      char * newKernelVersion = NULL;      char * newDevTreePath = NULL;
4141      char * newMBKernel = NULL;      char * newMBKernel = NULL;
4142      char * newMBKernelArgs = NULL;      char * newMBKernelArgs = NULL;
4143      char * removeMBKernelArgs = NULL;      char * removeMBKernelArgs = NULL;
# Line 4093  int main(int argc, const char ** argv) { Line 4195  int main(int argc, const char ** argv) {
4195      _("display the index of the default kernel") },      _("display the index of the default kernel") },
4196   { "default-title", 0, 0, &displayDefaultTitle, 0,   { "default-title", 0, 0, &displayDefaultTitle, 0,
4197      _("display the title of the default kernel") },      _("display the title of the default kernel") },
4198     { "devtree", 0, POPT_ARG_STRING, &newDevTreePath, 0,
4199        _("device tree file for new stanza"), _("dtb-path") },
4200   { "elilo", 0, POPT_ARG_NONE, &configureELilo, 0,   { "elilo", 0, POPT_ARG_NONE, &configureELilo, 0,
4201      _("configure elilo bootloader") },      _("configure elilo bootloader") },
4202   { "efi", 0, POPT_ARG_NONE, &isEfi, 0,   { "efi", 0, POPT_ARG_NONE, &isEfi, 0,
# Line 4258  int main(int argc, const char ** argv) { Line 4362  int main(int argc, const char ** argv) {
4362      grubConfig = cfi->defaultConfig;      grubConfig = cfi->defaultConfig;
4363      }      }
4364    
4365      if (bootloaderProbe && (displayDefault || kernelInfo || newKernelVersion ||      if (bootloaderProbe && (displayDefault || kernelInfo ||
4366      newKernelPath || removeKernelPath || makeDefault ||      newKernelPath || removeKernelPath || makeDefault ||
4367      defaultKernel || displayDefaultIndex || displayDefaultTitle ||      defaultKernel || displayDefaultIndex || displayDefaultTitle ||
4368      (defaultIndex >= 0))) {      (defaultIndex >= 0))) {
# Line 4267  int main(int argc, const char ** argv) { Line 4371  int main(int argc, const char ** argv) {
4371   return 1;   return 1;
4372      }      }
4373    
4374      if ((displayDefault || kernelInfo) && (newKernelVersion || newKernelPath ||      if ((displayDefault || kernelInfo) && (newKernelPath ||
4375     removeKernelPath)) {     removeKernelPath)) {
4376   fprintf(stderr, _("grubby: --default-kernel and --info may not "   fprintf(stderr, _("grubby: --default-kernel and --info may not "
4377    "be used when adding or removing kernels\n"));    "be used when adding or removing kernels\n"));
# Line 4436  int main(int argc, const char ** argv) { Line 4540  int main(int argc, const char ** argv) {
4540   if (!entry) return 0;   if (!entry) return 0;
4541   if (!suitableImage(entry, bootPrefix, 0, flags)) return 0;   if (!suitableImage(entry, bootPrefix, 0, flags)) return 0;
4542    
4543   line = getLineByType(LT_KERNEL|LT_HYPER|LT_KERNEL_EFI, entry->lines);   line = getLineByType(LT_KERNEL|LT_HYPER|LT_KERNEL_EFI|LT_KERNEL_16, entry->lines);
4544   if (!line) return 0;   if (!line) return 0;
4545    
4546          rootspec = getRootSpecifier(line->elements[1].item);          rootspec = getRootSpecifier(line->elements[1].item);
# Line 4497  int main(int argc, const char ** argv) { Line 4601  int main(int argc, const char ** argv) {
4601      if (updateImage(config, updateKernelPath, bootPrefix, newKernelArgs,      if (updateImage(config, updateKernelPath, bootPrefix, newKernelArgs,
4602                      removeArgs, newMBKernelArgs, removeMBKernelArgs)) return 1;                      removeArgs, newMBKernelArgs, removeMBKernelArgs)) return 1;
4603      if (updateKernelPath && newKernelInitrd) {      if (updateKernelPath && newKernelInitrd) {
4604              if (updateInitrd(config, updateKernelPath, bootPrefix,      if (newMBKernel) {
4605                               newKernelInitrd)) return 1;      if (addMBInitrd(config, newMBKernel, updateKernelPath,
4606     bootPrefix, newKernelInitrd))
4607        return 1;
4608        } else {
4609        if (updateInitrd(config, updateKernelPath, bootPrefix,
4610     newKernelInitrd))
4611     return 1;
4612        }
4613      }      }
4614      if (addNewKernel(config, template, bootPrefix, newKernelPath,      if (addNewKernel(config, template, bootPrefix, newKernelPath,
4615                       newKernelTitle, newKernelArgs, newKernelInitrd,                       newKernelTitle, newKernelArgs, newKernelInitrd,
4616                       (const char **)extraInitrds, extraInitrdCount,                       (const char **)extraInitrds, extraInitrdCount,
4617                       newMBKernel, newMBKernelArgs)) return 1;                       newMBKernel, newMBKernelArgs, newDevTreePath)) return 1;
4618            
4619    
4620      if (numEntries(config) == 0) {      if (numEntries(config) == 0) {

Legend:
Removed from v.2258  
changed lines
  Added in v.2687