09-07-2020, 05:01 AM
Hi,
In order to make this a a little more update resistant, you might find the following script useful
This will check whether the supplied update is in place, and, if not, apply it using SED.
How you use this is up to you - perhaps putting a call to it in rc.local... If the card boots, and the fix is not present then it will be applied and all should be well for the next boot.
If you want to test it first on a mounted image, simply adjust the value of DTB_PATH.
I hope that it is found useful, but use as your own risk, no guarantees of any sort etc etc
In order to make this a a little more update resistant, you might find the following script useful
Code:
#!/bin/bash
DTB_NAME=sun50i-a64-sopine-baseboard.dtb
DTB_PATH=/boot/dtb/allwinner
TMPFILE=/tmp/tmp.dts
NEWFILE=/tmp/new.dts
clean_up() {
rm $TMPFILE $NEWFILE > /dev/null 2>&1
}
if [ ! -f $DTB_PATH/$DTB_NAME ]
then
echo dtb file not found
exit 999
fi
dtc -I dtb -O dts -o $TMPFILE $DTB_PATH/$DTB_NAME > /dev/null 2>&1
if [ $? != 0 ]
then
echo Cannot extract dts from $DTB_PATH/$DTB_NAME
exit 998
fi
retcode=0
grep 'allwinner,tx-delay-ps' $TMPFILE > /dev/null 2>&1
if [ $? != 0 ]
then
sed -e '/ethernet@1c30000 {$/,/phandle = <0x88>;/!b;/phandle = <0x88>;/a\\t\t\tallwinner,tx-delay-ps = <500>;' $TMPFILE > $NEWFILE
if [ $? != 0 ]
then
echo Could not update temporary DTS file
retcode=997
else
dtc -O dtb -o $DTB_PATH/$DTB_NAME -b 0 $NEWFILE > /dev/null 2>&1
if [ $? != 0 ]
then
echo Could not create new dts file
retcode=996
fi
fi
else
echo Fix already in place
fi
clean_up
exit $retcode
This will check whether the supplied update is in place, and, if not, apply it using SED.
How you use this is up to you - perhaps putting a call to it in rc.local... If the card boots, and the fix is not present then it will be applied and all should be well for the next boot.
If you want to test it first on a mounted image, simply adjust the value of DTB_PATH.
I hope that it is found useful, but use as your own risk, no guarantees of any sort etc etc