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

RE: EDD disksigs for disks other than 0x80



Jeremy

  Here's an early peek at the Edd code that I've rewritten almost
completely based on your recommendations..Based on my limited testing,
the code works fine but once we agree on the general scheme of the code
I will refine it further...

 Here's a summary:

  1. The code basically defines two interfaces probeBiosDisks() and
getBiosDisk(disk#)
  2. proBiosDisks() does the following:
         i) Checks to see if there is a system wide unique signatures.
         ii) If unique signatures don't exist, it returns with a Warning
message that attempt to use "EDD Scheme" will fail.Otherwise proceed to
(iii).
         iii)Maps BIOS disk num to real device names.
         iv) If (iii) fails for some reason, it returns with a Warning
Message that attempt to use "Edd Scheme" will fail, otherwise returns
with success.

  3. getBiosDisk(disk#) returns the device name corresponding to a BIOS
disk #.

  4. Included "eddsupport.c" in libisys.a and _isys.so.
  5. Modified isys.c and isys.py to extend the functionalities of
"probeBiosDisks" and "getBiosDisk" to python modules.
  6. Also, no environment variables anywhere :-)


  Let me know  what you think...

   --rez


diff -urNp old-anaconda-10/anaconda anaconda-10.0/anaconda
--- old-anaconda-10/anaconda	2004-05-07 11:22:38.000000000 -0600
+++ anaconda-10.0/anaconda	2004-07-08 17:27:21.000000000 -0600
@@ -483,11 +483,14 @@ for n in args:
     elif (str == '--kickstart'):
 	from kickstart import Kickstart
 	ksfile = arg
-        instClass = Kickstart(ksfile, flags.serial)
+	## Code inserted by Rez ###
+        #Assume EDD support is on for kickstart based installation
+        isys.doProbeBiosDisks()
+	instClass = Kickstart(ksfile, flags.serial)
     elif (str == '--lang'):
-        lang = arg
+	lang = arg
     elif (str == '--lowres'):
-        runres = '640x480'
+	runres = '640x480'
     elif (str == '-m' or str == '--method'):
 	method = arg
 	if method[0] == '@':
diff -urNp old-anaconda-10/.cvsignore anaconda-10.0/.cvsignore
--- old-anaconda-10/.cvsignore	1969-12-31 18:00:00.000000000 -0600
+++ anaconda-10.0/.cvsignore	2003-01-14 00:19:38.000000000 -0600
@@ -0,0 +1,5 @@
+*.pyc
+anaconda*.tar.gz
+anaconda*.tar.bz2
+lang-names
+mini-wm
diff -urNp old-anaconda-10/isys/eddsupport.c
anaconda-10.0/isys/eddsupport.c
--- old-anaconda-10/isys/eddsupport.c	1969-12-31 18:00:00.000000000
-0600
+++ anaconda-10.0/isys/eddsupport.c	2004-07-08 18:12:26.997610176
-0600
@@ -0,0 +1,458 @@
+#include "eddsupport.h"
+
+extern int errno; 
+static struct diskMapTable *mbrSigToName;
+
+
+
+char* strupper(char * orig) {
+
+char *current_ptr;
+
+			if ( orig) {
+			for
(current_ptr=orig;*current_ptr;(*current_ptr)=toupper(*current_ptr),curr
ent_ptr++);
+                                  }
+                         return(orig);
+}
+
+
+/* This is the top level function that creates a disk list present in
the
+ system, checks to see if unique signatures exist on the disks at
offset 0x1b8.
+ If unique signature exists then it will map BIOS disks to their
corresponding
+ hd/sd device names. If  unique signatures don't exist on the disks
then it will print out Warning messages on the screen and proceed.This
is because although
+ EDD support is on, one may not use it. So, we wait till one tries to
access any
+ EDD specific information ( i.e. getBiosDisk()) and only then we'll
halt the 
+ system with an error message */
+

+

+void probeBiosDisks() {
+

+struct device ** disk_list=NULL;
+struct diskMapTable *diskSigToName;
+

+ DPRINT( "Going into createDiskList \n");
+ disk_list=createDiskList();
+ if(!disk_list){
+       /*logMessage("Warning: Could not create disk list, exiting");*/
+       printf("Warning: Could not create disk list, exiting");
+       sleep(10);
+       return;
+               }
+
+
+ #ifdef LOCAL_DEBUG
+ printDiskList(disk_list);
+ #endif
+
+

+ DPRINT("Trying to see if unique sig exists \n");
+
+

+ if(!(diskSigToName=uniqueSignatureExists(disk_list))){
+     /*logMessage("Warning: Can not use BIOS Disk Convention\n");*/
+      printf("Warning: Can not use BIOS Disk Convention\n");
+     sleep(10);
+     return;
+                                      }
+ else {
+     DPRINT( "Unique sig exists \n");
+     if(!mapBiosDisks(diskSigToName,EDD_DIR)){
+              /*logMessage("Warning , could not map BIOS disks! So BIOS
disk convention will not work\n");*/
+              printf("Warning , could not map BIOS disks! So BIOS disk
convention will not work\n");
+
+              sleep(10);
+              return;
+                                              }
+     /*logMessage("Mapped BIOS disks successfully\n");*/
+       printf("Mapped BIOS disks successfully\n");
+     /*logMessage("The Bios 0x80 disk is %s\n",getBiosDisk("80"));*/
+       printf("The Bios 0x80 disk is %s\n",getBiosDisk("80"));
+       sleep(10);
+      }
+

+

+} /* end probeBiosDisks */
+

+
+
+    
+
+struct device ** createDiskList(){
+

+struct device ** disk_list_head=NULL;
+

+

+  disk_list_head=probeDevices(CLASS_HD,BUS_SCSI|BUS_IDE,PROBE_ALL);
+

+  return(disk_list_head);
+

+}
+
+
+struct diskMapTable*  uniqueSignatureExists(struct device **
list_head){
+

+ __u32 current_device_signature,list_head_signature;
+ char list_head_device_name[9], current_device_name[9];
+ struct device **current_list_head, **current_device_list;
+ status local_status;
+ int i;
+ struct diskMapTable *hashTable;
+

+        memset(list_head_device_name,0,9);
+        memset(current_device_name,0,9);
+

+        hashTable=initializeHashTable(HASH_TABLE_SIZE);
+        if(!hashTable){
+             /*logMessage("Error initializing diskSigToName
table\n");*/
+             printf("Error initializing diskSigToName table\n");
+             sleep(5);
+             return NULL;
+                      }
+        DPRINT("Done initializing diskSigToName\n");
+
+
+        for
(current_list_head=list_head,i=0;(*current_list_head)!=NULL;current_list
_head++,i++) {
+

+
CREATE_DEVICE_NAME(list_head_device_name,(*current_list_head)->device);
+            DPRINT( "Current list head device name is :
%s\n",list_head_device_name);
+

+
local_status=readDiskSig((*current_list_head)->device,list_head_device_n
ame,&list_head_signature);
+

+            if(local_status==ERROR) {
+                   /*logMessage("Error: Reading disk sig");*/
+                     printf("Error: Reading disk sig");
+                   sleep(10);
+                   return NULL;
+                                    }
+

+            DPRINT( "The list head disk signature is : %x, IMPORTANT
\n", list_head_signature);
+    
+
+            for
(current_device_list=current_list_head+1;(*current_device_list)!=NULL;cu
rrent_device_list++) {
+

+
CREATE_DEVICE_NAME(current_device_name,(*current_device_list)->device);
+                  DPRINT( "Current device name is :
%s\n",current_device_name);
+
local_status=readDiskSig((*current_device_list)->device,current_device_n
ame,&current_device_signature);
+

+                  if(local_status==ERROR) {
+                        /*logMessage("Error: Reading disk sig");*/
+                        printf("Error: Reading disk sig");
+                        sleep(10);
+                        return NULL;
+                                          }
+

+                  DPRINT( "The current disk signature is : %x
IMPORTANT\n", current_device_signature);
+                  if(list_head_signature==current_device_signature)
+                                        return NULL;
+

+                                  } /* end inner for */
+
+
if(!addToHashTable(hashTable,list_head_signature,(*current_list_head)->d
evice))
+                        return NULL;
+

+

+              }/* end outer for */
+

+

+    return hashTable;
+

+

+}
+
+
+
+

+status readDiskSig(char *devname,char* filename, __u32 *disk_signature)
{
+
+int fd, bytes_read,offset;
+
+
+       if (devMakeInode(devname,filename)){
+                     /*logMessage("Could not create device node");*/
+                     printf("Could not create device node");
+                     sleep(20);
+                     return ERROR;
+                                          }

+       fd=open(filename,O_RDONLY);
+       if ( fd < 0 ) {
+             /*logMessage("Error opening file : %s\n ",filename);*/
+             printf("Error opening file : %s\n ",filename);
+             sleep(20);
+             unlink(filename);
+             return ERROR;
+                    }
+       offset=lseek (fd,OFFSET,SEEK_SET);
+       if ( offset < 0 ){
+             close(fd);
+             /*logMessage("Error with seek operation %s :
",filename);*/
+               printf("Error with seek operation %s : ",filename);
+             sleep(20);
+             unlink(filename);
+             return ERROR;
+                        }
+
+      DPRINT( "reading disk sig\n");
+      bytes_read=read(fd,disk_signature,sizeof(__u32));
+      if ( bytes_read < sizeof(__u32)){
+             close(fd);
+             if ( bytes_read==-1 ){
+                                    /*logMessage("Error reading file :
%s ",filename);*/
+                                      printf("Error reading file : %s
",filename);
+
+                                    sleep(10);
+                                  }
+             else {
+                   /*logMessage("Byte size doesn't match, read only %d
bytes \n",bytes_read);*/
+                    printf("Byte size doesn't match, read only %d bytes
\n",bytes_read);
+
+                   sleep(10);
+                  }
+
+            unlink(filename);
+            return ERROR;
+                                      }
+ 
+      unlink(filename);
+
+      return SUCCESS;
+
+
+}
+
+
+
+int  mapBiosDisks(struct diskMapTable* hashTable,const char *path) {
+

+ DIR *dirHandle;
+ struct dirent *entry;
+ char sigFileName[50];
+ __u32 mbrSig, biosNum;
+ struct diskMapEntry *hashItem;
+ status local_status;
+

+

+   if(access(path,R_OK)) {
+

+            /*logMessage("Directory %s not accessible\n",path);*/
+            printf("Directory %s not accessible\n",path);
+            sleep(5);
+            exit(1);
+                         }
+

+   dirHandle=opendir(path);
+   if(!dirHandle){
+       /*logMessage("Failed to open directory  %s\n",path);*/
+       printf("Failed to open directory  %s\n",path);
+       sleep(5);
+       return 0;
+               }
+

+   mbrSigToName=initializeHashTable(HASH_TABLE_SIZE);
+   if(!mbrSigToName){
+             /*logMessage("Error initializing mbrSigToName table\n");*/
+               printf("Error initializing mbrSigToName table\n");
+             sleep(5);
+             return 0;
+                     }
+

+

+   DPRINT("Done initializing mbrSigToName\n");
+

+   while((entry=readdir(dirHandle))!=NULL) {
+

+            if(strncmp(entry->d_name,".",1) &&
strncmp(entry->d_name,"..",2)) {
+            memset(sigFileName,0,50);
+            DPRINT("The directory name is : %s\n",entry->d_name);
+            sscanf((entry->d_name+9),"%x",&biosNum);
+            DPRINT("The BIOS disk number is : %d\n",biosNum);
+
strcat(strcat(strcat(sigFileName,path),entry->d_name),SIG_FILE);
+            switch(local_status=readMbrSig(sigFileName,&mbrSig))
+

+                    {
+

+                      case ERROR:
+                                   /*logMessage("Error reading MBR
sig\n");*/
+                                   printf("Error reading MBR sig\n");
+                                   sleep(10);
+                                   return 0;
+
+                      case FAILURE:
+                                   DPRINT("could not find MBR sig
file\n");
+                                   sleep(5);
+                                   continue;
+
+                      case SUCCESS:
+                                   DPRINT("Found MBR sig file\n");
+
hashItem=lookupHashItem(hashTable,mbrSig);
+                                   if(hashItem){
+                                            DPRINT("Printing hash key
from mapbiosdisk: %d\n",hashItem->key);
+                                            DPRINT("Printing hash data
from mapbiosdisk: %s\n",hashItem->diskname);
+                          
+                                               }
+
+                                   else        {
+                                            DPRINT("Didnot find the key
from mapBiosDisk\n");
+                                            return 0;
+                                                }
+
if(!addToHashTable(mbrSigToName,(__u32)biosNum,hashItem->diskname))
+                                   return 0;
+

+

+

+                      }
+

+                                                        }/*End of outer
if*/
+
+
+

+                                           }/*End of while*/
+   closedir(dirHandle);
+   return 1;
+

+

+}/* End of mapBiosDisks */
+
+
+
+status readMbrSig(char *fileName,__u32 * int_sig){
+

+FILE* fh;
+

+       fh=fopen(fileName,"r");
+       if(fh==NULL){
+                /*logMessage("Error opening mbr_signature file");*/
+                DPRINT("Error opening mbr_signature file");
+                return FAILURE;
+                   }
+       fseek(fh,0,SEEK_SET);
+       if(fscanf(fh,"%x",int_sig)!=1){
+                /*logMessage("Error reading mbr_signature from /sys
filesystem");*/
+                printf("Error reading mbr_signature from /sys
filesystem");
+                fclose(fh);
+                return ERROR;
+                                     }
+

+       fclose(fh);

+       return SUCCESS;
+

+}                                                   
+
+
+
+
+
+
+struct diskMapTable* initializeHashTable(int size) {
+

+ struct diskMapTable* hashTable;
+ hashTable=malloc(sizeof(struct diskMapTable));
+ hashTable->tableSize=size;
+ hashTable->table=malloc(sizeof(struct diskMapEntry *)*size);
+ memset(hashTable->table,0,(sizeof(struct diskMapEntry *)*size));
+ DPRINT("Hash table size is : %d\n",hashTable->tableSize);
+ return hashTable;
+}
+
+
+int insertHashItem(struct diskMapTable *hashTable,struct diskMapEntry
*hashItem){
+

+

+int index;
+

+        DPRINT("Inside insert item\n");
+

+        DPRINT("printing key of hash item: %d\n",hashItem->key);
+        index=(hashItem->key)%(hashTable->tableSize);
+        DPRINT("printing index : %d\n",index);
+

+        if(hashTable->table[index]==NULL){
+              DPRINT("Did not find the item in list\n");
+              hashTable->table[index]=hashItem;
+              DPRINT("The key is %x\n",hashTable->table[index]->key);
+              return index;
+                                         }
+        else{
+             DPRINT("Found the item\n");
+             hashItem->next=hashTable->table[index];
+             hashTable->table[index]=hashItem;
+             return index;
+            }
+

+}
+
+
+
+struct diskMapEntry* lookupHashItem(struct diskMapTable*
hashTable,__u32 itemKey){
+

+int index;
+          struct diskMapEntry *hashItem;
+          index=itemKey%(hashTable->tableSize);
+          DPRINT("Item key from lookup is : %d\n",index);
+
for(hashItem=hashTable->table[index];(hashItem!=NULL)&&(hashItem->key!=i
temKey);hashItem=hashItem->next);
+          return hashItem;
+

+

+}
+
+
+
+int addToHashTable(struct diskMapTable *hashTable,__u32 itemKey,char*
diskName) {
+

+    int index;
+    struct diskMapEntry *diskSigToNameEntry;
+

+            diskSigToNameEntry=malloc(sizeof(struct diskMapEntry));
+            diskSigToNameEntry->next=NULL;
+            diskSigToNameEntry->key=itemKey;
+            diskSigToNameEntry->diskname=diskName;
+

+            if((index=insertHashItem(hashTable,diskSigToNameEntry))<0){
+                      /*logMessage("operation not ok\n");*/
+                      printf("operation not ok\n");
+                      sleep(10);
+                      return 0;
+

+                                                                  }
+            else {
+                      DPRINT("operation ok\n");
+                      DPRINT("Printing key
%x\n",hashTable->table[index]->key);
+                      DPRINT("Printing diskname
%s\n",hashTable->table[index]->diskname);
+                       return 1;
+

+

+               }
+

+

+

+}/*End of addToHashTable */
+
+
+
+
+
+ char* getBiosDisk(char *biosStr) {
+ 
+  __u32 biosNum;
+        sscanf(biosStr,"%x",&biosNum);
+        return(lookupHashItem(mbrSigToName,biosNum)->diskname);
+

+}
+

+
+
+void printDiskList(struct device ** list_head) {
+ 
+struct device **current_disk;
+ 
+/*logMessage("The disk list with kudzu is as follows:\n");*/
+printf("The disk list with kudzu is as follows:\n");
+sleep(10);
+for (current_disk=list_head;(*current_disk);current_disk++) {
+ 
+           /*logMessage("%s\n",(*current_disk)->device);*/
+             printf("%s\n",(*current_disk)->device);
+ 
+                                                            }
+
+}
+
diff -urNp old-anaconda-10/isys/eddsupport.h
anaconda-10.0/isys/eddsupport.h
--- old-anaconda-10/isys/eddsupport.h	1969-12-31 18:00:00.000000000
-0600
+++ anaconda-10.0/isys/eddsupport.h	2004-07-08 18:11:31.609030520
-0600
@@ -0,0 +1,86 @@
+#ifndef EDDSUPPORT_H
+#define EDDSUPPORT_H
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <ctype.h>
+#include <linux/types.h>
+#include <sys/stat.h>
+#include <sys/reboot.h>
+#include <stdlib.h>
+#include <kudzu/kudzu.h>
+
+#include <sys/types.h>
+#include <dirent.h>
+ 
+#include "../loader2/log.h"
+#include "isys.h"
+
+
+#define LOCAL_DEBUG
+#undef LOCAL_DEBUG
+
+#define BUFF_SIZE 4
+#define OFFSET 0x1b8
+
+#define SIG_FILE "/mbr_signature"
+#define START_SIG 0x80
+#define CREATE_DEVICE_NAME(fullname,suffix)
strcat(strcpy(fullname,"/tmp/"),\
+suffix)
+#define EDD_DIR "/sys/firmware/edd/"
+#define HASH_TABLE_SIZE 17
+
+
+#ifdef LOCAL_DEBUG
+#define DPRINT(s...) do  { \
+			logMessage(s);\
+			sleep(5);\
+			} while(0)		
+#else
+#define DPRINT(s...)
+#endif
+
+struct diskMapEntry{
+

+__u32 key;
+char *diskname;
+struct diskMapEntry *next;
+

+};
+

+

+struct diskMapTable {
+

+struct diskMapEntry **table;
+int tableSize;
+

+};
+

+
+
+typedef enum {SUCCESS,FAILURE,ERROR} status;
+
+struct diskMapTable*  initializeHashTable( int );
+int insertHashItem(struct diskMapTable *,struct diskMapEntry *);
+struct diskMapEntry* lookupHashItem(struct diskMapTable*,__u32
itemKey);
+int addToHashTable(struct diskMapTable *,__u32 ,char* );
+
+
+void probeBiosDisks();
+char* getBiosDisk(char *);
+
+struct device ** createDiskList();
+int  mapBiosDisks(struct diskMapTable* ,const char *);
+status readDiskSig(char*,char*, __u32*);
+struct diskMapTable* uniqueSignatureExists(struct device ** );
+status readMbrSig(char *,__u32 *);
+char *strupper( char *orig);
+void printDiskList(struct device ** );
+
+
+char* parseHDCommand(char* drv, char* prt);
+char* parseEddHDCommand(char* tempstr);
+#endif
+
+
diff -urNp old-anaconda-10/isys/isys.c anaconda-10.0/isys/isys.c
--- old-anaconda-10/isys/isys.c	2004-04-15 11:52:51.000000000 -0600
+++ anaconda-10.0/isys/isys.c	2004-07-08 17:32:46.000000000 -0600
@@ -49,10 +49,19 @@
 #include "lang.h"
 #include "getmacaddr.h"
 
+/*Rez code here*/
+
+#include "eddsupport.h"
+
+/*Rez code ended*/
+
 #ifndef CDROMEJECT
 #define CDROMEJECT 0x5309
 #endif
 
+
+
+
 static PyObject * doGetOpt(PyObject * s, PyObject * args);
 /*static PyObject * doInsmod(PyObject * s, PyObject * args);
 static PyObject * doRmmod(PyObject * s, PyObject * args);*/
@@ -110,6 +119,14 @@ static PyObject * doGetMacAddress(PyObje
 static PyObject * doGetIPAddress(PyObject * s, PyObject * args);
 static PyObject * doResetFileContext(PyObject * s, PyObject * args);
 
+/* Rez code starts */
+
+static PyObject * doProbeBiosDisks(PyObject * s, PyObject * args);
+static PyObject * doGetBiosDisk(PyObject * s, PyObject * args); 
+/* Rez code ended */
+
+
+
 static PyMethodDef isysModuleMethods[] = {
     { "ejectcdrom", (PyCFunction) doEjectCdrom, METH_VARARGS, NULL },
     { "e2dirty", (PyCFunction) doExt2Dirty, METH_VARARGS, NULL },
@@ -164,10 +181,45 @@ static PyMethodDef isysModuleMethods[] =
     { "isLdlDasd", (PyCFunction) py_isLdlDasd, METH_VARARGS, NULL},
     { "getMacAddress", (PyCFunction) doGetMacAddress, METH_VARARGS,
NULL},
     { "getIPAddress", (PyCFunction) doGetIPAddress, METH_VARARGS,
NULL},
+    { "biosDiskProbe", (PyCFunction) doProbeBiosDisks,
METH_VARARGS,NULL},
+    { "getbiosdisk",(PyCFunction) doGetBiosDisk, METH_VARARGS,NULL},
     { "resetFileContext", (PyCFunction) doResetFileContext,
METH_VARARGS, NULL },
     { NULL }
 } ;
 
+
+/* Rez code starts */
+
+static PyObject * doProbeBiosDisks(PyObject * s, PyObject * args){
+
+    probeBiosDisks();
+    Py_INCREF(Py_None);
+    return Py_None;
+
+
+
+}
+
+static PyObject * doGetBiosDisk(PyObject * s, PyObject * args){
+
+char *mbr_sig;
+char *diskname;
+char *pyDiskName;
+            
+    if (!PyArg_ParseTuple(args, "s", &mbr_sig)) return NULL;
+    diskname=getBiosDisk(mbr_sig);
+    pyDiskName=(char *)calloc((strlen(diskname)+1),sizeof(char));
+    strcpy(pyDiskName,diskname);
+    return Py_BuildValue("s", pyDiskName);

+

+}
+
+
+
+/* Rez code ends */
+
+
+
 static PyObject * pyMakeDev(PyObject * s, PyObject * args) {
     int major, minor;
 
diff -urNp old-anaconda-10/isys/isys.py anaconda-10.0/isys/isys.py
--- old-anaconda-10/isys/isys.py	2004-05-12 16:21:17.000000000
-0600
+++ anaconda-10.0/isys/isys.py	2004-07-08 10:09:08.000000000 -0600
@@ -700,6 +700,16 @@ def resetFileContext(fn):
 def startBterm():
     return _isys.startBterm()
 
+
+#Rez code here
+
+def doProbeBiosDisks():
+	_isys.biosDiskProbe()
+
+def doGetBiosDisk(mbrSig):
+	return _isys.getbiosdisk(mbrSig)
+
+
 printObject = _isys.printObject
 bind_textdomain_codeset = _isys.bind_textdomain_codeset
 isVioConsole = _isys.isVioConsole
diff -urNp old-anaconda-10/isys/Makefile anaconda-10.0/isys/Makefile
--- old-anaconda-10/isys/Makefile	2004-02-24 17:56:01.000000000
-0600
+++ anaconda-10.0/isys/Makefile	2004-07-06 10:46:48.000000000 -0600
@@ -5,7 +5,7 @@ CFLAGS = -ffunction-sections -I$(PYTHONI
 OBJECTS = nfsmount.o nfsmount_clnt.o nfsmount_xdr.o imount.o
getmacaddr.o \
           smp.o devnodes.o cpio.o uncpio.o dasd.o \
 	  lang.o isofs.o dns.o linkdetect.o pdc.o hpt.o silraid.o vio.o
\
-	  ethtool.o getipaddr.o
+	  ethtool.o getipaddr.o eddsupport.o
 SOBJECTS = $(patsubst %.o,%.lo,$(OBJECTS))
 SOURCES = $(patsubst %.o,%.c,$(OBJECTS)) isys.c
 LOADLIBES = -lresolv -lpci -lpopt -lpump -lext2fs -lz -lbterm -lbogl
-lwlite -lkudzu -lpci -lselinux
diff -urNp old-anaconda-10/kickstart.py anaconda-10.0/kickstart.py
--- old-anaconda-10/kickstart.py	2004-03-23 13:03:00.000000000
-0600
+++ anaconda-10.0/kickstart.py	2004-07-08 15:59:19.000000000 -0600
@@ -1103,7 +1103,7 @@ class KickstartBase(BaseInstallClass):
                                         'type=', 'fstype=',
'asprimary',
                                         'noformat', 'start=', 'end=',
                                         'badblocks', 'recommended',
-                                        'ondrive='])
+                                        'ondrive=', 'onbiosdisk=' ])
 
 	for n in args:
 	    (str, arg) = n
@@ -1117,6 +1117,9 @@ class KickstartBase(BaseInstallClass):
 		onPart = arg
 	    elif str == '--ondisk' or str == '--ondrive':
 		disk = arg
+            #Rez code here
+            elif str == '--onbiosdisk':
+		disk = isys.doGetBiosDisk(arg)
             elif str == '--bytes-per-inode':
                 fsopts = ['-i', arg]
             # XXX this doesn't do anything right now
diff -urNp old-anaconda-10/loader2/hdinstall.c
anaconda-10.0/loader2/hdinstall.c
--- old-anaconda-10/loader2/hdinstall.c	2003-12-16 10:51:01.000000000
-0600
+++ anaconda-10.0/loader2/hdinstall.c	2004-07-08 18:26:19.539044640
-0600
@@ -39,7 +39,7 @@
 
 #include "../isys/imount.h"
 #include "../isys/isys.h"
-
+#include "../isys/eddsupport.h"
 
 /* see if this is a partition name or not */
 int isPartitionName(char *pname) {
@@ -583,14 +583,17 @@ char * mountHardDrive(struct installMeth
 
 void setKickstartHD(struct loaderData_s * loaderData, int argc,
                      char ** argv, int * flagsPtr) {
-    char *partition, *dir;
+    char *biospart=NULL, *partition, *dir, *p;
     poptContext optCon;
     int rc;
+
     struct poptOption ksHDOptions[] = {
+        {"biospart", '\0', POPT_ARG_STRING, &biospart, 0 },
         { "partition", '\0', POPT_ARG_STRING, &partition, 0 },
         { "dir", '\0', POPT_ARG_STRING, &dir, 0 },
         { 0, 0, 0, 0, 0 }
     };
+  
 
     logMessage("kickstartFromHD");
     optCon = poptGetContext(NULL, argc, (const char **) argv,
ksHDOptions, 0);
@@ -604,6 +607,29 @@ void setKickstartHD(struct loaderData_s 
         return;
     }
 
+    if(biospart) {
+
+              p=strchr(biospart,'p');
+              if(!p){
+                      logMessage("Bad argument for --biospart");
+                      sleep(10);
+                      return;
+                    }
+              partition=(char*)calloc(6,sizeof(char));
+              *p='\0';
+
strncat(strncat(partition,getBiosDisk(biospart),3),p+1,2);
+
+                  }
+
+
+    DPRINT("The BIOS partition is %s\n",partition);
+    DPRINT("The BIOS dir is %s\n",dir);
+    sleep(10);
+
+    DPRINT("EDD code to find the harddrive and partitions to start hard
drive based installation is done");
+
+
+
     loaderData->method = strdup("hd");
     loaderData->methodData = calloc(sizeof(struct hdInstallData *), 1);
     if (partition)
@@ -623,6 +649,7 @@ int kickstartFromHD(char *kssrc, int fla
     /* format is ks=hd:[device]:/path/to/ks.cfg */
     /* split of pieces */
     tmpstr = strdup(kssrc);
+
     p = strchr(tmpstr, ':');
     if (p)
 	q = strchr(p+1, ':');
@@ -642,6 +669,7 @@ int kickstartFromHD(char *kssrc, int fla
     ksdev = p+1;
     kspath = q+1;
 
+
     logMessage("Loading ks from device %s on path %s", ksdev, kspath);
     if ((rc=getKickstartFromBlockDevice(ksdev, kspath))) {
 	if (rc == 3) {
@@ -654,3 +682,72 @@ int kickstartFromHD(char *kssrc, int fla
 
     return 0;
 }
+
+
+
+int kickstartFromBD(char *kssrc, int flags) {
+    int rc;
+    char *p, *q = NULL, *tmpstr, *r=NULL, *kspath, *biosksdev;
+    char ksdev[6];
+
+    memset(ksdev,0,6);

+    logMessage("getting kickstart file from BIOS disk");
+

+    /* format is ks=bd:device:/path/to/ks.cfg */
+    /* split of pieces */
+    tmpstr = strdup(kssrc);
+

+

+

+ p = strchr(tmpstr, ':');
+    if (p)
+        q = strchr(p+1, ':');
+

+    if (!p || !q) {
+        logMessage("Format of command line is
ks=hd:device:/path/to/ks.cfg");
+        free(tmpstr);
+        return 1;
+    }
+

+    *q = '\0';
+    kspath = q+1;
+                      
+    r=strchr(p+1,'p');
+    if(!r){
+        logMessage("Format of BIOS disk is BIOS_DISK_NUM:partition");
+        free(tmpstr);
+        return 1;
+    }                                                          
+
+    *r='\0';
+    biosksdev=getBiosDisk((p+1));
+    if(!biosksdev){
+        startNewt(flags);
+        newtWinMessage(_("Error"), _("OK"),
+                         _("Cannot find kickstart file on hard
drive."));
+        return 1;
+
+    }
+
+    DPRINT("The BIOS ksdev is : %s ",biosksdev);
+    DPRINT("The kspath is : %s ",kspath);
+
+    strcat(strcat(ksdev,biosksdev),r+1);
+    DPRINT("The ksdev is : %s ",ksdev);

+    sleep(20);

+    logMessage("Loading ks from device %s on path %s", ksdev, kspath);
+    if ((rc=getKickstartFromBlockDevice(ksdev, kspath))) {
+        if (rc == 3) {
+            startNewt(flags);
+            newtWinMessage(_("Error"), _("OK"),
+                           _("Cannot find kickstart file on hard
drive."));
+        }
+        return 1;
+    }
+

+    return 0;
+}
+
+
+
+
diff -urNp old-anaconda-10/loader2/hdinstall.h
anaconda-10.0/loader2/hdinstall.h
--- old-anaconda-10/loader2/hdinstall.h	2003-11-21 18:12:14.000000000
-0600
+++ anaconda-10.0/loader2/hdinstall.h	2004-07-06 13:25:02.000000000
-0600
@@ -16,5 +16,6 @@ char * mountHardDrive(struct installMeth
                       moduleInfoSet modInfo, moduleList modLoaded,
                       moduleDeps * modDepsPtr, int flags);
 int kickstartFromHD(char *kssrc, int flags);
+int kickstartFromBD(char *kssrc, int flags);
 
 #endif
diff -urNp old-anaconda-10/loader2/kickstart.c
anaconda-10.0/loader2/kickstart.c
--- old-anaconda-10/loader2/kickstart.c	2004-04-15 20:37:01.000000000
-0600
+++ anaconda-10.0/loader2/kickstart.c	2004-07-06 12:19:06.000000000
-0600
@@ -321,7 +321,11 @@ void getKickstartFile(struct loaderData_
         if (kickstartFromHD(c, *flagsPtr)) 
             return;
         loaderData->ksFile = strdup("/tmp/ks.cfg");
-    } else if (!strncmp(c, "ks=cdrom", 8)) {
+    }else if (!strncmp(c, "ks=bd:", 6)) {
+        if (kickstartFromBD(c, *flagsPtr))
+            return;
+        loaderData->ksFile = strdup("/tmp/ks.cfg");
+    }else if (!strncmp(c, "ks=cdrom", 8)) {
         if (kickstartFromCD(c, *flagsPtr)) 
             return;
         loaderData->ksFile = strdup("/tmp/ks.cfg");
diff -urNp old-anaconda-10/loader2/loader.c
anaconda-10.0/loader2/loader.c
--- old-anaconda-10/loader2/loader.c	2004-05-05 13:00:21.000000000
-0600
+++ anaconda-10.0/loader2/loader.c	2004-07-06 13:27:55.000000000
-0600
@@ -80,6 +80,7 @@
 #include "../isys/isys.h"
 #include "../isys/stubs.h"
 #include "../isys/lang.h"
+#include "../isys/eddsupport.h"
 
 /* maximum number of extra arguments that can be passed to the second
stage */
 #define MAX_EXTRA_ARGS 128
@@ -554,6 +555,7 @@ static int parseCmdLineFlags(int flags, 
             flags &= ~LOADER_FLAGS_SELINUX;
         else if (!strncasecmp(argv[i], "selinux", 7))
             flags |= LOADER_FLAGS_SELINUX;
+
         else if (numExtraArgs < (MAX_EXTRA_ARGS - 1)) {
             /* go through and append args we just want to pass on to */
             /* the anaconda script, but don't want to represent as a */
@@ -1144,6 +1146,7 @@ int main(int argc, char ** argv) {
 
     memset(&loaderData, 0, sizeof(loaderData));
 
+
     extraArgs[0] = NULL;
     flags = parseCmdLineFlags(flags, &loaderData, cmdLine);
 
@@ -1229,6 +1232,17 @@ int main(int argc, char ** argv) {
         getDDFromSource(&loaderData, loaderData.ddsrc, flags);
     }
 
+
+/* Rez code here for edd. Load edd module and find BIOS disk map*/
+
+             logMessage("Loading edd module");
+             sleep(10);
+             mlLoadModuleSet("edd", modLoaded, modDeps,modInfo, flags);
+             logMessage("Done loading edd");
+             sleep(5);
+             probeBiosDisks();
+
+
     /* JKFIXME: loaderData->ksFile is set to the arg from the command
line,
      * and then getKickstartFile() changes it and sets FL_KICKSTART.  
      * kind of weird. */
diff -urNp old-anaconda-10/loader2/Makefile
anaconda-10.0/loader2/Makefile
--- old-anaconda-10/loader2/Makefile	2004-02-23 14:53:41.000000000
-0600
+++ anaconda-10.0/loader2/Makefile	2004-07-06 10:45:00.000000000
-0600
@@ -16,7 +16,7 @@ GUNZIP = -lz
 BINS = loader
 
 HWOBJS = pcmcia.o usb.o firewire.o hardware.o
-METHOBJS = method.o cdinstall.o hdinstall.o nfsinstall.o urlinstall.o
+METHOBJS = method.o cdinstall.o hdinstall.o nfsinstall.o urlinstall.o 
 OBJS = log.o moduleinfo.o loadermisc.o modules.o moduledeps.o windows.o
\
 	lang.o kbd.o modstubs.o driverdisk.o selinux.o \
 	md5.o mediacheck.o kickstart.o driverselect.o \






> -----Original Message-----
> From: Jeremy Katz [mailto:katzj redhat com]
> Sent: Wednesday, June 30, 2004 10:45 AM
> To: Kabir, Rezwanul
> Cc: Domsch, Matt; anaconda-devel-list redhat com
> Subject: RE: EDD disksigs for disks other than 0x80
> 
> 
> On Wed, 2004-06-30 at 10:01 -0500, Rezwanul_Kabir Dell com wrote:
> > > There shouldn't be a need to pass information around, 
> though.  Whether
> > > or not edd is being used should be pretty obvious based 
> on whether or
> > > not they ask for something in terms of BIOS disks.
> > 
> > 
> >    I must be missing something here...I understood the 
> part(described in
> > your next email) that you want to populate a struct of some sort ( a
> > hash table perhaps) with the mapping between BIOS and real 
> device names.
> > But as I understood the loader/anaconda code, you actually 
> interprete
> > some of the kickstart directives (e.g. harddrive --partition=<part#>
> > --dir=/) in loader and some (e.g. part / --size=<size> 
> --ondisk=<disk> )
> > in anacoda. If I'm correct, then you'll need to know the BIOS disk
> > mappings both in loader and in anaconda. How do you propose 
> to propagate
> > this information from loader to anaconda..? 
> 
> You just reprobe it.  As long as the functionality is in libisys, then
> the code gets shared trivially and there's no need to pass 
> around things
> that can be probed.
> 
> Jeremy
> 
> 
> 



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