mboot: skip --- marker; decompress all files
authorH. Peter Anvin <hpa@zytor.com>
Sun, 26 Apr 2009 23:43:39 +0000 (16:43 -0700)
committerH. Peter Anvin <hpa@zytor.com>
Sun, 26 Apr 2009 23:43:39 +0000 (16:43 -0700)
When walking the argument list we need to skip --- markers.

Grub, and the old mboot.c32, seem to transparently decompress all
files, not just the main one, so do the same.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
com32/mboot/mboot.c

index 77b864c..fcde53d 100644 (file)
@@ -108,14 +108,10 @@ static int get_modules(char **argv, struct module_data **mdp)
   mp = md;
   argp = argv;
   while (*argp) {
+    /* Note: it seems Grub transparently decompresses all compressed files,
+       not just the primary kernel. */
     printf("Loading %s... ", *argp);
-    if (md == mp) {
-      /* Transparently decompress the primary image */
-      rv = zloadfile(*argp, &mp->data, &mp->len);
-    } else {
-      /* Leave decompressing auxilliary modules to the OS */
-      rv = loadfile(*argp, &mp->data, &mp->len);
-    }
+    rv = zloadfile(*argp, &mp->data, &mp->len);
 
     if (rv) {
       printf("failed!\n");
@@ -140,6 +136,8 @@ static int get_modules(char **argv, struct module_data **mdp)
       *--p = '\0';
     }
     mp++;
+    if (*argp)
+      argp++;                  /* Advance past module_separator */
   }
 
   return module_count;