+#ifndef BOOT_PARTITION
+#define BOOT_PARTITION "boot"
+#endif
+
+#ifndef LOGO_PARTITION
+#define LOGO_PARTITION "logo"
+#endif
+
+#ifndef CONTROL_PARTITION
+#define CONTROL_PARTITION "misc"
+#endif
+
+#ifndef EXTRA_ANDROID_ENV_SETTINGS
+#define EXTRA_ANDROID_ENV_SETTINGS ""
+#endif
+
+#if defined(CONFIG_CMD_AVB)
+#define AVB_VERIFY_CHECK \
+ "if test \"${force_avb}\" -eq 1; then " \
+ "if run avb_verify; then " \
+ "echo AVB verification OK.;" \
+ "setenv bootargs \"$bootargs $avb_bootargs\";" \
+ "else " \
+ "echo AVB verification failed.;" \
+ "exit; fi;" \
+ "else " \
+ "setenv bootargs \"$bootargs androidboot.verifiedbootstate=orange\";" \
+ "echo Running without AVB...; "\
+ "fi;"
+
+#define AVB_VERIFY_CMD "avb_verify=avb init ${mmcdev}; avb verify $slot_suffix;\0"
+#else
+#define AVB_VERIFY_CHECK ""
+#define AVB_VERIFY_CMD ""
+#endif
+
+#if defined(CONFIG_CMD_AB_SELECT)
+#define ANDROIDBOOT_GET_CURRENT_SLOT_CMD "get_current_slot=" \
+ "if part number mmc ${mmcdev} " CONTROL_PARTITION " control_part_number; " \
+ "then " \
+ "echo " CONTROL_PARTITION \
+ " partition number:${control_part_number};" \
+ "ab_select current_slot mmc ${mmcdev}:${control_part_number};" \
+ "else " \
+ "echo " CONTROL_PARTITION " partition not found;" \
+ "fi;\0"
+
+#define AB_SELECT_SLOT \
+ "run get_current_slot; " \
+ "if test -e \"${current_slot}\"; " \
+ "then " \
+ "setenv slot_suffix _${current_slot}; " \
+ "else " \
+ "echo current_slot not found;" \
+ "exit;" \
+ "fi;"
+
+#define AB_SELECT_ARGS \
+ "setenv bootargs_ab androidboot.slot_suffix=${slot_suffix}; " \
+ "echo A/B cmdline addition: ${bootargs_ab};" \
+ "setenv bootargs ${bootargs} ${bootargs_ab};"
+
+#define AB_BOOTARGS " androidboot.force_normal_boot=1"
+#define RECOVERY_PARTITION "boot"
+#else
+#define AB_SELECT_SLOT ""
+#define AB_SELECT_ARGS " "
+#define ANDROIDBOOT_GET_CURRENT_SLOT_CMD ""
+#define AB_BOOTARGS " "
+#define RECOVERY_PARTITION "recovery"
+#endif
+
+#if defined(CONFIG_CMD_ABOOTIMG)
+/*
+ * Prepares complete device tree blob for current board (for Android boot).
+ *
+ * Boot image or recovery image should be loaded into $loadaddr prior to running
+ * these commands. The logic of these commnads is next:
+ *
+ * 1. Read correct DTB for current SoC/board from boot image in $loadaddr
+ * to $fdtaddr
+ * 2. Merge all needed DTBO for current board from 'dtbo' partition into read
+ * DTB
+ * 3. User should provide $fdtaddr as 3rd argument to 'bootm'
+ */
+#define PREPARE_FDT \
+ "echo Preparing FDT...; " \
+ "if test $board_name = sei510; then " \
+ "echo \" Reading DTB for sei510...\"; " \
+ "setenv dtb_index 0;" \
+ "elif test $board_name = sei610; then " \
+ "echo \" Reading DTB for sei610...\"; " \
+ "setenv dtb_index 1;" \
+ "elif test $board_name = vim3l; then " \
+ "echo \" Reading DTB for vim3l...\"; " \
+ "setenv dtb_index 2;" \
+ "elif test $board_name = vim3; then " \
+ "echo \" Reading DTB for vim3...\"; " \
+ "setenv dtb_index 3;" \
+ "else " \
+ "echo Error: Android boot is not supported for $board_name; " \
+ "exit; " \
+ "fi; " \
+ "abootimg get dtb --index=$dtb_index dtb_start dtb_size; " \
+ "cp.b $dtb_start $fdt_addr_r $dtb_size; " \
+ "fdt addr $fdt_addr_r 0x80000; " \
+ "if test $board_name = sei510; then " \
+ "echo \" Reading DTBO for sei510...\"; " \
+ "setenv dtbo_index 0;" \
+ "elif test $board_name = sei610; then " \
+ "echo \" Reading DTBO for sei610...\"; " \
+ "setenv dtbo_index 1;" \
+ "elif test $board_name = vim3l; then " \
+ "echo \" Reading DTBO for vim3l...\"; " \
+ "setenv dtbo_index 2;" \
+ "elif test $board_name = vim3; then " \
+ "echo \" Reading DTBO for vim3...\"; " \
+ "setenv dtbo_index 3;" \
+ "else " \
+ "echo Error: Android boot is not supported for $board_name; " \
+ "exit; " \
+ "fi; " \
+ "part start mmc ${mmcdev} dtbo${slot_suffix} p_dtbo_start; " \
+ "part size mmc ${mmcdev} dtbo${slot_suffix} p_dtbo_size; " \
+ "mmc read ${dtboaddr} ${p_dtbo_start} ${p_dtbo_size}; " \
+ "echo \" Applying DTBOs...\"; " \
+ "adtimg addr $dtboaddr; " \
+ "adtimg get dt --index=$dtbo_index dtbo0_addr; " \
+ "fdt apply $dtbo0_addr;" \
+ "setenv bootargs \"$bootargs androidboot.dtbo_idx=$dtbo_index \";"\
+
+#define BOOT_CMD "bootm ${loadaddr} ${loadaddr} ${fdt_addr_r};"
+
+#else
+#define PREPARE_FDT " "
+#define BOOT_CMD "bootm ${loadaddr};"
+#endif