summaryrefslogtreecommitdiffstats
path: root/mdk-stage1
diff options
context:
space:
mode:
Diffstat (limited to 'mdk-stage1')
-rw-r--r--mdk-stage1/mount.c10
-rw-r--r--mdk-stage1/probing.c35
-rw-r--r--mdk-stage1/tools.c5
3 files changed, 47 insertions, 3 deletions
diff --git a/mdk-stage1/mount.c b/mdk-stage1/mount.c
index 9098456b6..8db04ddc0 100644
--- a/mdk-stage1/mount.c
+++ b/mdk-stage1/mount.c
@@ -83,6 +83,16 @@ static int ensure_dev_exists(char *dev)
/* SCSI cd's */
major = 11;
minor = name[3] - '0';
+ } else if (ptr_begins_static_str(name, "ida/") ||
+ ptr_begins_static_str(name, "cciss/")) {
+ char * ptr = strchr(name, '/');
+ mkdir("/dev/ida", 0755);
+ mkdir("/dev/cciss", 0755);
+ major = ptr_begins_static_str(name, "ida/") ? 72 : 104 + charstar_to_int(ptr+2);
+ ptr = strchr(ptr, 'd');
+ minor = 16 * charstar_to_int(ptr+1);
+ ptr = strchr(ptr, 'p');
+ minor += charstar_to_int(ptr+1);
} else {
log_message("I don't know how to create device %s, please post bugreport to me!", dev);
return -1;
diff --git a/mdk-stage1/probing.c b/mdk-stage1/probing.c
index 0e4a53e24..703913a0e 100644
--- a/mdk-stage1/probing.c
+++ b/mdk-stage1/probing.c
@@ -22,7 +22,7 @@
/*
* This contains stuff related to probing:
- * (1) any (actually only SCSI, NET, USB Controllers) devices (autoprobe for PCI and USB)
+ * (1) any (actually only SCSI, NET, CPQ, USB Controllers) devices (autoprobe for PCI and USB)
* (2) IDE media
* (3) SCSI media
* (4) ETH devices
@@ -53,7 +53,7 @@
#include "probing.h"
-enum bus_type { IDE, SCSI };
+enum bus_type { IDE, SCSI, CPQ };
struct media_info {
char * name;
@@ -387,7 +387,6 @@ static void find_media(void)
/* ----------------------------------------------- */
log_message("looking for scsi media");
-
fd = open("/proc/scsi/scsi", O_RDONLY);
if (fd != -1) {
enum { SCSI_TOP, SCSI_HOST, SCSI_VENDOR, SCSI_TYPE } state = SCSI_TOP;
@@ -511,6 +510,36 @@ static void find_media(void)
}
/* ----------------------------------------------- */
+ log_message("looking for Compaq Smart Array media");
+ {
+ char * procfiles[] = { "/proc/driver/array/ida0", "/proc/array/ida",
+ "/proc/driver/cciss/cciss0", "/proc/cciss/cciss",
+ NULL };
+ char ** procfile = procfiles;
+ FILE * f;
+ while (procfile && *procfile && (f = fopen(*procfile, "rb"))) {
+ while (fgets(buf, sizeof(buf), f)) {
+ if (ptr_begins_static_str(buf, "ida/") || ptr_begins_static_str(buf, "cciss/")) {
+ char * end = strchr(buf, ':');
+ if (!end)
+ log_message("Inconsistency in %s, line:\n%s", *procfile, buf);
+ else {
+ *end = '\0';
+ tmp[count].name = strdup(buf);
+ tmp[count].type = DISK;
+ tmp[count].model = "Compaq RAID logical disk";
+ log_message("CPQ: found %s", tmp[count].name);
+ tmp[count].bus = CPQ;
+ count++;
+ }
+ }
+ }
+ fclose(f);
+ procfile++;
+ }
+ }
+
+ /* ----------------------------------------------- */
tmp[count].name = NULL;
count++;
diff --git a/mdk-stage1/tools.c b/mdk-stage1/tools.c
index ad136b4d4..e5d37f28b 100644
--- a/mdk-stage1/tools.c
+++ b/mdk-stage1/tools.c
@@ -174,6 +174,9 @@ void unset_param(int i)
stage1_mode &= ~i;
}
+// warning, many things rely on the fact that:
+// - when failing it returns 0
+// - it stops on first non-digit char
int charstar_to_int(char * s)
{
int number = 0;
@@ -283,6 +286,8 @@ enum return_type load_ramdisk_fd(int ramdisk_fd, int size)
if (!seems_ok) {
log_message("reading compressed ramdisk: %s", BZ2_bzerror(st2, &z_errnum));
+ BZ2_bzclose(st2); /* opened by gzdopen, but also closes the associated fd */
+ close(ram_fd);
remove_wait_message();
stg1_error_message("Could not uncompress second stage ramdisk. "
"This is probably an hardware error while reading the data. "