odroid xu3/xu4: add bootclone and ubootupgrade environment scripts tizen_-3
authorPrzemyslaw Marczak <p.marczak@samsung.com>
Fri, 4 Dec 2015 15:21:02 +0000 (16:21 +0100)
committerPrzemyslaw Marczak <p.marczak@samsung.com>
Fri, 4 Dec 2015 15:31:07 +0000 (16:31 +0100)
Script ubootupgrade:
This script allows updating U-Boot from file u-boot-mmc.bin
existing on boot partition, e.g. with SD card reader.

This is useful for XU4, when U-Boot upgrade is needed,
then it can be delivered with 'boot.img' as regular file
and upgraded by running:
run ubootupgrade

Script bootclone:
This script allows cloning bootloader firmware including:
- bl1, bl2, U-Boot ,and TZSW
from bootable SD card to clean eMMC card using XU3/XU4 board.

This is useful, when user have SD card reader only and wants prepare
a bootable eMMC card.

The script expects that SD is bootable and can be run as follows:
run bootclone

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
include/configs/odroid_xu3.h

index 7420c4a..8a225d5 100644 (file)
        "dfu_interface=mmc\0" \
        "dfu_device=" __stringify(CONFIG_MMC_DEFAULT_DEV) "\0" \
        "dfu_alt_system="CONFIG_DFU_ALT_SYSTEM \
-       "dfu_alt_info=Autoset by THOR/DFU command run.\0"
+       "dfu_alt_info=Autoset by THOR/DFU command run.\0" \
+       "bootclone="                                               \
+       "echo ' 'Bootloader clone from SD to eMMC.;"               \
+       "echo ' 'Checking SD/eMMC configuration...;"               \
+       "if mmc dev 1 1; then "                                    \
+               "mmc dev 0;"                                       \
+               "mmc read 0x40000000 0x1 0xa3e;"                   \
+               "mmc dev 1 1;"                                     \
+               "mmc write 0x40000000 0x0 0xa3e;"                  \
+               "mmc dev 1 0;"                                     \
+       "else "                                                    \
+               "echo ' 'Wrong cards setup.;"                      \
+               "echo ' 'Make sure that eMMC is in proper slot.;"  \
+               "echo ' 'Switch SW1 DIP to SD card booting.;"      \
+       "fi;\0"                                                    \
+       "ubootupgrade="                                            \
+       "if test -e mmc 0:${mmcbootpart} u-boot-mmc.bin; then "        \
+               "echo U-Boot upgrade from partition: ${mmcbootpart}.;" \
+               "echo Found U-Boot image: u-boot-mmc.bin;"             \
+               "fatload mmc 0:1 0x40000000 u-boot-mmc.bin;"           \
+               "if mmc dev 0 1; then "                                \
+                       "echo Boot device is eMMC;"                    \
+                       "mmc write 0x40000000 0x3e 0x800;"             \
+                       "mmc dev 0 0;"                                 \
+               "else "                                                \
+                       "echo Boot device is SD;"                      \
+                       "mmc write 0x40000000 0x3f 0x800;"             \
+               "fi;"                                                  \
+               "echo Bootloader upgrade done;"                        \
+               "reset;"                                               \
+       "else "                                                        \
+               "echo U-Boot image: u-boot-mmc.bin not found!;"        \
+       "fi;\0"
 
 /* Hacking */
 #define EXYNOS5422_MFC_CPLL_FIX