On Wed, May 23, 2001 at 11:18:58PM -0800, Ethan Benson wrote: > On Wed, May 23, 2001 at 06:12:46PM -0700, Tom Rini wrote: > > > > Well, the problem is that my fstab has /dev/hda10, but df shows the > > devfs name. I've (almost) got something done which will turn > > /dev/ide/host0/bus0/target0/lun0/partX into /dev/hdaX and so on (at least > > as much as we have OF aliases for). > > i am not opposed to ofpath supporting devfs, there are some criteria > that MUST be met for me to accept a patch:
Okay, I think I managed to meet all of these. Doesn't need anything not already in use, should be nice and POSIX compliant, and makes devfs look like 'standard', not the other way around. I'm not quite happy about how the translation for SCSI went, but that wasn't something I could fix (since unlike IDE, /dev/sdb could be anywhere.) -- Tom Rini (TR1265) http://gate.crashing.org/~trini/
--- yabootconfig.orig Thu May 24 11:33:58 2001 +++ yabootconfig Thu May 24 12:21:37 2001 @@ -104,13 +104,13 @@ esac } -## devfs is not supported, by this or ofpath. -ckcrapfs() +## If we're running devfs, we need to convert the pathname, probably. +ckdevfs() { - case "$1" in + case "$KERNDEV" in /dev/ide/*|/dev/scsi/*|/dev/discs/*) - echo 1>&2 "$PRG: devfs is not supported. Recompile your kernel with CONFIG_FS_DEVFS=n" - return 1 + fixdevfs "$KERDEV" || exit 1 + return 0 ;; *) return 0 @@ -181,6 +181,90 @@ return 0 } +fixdevfs() +{ + # Find the bus type + TYPE=${KERNDEV#/dev/} + TYPE=${TYPE%/host*} + # Partition number + PARTNUM=${KERNDEV#/dev/*/part} + case "$TYPE" in + ide) + DRIVE=${KERNDEV#/dev/ide/} + DRIVE=${DRIVE%/bus*} + BUS=${KERNDEV#/dev/ide/host*/} + BUS=${BUS%/target*} + case "$DRIVE" in + host0) + case "$BUS" in + bus0) + DEV=hda + ;; + bus1) + DEV=hdb + ;; + esac + ;; + host1) + case "$BUS" in + bus0) + DEV=hdc + ;; + bus1) + DEV=hdd + ;; + esac + ;; + *) + echo "Can't determine what this drive would be in OF" + return 1 + esac + DEV=${DEV}$PARTNUM + ;; + scsi) + BASEDEV=${KERNDEV#/dev/} + SDA=`ls -l /dev/sda$PARTNUM` + SDA=${SDA#l*> } + SDB=`ls -l /dev/sdb$PARTNUM` + SDB=${SDB#l*> } + SDC=`ls -l /dev/sdc$PARTNUM` + SDC=${SDC#l*> } + SDD=`ls -l /dev/sdd$PARTNUM` + SDD=${SDD#l*> } + SDE=`ls -l /dev/sde$PARTNUM` + SDE=${SDE#l*> } + SDF=`ls -l /dev/sdf$PARTNUM` + SDF=${SDF#l*> } + SDG=`ls -l /dev/sdg$PARTNUM` + SDG=${SDG#l*> } + SDH=`ls -l /dev/sdh$PARTNUM` + SDH=${SDH#l*> } + if [ "$BASEDEV" == "$SDA" ]; then + DEV=sda${PARTNUM} + elif [ "$BASEDEV" == "$SDB" ]; then + DEV=sdb${PARTNUM} + elif [ "$BASEDEV" == "$SDC" ]; then + DEV=sdc${PARTNUM} + elif [ "$BASEDEV" == "$SDC" ]; then + DEV=sdd${PARTNUM} + elif [ "$BASEDEV" == "$SDE" ]; then + DEV=sde${PARTNUM} + elif [ "$BASEDEV" == "$SDF" ]; then + DEV=sdf${PARTNUM} + elif [ "$BASEDEV" == "$SDG" ]; then + DEV=sdg${PARTNUM} + elif [ "$BASEDEV" == "$SDH" ]; then + DEV=sdh${PARTNUM} + fi + ;; + *) + echo "Unknown bus $TYPE" + return 1 + ;; + esac + KERNDEV=/dev/$DEV +} + cleanup() { if [ -n "$TMPCONF" ] ; then rm -f "$TMPCONF" ; fi @@ -305,9 +389,6 @@ fi fi -## tell devfs to foad -ckcrapfs "$ROOT" || exit 1 - ## make sure root device exists if [ ! -e "$ROOT" ] ; then echo 1>&2 "$PRG: $ROOT: No such file or directory" @@ -338,9 +419,6 @@ exit 1 fi -## tell devfs to foad -ckcrapfs "$BOOT" || exit 1 - ## sanity check for i in "$DISK" "$ROOT" "$BOOT" ; do if [ ! -b "$i" ] ; then @@ -388,8 +466,8 @@ ## of the whole disk. KERNDEV="$(v=`df "$KERNEL" 2> /dev/null | grep ^/dev/` ; echo ${v%%[ ]*})" KERNDIR="$(v=`df "$KERNEL" 2> /dev/null | grep ^/dev/` ; echo ${v##*[ ]})" -ckcrapfs "$KERNDEV" || exit 1 PARTITION="${KERNDEV##*[a-z]}" +ckdevfs "$KERNDEV" KERNELDISK="${KERNDEV%%[0-9]*}" ## sanity check