samsung: tizen_rpi: add a set_to_part_a/b uboot env
authorJaehoon Chung <jh80.chung@samsung.com>
Wed, 29 Jun 2022 03:59:58 +0000 (12:59 +0900)
committerJaehoon Chung <jh80.chung@samsung.com>
Mon, 28 Oct 2024 11:28:38 +0000 (20:28 +0900)
Add a set_to_part_a/b uboot env.
If wants to change to part_a or part_b, run the below command on u-boot
console.
e.g) "run set_to_part_a" or "run set_to_part_b"

Change-Id: I639aea2809f08382ade115d6718fa63d3931c35a
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
include/samsung/tizen_rpi.h

index cf117704fce9570b4d0b9c9e991b726851db398e..b554e839bdfe3d1b7083cd419d76a8e02ce6dd42 100644 (file)
        "name=reserved2,size=125M,id=0x83;"                     \
        ""
 
+#define MBR_CHECK      \
+       "env default mbr_parts; "                                       \
+       "if mbr verify ${dfu_interface} ${dfu_device}; "                \
+       "then true; else "                                              \
+       "echo \"MBR partition layout does not match flashed bootloader!\"; " \
+       "echo \"Please format SD card with recent sd_fusing_rpi3.sh script or Ctrl-C to continue.\"; " \
+       "while sleep 2; do echo .\\\\\\\\c; done; echo; "               \
+       "fi"
+
+#define SET_TO_PARTITION_A     \
+       "if test -e mmc ${mmcbootdev}:${mmcinformpart} ${slotfile}; "   \
+       "then ;"                                                        \
+       "load mmc ${mmcbootdev}:${mmcinformpart} ${slot_addr} /${slotfile} 2; " \
+       "fi; "                                                                  \
+       "mw.b ${slot_addr} 61; "                                                \
+       "ext4write mmc ${mmcbootdev}:${mmcinformpart} ${slot_addr} /${slotfile} 2; " \
+
+#define SET_TO_PARTITION_B     \
+       "if test -e mmc ${mmcbootdev}:${mmcinformpart} ${slotfile}; "   \
+       "then ;"                                                        \
+       "load mmc ${mmcbootdev}:${mmcinformpart} ${slot_addr} /${slotfile} 2; " \
+       "fi; "                                                                  \
+       "mw.b ${slot_addr} 62; "                                                \
+       "ext4write mmc ${mmcbootdev}:${mmcinformpart} ${slot_addr} /${slotfile} 2; " \
+
 #ifdef CONFIG_TARGET_RPI_4_32B
 #define TIZEN_VC_MEM "vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000 swiotlb=8192 "
 #else
        "dfu_interface=mmc\0"                   \
        "dfu_device=" __stringify(CONFIG_MMC_DEFAULT_DEV) "\0" \
        "mbr_parts=" PARTS_DEFAULT "\0"         \
+       "mbr_check=" MBR_CHECK "\0"             \
+       "set_to_part_a=" SET_TO_PARTITION_A "\0"                \
+       "set_to_part_b=" SET_TO_PARTITION_B "\0"                \
        ""
 
 #endif /* __CONFIG_TIZEN_RPI_H */