Commit yaboot 1.3.5-pre2.
git-archimport-id: erbenson@alaska.net--public/yaboot--devel--1.3--patch-10
 # tag: automatic-ChangeLog--erbenson@alaska.net--public/yaboot--devel--1.3
 #
 
+2002-03-27 13:22:23 GMT        Ethan Benson <erbenson@alaska.net>      patch-10
+
+    Summary:
+      Commit yaboot 1.3.5-pre2
+    Revision:
+      yaboot--devel--1.3--patch-10
+
+    Commit yaboot 1.3.5-pre2.
+
+    modified files:
+     ChangeLog Makefile changelog man.patch man/yaboot.conf.5
+     second/fs_ext2.c second/prom.c second/yaboot.c ybin/ybin
+
+
 2002-03-26 15:11:26 GMT        Ethan Benson <erbenson@alaska.net>      patch-9
 
     Summary:
 
 
 include Config
 
-VERSION = 1.3.5pre1
+VERSION = 1.3.5pre2
 # Debug mode (spam/verbose)
 DEBUG = 0
 # make install vars
        find . -name '#*' | xargs rm -f
        find . -name '.#*' | xargs rm -f
        find . -name '*~' | xargs rm -f
+       find . -name '*.swp' | xargs rm -f
        -gunzip man/*.gz
        rm -rf man.deb
        chmod 755 ybin/ybin ybin/ofpath ybin/yabootconfig
 
-2001-10-24  Ethan Benson  <erbenson@alaska.net>
+2001-10-25  Ethan Benson  <erbenson@alaska.net>
 
-       * Version 1.3.5pre1
+       * Version 1.3.5pre2
 
        * yaboot:
          - XFS fixes for large partitions (Brendan O'Dea)
          - Upgrade libext2fs to 1.25, this adds full ext3 support to yaboot.
          - Reiserfs fixes (Jeff Mahoney)
+         - Implement the message= configuration option (see yaboot.conf man page).
 
 2001-10-13  Ethan Benson  <erbenson@alaska.net>
 
 
-diff -urN -X CVS man/mkofboot.8 man.deb/mkofboot.8
+diff -urN -x CVS man/mkofboot.8 man.deb/mkofboot.8
 --- man/mkofboot.8     Thu May 24 04:32:54 2001
-+++ man.deb/mkofboot.8 Tue Sep 25 05:38:42 2001
++++ man.deb/mkofboot.8 Thu Oct 25 05:06:35 2001
 @@ -94,7 +94,7 @@
  .TP
  .BR \-i ,\  \-\-install\ \fIboot-file
  \fBmkofboot\fR) it is thus critical that it not be writable by anyone
  but root.  It is also critical that \fI/etc/yaboot.conf\fR not be
  writable by anyone but root since a different \fIofboot\fR script could be
-diff -urN -X CVS man/yaboot.conf.5 man.deb/yaboot.conf.5
---- man/yaboot.conf.5  Tue Sep 25 05:20:03 2001
-+++ man.deb/yaboot.conf.5      Tue Sep 25 05:38:42 2001
+diff -urN -x CVS man/yaboot.conf.5 man.deb/yaboot.conf.5
+--- man/yaboot.conf.5  Thu Oct 25 05:06:22 2001
++++ man.deb/yaboot.conf.5      Thu Oct 25 05:06:35 2001
 @@ -136,7 +136,7 @@
    boot=/dev/hda2
    device=hd:
  loader for yaboot.  It is capable of presenting a dual boot menu for
  GNU/Linux, MacOS and MacOSX.  If dual booting is not required or
  configured it will simply load yaboot directly.  You must specify this
-@@ -301,7 +301,7 @@
+@@ -305,7 +305,7 @@
  When you define this option you will be presented with a simple menu at
  bootup allowing you to hit L to boot GNU/Linux or B to boot BSD (along
  with other choices if configured).  This will only work if you are
  set to a unix device node (ie \fI/dev/hda11\fR) then ybin will use the
  \fBofpath\fR(8) utility to determine the OpenFirmware device path.
  .TP
-@@ -310,7 +310,7 @@
+@@ -314,7 +314,7 @@
  partition.  When you define this option you will be presented with a
  simple menu at bootup allowing you to hit L to boot GNU/Linux or M to
  boot MacOS (along with other choices if configured).  This will only
  script.  When this is set to a unix device node (ie \fI/dev/hda11\fR)
  then ybin will use the \fBofpath\fR(8) utility to determine the
  OpenFirmware device path.
-@@ -320,7 +320,7 @@
+@@ -324,7 +324,7 @@
  When you define this option you will be presented with a simple menu
  at bootup allowing you to hit L to boot GNU/Linux or X to boot MacOSX
  (along with other choices if configured).  This will only work if you
  this is set to a unix device node (ie \fI/dev/hda11\fR) then ybin will
  use the \fBofpath\fR(8) utility to determine the OpenFirmware device
  path.
-@@ -341,7 +341,7 @@
+@@ -345,7 +345,7 @@
  When you define this option you will be presented with a simple menu
  at bootup allowing you to hit L to boot GNU/Linux or D to boot Darwin
  (along with other choices if configured).  This will only work if you
  this is set to a unix device node (ie \fI/dev/hda11\fR) then ybin will
  use the \fBofpath\fR(8) utility to determine the OpenFirmware device
  path.
-@@ -589,8 +589,8 @@
+@@ -593,8 +593,8 @@
  root=/dev/hda3
  partition=3
  timeout=20
  fgcolor=black
  bgcolor=green
  default=Linux
-diff -urN -X CVS man/ybin.8 man.deb/ybin.8
+diff -urN -x CVS man/ybin.8 man.deb/ybin.8
 --- man/ybin.8 Thu May 24 04:33:16 2001
-+++ man.deb/ybin.8     Tue Sep 25 05:38:42 2001
++++ man.deb/ybin.8     Thu Oct 25 05:06:35 2001
 @@ -109,7 +109,7 @@
  .TP
  .BR \-i ,\  \-\-install\ \fIboot-file
 
 .\" This program is distributed according to the Gnu General Public License.
 .\" See the file COPYING in the ybin source distribution.
 .\"
-.TH YABOOT.CONF 5 "25 September 2001" "GNU/Linux PowerPC" "File Formats"
+.TH YABOOT.CONF 5 "25 October 2001" "GNU/Linux PowerPC" "File Formats"
 .SH NAME
 .B yaboot.conf
 \- Configuration file format used by
 \fImacosx=\fR, or \fIdarwin=\fR options defined.
 .TP
 .BI "message=" message_filename
-Specifies a file containing a message that is displayed before the boot
-prompt. [CURRENTLY UNIMPLEMENTED]
+Specifies a file containing a message that is displayed before the
+boot prompt.  You may specify either a plain pathname, in which case
+the default device and partition will be derived from the
+\fIdevice=\fR and \fIpartition=\fR lines in the global section of
+\fByaboot.conf\fR, or you can specify a full OpenFirmware device
+path.  Note: only the first 2000 bytes of this file will be read.
 .TP
 .BI "password=" password
 Protect booting by a password. The password is given in either
 
      DEBUG_OPEN;
 
      if (opened) {
-         prom_printf("ext2_open() : fs busy\n");
          DEBUG_LEAVE(FILE_ERR_FSBUSY);
          return FILE_ERR_FSBUSY;
      }
      if (file->device_kind != FILE_DEVICE_BLOCK) {
-         prom_printf("Can't open ext2 filesystem on non-block device\n");
          DEBUG_LEAVE(FILE_ERR_BADDEV);
          return FILE_ERR_BADDEV;
      }
 
 void
 prom_vfprintf (prom_handle file, char *fmt, va_list ap)
 {
-     static char printf_buf[1536];
+     static char printf_buf[2048];
      vsprintf (printf_buf, fmt, ap);
      prom_puts (file, printf_buf);
 }
 void
 prom_vprintf (char *fmt, va_list ap)
 {
-     static char printf_buf[1536];
+     static char printf_buf[2048];
      vsprintf (printf_buf, fmt, ap);
      prom_puts (prom_stdout, printf_buf);
 }
 
 }      
 #endif /* CONFIG_COLOR_TEXT */
 
+
+void print_message_file(char *filename)
+{
+     char *msg = NULL; 
+     char *p, *endp;
+     char *defdev = boot.dev;
+     int defpart = boot.part;
+     char msgpath[1024];
+     int opened = 0;
+     int result = 0;
+     int n;
+     struct boot_file_t file;
+     struct boot_fspec_t msgfile;
+
+     defdev = cfg_get_strg(0, "device");
+     if (!defdev)
+         defdev = boot.dev;
+     p = cfg_get_strg(0, "partition");
+         if (p) {
+              n = simple_strtol(p, &endp, 10);
+              if (endp != p && *endp == 0)
+                   defpart = n;               
+         }
+
+     strncpy(msgpath, filename, sizeof(msgpath));
+     if (!parse_device_path(msgpath, defdev, defpart, "/etc/yaboot.msg", &msgfile)) {
+         prom_printf("%s: Unable to parse\n", msgpath);
+         goto done;
+     }
+
+     result = open_file(&msgfile, &file);
+     if (result != FILE_ERR_OK) {
+         prom_printf("%s:%d,", msgfile.dev, msgfile.part);
+         prom_perror(result, msgfile.file);
+         goto done;
+     } else
+         opened = 1;
+
+     msg = malloc(2001);
+     if (!msg)
+         goto done;
+     else
+         memset(msg, 0, sizeof(*msg));
+
+     if (file.fs->read(&file, 2000, msg) <= 0)
+         goto done;
+     else
+         prom_printf("%s", msg);
+
+done:
+     if (opened)
+         file.fs->close(&file);
+     if (msg)
+         free(msg);
+     if (p)
+         free(p);
+     if (endp)
+         free(endp);
+}
+
 /* Currently, the config file must be at the root of the filesystem.
  * todo: recognize the full path to myself and use it to load the
  * config file. Handle the "\\" (blessed system folder)
      p = cfg_get_strg(0, "init-message");
      if (p)
          prom_printf("%s\n", p);
-#if 0
+
      p = cfg_get_strg(0, "message");
      if (p)
          print_message_file(p);
-#endif         
 
      result = 1;
     
               "press <return> to boot it.\n\n"
               "To boot any other label simply type its name and press <return>.\n\n"
               "To boot a kernel image which is not defined in the yaboot configuration \n"
-              "file, enter the kernel image name as [device:][partno],/path, where \n"
+              "file, enter the kernel image name as [[device:][partno],]/path, where \n"
               "\"device:\" is the OpenFirmware device path to the disk the image \n"
               "resides on, and \"partno\" is the partition number the image resides on.\n"
               "Note that the comma (,) is only required if you specify an OpenFirmware\n"
 
 fi
 PRG="${0##*/}"
 SIGINT="$PRG: Interrupt caught ... exiting"
-VERSION=1.3.5pre1
+VERSION=1.3.5pre2
 DEBUG=0
 VERBOSE=0
 TMP="${TMPDIR:-/tmp}"