RE: EDD disksigs for disks other than 0x80

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

 



 As per Jermey's recommendations, I have done the followings:
    1) Using kudzu to create the disk list instead of parsing the
/proc/partitions
    2) As a consequence of the above, regexp is no longer needed, so
gotten rid of it.

 I still need a consensus on a proper naming conventions for BIOS disks
and partitions.
 How about identifying BIOS disks as "bd[a-z]" and partitions as
"bd[a-z][1-9][0-9]*"
 So, for example kickstart directives would be:
    harddrive  --partition=bda2 --dir=/
    part / --size=1646 --ondisk=bdb
    etc.

  --rez


  Here's the latest patch....

 


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-06-29 10:38:13.000000000 -0600
@@ -483,11 +483,23 @@ for n in args:
     elif (str == '--kickstart'):
 	from kickstart import Kickstart
 	ksfile = arg
-        instClass = Kickstart(ksfile, flags.serial)
+
+	## Code inserted by Rez ###
+	print 'Rez code here'
+	if os.environ.has_key("EDD"):
+		print 'The DISK80 var is : '+os.environ["DISK80"]
+		time.sleep(10)
+		import eddparser
+		eddparser.Eddfy(ksfile)
+		print 'Eddfy over'
+	print 'Rez code ended'
+	time.sleep(20)
+
+	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/eddparser.py anaconda-10.0/eddparser.py
--- old-anaconda-10/eddparser.py	1969-12-31 18:00:00.000000000
-0600
+++ anaconda-10.0/eddparser.py	2004-06-29 10:27:48.000000000 -0600
@@ -0,0 +1,120 @@
+import time
+import sys
+import os
+import re
+import string
+import getopt
+
+module_name="eddparser"
+class EddClass:
+	def __init__(self,ksFileName):
+		self.kickStartFile=ksFileName
+
+	def run(self):
+		print self.kickStartFile
+		fh_old=open(self.kickStartFile,"r")
+		newFileName=self.kickStartFile+".tmp"
+		fh_new=open(newFileName,"a+")
+		self.parseCommands(fh_old,fh_new)
+		os.rename(newFileName,self.kickStartFile)
+		fh_old.close()
+
+	def foundMatch(self,ksLine,regCompiledList):
+		tokenList=[]
+		match=None
+		for regexp in regCompiledList:
+			match=regexp.match(ksLine)
+			if match != None:
+				tokenList=tokenList+string.split(ksLine)
+				break
+		return (match,tokenList)
+
+	def handleDrive(self,(m,argString)):
+		print 'Handler for drive'
+		disk=""
+		part=""
+
options,extra=getopt.getopt(argString,'',['drive=','partition=','dir='])
+		if extra:
+			raise ValueError, "Error in handleDrive:
Unsupported format in hardrive command"
+		else:
+#			print 'Valid Options found'
+
+			for (opt,val) in options:
+				if opt=='--drive':
+					disk=val
+				elif opt=='--partition':
+					part=val
+				else:
+					pass
+				
+		tempString=string.join(argString," ")
+		if len(disk)>0:
+
newOption="--partition="+os.environ[string.upper(disk)]+part
+			newString="harddrive
"+string.replace(tempString,"--drive="+disk+"
"+"--partition="+part,newOption)+"\n"
+		else:
+			newString="harddrive "+tempString
+		return newString
+					
+					
+				
+
+	def handlePart(self,(m,argString)):
+		print 'Handle partition'
+		newOption=os.environ[string.upper(m.group(1))]
+		tempString=string.join(argString," ")
+		newString="part
"+string.replace(tempString,m.group(1),os.environ[string.upper(m.group(1
))])+"\n"
+		return newString
+
+
+	def parseCommands(self,oldFile,newFile):
+		print 'In parse'
+		cmdHandlers = { "harddrive":self.handleDrive	,
+				"part":self.handlePart	,}
+	
+		commandList=[r"^harddrive[ \t]+--drive.*",r"^part[
\t].*(disk8.).*"]	
+	
+		compiledList=[]
+		for item in commandList:
+			compiledList.append(re.compile(item))
+		for line in oldFile.readlines():
+
(matchObject,args)=self.foundMatch(line,compiledList)
+			if matchObject:
+
newLine=cmdHandlers[args[0]]((matchObject,args[1:]))
+				print newLine
+				newFile.write(newLine)		
+			else:
+				newFile.write(line)
+
+
+
+def Eddfy(ksFile):
+	try:
+
+		if os.environ.has_key("EDD") and (os.environ["EDD"] ==
"1"):
+			EddInstance=EddClass(ksFile)
+			EddInstance.run()
+		else:
+			print 'eddon option not set'
+	except ValueError,e:
+		print "Invalid Value in module :"+ module_name
+		print e.args
+		sys.exit(1)
+	except getopt.GetoptError,e:
+		print "Error with options in module:"+ module_name
+		print e.args
+		sys.exit(1)
+	except IOError,e:
+		print "IO error in module: " + module_name
+		print e.args
+		sys.exit(1)
+	except Exception,e:
+		print "Unknown Exception occured in module: "+
module_name
+		print e.args
+		sys.exit(1)
+
+#time.sleep(10)
+#sys.exit(0)
+#print 'Program started'
+#Eddfy(sys.argv[1])
+#print 'The programe ended '
+
diff -urNp old-anaconda-10/loader2/eddsupport.c
anaconda-10.0/loader2/eddsupport.c
--- old-anaconda-10/loader2/eddsupport.c	1969-12-31
18:00:00.000000000 -0600
+++ anaconda-10.0/loader2/eddsupport.c	2004-06-29 11:24:47.632167320
-0600
@@ -0,0 +1,464 @@
+#include "eddsupport.h"
+
+/*extern int errno; */
+
+
+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 the 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 find out the BIOS disk80
device by 
+ reading in the MBR sig and compare it against the signatures on the
disks and
+ set the environment variable DISK80 to whatever the hd/sd name it has.
If
+ unique signatures don't exist on the disks, then it will write unique 
+ signatures on the disks and  reboot */
+ 
+
+void prepareForEdd() {
+
+struct device ** disk_list=NULL;
+__u32 mbr_sig;
+status local_status;
+
+ DPRINT("Going into createDiskList \n");
+ disk_list=createDiskList();
+ if(!disk_list){
+       logMessage("Error: Could not create disk list, exiting");
+       sleep(10);
+       exit(1);
+               }
+
+ #ifdef LOCAL_DEBUG
+  printDiskList(disk_list);
+ #endif
+
+ DPRINT("Trying to see if unique sig exists \n");
+
+ local_status=uniqueSignatureExists(disk_list);
+ switch(local_status){
+
+     case ERROR: 
+                 logMessage("Error: Could not determine if unique sig
exists");
+                 sleep(10);
+                 exit(1);
+
+     case SUCCESS:
+                  logMessage( "Unique sig exists \n");
+                  logMessage( "Reading MBR sig \n");
+                  local_status=readMbrSig(&mbr_sig);
+                  if(local_status!=SUCCESS) {
+                      logMessage("Problem reading mbr signature\n");
+                      sleep(10);
+                      exit(1);
+                                             }
+                  DPRINT("The hex mbr signature is : %x \n",mbr_sig);
+

+                  local_status=tagBiosLabel(disk_list,mbr_sig);
+                  if (local_status!=SUCCESS){
+                        logMessage("Could not find BIOS boot device
\n");
+                        sleep(10);
+                        exit(1);
+                                             }
+

+                  logMessage( "Woo hooh , Found BIOS dev80 \n");
+                  sleep(10);
+                  return;
+
+     case FAILURE: 
+                  logMessage( "Unique sig does not exists \n");
+                  local_status=writeUniqueSignatures(disk_list);
+                  if (local_status!=SUCCESS){
+                           logMessage("Problem writing disk signatures
\n");
+                           sleep(10);
+                           exit(1);
+                                            }
+                  logMessage("Done writing unique signatures,
rebooting\n");
+                  sleep(10);
+                  reboot(RB_AUTOBOOT);
+
+                } /* end switch */
+
+} /* end prepareForEdd */
+     
+
+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);
+

+}
+
+
+status readMbrSig(__u32 * int_sig){
+

+FILE* fh;
+

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

+       return SUCCESS;
+

+                                    }
+
+

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

+       fd=open(filename,O_RDONLY);
+       if ( fd < 0 ) {
+             logMessage("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);
+             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);
+                                    sleep(10);
+                                  }
+             else {
+                   logMessage("Byte size doesn't match, read only %d
bytes \n",bytes_read);
+                   sleep(10);
+                  }
+
+            unlink(filename);
+            return ERROR;
+                                      }
+ 
+      unlink(filename);
+
+      return SUCCESS;
+
+
+}
+
+status 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;
+ 
+
+        memset(list_head_device_name,0,9);
+        memset(current_device_name,0,9);
+ 
+
+ for
(current_list_head=list_head;(*current_list_head)->next!=NULL;current_li
st_head++) {
+

+
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");
+                   sleep(10);
+                   return ERROR;
+                                    }
+

+            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");
+                        sleep(10);
+                        return ERROR;
+                                          }
+

+

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

+                                  } /* end inner for */
+
+     }/* end outer for */
+

+    return SUCCESS;
+

+

+    }
+
+
+status writeDiskSig(char *devname,char *filename, __u32 *signature) {
+
+int fd, bytes_written,offset;
+
+
+      if(devMakeInode(devname,filename)) {
+                logMessage("Error creating device node");
+                sleep(20);
+                return ERROR;
+                                         }
+

+       fd=open(filename,O_WRONLY);
+       if ( fd < 0 ) {
+             logMessage("Error opening file : %s ",filename);
+             sleep(10);
+             unlink(filename);
+             return ERROR;
+                    }
+
+       offset=lseek (fd,OFFSET,SEEK_SET);
+       if ( offset < 0 ){
+             close(fd);
+             logMessage("Error with seek operation : %s ",filename);
+             unlink(filename);
+             return ERROR;
+                        }
+
+      if((bytes_written=write(fd,signature,sizeof(__u32))) != 4){
+          close(fd);
+	  logMessage("Error writing to file: %s \n",filename);
+          unlink(filename);
+          return ERROR;
+                                                                }
+       unlink(filename);	
+       return SUCCESS;
+
+}
+
+
+
+
+status writeUniqueSignatures(struct device ** list_head) {
+
+__u32 disk_sig, tmp_sig;
+struct device **current_device_list;
+char  current_device_name[9];
+memset(current_device_name,0,9);
+status local_status;
+

+          for
(current_device_list=list_head,disk_sig=START_SIG;(*current_device_list)
!=NULL;current_device_list++,disk_sig++) {
+               DPRINT("Inside write loop");
+
CREATE_DEVICE_NAME(current_device_name,(*current_device_list)->device);
+               DPRINT("Wriitng on device: %s ",current_device_name);
+
+
local_status=writeDiskSig((*current_device_list)->device,current_device_
name,&disk_sig);
+	       if (local_status != SUCCESS)
+	        	return local_status;
+               DPRINT("Written sig successfully");
+
readDiskSig((*current_device_list)->device,current_device_name,&tmp_sig)
;
+               DPRINT("The sig is : %x",tmp_sig);
+               
+               
+                                                }
+
+               return SUCCESS;
+}
+
+
+
+status tagBiosLabel(struct device ** list_head,__u32 mbr_signature) {
+
+ __u32 current_device_signature;
+ char  current_device_name[9];
+ struct device  **current_device_list=NULL;
+ status local_status;
+

+     memset(current_device_name,0,9);
+
+     DPRINT("Inside tag bios label \n");
+
+          for
(current_device_list=list_head;(*current_device_list)!=NULL;current_devi
ce_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");
+                        sleep(10);
+                        return ERROR;
+                                           }
+    
+
+              DPRINT( "The current disk signature is : %x \n",
current_device_signature);
+   
+              if(mbr_signature==current_device_signature){
+      
+                       logMessage( "Found MBR signature in device :
%s\n",current_device_name);
+
setenv("DISK80",(*current_device_list)->device,1);
+                       DPRINT("The DISK80 env var is : %s
\n",getenv("DISK80"));
+                       return SUCCESS;
+                                                         }
+

+             }
+
+      return FAILURE;
+
+}
+
+/* This function converts the "harddrive" command in ks.cfg that EDD
supports
+ into the regular format that the redhat code supports */
+
+char* parseHDCommand(char* drv, char* prt) {
+
+char * part;
+
+           if (drv) {
+

+                DPRINT("Parsing EDD options of kickstart harddrive
command");
+                logMessage ( "The EDD options are drive: %s, and
partition: %s \n",drv,prt);
+

+                if ( ! prt) {
+                     logMessage( " EDD requires both drive and
partition options \n");
+                     sleep(20);
+                     exit(1);
+                                  }
+      
+
part=(char*)malloc((strlen(drv)+strlen(prt)+1)*sizeof(char));
+                memset(part,0,strlen(drv)+strlen(prt)+1);
+
strncat(strncpy(part,getenv(strupper(drv)),strlen(drv)),prt,strlen(prt))
;
+                DPRINT("The EDD partition is %s \n",part);
+                return part;
+

+                     }
+     return prt;
+
+}
+
+/* This routine parses the boot option, ks=..., for EDD option. If it
finds
+EDD options it will parse it and return a string that kickstartFromHD
(in
+hdinstall.c) understands..Otherwise it will perform an Identity
operation on 
+the input string */
+
+
+char* parseEddHDCommand(char* tempstr) {
+
+char *p, *q = NULL, *r=NULL, *tmpksdev=NULL;
+char *eddtmpstr=NULL;
+
+
+      if(strstr(tempstr,"disk8")) {
+                 logMessage("EDD option found as boot option\n");
+                 p=strchr(tempstr,':');
+                 r=strchr(p+1,':');
+                 q=strchr(r+1,':');
+

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

+                 *q='\0';
+                 *r='\0';
+                 
+                  tmpksdev=strdup(getenv(strupper(p+1)));
+                  DPRINT("kickstart device is %s\n",tmpksdev);
+                  *(p+1)='\0';
+
+
+
eddtmpstr=(char*)calloc((strlen(tempstr)+strlen(tmpksdev)+strlen(r+1)+st
rlen(q+1)+2),sizeof(char));
+                  strcpy(eddtmpstr,tempstr);
+                  DPRINT("The new tmp str is :%s \n",eddtmpstr);
+                  strncat(eddtmpstr,tmpksdev,strlen(tmpksdev));
+                  DPRINT("partially built kickstart string is
%s\n",eddtmpstr);
+                  strncat(eddtmpstr,r+1,strlen(r+1));
+                  DPRINT("partially built kickstart string is
%s\n",eddtmpstr);
+                  strncat(eddtmpstr,":",1);
+                  DPRINT("partially built kickstart string is
%s\n",eddtmpstr);
+                  strncat(eddtmpstr,q+1,strlen(q+1));
+                  free(tempstr);
+                  free(tmpksdev);
+                  free(r+1);
+                  free(q+1);
+                  p=q=r=NULL;
+                  DPRINT("Completely built kickstart string is
%s\n",eddtmpstr);
+                  DPRINT("Final EDD tmpstr is %s",eddtmpstr);
+                  return eddtmpstr;
+

+                      }
+
+    return tempstr;
+}
+
+
+void printDiskList(struct device ** list_head) {
+ 
+struct device **current_disk;
+ 
+logMessage("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);
+ 
+}
+
+}
+
+void printFile(char *filename) {
+

+

+ struct stat stat_buff;
+ char *buff;
+ int fd;
+

+  fd=open(filename,O_RDONLY);
+  fstat(fd,&stat_buff);
+

+  if(!stat_buff.st_size){
+   DPRINT("The file size is zero\n");
+   sleep(20);
+                        }
+  else {
+     buff=malloc(stat_buff.st_size + 1);
+     read(fd,buff,stat_buff.st_size);
+     buff[stat_buff.st_size]='\0';
+     DPRINT("The file is : \n %s \n",buff);
+     sleep(20);
+

+       }
+

+
+}
diff -urNp old-anaconda-10/loader2/eddsupport.h
anaconda-10.0/loader2/eddsupport.h
--- old-anaconda-10/loader2/eddsupport.h	1969-12-31
18:00:00.000000000 -0600
+++ anaconda-10.0/loader2/eddsupport.h	2004-06-29 09:53:18.000000000
-0600
@@ -0,0 +1,53 @@
+#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 "log.h"
+#include "../isys/isys.h"
+
+
+#define LOCAL_DEBUG
+
+#define BUFF_SIZE 4
+#define OFFSET 0x1b8
+#define SIG_FILE "/sys/firmware/edd/int13_dev80/mbr_signature"
+#define START_SIG 0x80
+#define CREATE_DEVICE_NAME(fullname,suffix)
strcat(strcpy(fullname,"/tmp/"),\
+suffix)
+
+#ifdef LOCAL_DEBUG
+#define DPRINT(s...) do  { \
+			logMessage(s);\
+			sleep(5);\
+			} while(0)		
+#else
+#define DPRINT(s...)
+#endif
+
+
+
+typedef enum {SUCCESS,FAILURE,ERROR} status;
+struct device ** createDiskList();
+status readDiskSig(char*,char*, __u32*);
+status  writeDiskSig(char*,char*,__u32*);
+status uniqueSignatureExists(struct device ** );
+status writeUniqueSignatures(struct device ** );
+status readMbrSig(__u32 *);
+status tagBiosLabel(struct device **,__u32 );
+void prepareForEdd();
+char *strupper( char *orig);
+char* parseHDCommand(char* drv, char* prt);
+char* parseEddHDCommand(char* tempstr);
+void printDiskList(struct device ** );
+void printFile(char *); 
+#endif
+
+
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-06-29 10:12:31.000000000
-0600
@@ -36,7 +36,7 @@
 #include "modules.h"
 #include "method.h"
 #include "mediacheck.h"
-
+#include "eddsupport.h"
 #include "../isys/imount.h"
 #include "../isys/isys.h"
 
@@ -583,14 +583,19 @@ char * mountHardDrive(struct installMeth
 
 void setKickstartHD(struct loaderData_s * loaderData, int argc,
                      char ** argv, int * flagsPtr) {
-    char *partition, *dir;
+    char *drive=NULL, *partition, *dir;
     poptContext optCon;
     int rc;
+
+   /*Rez code here */
     struct poptOption ksHDOptions[] = {
+        {"drive", '\0', POPT_ARG_STRING, &drive, 0 },
         { "partition", '\0', POPT_ARG_STRING, &partition, 0 },
         { "dir", '\0', POPT_ARG_STRING, &dir, 0 },
         { 0, 0, 0, 0, 0 }
     };
+  
+   /*Rez code ends here */
 
     logMessage("kickstartFromHD");
     optCon = poptGetContext(NULL, argc, (const char **) argv,
ksHDOptions, 0);
@@ -604,6 +609,20 @@ void setKickstartHD(struct loaderData_s 
         return;
     }
 
+/*Rez code starts */
+/* If EDD option is set,parse the "hardrive" command in ks.cfg to find
out the
+actual partition to mount.The function parseHDCommand will take drive
and
+partition option from the "harddrive" command in ks.cfg and return the
partitionas required by the rest of the code.If the "drive" option is
not available it will just become and Identity operation. */
+
+
+    if (getenv("EDD"))
+          partition=parseHDCommand(drive,partition);
+
+    DPRINT("EDD code to find the harddrive and partitions to start hard
drive based installation is done");
+
+/* Rez code ends */
+
+
     loaderData->method = strdup("hd");
     loaderData->methodData = calloc(sizeof(struct hdInstallData *), 1);
     if (partition)
@@ -623,6 +642,18 @@ int kickstartFromHD(char *kssrc, int fla
     /* format is ks=hd:[device]:/path/to/ks.cfg */
     /* split of pieces */
     tmpstr = strdup(kssrc);
+
+ /*Rez code starts here */
+/* If EDD support is set , then parse the boot option
ks=hd:drive:partition:/path/to/ks.cfg if available and return the format
as recognized by the rest of
+the code. If the new option is not available then the function just
performs
+Identity operation on the string tmpstr */
+
+    if (getenv("EDD"))
+         tmpstr=parseEddHDCommand(tmpstr);
+
+/*Rez code ended here */
+
+
     p = strchr(tmpstr, ':');
     if (p)
 	q = strchr(p+1, ':');
@@ -642,6 +673,12 @@ int kickstartFromHD(char *kssrc, int fla
     ksdev = p+1;
     kspath = q+1;
 
+/*Rez code here */
+    DPRINT("The ksdev is : %s ",ksdev);
+    DPRINT("The kspath is : %s ",kspath);
+/*Rez code ended */
+
+
     logMessage("Loading ks from device %s on path %s", ksdev, kspath);
     if ((rc=getKickstartFromBlockDevice(ksdev, kspath))) {
 	if (rc == 3) {
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-06-29 10:08:46.000000000
-0600
@@ -74,6 +74,7 @@
 #include "net.h"
 #include "telnetd.h"
 
+#include "eddsupport.h"
 #include "selinux.h"
 
 #include "../isys/imount.h"
@@ -554,6 +555,17 @@ static int parseCmdLineFlags(int flags, 
             flags &= ~LOADER_FLAGS_SELINUX;
         else if (!strncasecmp(argv[i], "selinux", 7))
             flags |= LOADER_FLAGS_SELINUX;
+
+        /* Code inserted here by Rez */
+
+        else if(!strncasecmp(argv[i],"noedd",5)) {
+           printf("Unsetting EDD env variable \n");
+           unsetenv("EDD");
+           printf("unsetting done");
+           sleep(10);
+                                                }
+
+
         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 */
@@ -1068,6 +1080,8 @@ int main(int argc, char ** argv) {
 
     struct loaderData_s loaderData;
 
+    char *env_val;
+
     char * cmdLine = NULL;
     char * ksFile = NULL;
     int testing = 0;
@@ -1144,6 +1158,17 @@ int main(int argc, char ** argv) {
 
     memset(&loaderData, 0, sizeof(loaderData));
 
+    /* Assume that EDD support is turned on */
+
+    setenv("EDD","1",1);
+    env_val=getenv("EDD");
+    printf("The EDD val is: %s  \n",env_val);
+    sleep(10);
+
+
+
+
+
     extraArgs[0] = NULL;
     flags = parseCmdLineFlags(flags, &loaderData, cmdLine);
 
@@ -1229,6 +1254,23 @@ int main(int argc, char ** argv) {
         getDDFromSource(&loaderData, loaderData.ddsrc, flags);
     }
 
+
+/* Rez code here for edd. If EDD support is on, load the edd module and
find the BIOS disk80 device*/
+
+
+         if (getenv("EDD")) {
+             logMessage("new routine");
+             logMessage("Found edd option");
+             logMessage("Loading edd module");
+             sleep(10);
+             mlLoadModuleSet("edd", modLoaded, modDeps,modInfo, flags);
+             logMessage("Done loading edd");
+             sleep(5);
+             prepareForEdd();
+                                             }
+
+
+
     /* 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-06-28 15:11:32.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
eddsupport.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: Kabir, Rezwanul 
> Sent: Friday, June 25, 2004 2:54 PM
> To: 'Jeremy Katz'; Domsch, Matt
> Cc: anaconda-devel-list@xxxxxxxxxx
> Subject: RE: EDD disksigs for disks other than 0x80
> 
> 
> Sorry to chime in a little late. I wasn't following the issue 
> tracker..
> Anyway, I wanted to comment on Jeremy's comments about the 
> style of the coding.
> 
> In order to facilitate other's understanding, I'm copying and 
> pasting jeremy's comments..
> 
>  >Hrmmm, I'm not sure that I like the approach being taken 
> here.   Before getting into
> > details, a couple of process related things:
> >* Having the whole thing as a unified diff makes things far 
> simpler to review.  The simple >way to do this is to copy 
> files before you modify them to file.foo and then run 
> `gendiff >anaconda .foo`.  For new files, touch newfile.foo 
> and then it'll get included inthe diff as >well.
> >* Instead of copying and pasting functions and commenting 
> old versions out, please just put >your changes inline.  It 
> makes the diff much more difficult to parse otherwise.
> 
>    Your points well taken. I'll stick to them from now on..
> 
> >1) Stylistically, this doesn't fit in properly with 
> anaconda.  We don't pass around state 
> >via environmental variables, instead, the flags structure is 
> used with all of the defines 
> >in loader.h.  Then, parsing of /proc/cmdline can occur in one place
> > (loader.c:parseCmdLineFlags())
> 
>   
> One of the reasons ,I used environment variables is to access 
> them in consistent manner between loader and anaconda. 
> Otherwise I would have to touch more codes to pass them to 
> anaconda in some way, e.g. as command line arguments..
> 
>  >2) Doing replacements of things inside the kickstart config 
> is going to be fragile.  I'd 
> >really prefer to avoid that.  Two possible approaches for 
> doing so would be 
>  >  a) Decide to use something like biosdisk0 -> biosdisk7 to 
> correspond to bios disks 0x80
> >-0x87 and just then use that for corresponding to the disk 
> and then use biosdisk0p1 for the >first partition.  (biosdisk 
> or bd or something that doesn't actually exist, not 
> completely >sold on which syntax)
> >   b) Instead of using the existing directives, add a new 
> one of bd: instead of places 
> >where hd: gets used for defining a hard drive.  Then, 
> --onbiosdisk or similar with 
> >partitioning commands.  This is probably the better 
> approach, but I haven't thought through >it as completely
>  
>    My idea here was to decouple the "EDD" stuff as much as 
> possible from the rest of the code.This would allow 
> development/modification/experimentation with "EDD" code 
> independently from the rest of the bulk. With this in mind, 
> to parse boot options or ks.cfg, I introduced some hooks into 
> the loader/anaconda code (parseEDDHDCommand,EDDfy etc.)that 
> would behave as wrapper/adapter. They allow  "current" 
> options to pass through without any scrutiny and will convert 
> any new "EDD options" into their corresponding "current" 
> format.The back end, which makes sense of this options 
> remains the same...
>   
> 
> >Why have the noedd flag -- edd will only get utilized if 
> people request it, especially if 
> >we're not rewriting the ks.cfg.  Does loading the module 
> cause an oops in some cases? 
> 
>     I used it basically to do two things 1) load the edd.o 
> module 2) activate hooks in loader/anaconda that deals with 
> EDD specific options..
> 
> >5) regexp are likely to increase the size of the loader 
> greatly -- are they really needed?
>    
>         Otherwise, I probably needed to write a tiny state 
> machine. I went for the easier way :-)
> 
> 
> >6) Parsing of /proc/partitions isn't recommended (your 
> current parsing will miss cciss and >other Weird (tm) devices 
> for example).  Instead, getting a list of drives from kudzu is
> > better as that's then completely consistent
> 
>      Point well taken.. I'll see if I can use kudzu instead...
>       
> 
> >7) With the way you're currently doing things, you're not 
> guaranteed to have the device
> > node when you need it -- we don't create the full set of 
> devices in /dev until we get to
> > the second stage and the loader always makes device nodes 
> in /tmp as needed using
> > devMakeInode() from isys
> 
>    Aahah.. if you look into the readDiskSig/writeDiskSig in 
> eddsupport.c you'll see that I'm indeed using the 
> devMakeInode interface..
>     I did some preliminary testing before sending you the 
> code..So the code works at least with some simple configs...
> 
>   Thanks..
>      --rez
> 
> 
> 
> 
> > -----Original Message-----
> > From: anaconda-devel-list-bounces@xxxxxxxxxx
> > [mailto:anaconda-devel-list-bounces@xxxxxxxxxx]On Behalf Of 
> > Jeremy Katz
> > Sent: Friday, June 25, 2004 9:54 AM
> > To: Domsch, Matt
> > Cc: anaconda-devel-list@xxxxxxxxxx
> > Subject: Re: EDD disksigs for disks other than 0x80
> > 
> > 
> > On Thu, 2004-06-24 at 15:40 -0500, Matt Domsch wrote:
> > > Patch below against 2.6.7-bk(current) gives mbr_signature 
> for first
> > > six BIOS disks.
> > 
> > Seems to work, at least for two (all that I have handy on a 
> > test machine
> > right now).  Unfortunately, the mbr_signature on both of those disks
> > (and the sig on the first from before rebooting into the 
> newer kernel)
> > is 0x00000000.  So I guess these don't have any guarantee of 
> > uniqueness?
> > 
> > Jeremy	
> > 
> > 
> > _______________________________________________
> > Anaconda-devel-list mailing list
> > Anaconda-devel-list@xxxxxxxxxx
> > https://www.redhat.com/mailman/listinfo/anaconda-devel-list
> > 
> 



[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux