ofpath bugfix powerpc g5 dual sata

Roman Rakus rrakus at redhat.com
Wed Nov 19 02:40:30 EST 2008


peter cros wrote:
> This one still needs fixing.
>
> On Sun, Sep 28, 2008 at 1:57 AM, peter cros <pxwpxw8 at gmail.com> wrote:
>   
>> Hi,
>>
>> I am submitting this small patch to fix a residual bug in ofpath, for Apple
>> powerpc64 g5 with dual sata drives, ubuntu and possibly other installations
>> which use dash as their default shell.
>>
>> When ybin runs ofpath in the target root system with the default shell (#!
>> /bin/sh ), in ubuntu this is /bin/sh -> dash.
>>
>> The "let" statement used to increment the ID for multiple k2-sata drives, is
>> not found by the dash shell as used by ubuntu, in my g5 for example.
>>
>> Failure to increment K2_DEVICE_ID returns the same k2-sata path for each of
>> multiple sata drives, ybin fails to find correct boot drive.
>>
>> This patch just avoids using "let".
>>
>> Tested on powerpc g5 Openfirmware V4, dual sata drives, ubuntu 804.
>>
>>  -----------------------------------
>> ~/src/gits$ diff -pu yaboot/ybin/ofpath test/ybin/ofpath
>>  --------------------------------------------------------
>>
>> --- yaboot/ybin/ofpath    2008-09-26 21:36:38.000000000 +1000
>> +++ test/ybin/ofpath    2008-09-26 16:41:00.000000000 +1000
>> @@ -306,7 +306,8 @@ scsi_ofpath()
>>          K2_DEVICE_ID=0
>>          while [ "$DEVICE_PATH" = "" ] ; do
>>              SCSI_HOSTNUMBER=`expr $SCSI_HOSTNUMBER - 1`
>> -            let "K2_DEVICE_ID += 1"
>> +# let not found in dash     #       let "K2_DEVICE_ID += 1"
>> +        K2_DEVICE_ID=$((K2_DEVICE_ID+1))
>>              DEVICE_PATH="$(printhost $SCSI_HOSTNUMBER $HOST_LIST)"
>>          done
>>          echo
>> "${DEVICE_PATH##*device-tree}/k2-sata@$K2_DEVICE_ID/disk at 0:$PARTITION"
>>
>> -----------------------------
>> peter cros
>>
>>
>>     
> _______________________________________________
> Yaboot-devel mailing list
> Yaboot-devel at ozlabs.org
> https://ozlabs.org/mailman/listinfo/yaboot-devel
>   
I can confirm that `let' is bashism (bash builtin) and is better to 
avoid using it. Patch you proposed looks well. Using $(()) is posixly 
correct arithmetic expansion. What do you think Paul? There are no other 
let statements.
RR



More information about the Yaboot-devel mailing list