]> git.ozlabs.org Git - yaboot.git/blobdiff - second/yaboot.c
The following patch fix reverts removal of some lines for the netboot patch.
[yaboot.git] / second / yaboot.c
index 20296dfb5bfd6216bfca32b4e552bc9ef31f5078..59f7d2efd91f68e39e5c70e76c2ebcb528a99eee 100644 (file)
@@ -112,6 +112,7 @@ static void     setup_display(void);
 
 int useconf = 0;
 char bootdevice[BOOTDEVSZ];
+char bootoncelabel[1024];
 char bootargs[1024];
 char *password = NULL;
 struct boot_fspec_t boot;
@@ -330,6 +331,7 @@ load_config_file(struct boot_fspec_t *fspec)
      char *conf_file = NULL, *p;
      struct boot_file_t file;
      int sz, opened = 0, result = 0;
+     char conf_path[512];
 
      /* Allocate a buffer for the config file */
      conf_file = malloc(CONFIG_FILE_MAX);
@@ -338,7 +340,19 @@ load_config_file(struct boot_fspec_t *fspec)
          goto bail;
      }
 
+     /* Build the path to the file */
+     if (_machine == _MACH_chrp)
+         strcpy(conf_path, "/etc/");
+     else
+         conf_path[0] = 0;
+     if (fspec->file && *fspec->file)
+         strcat(conf_path, fspec->file);
+     else
+         strcat(conf_path, CONFIG_FILE_NAME);
+
+
      /* Open it */
+     fspec->file = conf_path;
      result = open_file(fspec, &file);
      if (result != FILE_ERR_OK) {
          prom_printf("%s:%d,", fspec->dev, fspec->part);
@@ -524,6 +538,8 @@ static int load_my_config_file(struct boot_fspec_t *orig_fspec)
          strcat(fspec.file, tmp);
      }
 
+     //DEBUG_F("----> mac addr: %s\n", fspec.file);
+
      rc = load_config_file(&fspec);
      if (rc)
          goto out;
@@ -764,8 +780,12 @@ int get_params(struct boot_param_t* params)
      }
 
      if (c == '\n' || c == '\r') {
-         if (!imagename)
-              imagename = cfg_get_default();
+         if (!imagename) {
+              if (bootoncelabel[0] != 0)
+                   imagename = bootoncelabel;
+              else
+                   imagename = cfg_get_default();
+         }
          if (imagename)
               prom_printf("%s", imagename);
          if (params->args)
@@ -1625,6 +1645,14 @@ yaboot_main(void)
          return -1;
      }
 
+     if (bootoncelabel[0] == 0) {
+         prom_get_options("boot-once", bootoncelabel, 
+                          sizeof(bootoncelabel));
+         if (bootoncelabel[0] != 0)
+               DEBUG_F("boot-once: [%s]\n", bootoncelabel);
+     }
+     prom_set_options("boot-once", NULL, 0);
+
      if (!parse_device_path(bootdevice, NULL, -1, "", &boot)) {
          prom_printf("%s: Unable to parse\n", bootdevice);
          return -1;