summaryrefslogtreecommitdiff
path: root/sd_fuse
diff options
context:
space:
mode:
authorJavier Martinez Canillas <javier.martinez@collabora.co.uk>2014-02-15 12:04:41 +0400
committerJavier Martinez Canillas <javier.martinez@collabora.co.uk>2014-02-15 12:33:59 +0400
commit6e5927bbf8479dad65243d18711929653cc4e44f (patch)
tree90249d2c17b480227b9f8293b8dce6040a381b54 /sd_fuse
parentbce9759a9dc8319a8624e84013692fb5e3e5c830 (diff)
downloadu-boot-6e5927bbf8479dad65243d18711929653cc4e44f.tar.xz
sd_fuse: sd_fusing: Add Embedded MMC (eMMC) support
Odroid boards can boot from either a SD/MMC or an eMMC. The iROM load the bootloader binaries (first and second stage bootloader, trustzone, DRM, etc) from the first sectors of the boot device. An SD exposes all its physical address space as just one device (e.g: /dev/mmcblk0) so its first sectors are just located on that device but the eMMC split its physical address space in different virtual devices (e.g: mmcblk0boot0, mmcblk0boot1, mmcblk0rpmb and mmcblk0). So the eMMC first sectors are not located on the device but on the virtual ${device}boot0. Also, the addresses are at a different offset for SD/MMC and eMMC so special care has to be taken when flashing images to an eMMC since just dd'ing an image to the block device won't work. The binaries written and their offset on both a SD/MMC and eMMC are: +---------------------------------+--------------+-----------------+ | eMMC | +---------------------------------+--------------+-----------------+ | Binary | Start sector | Length (sector) | +---------------------------------+--------------+-----------------+ | | | | | bl1.HardKernel (BL1/DRM) | 0 | 30 | | | | | | bl2.HardKernel (BL2/SPL) | 30 | 32 | | | | | | u-boot.bin (U-Boot) | 62 | 1024 | | | | | | tzsw.HardKernel (TrustZone S/W) | 2110 | 312 | +---------------------------------+--------------+-----------------+ +---------------------------------+--------------+-----------------+ | SD/MMC | +---------------------------------+--------------+-----------------+ | Binary | Start sector | Length (sector) | +---------------------------------+--------------+-----------------+ | | | | | bl1.HardKernel (BL1/DRM) | 1 | 30 | | | | | | bl2.HardKernel (BL2/SPL) | 31 | 32 | | | | | | u-boot.bin (U-Boot) | 63 | 1024 | | | | | | tzsw.HardKernel (TrustZone S/W) | 2111 | 312 | +---------------------------------+--------------+-----------------+ Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Diffstat (limited to 'sd_fuse')
-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."