Patch to allow netbooting with IBM JS21 GA3 firmware

Andrew Wray andywray at us.ibm.com
Fri Aug 3 10:50:02 EST 2007



Between the GA2 and GA3 firmware on IBM JS21 blades, a change was made that
prevents yaboot from loading its configuration file over the network with
the newer firmware.  The following patches fix the problem (with the
exception of the scenario for booting across a router).  This has been
tested on JS21 with GA3 firwmare, but not on JS21 with GA2 firmware or any
other systems yet.

--- prom.h  2007-08-05 09:14:27.000000000 -0400
+++ prom.h~ 2007-08-05 09:22:22.000000000 -0400
@@ -154,8 +154,5 @@
 struct bootp_packet * prom_get_netinfo (void);
 char * prom_get_mac (struct bootp_packet * packet);
 char * prom_get_ip (struct bootp_packet * packet);
-char * prom_get_yiaddr (struct bootp_packet * packet);
-char * prom_get_siaddr (struct bootp_packet * packet);
-char * prom_get_giaddr (struct bootp_packet * packet);

 #endif

--- prom.c  2007-08-05 09:24:17.000000000 -0400
+++ prom.c~ 2007-08-05 09:23:32.000000000 -0400
@@ -752,6 +752,78 @@
 }

 /*
+ * prom_get_yiaddr()
+ * returns the ip addr of the client in dotted decimal format
+ */
+char * prom_get_yiaddr (struct bootp_packet * packet)
+{
+     char * conf_path;
+
+     if (!packet)
+        return NULL;
+
+     /* 15 chars in yiaddr + \0 */
+     conf_path = malloc(16);
+     if (!conf_path)
+         return NULL;
+     sprintf(conf_path, "%d.%d.%d.%d",
+         packet->yiaddr >> 24,
+         (packet->yiaddr << 8) >> 24,
+         (packet->yiaddr << 16) >> 24,
+         (packet->yiaddr << 24) >> 24);
+
+     return conf_path;
+}
+
+/*
+ * prom_get_siaddr()
+ * returns the ip addr of the server in dotted decimal format
+ */
+char * prom_get_siaddr (struct bootp_packet * packet)
+{
+     char * conf_path;
+
+     if (!packet)
+        return NULL;
+
+     /* 15 chars in siaddr + \0 */
+     conf_path = malloc(16);
+     if (!conf_path)
+         return NULL;
+     sprintf(conf_path, "%d.%d.%d.%d",
+         packet->siaddr >> 24,
+         (packet->siaddr << 8) >> 24,
+         (packet->siaddr << 16) >> 24,
+         (packet->siaddr << 24) >> 24);
+
+     return conf_path;
+}
+
+/*
+ * prom_get_giaddr()
+ * returns the ip addr of the gateway in dotted decimal format
+ */
+char * prom_get_giaddr (struct bootp_packet * packet)
+{
+     char * conf_path;
+
+     if (!packet)
+        return NULL;
+
+     /* 15 chars in giaddr + \0 */
+     conf_path = malloc(16);
+     if (!conf_path)
+         return NULL;
+     sprintf(conf_path, "%d.%d.%d.%d",
+         packet->giaddr >> 24,
+         (packet->giaddr << 8) >> 24,
+         (packet->giaddr << 16) >> 24,
+         (packet->giaddr << 24) >> 24);
+
+     return conf_path;
+}
+
+/*
  * Local variables:
  * c-file-style: "k&r"
  * c-basic-offset: 5

--- fs_of.c 2007-08-05 09:28:36.000000000 -0400
+++ fs_of.c~      2007-08-05 09:27:35.000000000 -0400
@@ -138,29 +138,18 @@
      static char buffer[1024];
      char               *filename;
      char               *p;
-     struct bootp_packet *packet;

      DEBUG_ENTER;
      DEBUG_OPEN;

-     packet = prom_get_netinfo();
-
      strncpy(buffer, dev_name, 768);
      if (file_name && strlen(file_name)) {
-       strcat(buffer, prom_get_siaddr(packet));
        strcat(buffer, ",");
        filename = strdup(file_name);
        for (p = filename; *p; p++)
             if (*p == '/')
                *p = '\\';
        strcat(buffer, filename);
-       strcat(buffer, ",");
-       strcat(buffer, prom_get_yiaddr(packet));
-       strcat(buffer, ",");
-          /* Hack required since giaddr not returned on some systems
-             and required to boot on those systems.  This should work
-             for the client and server on the same subnet. */
-       strcat(buffer, prom_get_siaddr(packet));
        free(filename);
      }



(See attached file: prom.c.diff)(See attached file: prom.h.diff)(See
attached file: fs_of.c.diff)


Thanks,

Andy Wray
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/yaboot-devel/attachments/20070802/37d3db8e/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: prom.c.diff
Type: application/octet-stream
Size: 1858 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/yaboot-devel/attachments/20070802/37d3db8e/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: prom.h.diff
Type: application/octet-stream
Size: 446 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/yaboot-devel/attachments/20070802/37d3db8e/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fs_of.c.diff
Type: application/octet-stream
Size: 993 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/yaboot-devel/attachments/20070802/37d3db8e/attachment-0002.obj>


More information about the Yaboot-devel mailing list