summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsd_fuse/sd_fusing.sh36
1 files changed, 27 insertions, 9 deletions
diff --git a/sd_fuse/sd_fusing.sh b/sd_fuse/sd_fusing.sh
index 0c03426629..65ee2714b8 100755
--- a/sd_fuse/sd_fusing.sh
+++ b/sd_fuse/sd_fusing.sh
@@ -22,31 +22,49 @@ else
exit 0
fi
+if [ -d /sys/block/${1##*/}boot0 ]; then
+ echo "$1 is an eMMC card, disabling ${1##*/}boot0 ro"
+ if ! echo 0 > /sys/block/${1##*/}boot0/force_ro; then
+ echo "Enabling r/w for $1boot0 failed"
+ exit 1
+ fi
+ emmc=1
+fi
+
####################################
# fusing images
-signed_bl1_position=1
-bl2_position=31
-uboot_position=63
-tzsw_position=2111
+if [ -n $emmc ]; then
+ signed_bl1_position=0
+ bl2_position=30
+ uboot_position=62
+ tzsw_position=2110
+ device=$1boot0
+else
+ signed_bl1_position=1
+ bl2_position=31
+ uboot_position=63
+ tzsw_position=2111
+ device=$1
+fi
#<BL1 fusing>
echo "BL1 fusing"
-sudo dd iflag=dsync oflag=dsync if=./bl1.HardKernel of=$1 seek=$signed_bl1_position
+sudo dd iflag=dsync oflag=dsync if=./bl1.HardKernel of=$device seek=$signed_bl1_position
#<BL2 fusing>
echo "BL2 fusing"
-sudo dd iflag=dsync oflag=dsync if=./bl2.HardKernel of=$1 seek=$bl2_position
+sudo dd iflag=dsync oflag=dsync if=./bl2.HardKernel of=$device seek=$bl2_position
#<u-boot fusing>
echo "u-boot fusing"
-sudo dd iflag=dsync oflag=dsync if=../u-boot.bin of=$1 seek=$uboot_position
+sudo dd iflag=dsync oflag=dsync if=../u-boot.bin of=$device seek=$uboot_position
#<TrustZone S/W fusing>
echo "TrustZone S/W fusing"
-sudo dd iflag=dsync oflag=dsync if=./tzsw.HardKernel of=$1 seek=$tzsw_position
+sudo dd iflag=dsync oflag=dsync if=./tzsw.HardKernel of=$device seek=$tzsw_position
####################################
#<Message Display>
echo "U-boot image is fused successfully."
-echo "Eject SD card and insert it again."
+echo "Eject $1 and insert it again."