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

[Patch] make mips/ip22 bootable form harddisk



The attached patch finally adds dvhtool support so we can make ip22
systems directly bootable from harddisk. This should make the mips
specific part of the bootdisks basically feature complete.
 -- Guido
Index: utilities/dbootstrap/bootconfig.c
===================================================================
RCS file: /cvs/debian-boot/boot-floppies/utilities/dbootstrap/bootconfig.c,v
retrieving revision 1.129
diff -u -r1.129 bootconfig.c
--- utilities/dbootstrap/bootconfig.c	2001/07/18 23:50:36	1.129
+++ utilities/dbootstrap/bootconfig.c	2001/08/04 18:31:52
@@ -38,6 +38,9 @@
 # define USE_PALO
 #elif #cpu(ia64)
 # define USE_ELILO
+/* for now we only support ip22 */
+#elif #cpu(mips)
+# define USE_DVHTOOL
 #else
 # define USE_LILO
 #endif
@@ -1399,6 +1402,51 @@
 }
 #endif /* USE_ELILO */
 
+#ifdef USE_DVHTOOL
+static int run_dvhtool(void)
+{
+  int count;
+  char buf[256];
+  char* disk_name;
+  struct fdisk_partition* volhdr;
+
+  if (strcmp(Arch2, "ip22") != 0) {
+	problemBox(_("Making the system bootable from harddisk is currently only supported for the mips ip22 subarchitecture - sorry."),
+        	_("Not an ip22 machine"));
+	return 0;
+  } 
+  volhdr = fdisk_find_partition_by_type(PTYPE_SGI_VOLHDR);
+  if( !volhdr ) {
+    	problemBox(_("I couldn't find any partitions with SGI disklabel. I can't make your system bootable from harddisk."),
+               _("No SGI disklabel found"));
+    	return 1;
+  } 
+  disk_name = volhdr->disk->name;
+  if ((count=readlink("/target/vmlinuz", buf, sizeof(buf))) == -1) {
+	ERRMSG("Error resolving /target/vmlinuz symlink");
+	return 1;
+  }
+  buf[count] = '\0';
+  snprintf(prtbuf, sizeof(prtbuf), 
+	"dvhtool -d %s --unix-to-vh /target/%s linux", disk_name, buf );
+  if( execlog(prtbuf, LOG_DEBUG) ) {
+	problemBox(_("Dvhtool failed - cannot continue."),"Critical error");
+	 return 1;
+  }
+  vaproblemBox(_("Important"),
+	_("I have coppied the kernel into the volume header of disk %s. "
+	  "Please adjust your PROM settings after rebooting as follows.")
+	  , disk_name);
+  vaproblemBox(_("Prom Settings"),
+	_("setenv OSLoader linux\n"
+	  "setenv SystemPartition scsi(0)disk(X)rdisk(0)partition(8)\n"
+	  "where X is the scsi id of disk %s"), disk_name);
+  vaproblemBox(_("Prom Settings"),
+	_("Furthermore you can set your root partition with:\n"
+	  "setenv OSLoadPartition %s"), Root->name);
+  return 0;
+}
+#endif
 
 #ifdef USE_LILO
 /*
@@ -2356,8 +2404,11 @@
   }
   notInstalledLILO=0;
 #elif #cpu (mips)
-  problemBox(_("You need to setup DVHTOOL yourself, sorry"),
-	     _("Problem"));
+  status=run_dvhtool();
+  if(status!=0) {
+    problemBox(_("Dvhtool wasn't able to install the kernel. You can still remote boot and point the root device to the installed system."),_("Problem"));
+    return 1; 
+  }
 #elif #cpu (mipsel)
   problemBox(_("You need to setup DELO yourself, sorry"),
 	     _("Problem"));
 

Reply to: