• Hello MLAers! We've re-enabled auto-approval for accounts. If you are still waiting on account approval, please check this thread for more information.

updated firmware for new world ppc32 macs that allows booting from usb from the boot picker

I know that it's possible to boot from usb on a 32 bit ppc mac by entering a command into OpenFirmware but would it be possible to code a firmware patch/update that would show usb devices in the boot picker? (by boot picker I mean the menu that pops up when one holds the alt key on startup) Sorry if this is a dumb question.
 
Maybe. It depends on the version of Open Firmware. What versions do you have?

Here's a patch for Open Firmware 5.2.7f1 (Quad G5)
Code:
dev /packages/bootpath-search
: mypatch { ; loc0 loc1 loc2 loc3 loc4 } loc4 6 = if loc0 findandadd-block-usb then ;
' findandadd-block 3ac + ' mypatch c + brpatch

Just because a USB item appears in the boot menu, doesn't mean it will successfully boot. You may need to boot into verbose mode to diagnose problems.

You can dump the firmware using #20
An Open Firmware dictionary dump is useful for creating patches that patch compiled fcode. See #1

I've attached some notes.
 

Attachments

The fw800 G4's that I know about have 4.5.7f1 or 4.6.0f1. If you have something different then I would be interested in getting that.

4.2.8f1, 4.5.7f1, and 4.6.0f1 should all be able to boot USB.

Of the firmwares I have, the ones that support USB mass storage but don't scan for USB are built on or after 09/23/04.
09/23/04 4.8.7f1 iBook G4
03/23/05 4.8.9f4 Mac mini G4
07/12/05 4.9.4f1 Mac mini G4
09/22/05 4.9.5f3 PowerBook G4 DLSD
09/30/05 5.2.7f1 G5 Quad

Look at the notes in USB scan.of and try the debug options aapl,debug-bps and aapl,debug-mb
The following firmwares also have the aapl,debug-mbv option.
09/30/02 4.4.8f2
11/11/02 4.5.4f1
01/15/03 4.5.7f1
02/20/03 4.6.0f1
03/15/03 4.6.4f1
04/06/04 4.8.5f0
09/21/04 5.1.5f2
09/23/04 4.8.7f1
03/23/05 4.8.9f4
07/12/05 4.9.4f1
09/22/05 4.9.5f3
09/30/05 5.2.7f1

For the boot option, we are talking strictly Mac OS X or OS 9 tbxi, correct? Linux is a different matter and would require new scanning code (like what rEFIt or rEFInd or RefindPlus or Clover or OpenCore do)
 
For the boot option, I would like to get linux working if that's possible. About the firmware, I probably just read it wrong
 
I think I found a command that should work for any operating system:

probe-usb boot usb<port ID>/disk:<partition number>,\\:tbxi

I found it here: https://forums.macrumors.com/threads/guide-new-method-booting-from-usb-on-powerpc-macs.2403368/
Does that command work for you to boot Linux?

The boot path search code searches for \\:tbxi already. So there must be a reason why it's not showing the one from the Linux boot partition in the multi-boot GUI.

In Open Firmware, what is the output of this command?
dir usb<port ID>/disk:<partition number>,\

In Open Firmware, what is the output of multi-boot-menu after using setenv commands to set the debug options?

I don't think you need to probe-usb if the disk is connected before you boot. My Quad G5 hangs if I do multi-boot after probe-usb.

In OS X, what is the output of
diskutil list

In OS X, what is the output of
pdisk /dev/diskX where diskx is the disk containing your linux partition?

In OS X, what is the output of
bless -info /Volumes/linuxvolumename

Run the script from https://gist.github.com/joevt/a99e3af71343d8242e0078ab4af39b6c#file-dumpvols-sh-L719 and attach the output.

Here's some pictures from my Quad G5 (with the scan USB patch). The first is with aapl,debug-mb (shows USB location text) and the second is without (shows USB icon).

multi-boot with aapl,debug-mb.png

multi-boot without aapl,debug-mb.png
 

Attachments

Last edited:
4.2.8f1, 4.5.7f1, and 4.6.0f1 should all be able to boot USB.

Of the firmwares I have, the ones that support USB mass storage but don't scan for USB are built on or after 09/23/04.
09/23/04 4.8.7f1 iBook G4
03/23/05 4.8.9f4 Mac mini G4
07/12/05 4.9.4f1 Mac mini G4
09/22/05 4.9.5f3 PowerBook G4 DLSD
09/30/05 5.2.7f1 G5 Quad
Huh....so 4.2.8f1, 4.5.7f1, and 4.6.0f1 do scan for USB at boot and present it in the picker? I swear I just read another thread where people were saying they saw USB in the picker on pre Mac mini, but maybe I'm imagining things.
 
Huh....so 4.2.8f1, 4.5.7f1, and 4.6.0f1 do scan for USB at boot and present it in the picker? I swear I just read another thread where people were saying they saw USB in the picker on pre Mac mini, but maybe I'm imagining things.
  • 08/19/99 1.2f2 : The latest ROM that I have that can't boot USB is from a Yikes G4. The bootpath-search package is similar to later versions but doesn't include code for USB and FireWire.
  • 06/13/00 3.0f3 : The first ROM that I don't have that is known to boot USB is from a iMac DV+.
  • 03/20/01 4.1.7f4 : The earliest ROM I have that can boot USB is from an iBook G3.
    The bootpath-search package hasn't changed much since this version.
  • 09/23/04 4.8.7f1 : The first ROM I have that can boot USB but doesn't include USB in the boot menu because a couple lines of code were removed which my patch restores.
For firmwares for 64-bit Macs (5.x.x), compare the dates to see what range from the above it belongs to.
 
06/13/00 3.0f3 : The first ROM that I don't have that is known to boot USB is from a iMac DV+.
My contributions earlier were based on an iMac DV/400, which I think predates the iMac DV+. The firmware was updated though.
 
I wish I could make heads or tails of Forth yet...but...

Trying this out for a mini, PowerMac10,1. Doesn't crash but doesn't seem to probe USB at all with the G5 patch. How did you discover the patch values, basically detoking the firmware?

I imagine the procedure is to dump the firmware, detok, and from that determine how to inject findandadd-block-usb again?

Along the way, learning how to understand Forth I suppose...
 
I wish I could make heads or tails of Forth yet...but...

Trying this out for a mini, PowerMac10,1. Doesn't crash but doesn't seem to probe USB at all with the G5 patch. How did you discover the patch values, basically detoking the firmware?

I imagine the procedure is to dump the firmware, detok, and from that determine how to inject findandadd-block-usb again?

Along the way, learning how to understand Forth I suppose...
What firmware version does your Mac Mini have? You can dump the ROM using the info at #2

My DumpMacRom.sh script disassembles the Open Firmware assembly part of ROM, and it detokenizes and converts to Forth the fcode parts of ROM.

For making patches, you usually patch the assembled Forth words, rather than the originating fcode. So for this I dump the entire Open Firmware dictionary where the assembled forth words exist in RAM and use DumpMacRom.sh to disassemble that.

There's notes at
https://forums.macrumors.com/thread...l-work-in-a-beige-power-macintosh-g3.2303689/

Open Firmware documentation exists at
https://openfirmware.info/Welcome_to_OpenBIOS
https://openfirmware.info/IEEE_1275-1994 <-- get this one
https://openfirmware.info/Bindings <-- get these if you're working with a particular device type
https://openfirmware.info/On_the_Net
 
What firmware version does your Mac Mini have? You can dump the ROM using the info at #2

My DumpMacRom.sh script disassembles the Open Firmware assembly part of ROM, and it detokenizes and converts to Forth the fcode parts of ROM.

For making patches, you usually patch the assembled Forth words, rather than the originating fcode. So for this I dump the entire Open Firmware dictionary where the assembled forth words exist in RAM and use DumpMacRom.sh to disassemble that.

There's notes at
https://forums.macrumors.com/thread...l-work-in-a-beige-power-macintosh-g3.2303689/

Open Firmware documentation exists at
https://openfirmware.info/Welcome_to_OpenBIOS
https://openfirmware.info/IEEE_1275-1994 <-- get this one
https://openfirmware.info/Bindings <-- get these if you're working with a particular device type
https://openfirmware.info/On_the_Net
4.8.9f4 - 03/23/05

I'll give those a try, thanks for the details!
 
findandadd-block appears to be the same in 4.8.9f4 (Mac mini G4) and 5.2.7f1 (Quad G5).

I suppose we might need to look at the assembly code to make sure they compile the same.

This is how my DumpMacRom.sh script converts fcode to Forth:
Code:
: findandadd-block
    { local_0 ; ... }           \ the first local variable is a parameter popped from the stack ; ... represents an unknown number of other local variables
    local_0
    parentdtn
    -> local_3
    -> local_2
    -> local_1
    0
    -> local_4
    local_1
    0<>
    if
        local_1
        " scsi"
        comp
        0=
        if
            2
            -> local_4
            " scsi-wide"
            local_1
            local_2
            $=
            if
                3
                -> local_4
            then
            " wide"
            local_3
            get-package-property
            0=
            if
                2drop
                3
                -> local_4
            else
                " extended"
                local_3
                get-package-property
                0=
                if
                    decode-int
                    to scsi-range-low
                    decode-int
                    to scsi-range-high
                    2drop
                    8
                    -> local_4
                then
            then
        then
        " spi"
        local_1
        local_2
        $=
        if
            3
            -> local_4
        then
        local_1
        " ide"
        comp
        0=
        local_1
        " ata"
        comp
        0=
        or
        if
            4
            -> local_4
        then
        " swim3"
        local_1
        local_2
        $=
        " fdc"
        local_1
        local_2
        $=
        or
        if
            1
            -> local_4
        then
        " sbp-2"
        local_1
        local_2
        $=
        if
            5
            -> local_4
        then
        " usb"
        local_1
        local_2
        $=
        " hub"
        local_1
        local_2
        $=
        or
        " usb-device"
        local_1
        local_2
        $=
        or
        if
            6
            -> local_4
        then
        " k2-sata"
        local_1
        local_2
        $=
        if
            7
            -> local_4
        then
    then
    local_4
    case
        1
        of
            local_0
            findandadd-block-fdc
        endof
        2
        of
            local_0
            findandadd-block-scsi-8
        endof
        3
        of
            local_0
            findandadd-block-scsi-16
        endof
        4
        of
            " compatible"
            local_3
            get-package-property
            0=
            if
                extract-string
                " cmd646-ata"
                $=
                if
                    local_0
                    findandadd-block-ata-4
                else
                    local_0
                    findandadd-block-ide
                then
            then
        endof
        5
        of
            local_0
            findandadd-block-fw
        endof
        6
        of
        endof
        7
        of
            local_0
            findandadd-block-sata
        endof
        8
        of
            local_0
            findandadd-block-scsi-extended
        endof
    endcase
    ; \ this gets replaced by the patch

This is how Open Firmware's see command converts compiled fcode into mostly Forth:
Code:
0 > see findandadd-block 
: findandadd-block 
  {1} {0@} parentdtn {3!} {2!} {1!} 0 {4!} {1@} 0<> if 
    {1@} " scsi"comp 0= if 
      2 {4!} " scsi-wide"{1@} {2@} $= if 
        3 {4!} 
        then 
      " wide"{3@} get-package-property 0= if 
        2drop 3 {4!} 
        else 
        " extended"{3@} get-package-property 0= if 
          decode-int to scsi-range-low decode-int to scsi-range-high 2drop 8 {4!} 
          then 
        then 
      then 
    " spi"{1@} {2@} $= if 
      3 {4!} 
      then 
    {1@} " ide"comp 0= {1@} " ata"comp 0= or if 
      4 {4!}              
      then 
    " swim3"{1@} {2@} $= " fdc"{1@} {2@} $= or if 
      1 {4!} 
      then 
    " sbp-2"{1@} {2@} $= if 
      5 {4!} 
      then 
    " usb"{1@} {2@} $= " hub"{1@} {2@} $= or " usb-device"{1@} {2@} $= or if 
      6 {4!} 
      then 
    " k2-sata"{1@} {2@} $= if 
      7 {4!} 
      then 
    then 
  {4@} case 
    1 of 
      {0@} findandadd-block-fdc 
      endof 
    2 of                  
      {0@} findandadd-block-scsi-8 
      endof 
    3 of 
      {0@} findandadd-block-scsi-16 
      endof 
    4 of 
      " compatible"{3@} get-package-property 0= if 
        extract-string " cmd646-ata"$= if 
          {0@} findandadd-block-ata-4 
          else 
          {0@} findandadd-block-ide 
          then 
        then 
      endof 
    5 of 
      {0@} findandadd-block-fw 
      endof 
    6 of 
      endof 
    7 of 
      {0@} findandadd-block-sata 
      endof 
    8 of 
      {0@} findandadd-block-scsi-extended 
      endof 
    endcase 
  ; \ this gets replaced by the patch

Open Firmware's xsee command can show how each fcode word is compiled:
Code:
0 > xsee findandadd-block 
ff946cb0: 967efffc 
ff946cb4: 7e6802a6 
ff946cb8: 4bf00599 {1}            \ {1} means that only the first local variable is a parameter from the stack
ff946cbc: 4bf005ed {0@} 
ff946cc0: 4bffe9b9 parentdtn 
ff946cc4: 4bf006ad {3!} 
ff946cc8: 4bf00699 {2!} 
ff946ccc: 4bf00685 {1!} 
ff946cd0: 4bf02491 0 
ff946cd4: 4bf006ad {4!} 
ff946cd8: 4bf005e1 {1@} 
ff946cdc: 4bf02ded 0<> 
ff946ce0: 4bf00349 (b?branch) 
ff946ce4: 48000244 
ff946ce8: 4bf005d1 {1@} 
ff946cec: 4bf002a5 " scsi"
ff946cf8: 4bf037b1 comp 
ff946cfc: 4bf02da5 0= 
ff946d00: 4bf00329 (b?branch) 
ff946d04: 480000c0 
ff946d08: 4beff899 h# 2 
ff946d10: 4bf00671 {4!} 
ff946d14: 4bf0027d " scsi-wide"
ff946d24: 4bf00595 {1@} 
ff946d28: 4bf005a1 {2@} 
ff946d2c: 4bf14f8d $= 
ff946d30: 4bf002f9 (b?branch) 
ff946d34: 48000010 
ff946d38: 4beff869 h# 3 
ff946d40: 4bf00641 {4!} 
ff946d44: 4bf0024d " wide"
ff946d50: 4bf00589 {3@} 
ff946d54: 4bf0f395 get-package-property 
ff946d58: 4bf02d49 0= 
ff946d5c: 4bf002cd (b?branch) 
ff946d60: 48000018 
ff946d64: 4bf01f95 2drop 
ff946d68: 4beff839 h# 3 
ff946d70: 4bf00611 {4!} 
ff946d74: 48000050 
ff946d78: 4bf00219 " extended"
ff946d88: 4bf00551 {3@} 
ff946d8c: 4bf0f35d get-package-property 
ff946d90: 4bf02d11 0= 
ff946d94: 4bf00295 (b?branch) 
ff946d98: 4800002c 
ff946d9c: 4bf30305 decode-int 
ff946da0: 4beff3f9 b<to> 
ff946da4: ff9467d8 
ff946da8: 4bf302f9 decode-int 
ff946dac: 4beff3ed b<to> 
ff946db0: ff946800 
ff946db4: 4bf01f45 2drop 
ff946db8: 4beff7e9 h# 8 
ff946dc0: 4bf005c1 {4!} 
ff946dc4: 4bf001cd " spi"
ff946dcc: 4bf004ed {1@} 
ff946dd0: 4bf004f9 {2@} 
ff946dd4: 4bf14ee5 $= 
ff946dd8: 4bf00251 (b?branch) 
ff946ddc: 48000010 
ff946de0: 4beff7c1 h# 3 
ff946de8: 4bf00599 {4!} 
ff946dec: 4bf004cd {1@} 
ff946df0: 4bf001a1 " ide"
ff946df8: 4bf036b1 comp 
ff946dfc: 4bf02ca5 0= 
ff946e00: 4bf004b9 {1@} 
ff946e04: 4bf0018d " ata"
ff946e0c: 4bf0369d comp 
ff946e10: 4bf02c91 0= 
ff946e14: 4bf03215 or 
ff946e18: 4bf00211 (b?branch) 
ff946e1c: 48000010 
ff946e20: 4beff781 h# 4 
ff946e28: 4bf00559 {4!} 
ff946e2c: 4bf00165 " swim3"
ff946e38: 4bf00481 {1@} 
ff946e3c: 4bf0048d {2@} 
ff946e40: 4bf14e79 $= 
ff946e44: 4bf0014d " fdc"
ff946e4c: 4bf0046d {1@} 
ff946e50: 4bf00479 {2@} 
ff946e54: 4bf14e65 $= 
ff946e58: 4bf031d1 or 
ff946e5c: 4bf001cd (b?branch) 
ff946e60: 48000010 
ff946e64: 4beff73d h# 1 
ff946e6c: 4bf00515 {4!} 
ff946e70: 4bf00121 " sbp-2"
ff946e7c: 4bf0043d {1@} 
ff946e80: 4bf00449 {2@} 
ff946e84: 4bf14e35 $= 
ff946e88: 4bf001a1 (b?branch) 
ff946e8c: 48000010 
ff946e90: 4beff711 h# 5 
ff946e98: 4bf004e9 {4!} 
ff946e9c: 4bf000f5 " usb"
ff946ea4: 4bf00415 {1@} 
ff946ea8: 4bf00421 {2@} 
ff946eac: 4bf14e0d $= 
ff946eb0: 4bf000e1 " hub"
ff946eb8: 4bf00401 {1@} 
ff946ebc: 4bf0040d {2@} 
ff946ec0: 4bf14df9 $= 
ff946ec4: 4bf03165 or 
ff946ec8: 4bf000c9 " usb-device"
ff946ed8: 4bf003e1 {1@} 
ff946edc: 4bf003ed {2@} 
ff946ee0: 4bf14dd9 $= 
ff946ee4: 4bf03145 or 
ff946ee8: 4bf00141 (b?branch) 
ff946eec: 48000010 
ff946ef0: 4beff6b1 h# 6 
ff946ef8: 4bf00489 {4!} 
ff946efc: 4bf00095 " k2-sata"
ff946f08: 4bf003b1 {1@} 
ff946f0c: 4bf003bd {2@} 
ff946f10: 4bf14da9 $= 
ff946f14: 4bf00115 (b?branch) 
ff946f18: 48000010 
ff946f1c: 4beff685 h# 7 
ff946f24: 4bf0045d {4!} 
ff946f28: 4bf003c1 {4@} 
ff946f2c: 4bf000b5 (case) 
ff946f30: 4beff671 h# 1 
ff946f38: 4bf00261 b<of> 
ff946f3c: 48000010 
ff946f40: 4bf00369 {0@} 
ff946f44: 4bfffaf5 findandadd-block-fdc 
ff946f48: 48000114 
ff946f4c: 4beff655 h# 2 
ff946f54: 4bf00245 b<of> 
ff946f58: 48000010 
ff946f5c: 4bf0034d {0@} 
ff946f60: 4bfff779 findandadd-block-scsi-8 
ff946f64: 480000f8 
ff946f68: 4beff639 h# 3 
ff946f70: 4bf00229 b<of> 
ff946f74: 48000010 
ff946f78: 4bf00331 {0@} 
ff946f7c: 4bfff7e5 findandadd-block-scsi-16 
ff946f80: 480000dc 
ff946f84: 4beff61d h# 4 
ff946f8c: 4bf0020d b<of> 
ff946f90: 48000060 
ff946f94: 4beffffd " compatible"
ff946fa4: 4bf00335 {3@} 
ff946fa8: 4bf0f141 get-package-property 
ff946fac: 4bf02af5 0= 
ff946fb0: 4bf00079 (b?branch) 
ff946fb4: 48000038 
ff946fb8: 4bf302b9 extract-string 
ff946fbc: 4befffd5 " cmd646-ata"
ff946fcc: 4bf14ced $= 
ff946fd0: 4bf00059 (b?branch) 
ff946fd4: 48000010 
ff946fd8: 4bf002d1 {0@} 
ff946fdc: 4bfff97d findandadd-block-ata-4 
ff946fe0: 4800000c 
ff946fe4: 4bf002c5 {0@} 
ff946fe8: 4bfff901 findandadd-block-ide 
ff946fec: 48000070 
ff946ff0: 4beff5b1 h# 5 
ff946ff8: 4bf001a1 b<of> 
ff946ffc: 48000010 
ff947000: 4bf002a9 {0@} 
ff947004: 4bfffadd findandadd-block-fw 
ff947008: 48000054 
ff94700c: 4beff595 h# 6 
ff947014: 4bf00185 b<of> 
ff947018: 48000008 
ff94701c: 48000040 
ff947020: 4beff581 h# 7 
ff947028: 4bf00171 b<of> 
ff94702c: 48000010 
ff947030: 4bf00279 {0@} 
ff947034: 4bfff995 findandadd-block-sata 
ff947038: 48000024 
ff94703c: 4beff565 h# 8 
ff947044: 4bf00155 b<of> 
ff947048: 48000010 
ff94704c: 4bf0025d {0@} 
ff947050: 4bfff7e9 findandadd-block-scsi-extended 
ff947054: 48000008 
ff947058: 4befffa9 (endcase) 
ff94705c: 4beff444 \ this gets replaced by the patch

My DumpMacRom.sh can disassemble that same compiled fcode:
Code:
FF946C90: FFFF FF18     FF946BA8
FF946C94: 80
FF946C95: b(:) \ [0x0b7] 0x1ec4 findandadd-block
FF946CB0: 967E FFFC                       stwu     r19,-4(r30)
FF946CB4: 7E68 02A6                       mflr     r19
FF946CB8: 4BF0 0599     FF847250          bl       (pushlocals)+8
FF946CBC: 4BF0 05ED     FF8472A8          bl       (local@)
FF946CC0: 4BFF E9B9     FF945678          bl       parentdtn
FF946CC4: 4BF0 06AD     FF847370          bl       (local!)+48
FF946CC8: 4BF0 0699     FF847360          bl       (local!)+32
FF946CCC: 4BF0 0685     FF847350          bl       (local!)+16
FF946CD0: 4BF0 2491     FF849160          bl       0
FF946CD4: 4BF0 06AD     FF847380          bl       (local!)+64
FF946CD8: 4BF0 05E1     FF8472B8          bl       (local@)+16
FF946CDC: 4BF0 2DED     FF849AC8          bl       0<>
FF946CE0: 4BF0 0349     FF847028          bl       (b?branch)
FF946CE4: 4800 0244     FF946F28          b        $+580
FF946CE8: 4BF0 05D1     FF8472B8          bl       (local@)+16
FF946CEC: 4BF0 02A5     FF846F90          bl       b<">
FF946CF0: 04 ...                          dc.b     " scsi"
FF946CF8: 4BF0 37B1     FF84A4A8          bl       comp
FF946CFC: 4BF0 2DA5     FF849AA0          bl       0=
FF946D00: 4BF0 0329     FF847028          bl       (b?branch)
FF946D04: 4800 00C0     FF946DC4          b        $+192
FF946D08: 4BEF F899     FF8465A0          bl       b<lit>
FF946D0C: 0000 0002                       dc.l     2
FF946D10: 4BF0 0671     FF847380          bl       (local!)+64
FF946D14: 4BF0 027D     FF846F90          bl       b<">
FF946D18: 09 ...                          dc.b     " scsi-wide"
FF946D24: 4BF0 0595     FF8472B8          bl       (local@)+16
FF946D28: 4BF0 05A1     FF8472C8          bl       (local@)+32
FF946D2C: 4BF1 4F8D     FF85BCB8          bl       $=
FF946D30: 4BF0 02F9     FF847028          bl       (b?branch)
FF946D34: 4800 0010     FF946D44          b        $+16
FF946D38: 4BEF F869     FF8465A0          bl       b<lit>
FF946D3C: 0000 0003                       dc.l     3
FF946D40: 4BF0 0641     FF847380          bl       (local!)+64
FF946D44: 4BF0 024D     FF846F90          bl       b<">
FF946D48: 04 ...                          dc.b     " wide"
FF946D50: 4BF0 0589     FF8472D8          bl       (local@)+48
FF946D54: 4BF0 F395     FF8560E8          bl       get-package-property
FF946D58: 4BF0 2D49     FF849AA0          bl       0=
FF946D5C: 4BF0 02CD     FF847028          bl       (b?branch)
FF946D60: 4800 0018     FF946D78          b        $+24
FF946D64: 4BF0 1F95     FF848CF8          bl       2drop
FF946D68: 4BEF F839     FF8465A0          bl       b<lit>
FF946D6C: 0000 0003                       dc.l     3
FF946D70: 4BF0 0611     FF847380          bl       (local!)+64
FF946D74: 4800 0050     FF946DC4          b        $+80
FF946D78: 4BF0 0219     FF846F90          bl       b<">
FF946D7C: 08 ...                          dc.b     " extended"
FF946D88: 4BF0 0551     FF8472D8          bl       (local@)+48
FF946D8C: 4BF0 F35D     FF8560E8          bl       get-package-property
FF946D90: 4BF0 2D11     FF849AA0          bl       0=
FF946D94: 4BF0 0295     FF847028          bl       (b?branch)
FF946D98: 4800 002C     FF946DC4          b        $+44
FF946D9C: 4BF3 0305     FF8770A0          bl       decode-int
FF946DA0: 4BEF F3F9     FF846198          bl       b<to>
FF946DA4: FF94 67D8     FF9467D8          dc.l     scsi-range-low
FF946DA8: 4BF3 02F9     FF8770A0          bl       decode-int
FF946DAC: 4BEF F3ED     FF846198          bl       b<to>
FF946DB0: FF94 6800     FF946800          dc.l     scsi-range-high
FF946DB4: 4BF0 1F45     FF848CF8          bl       2drop
FF946DB8: 4BEF F7E9     FF8465A0          bl       b<lit>
FF946DBC: 0000 0008                       dc.l     8
FF946DC0: 4BF0 05C1     FF847380          bl       (local!)+64
FF946DC4: 4BF0 01CD     FF846F90          bl       b<">
FF946DC8: 03 ...                          dc.b     " spi"
FF946DCC: 4BF0 04ED     FF8472B8          bl       (local@)+16
FF946DD0: 4BF0 04F9     FF8472C8          bl       (local@)+32
FF946DD4: 4BF1 4EE5     FF85BCB8          bl       $=
FF946DD8: 4BF0 0251     FF847028          bl       (b?branch)
FF946DDC: 4800 0010     FF946DEC          b        $+16
FF946DE0: 4BEF F7C1     FF8465A0          bl       b<lit>
FF946DE4: 0000 0003                       dc.l     3
FF946DE8: 4BF0 0599     FF847380          bl       (local!)+64
FF946DEC: 4BF0 04CD     FF8472B8          bl       (local@)+16
FF946DF0: 4BF0 01A1     FF846F90          bl       b<">
FF946DF4: 03 ...                          dc.b     " ide"
FF946DF8: 4BF0 36B1     FF84A4A8          bl       comp
FF946DFC: 4BF0 2CA5     FF849AA0          bl       0=
FF946E00: 4BF0 04B9     FF8472B8          bl       (local@)+16
FF946E04: 4BF0 018D     FF846F90          bl       b<">
FF946E08: 03 ...                          dc.b     " ata"
FF946E0C: 4BF0 369D     FF84A4A8          bl       comp
FF946E10: 4BF0 2C91     FF849AA0          bl       0=
FF946E14: 4BF0 3215     FF84A028          bl       or
FF946E18: 4BF0 0211     FF847028          bl       (b?branch)
FF946E1C: 4800 0010     FF946E2C          b        $+16
FF946E20: 4BEF F781     FF8465A0          bl       b<lit>
FF946E24: 0000 0004                       dc.l     4
FF946E28: 4BF0 0559     FF847380          bl       (local!)+64
FF946E2C: 4BF0 0165     FF846F90          bl       b<">
FF946E30: 05 ...                          dc.b     " swim3"
FF946E38: 4BF0 0481     FF8472B8          bl       (local@)+16
FF946E3C: 4BF0 048D     FF8472C8          bl       (local@)+32
FF946E40: 4BF1 4E79     FF85BCB8          bl       $=
FF946E44: 4BF0 014D     FF846F90          bl       b<">
FF946E48: 03 ...                          dc.b     " fdc"
FF946E4C: 4BF0 046D     FF8472B8          bl       (local@)+16
FF946E50: 4BF0 0479     FF8472C8          bl       (local@)+32
FF946E54: 4BF1 4E65     FF85BCB8          bl       $=
FF946E58: 4BF0 31D1     FF84A028          bl       or
FF946E5C: 4BF0 01CD     FF847028          bl       (b?branch)
FF946E60: 4800 0010     FF946E70          b        $+16
FF946E64: 4BEF F73D     FF8465A0          bl       b<lit>
FF946E68: 0000 0001                       dc.l     1
FF946E6C: 4BF0 0515     FF847380          bl       (local!)+64
FF946E70: 4BF0 0121     FF846F90          bl       b<">
FF946E74: 05 ...                          dc.b     " sbp-2"
FF946E7C: 4BF0 043D     FF8472B8          bl       (local@)+16
FF946E80: 4BF0 0449     FF8472C8          bl       (local@)+32
FF946E84: 4BF1 4E35     FF85BCB8          bl       $=
FF946E88: 4BF0 01A1     FF847028          bl       (b?branch)
FF946E8C: 4800 0010     FF946E9C          b        $+16
FF946E90: 4BEF F711     FF8465A0          bl       b<lit>
FF946E94: 0000 0005                       dc.l     5
FF946E98: 4BF0 04E9     FF847380          bl       (local!)+64
FF946E9C: 4BF0 00F5     FF846F90          bl       b<">
FF946EA0: 03 ...                          dc.b     " usb"
FF946EA4: 4BF0 0415     FF8472B8          bl       (local@)+16
FF946EA8: 4BF0 0421     FF8472C8          bl       (local@)+32
FF946EAC: 4BF1 4E0D     FF85BCB8          bl       $=
FF946EB0: 4BF0 00E1     FF846F90          bl       b<">
FF946EB4: 03 ...                          dc.b     " hub"
FF946EB8: 4BF0 0401     FF8472B8          bl       (local@)+16
FF946EBC: 4BF0 040D     FF8472C8          bl       (local@)+32
FF946EC0: 4BF1 4DF9     FF85BCB8          bl       $=
FF946EC4: 4BF0 3165     FF84A028          bl       or
FF946EC8: 4BF0 00C9     FF846F90          bl       b<">
FF946ECC: 0A ...                          dc.b     " usb-device"
FF946ED8: 4BF0 03E1     FF8472B8          bl       (local@)+16
FF946EDC: 4BF0 03ED     FF8472C8          bl       (local@)+32
FF946EE0: 4BF1 4DD9     FF85BCB8          bl       $=
FF946EE4: 4BF0 3145     FF84A028          bl       or
FF946EE8: 4BF0 0141     FF847028          bl       (b?branch)
FF946EEC: 4800 0010     FF946EFC          b        $+16
FF946EF0: 4BEF F6B1     FF8465A0          bl       b<lit>
FF946EF4: 0000 0006                       dc.l     6
FF946EF8: 4BF0 0489     FF847380          bl       (local!)+64
FF946EFC: 4BF0 0095     FF846F90          bl       b<">
FF946F00: 07 ...                          dc.b     " k2-sata"
FF946F08: 4BF0 03B1     FF8472B8          bl       (local@)+16
FF946F0C: 4BF0 03BD     FF8472C8          bl       (local@)+32
FF946F10: 4BF1 4DA9     FF85BCB8          bl       $=
FF946F14: 4BF0 0115     FF847028          bl       (b?branch)
FF946F18: 4800 0010     FF946F28          b        $+16
FF946F1C: 4BEF F685     FF8465A0          bl       b<lit>
FF946F20: 0000 0007                       dc.l     7
FF946F24: 4BF0 045D     FF847380          bl       (local!)+64
FF946F28: 4BF0 03C1     FF8472E8          bl       (local@)+64
FF946F2C: 4BF0 00B5     FF846FE0          bl       (case)
FF946F30: 4BEF F671     FF8465A0          bl       b<lit>
FF946F34: 0000 0001                       dc.l     1
FF946F38: 4BF0 0261     FF847198          bl       b<of>
FF946F3C: 4800 0010     FF946F4C          b        $+16
FF946F40: 4BF0 0369     FF8472A8          bl       (local@)
FF946F44: 4BFF FAF5     FF946A38          bl       findandadd-block-fdc
FF946F48: 4800 0114     FF94705C          b        $+276
FF946F4C: 4BEF F655     FF8465A0          bl       b<lit>
FF946F50: 0000 0002                       dc.l     2
FF946F54: 4BF0 0245     FF847198          bl       b<of>
FF946F58: 4800 0010     FF946F68          b        $+16
FF946F5C: 4BF0 034D     FF8472A8          bl       (local@)
FF946F60: 4BFF F779     FF9466D8          bl       findandadd-block-scsi-8
FF946F64: 4800 00F8     FF94705C          b        $+248
FF946F68: 4BEF F639     FF8465A0          bl       b<lit>
FF946F6C: 0000 0003                       dc.l     3
FF946F70: 4BF0 0229     FF847198          bl       b<of>
FF946F74: 4800 0010     FF946F84          b        $+16
FF946F78: 4BF0 0331     FF8472A8          bl       (local@)
FF946F7C: 4BFF F7E5     FF946760          bl       findandadd-block-scsi-16
FF946F80: 4800 00DC     FF94705C          b        $+220
FF946F84: 4BEF F61D     FF8465A0          bl       b<lit>
FF946F88: 0000 0004                       dc.l     4
FF946F8C: 4BF0 020D     FF847198          bl       b<of>
FF946F90: 4800 0060     FF946FF0          b        $+96
FF946F94: 4BEF FFFD     FF846F90          bl       b<">
FF946F98: 0A ...                          dc.b     " compatible"
FF946FA4: 4BF0 0335     FF8472D8          bl       (local@)+48
FF946FA8: 4BF0 F141     FF8560E8          bl       get-package-property
FF946FAC: 4BF0 2AF5     FF849AA0          bl       0=
FF946FB0: 4BF0 0079     FF847028          bl       (b?branch)
FF946FB4: 4800 0038     FF946FEC          b        $+56
FF946FB8: 4BF3 02B9     FF877270          bl       extract-string
FF946FBC: 4BEF FFD5     FF846F90          bl       b<">
FF946FC0: 0A ...                          dc.b     " cmd646-ata"
FF946FCC: 4BF1 4CED     FF85BCB8          bl       $=
FF946FD0: 4BF0 0059     FF847028          bl       (b?branch)
FF946FD4: 4800 0010     FF946FE4          b        $+16
FF946FD8: 4BF0 02D1     FF8472A8          bl       (local@)
FF946FDC: 4BFF F97D     FF946958          bl       findandadd-block-ata-4
FF946FE0: 4800 000C     FF946FEC          b        $+12
FF946FE4: 4BF0 02C5     FF8472A8          bl       (local@)
FF946FE8: 4BFF F901     FF9468E8          bl       findandadd-block-ide
FF946FEC: 4800 0070     FF94705C          b        $+112
FF946FF0: 4BEF F5B1     FF8465A0          bl       b<lit>
FF946FF4: 0000 0005                       dc.l     5
FF946FF8: 4BF0 01A1     FF847198          bl       b<of>
FF946FFC: 4800 0010     FF94700C          b        $+16
FF947000: 4BF0 02A9     FF8472A8          bl       (local@)
FF947004: 4BFF FADD     FF946AE0          bl       findandadd-block-fw
FF947008: 4800 0054     FF94705C          b        $+84
FF94700C: 4BEF F595     FF8465A0          bl       b<lit>
FF947010: 0000 0006                       dc.l     6
FF947014: 4BF0 0185     FF847198          bl       b<of>
FF947018: 4800 0008     FF947020          b        $+8
FF94701C: 4800 0040     FF94705C          b        $+64
FF947020: 4BEF F581     FF8465A0          bl       b<lit>
FF947024: 0000 0007                       dc.l     7
FF947028: 4BF0 0171     FF847198          bl       b<of>
FF94702C: 4800 0010     FF94703C          b        $+16
FF947030: 4BF0 0279     FF8472A8          bl       (local@)
FF947034: 4BFF F995     FF9469C8          bl       findandadd-block-sata
FF947038: 4800 0024     FF94705C          b        $+36
FF94703C: 4BEF F565     FF8465A0          bl       b<lit>
FF947040: 0000 0008                       dc.l     8
FF947044: 4BF0 0155     FF847198          bl       b<of>
FF947048: 4800 0010     FF947058          b        $+16
FF94704C: 4BF0 025D     FF8472A8          bl       (local@)
FF947050: 4BFF F7E9     FF946838          bl       findandadd-block-scsi-extended
FF947054: 4800 0008     FF94705C          b        $+8
FF947058: 4BEF FFA9     FF847000          bl       (endcase)
FF94705C: 4BEF F444     FF8464A0          b        exit \ this gets replaced by the patch

The patch changes the b exit (which is compiled from the ; fcode) at findandadd-block + 0x3ac into a branch that jumps to mypatch + 0xc which is just after mypatch sets up the locals because we want to use the locals that were setup by findandadd-block.

Code:
0 > : mypatch { ; loc0 loc1 loc2 loc3 loc4 } loc4 6 = if loc0 findandadd-block-usb then ;  ok
0 > xsee mypatch 
ffa3b9e8: 967efffc 
ffa3b9ec: 7e6802a6 
ffa3b9f0: 4be0b859 {0}                   \ {0} means don't pop any parameters from the stack - doesn't matter because the patch skips this
ffa3b9f4: 4be0b8f5 {4@}                  \ branch from findandadd-block goes to here; we want to examine the fifth local variable
ffa3b9f8: 4be11cb9 6
ffa3b9fc: 4be0e1f5 = 
ffa3ba00: 4be0b629 (b?branch) 
ffa3ba04: 4800000c 
ffa3ba08: 4be0b8a1 {0@} 
ffa3ba0c: 4bf0b1bd findandadd-block-usb 
ffa3ba10: 4be0aa90                       \ this exit takes the place of the exit that we patched in findandadd-block
 
findandadd-block appears to be the same in 4.8.9f4 (Mac mini G4) and 5.2.7f1 (Quad G5).

I suppose we might need to look at the assembly code to make sure they compile the same.
Joe, do we have a list of what Macs can find USB disk and boot from them without patching and which ones can't?

I remember I had a 400MHz DV iMac with a dead HD, and I put in a USB stick with an APM and OS 9 installed and I was able to just let the Mac boot and find that from the "?" icon. I took awhile but it eventually found the only bootable disk, the USB stick.

I can't seem to get my 1.6GHz original G5 to boot from a USB stick at all, even when I provide the absolute path to the boot file in OF.

Could just be the brand of USB stick I'm using.

I'll have to dig all my PPC stuff out and set it all up again. So many projects and so little motivation from me lately.
 
Back
Top