[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

rpms/yaboot/devel yaboot-1.3.13-confarg.patch, NONE, 1.1 yaboot-1.3.13-ofpath-pegasos.patch, NONE, 1.1 yaboot.spec, 1.14, 1.15



Author: dwmw2

Update of /cvs/dist/rpms/yaboot/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv22317

Modified Files:
	yaboot.spec 
Added Files:
	yaboot-1.3.13-confarg.patch yaboot-1.3.13-ofpath-pegasos.patch 
Log Message:
more pegasos stuff, conf on command line

yaboot-1.3.13-confarg.patch:
 yaboot.c |   97 +++++++++++++++++++++++++++++++++++----------------------------
 1 files changed, 54 insertions(+), 43 deletions(-)

--- NEW FILE yaboot-1.3.13-confarg.patch ---
--- yaboot-1.3.13/second/yaboot.c~	2002-09-15 04:11:44.000000000 +0100
+++ yaboot-1.3.13/second/yaboot.c	2005-07-30 13:43:59.000000000 +0100
@@ -112,6 +112,7 @@ static void     setup_display(void);
 
 int useconf = 0;
 char bootdevice[1024];
+char bootargs[1024];
 char *password = NULL;
 struct boot_fspec_t boot;
 int _machine = _MACH_Pmac;
@@ -324,13 +325,11 @@ done:
  * config file. Handle the "\\" (blessed system folder)
  */
 static int
-load_config_file(char *device, char* path, int partition)
+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];
-     struct boot_fspec_t fspec;
 
      /* Allocate a buffer for the config file */
      conf_file = malloc(CONFIG_FILE_MAX);
@@ -339,23 +338,11 @@ load_config_file(char *device, char* pat
 	  goto bail;
      }
 
-     /* Build the path to the file */
-     if (_machine == _MACH_chrp)
-	  strcpy(conf_path, "/etc/");
-     else if (path && *path)
-	  strcpy(conf_path, path);
-     else
-	  conf_path[0] = 0;
-     strcat(conf_path, CONFIG_FILE_NAME);
-
      /* Open it */
-     fspec.dev = device;
-     fspec.file = conf_path;
-     fspec.part = partition;
-     result = open_file(&fspec, &file);
+     result = open_file(fspec, &file);
      if (result != FILE_ERR_OK) {
-	  prom_printf("%s:%d,", fspec.dev, fspec.part);
-	  prom_perror(result, fspec.file);
+	  prom_printf("%s:%d,", fspec->dev, fspec->part);
+	  prom_perror(result, fspec->file);
 	  prom_printf("Can't open config file\n");
 	  goto bail;
      }
@@ -375,7 +362,7 @@ load_config_file(char *device, char* pat
      opened = 0;
 
      /* Call the parsing code in cfg.c */
-     if (cfg_parse(conf_path, conf_file, sz) < 0) {
+     if (cfg_parse(fspec->file, conf_file, sz) < 0) {
 	  prom_printf ("Syntax error or read error config\n");
 	  goto bail;
      }
@@ -589,8 +576,6 @@ int get_params(struct boot_param_t* para
      int beg = 0, end;
      int singlekey = 0;
      int restricted = 0;
-     static int first = 1;
-     static char bootargs[1024];
      static char imagepath[1024];
      static char initrdpath[1024];
      static char sysmappath[1024];
@@ -605,9 +590,7 @@ int get_params(struct boot_param_t* para
     
      cmdinit();
 
-     if (first) {
-	  first = 0;
-	  prom_get_chosen("bootargs", bootargs, sizeof(bootargs));
+     if (bootargs[0]) {
 	  imagename = bootargs;
 	  word_split(&imagename, &params->args);
 	  timeout = DEFAULT_TIMEOUT;
@@ -619,6 +602,7 @@ int get_params(struct boot_param_t* para
 	  }
 	  if (useconf && (q = cfg_get_strg(0, "timeout")) != 0 && *q != 0)
 	       timeout = simple_strtol(q, NULL, 0);
+	  bootargs[0] = 0;
      }
 
      prom_printf("boot: ");
@@ -1458,12 +1442,32 @@ int
 yaboot_main(void)
 {
      char *ptype;
+     int conf_given = 0;
+     char conf_path[1024];
 
      if (_machine == _MACH_Pmac)
 	  setup_display();
 	
+     prom_get_chosen("bootargs", bootargs, sizeof(bootargs));
+     DEBUG_F("/chosen/bootargs = %s\n", bootargs);
      prom_get_chosen("bootpath", bootdevice, sizeof(bootdevice));
      DEBUG_F("/chosen/bootpath = %s\n", bootdevice);
+
+     /* If conf= specified on command line, it overrides */
+     if (!strncmp(bootargs, "conf=", 5)) {
+	      char *end = strchr(bootargs,' ');
+	      if (end)
+		   *end = 0;
+
+	      strcpy(bootdevice, bootargs + 5);
+	      conf_given = 1;
+
+	      /* Remove conf=xxx from bootargs */
+	      if (end)
+		   memmove(bootargs, end+1, strlen(end+1)+1);
+	      else
+		   bootargs[0] = 0;
+     }
      if (bootdevice[0] == 0) {
 	  prom_get_options("boot-device", bootdevice, sizeof(bootdevice));
 	  DEBUG_F("boot-device = %s\n", bootdevice);
@@ -1480,29 +1484,36 @@ yaboot_main(void)
      DEBUG_F("After parse_device_path: dev=%s, part=%d, file=%s\n",
 	     boot.dev, boot.part, boot.file);
 
-     if (strlen(boot.file)) {
-	  if (!strncmp(boot.file, "\\\\", 2))
-	       boot.file = "\\\\";
-	  else {
-	       char *p, *last;
-	       p = last = boot.file;
-	       while(*p) {
-		    if (*p == '\\')
-			 last = p;
-		    p++;
+     if (!conf_given) {
+	  if (_machine == _MACH_chrp)
+	       boot.file = "/etc/";
+	  else if (strlen(boot.file)) {
+	       if (!strncmp(boot.file, "\\\\", 2))
+		    boot.file = "\\\\";
+	       else {
+		    char *p, *last;
+		    p = last = boot.file;
+		    while(*p) {
+			 if (*p == '\\')
+			      last = p;
+			 p++;
+		    }
+		    if (p)
+			 *(last) = 0;
+		    else
+			 boot.file = "";
+		    if (strlen(boot.file))
+			 strcat(boot.file, "\\");
 	       }
-	       if (p)
-		    *(last) = 0;
-	       else
-		    boot.file = "";
-	       if (strlen(boot.file))
-		    strcat(boot.file, "\\");
 	  }
+	  strcpy(conf_path, boot.file);
+	  strcat(conf_path, CONFIG_FILE_NAME);
+	  boot.file = conf_path;
+	  DEBUG_F("After path kludgeup: dev=%s, part=%d, file=%s\n",
+		  boot.dev, boot.part, boot.file);
      }
-     DEBUG_F("After pmac path kludgeup: dev=%s, part=%d, file=%s\n",
-	     boot.dev, boot.part, boot.file);
 
-     useconf = load_config_file(boot.dev, boot.file, boot.part);
+     useconf = load_config_file(&boot);
 
      prom_printf("Welcome to yaboot version " VERSION "\n");
      prom_printf("Enter \"help\" to get some basic usage information\n");

yaboot-1.3.13-ofpath-pegasos.patch:
 ofpath |   44 +++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 43 insertions(+), 1 deletion(-)

--- NEW FILE yaboot-1.3.13-ofpath-pegasos.patch ---
--- yaboot-1.3.13/ybin/ofpath.orig	2005-07-30 13:51:22.000000000 +0100
+++ yaboot-1.3.13/ybin/ofpath	2005-07-30 14:14:19.000000000 +0100
@@ -382,12 +382,19 @@ ide_ofpath()
 	    echo 1>&2 "$PRG: KERNEL BUG: /proc/ide/${IDEBUS}/channel does not exist"
 	    return 1
 	fi
-
 	case "$(cat /proc/device-tree${DEVSPEC}/device_type 2> /dev/null)" in
 	    ide|ata)
 		local MASTER="/disk 0"
 		local SLAVE="/disk 1"
 		;;
+	    spi)
+		local DEVTYPE="disk$DEVTYPE"
+		if grep -q ide-cdrom /proc/ide/$DEVNODE/driver; then
+		    DEVTYPE="cdrom"
+		fi
+		local MASTER="/$DEVTYPE $(cat /proc/ide/${IDEBUS}/channel),0"
+		local SLAVE="/$DEVTYPE $(cat /proc/ide/${IDEBUS}/channel),1"
+		;;
 	    pci-ide|pci-ata)
 		local MASTER="/@$(cat /proc/ide/${IDEBUS}/channel)/disk 0"
 		local SLAVE="/@$(cat /proc/ide/${IDEBUS}/channel)/disk 1"
@@ -681,6 +688,36 @@ chrp()
     return 0
 }
 
+## find OpenFirmware device path for Genesi Pegasos hardware (ide only)
+pegasos()
+{
+    case "$DEVNODE" in
+	sd*)
+	    if ls -l /proc/device-tree | grep -q ^lr ; then
+		true
+	    else
+		echo 1>&2 "$PRG: /proc/device-tree is broken."
+		return 1
+	    fi
+
+	    ## use common scsiinfo function to get info we need.
+	    scsiinfo || return 1
+
+	    ## now we have the data for /@$DEVID:$PARTITION
+	    ## find the actual OF path.	
+	    scsi_ofpath || return 1
+	    ;;
+	hd*)
+	    ide_ofpath || return 1
+	    ;;
+	*)
+	    echo 1>&2 "$PRG: Device: /dev/$DEVNODE is not supported"
+	    return 1
+	    ;;
+    esac
+    return 0
+}
+
 ## If we get lame devfs name, we need to make it foad
 ckdevfs()
 {
@@ -906,6 +943,8 @@ elif (cat /proc/cpuinfo 2>/dev/null | gr
     SUBARCH=OldWorld
 elif (cat /proc/cpuinfo 2> /dev/null | grep ^machine | grep -q 'CHRP IBM') ; then
     SUBARCH=CHRP
+elif (cat /proc/cpuinfo 2> /dev/null | grep ^machine | grep -q 'CHRP Pegasos') ; then
+    SUBARCH=Pegasos
 else
     echo 1>&2 "$PRG: This machine is not yet supported"
     exit 1
@@ -937,6 +976,9 @@ case "$SUBARCH" in
     CHRP)
 	chrp || exit 1
 	;;
+    Pegasos)
+        pegasos || exit 1
+	;;
 esac
 
 exit 0


Index: yaboot.spec
===================================================================
RCS file: /cvs/dist/rpms/yaboot/devel/yaboot.spec,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- yaboot.spec	29 Jul 2005 15:04:45 -0000	1.14
+++ yaboot.spec	30 Jul 2005 13:35:30 -0000	1.15
@@ -1,7 +1,7 @@
 Summary: Linux bootloader for Power Macintosh "New World" computers.
 Name: yaboot
 Version: 1.3.13
-Release: 0.2
+Release: 0.3
 License: GPL
 Group: System Environment/Base
 Source: http://penguinppc.org/bootloaders/yaboot/yaboot-%{version}.tar.gz
@@ -23,6 +23,8 @@
 Patch16: yaboot-1.3.13-swraid2.patch
 Patch17: yaboot-1.3.13-pegasos-claim.patch
 Patch18: yaboot-1.3.13-pegasos-ext2.patch
+Patch19: yaboot-1.3.13-confarg.patch
+Patch20: yaboot-1.3.13-ofpath-pegasos.patch
 
 URL: http://penguinppc.org/bootloaders/yaboot/
 BuildRoot: %{_tmppath}/%{name}-root
@@ -56,6 +58,8 @@
 %patch16 -p1 -b .swraid2
 %patch17 -p1 -b .pegasos
 %patch18 -p1 -b .ext2
+%patch19 -p1 -b .confarg
+%patch20 -p1 -b .ofpath
 
 %build
 make
@@ -89,7 +93,11 @@
 %ghost %config(noreplace) %{_sysconfdir}/yaboot.conf
 
 %changelog
-* Fri Jul 22 2005 Paul Nasrat <pnasrat redhat com> - 1.3.13-0.2
+* Sat Jul 30 2005 David Woodhouse <dwmw2 redhat com> - 1.3.13-0.3
+- Accept config file path on command line
+- Make ofpath work on Pegasos
+
+* Fri Jul 29 2005 David Woodhouse <dwmw2 redhat com> - 1.3.13-0.2
 - Workaround claim bug in Pegasos SmartFirmware
 - Handle ext2 boot partition
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]