]> git.ozlabs.org Git - yaboot.git/commitdiff
This patch fixes OF netbooting on pSeries
authorPaul Nasrat <pnasrat@redhat.com>
Tue, 15 May 2007 13:18:33 +0000 (14:18 +0100)
committerPaul Nasrat <pauln@enki.eridu>
Tue, 15 May 2007 13:18:33 +0000 (14:18 +0100)
Signed-off-by: Paulo Ricardo Paz Vital <vital@br.ibm.com>
second/yaboot.c

index c0027c34c02224dc00180ea799d6af969bc2ee3d..e75046aeabd1eb94c30406584be3836959e1b318 100644 (file)
@@ -331,7 +331,6 @@ 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);
@@ -340,19 +339,7 @@ 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);
@@ -525,12 +512,15 @@ static int load_my_config_file(struct boot_fspec_t *orig_fspec)
       * prepended.
       */
 
-     /* 3 chars per byte in chaddr + 2 chars for htype + \0 */
-     fspec.file = malloc(packet->hlen * 3 + 2 + 1);
+     /* 3 chars per byte in chaddr + 2 chars for htype + /etc/ +\0 */
+     fspec.file = malloc(packet->hlen * 3 + 2 + 6);
      if (!fspec.file)
          goto out;
 
-     sprintf(fspec.file, "%02x", packet->htype);
+     if (_machine == _MACH_chrp)
+         sprintf(fspec.file, "/etc/%02x", packet->htype);
+     else
+         sprintf(fspec.file, "%02x", packet->htype);
 
      for (i = 0; i < packet->hlen; i++) {
          char tmp[4];
@@ -538,8 +528,6 @@ 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;