If I understand correctly, the patch is meant to add the 6th case back?
Correct. We add it to the end of
findandadd-block since there's no place to add it earlier (patching
case and
of and
endof or any other flow control words is weird - avoid it). Actually,
; is kind of a flow control word. Perhaps it would have been better to just replace
with
Code:
local_0
findandadd-block-usb
We don't need to do it in the case statement unless there's a possibility of a USB device to also be a
"k2-sata" which is the only other item after
usb and
hub and
usb-device that can change
local_4.
We need to set
local_4 if there is a possibility that a
usb or
hub or [icode"usb-device[/icode] device can also be one of the earlier devices (
scsi,
scsi-wide,
wide,
extended,
spi,
ide,
ata,
swim3,
fdc, or
sbp-2)
Since we are using local variables in the patch, we are using a
brpatch to jump to after the local variables are setup in our patch instead of a
blpatch to our patch. If we put the
brpatch in the middle of
findandadd-block-usb instead of the end then we need to add a
brpatch at at the end of our patch to branch back to
findandadd-block-usb (a
blpatch would not need to do that).
A
blpatch is a branch with link instruction (
bl in PPC assembly). The least significant bit is 1 to indicate the
link option.
Code:
0 > see blpatch
: blpatch
over - 3fffffc and 48000001 or swap code! ; ok
A
brpatch is a branch instruction (
br in PPC assembly)
Code:
0 > see brpatch
: brpatch
over - 3fffffc and 48000000 or swap code! ; ok
Interesting. Just to confirm, this is specifically what's in my nvramrc:
That looks correct. I would reduce line length to less than 80 characters if possible.
Have you tried applying the patch manually without using nvramrc?
You have not provided any info to prove that
findandadd-block + 3ac is the correct offset for the patch or that
mypatch + c is the correct destination for the patch.
If you do
see findandadd-block then you should see at the end some garbage where the
; used to be.
Code:
0 > see findandadd-block
: findandadd-block
...
8 of
{0@} findandadd-block-scsi-extended
endof
endcase
endof
{1} {0@} makefullpathalloc {2!} {1!} {1@} {2@} bpr-new {1@} {2@}
ib-newphyspath true bpr-set-infobit {1@} {2@} {0@} bpr-set-node {1@} {2@}
ib-netpath true bpr-set-infobit {1@} {2@} bi-t-net bi-t-loc lshift
bpr-set-businfo {1@} {2@} freemem0 ;
STACK UNDERFLOW!
ok
If you do
xsee findandadd-block then you should see that the word at
' findandadd-block 3ac + has changed from a branch with negative offset
4beff444 to a branch with positive offset
480f4a58 (the offset is the least 26 bits of the branch instruction, i.e. instruction & 0x03fffffc.
Code:
0> xsee findandadd-block
...
ff947058: 4befffa9 (endcase)
ff94705c: 480f4a58 <- positive offset means it's patched.
With the debugging vars set I don't see it looking through the USB bus at all, just the ATA disks.
If I manually boot from the USB drive, it does work, but I guess it's possible the disk is formatted in some way the USB probe doesn't detect? I kinda doubt that's it though, since I don't see any trace of it searching USB.
What command do you use to boot manually?
Check the contents of
dev / ls and
dump-device-tree and
devalias
Do you see any USB disks? What are the properties?
Do you see a usb disk devalias?
Code:
ud /ht@0,f2000000/pci@8/usb@b/disk@2
If it's missing, then try adding it (encode it as a property in
dev /alias