Skip to contentSkip to conversation

quick test please? device tree path translation

PPC Hollis Blanchard 3 participants 6 messages Oct 23, 2005 – Oct 24, 2005

lore
Share & tools
lore
#0 lore raw

Hi, could PPC people give the attached shell script a try? For example,

$ ./ofpathname /dev/hda
/pci@80000000/pci-bridge@d/pci-ata@1/@0/disk@0

I'd like to make sure that the resulting Open Firmware device tree path is accurate. I think we should use this script for GRUB installation, which means that when the user says "grub-install /dev/hda2" this script will tell us the proper setting of the OF "boot-device" variable.

It seems to be working fine for disk, CD, and Zip drive on my Blue & White G3, which has a slightly unusual ATA setup. I expect it to work just fine on simple systems like laptops, but I'm particularly interested in more unsual systems like Pegasos, or systems with lots of IO and disks.

You can validate by comparing the output with /proc/device-tree/aliases/hd, for example, or just try it out.

-Hollis

#1 lore raw
Quoted 16 lines · Hollis Blanchard

Hi, could PPC people give the attached shell script a try? For example,

$ ./ofpathname /dev/hda
/pci@80000000/pci-bridge@d/pci-ata@1/@0/disk@0

I'd like to make sure that the resulting Open Firmware device tree path is accurate. I think we should use this script for GRUB installation, which means that when the user says "grub-install /dev/hda2" this script will tell us the proper setting of the OF "boot-device" variable.

It seems to be working fine for disk, CD, and Zip drive on my Blue & White G3, which has a slightly unusual ATA setup. I expect it to work just fine on simple systems like laptops, but I'm particularly interested in more unsual systems like Pegasos, or systems with lots of IO and disks.

Quoted 4 lines

You can validate by comparing the output with /proc/device-tree/aliases/hd, for example, or just try it out.

-Hollis

Seems to work for me. It gives the same answers as ofpath (packaged with yaboot 1.0.8), except for a usb floppy drive, which your script can handle but ofpath cannot. The machine is a 466Mhz G4 Powermac (Digital Audio) with an IDE harddrive and cdrom drive, and a usb floppy drive...

$ ./ofpathname /dev/hda
/pci@f2000000/mac-io@17/ata-4@1f000/disk@0
$ ./ofpathname /dev/hdc
/pci@f2000000/mac-io@17/ata-3@20000/disk@0
$ ./ofpathname /dev/sda
/pci@f2000000/usb@19/scsi@0/sd@0,0

(for comparison)

# ofpath /dev/hda
/pci@f2000000/mac-io@17/ata-4@1f000/disk@0:
# ofpath /dev/hdc
/pci@f2000000/mac-io@17/ata-3@20000/disk@0:
# ofpath /dev/sdc
ofpath: /proc/device-tree is broken.  Do not use BootX to boot, use yaboot.
ofpath: The yaboot HOWTO can be found here: http://www.alaska.net/~erbenson/doc

So your script seems better.

Signature · 2 lines
Mike Small
[email protected]
#2 lore raw
Quoted 24 lines · Mike Small

Seems to work for me. It gives the same answers as ofpath (packaged with yaboot 1.0.8), except for a usb floppy drive, which your script can handle but ofpath cannot. The machine is a 466Mhz G4 Powermac (Digital Audio) with an IDE harddrive and cdrom drive, and a usb floppy drive...

$ ./ofpathname /dev/hda
/pci@f2000000/mac-io@17/ata-4@1f000/disk@0
$ ./ofpathname /dev/hdc
/pci@f2000000/mac-io@17/ata-3@20000/disk@0
$ ./ofpathname /dev/sda
/pci@f2000000/usb@19/scsi@0/sd@0,0

(for comparison)

# ofpath /dev/hda
/pci@f2000000/mac-io@17/ata-4@1f000/disk@0:
# ofpath /dev/hdc
/pci@f2000000/mac-io@17/ata-3@20000/disk@0:
# ofpath /dev/sdc
ofpath: /proc/device-tree is broken.  Do not use BootX to boot, use yaboot.
ofpath: The yaboot HOWTO can be found here: http://www.alaska.net/~erbenson/doc
Quoted 1 line

So your script seems better.

Excellent!

To clarify, though, it's not my script: it's from the ppc64-utils package (which I'm thinking needs to be renamed)... I just added a small patch I needed for my G3 before sending it to the list.

-Hollis

#3 lore raw
Quoted 10 lines · Hollis Blanchard
Quoted 2 lines · Mike Small

So your script seems better.

Excellent!

To clarify, though, it's not my script: it's from the ppc64-utils package (which I'm thinking needs to be renamed)... I just added a small patch I needed for my G3 before sending it to the list.

yeah .. I was just looking at :

#!/bin/bash
# Copyright (c) 2004 International Business Machines # Common Public License Version 1.0 (see COPYRIGHT)

#

am trying to figure out what the problem is :

[dclarke@ppc ~]$ ls -lap /dev/hdc brw-rw---- 1 root disk 22, 0 Oct 22 17:39 /dev/hdc [dclarke@ppc ~]$ ./ofpathname /dev/hdc
: bad interpreter: No such file or directory [dclarke@ppc ~]$

[dclarke@ppc ~]$ which bash
/bin/bash

Dennis

#4 lore raw
Quoted 4 lines · Dennis Clarke

[dclarke@ppc ~]$ ./ofpathname /dev/hdc
: bad interpreter: No such file or directory
[dclarke@ppc ~]$ which bash
/bin/bash

That can happen if a script acquires some carriage return line endings on its way through a Windows system.

-Hollis

#5 lore raw
In reply to Mike Small
Quoted 9 lines · Mike Small
Quoted 4 lines · Hollis Blanchard

Hi, could PPC people give the attached shell script a try? For example,

$ ./ofpathname /dev/hda
/pci@80000000/pci-bridge@d/pci-ata@1/@0/disk@0

Seems to work for me.

$ ./ofpathname /dev/hda
/pci@f2000000/mac-io@17/ata-4@1f000/disk@0
$ ./ofpathname /dev/hdc

On a fresh install of Fedora Core 4 on a Pegasos ( Genesi ODW ) :

[dclarke@ppc ~]$ ls -lap /dev/hda
brw-r----- 1 root disk 3, 0 Oct 22 17:39 /dev/hda [dclarke@ppc ~]$ uname -a
Linux ppc.blastwave.org 2.6.12-1.1456_FC4 #1 Thu Sep 22 02:20:14 EDT 2005 ppc ppc ppc GNU/Linux
[dclarke@ppc ~]$ cat /proc/cpuinfo
processor : 0
cpu : 7447/7457, altivec supported
clock : 999MHz
revision : 0.1 (pvr 8002 0101)
bogomips : 665.60
machine : CHRP Pegasos2
[dclarke@ppc ~]$ ./ofpathname /dev/hda
: bad interpreter: No such file or directory
[dclarke@ppc ~]$

sorry .. that is what I get here.

Dennis