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

RE: EDD disksigs for disks other than 0x80



On Tue, 2004-06-29 at 11:42 -0500, Rezwanul_Kabir Dell com wrote: 
>     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.

Cool, these are definitely steps in the right direction.

>  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.

After thinking about it a little longer, I think that it's definitely
going to be better to add a separate switch for each of these.  ie,
harddrive --biospart=80p2 --dir=/
part / --size=1646 --onbiosdisk=82

This then keeps us from conflicting with anything that gets added to the
kernel at a later date and then makes it obvious that you parse the
biosdisk or biospart bit first and transform it to be a regular drive
name and only ever have to keep track of real drive names.  And we can
lose the whole eddify bit that I dislike :)

> 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 @@
> +/* 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 */

Unfortunately, this is a bit of a non-starter for real inclusion.
Random reboots aren't at all guaranteed to get back into the
installation environment.  There's actually a pretty good chance that
they won't.  So, I think that instead, the proper course is if a bios
disk is specified that we can't determine, we just have to pop up a nice
error dialog.  

anaconda can't get into the business of being responsible for your
machine being set up properly to begin with (although it's conceivable
to add some stuff to make it easier to add unique sigs if you're in the
case where you don't have them; that shouldn't be the default behavior
though)

As far as the rest of the file is concerned, the bits for reading off a
disk, etc all seem fine.  The interface, though, still concerns me.  I
really do think that the better interface is to have something like a
probeBiosDisks() function that basically deciphers the mapping and puts
it in a static struct.  Then, we can just call getBiosDisk("80") which
would return sda or whatever.  eg, if I were to do it in pseudo-python
(which it obviously will have to be in C, but this should make how I'm
thinking clearer)

biosDisks = {}

def readDiskSig(disk):
  devnode = mknod(disk)
  f = open(devnode)
  f.lseek(offset)
  sig = f.read(numbytes)
  close(f)
  unlink(devnode)
  return sig

def probeBiosDisks():
  biossig = {}
  ignoredsig = []
  for disk in /sys/firmware/edd/int13_dev*:
    sig = read(disk/mbr_signature)
    if sig in ignoredsig:
      continue
    if sig in biossig.keys():
      log("warning: more than one disk with sig %s, ignoring")
      ignoredsig.append(sig)
      del biossig[sig]
      continue
    biossig[sig] = disk[-2:]

  for disk in disklist:
    sig = readDiskSig(disk)
    if sig in biossig.keys():
       bd = biosdisk[sig]
       biosDisks[bd] = disk

def getBiosDisk(disk):
  if disk in biosDisks.keys():
    return biosDisks[disk]

...

Then, it's easy enough to just put in the correct calls to getBiosDisk()
as necessary in the various places that handle other partitioning bits
now.

> 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"

In general, we try to include headers in the appropriate .c files.
Otherwise, you get into some neat circular includes.

Jeremy



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