Enable A/B

As boot_control HAL is now implemented for AM57x, we can enable A/B
updates. Slotted partitions are specified in AB_OTA_PARTITIONS.
Related changes should be implemented in bootloader (partition table).
See [0] for implementation details.

Next changes are made w.r.t. boot flow:
 - system is mounted as root, so "skip_initramfs" must be added to
   kernel cmdline when normal boot is requested
 - recovery image is not built, so recovery partition can be deleted
   (in partition table and in fstab)
 - ramdisk in boot.img contains recovery functionality and should be
   booted when recovery boot is requested (without "skip_initramfs"
   parameter in kernel cmdline)
 - for partitions specified in AB_OTA_PARTITIONS there should be two
   versions in partition table: with "_a" and "_b" suffixes

[0] https://source.android.com/devices/tech/ota/ab/ab_implement

Change-Id: I265c8b79c1772c57172b0a5f0094d21d5e4fa86b
Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
diff --git a/BoardConfig.mk b/BoardConfig.mk
index 5904014..af7c3a2 100644
--- a/BoardConfig.mk
+++ b/BoardConfig.mk
@@ -53,7 +53,11 @@
 TARGET_BOARD_PLATFORM := am57x
 TARGET_COPY_OUT_VENDOR := vendor
 
+TARGET_NO_RECOVERY := true
 TARGET_RECOVERY_FSTAB := device/ti/beagle_x15/$(TARGET_FSTAB)
+BOARD_USES_RECOVERY_AS_BOOT := true
+BOARD_BUILD_SYSTEM_ROOT_IMAGE := true
+
 TARGET_RECOVERY_PIXEL_FORMAT := "BGRA_8888"
 TARGET_RECOVERY_UI_LIB := librecovery_ui_beagle_x15
 TARGET_RELEASETOOLS_EXTENSIONS := device/ti/beagle_x15
@@ -95,3 +99,15 @@
 BOARD_INCLUDE_DTB_IN_BOOTIMG := true
 BOARD_PREBUILT_DTBIMAGE_DIR := $(DTB_DIR)
 BOARD_MKBOOTIMG_ARGS := --header_version 2
+
+# Board uses A/B OTA.
+AB_OTA_UPDATER := true
+# A/B updater updatable partitions list. Keep in sync with the partition list
+# with "_a" and "_b" variants in the device. Note that the vendor can add more
+# partitions to this list for the bootloader and radio.
+AB_OTA_PARTITIONS += \
+	boot \
+	system \
+	vbmeta \
+	dtbo \
+	vendor
diff --git a/device.mk b/device.mk
index 6e56ea4..b473121 100644
--- a/device.mk
+++ b/device.mk
@@ -178,3 +178,13 @@
 PRODUCT_PACKAGES_DEBUG += \
 	bootctl \
 	fastbootd \
+# A/B
+PRODUCT_PACKAGES += \
+	update_engine \
+	update_verifier
+
+PRODUCT_PACKAGES += \
+	update_engine_sideload
+
+PRODUCT_PACKAGES_DEBUG += \
+	update_engine_client
diff --git a/fstab.beagle_x15board_v4 b/fstab.beagle_x15board_v4
index 505e652..5e6549c 100644
--- a/fstab.beagle_x15board_v4
+++ b/fstab.beagle_x15board_v4
@@ -4,6 +4,7 @@
 # specify 'check', and must come before any filesystems that do specify 'check'
 
 #<src>                                                                  <mnt_point>     <type>  <mnt_flags and options> <fs_mgr_flags>
+/dev/block/platform/44000000.ocp/480b4000.mmc/by-name/system            /               ext4    ro,barrier=1            wait,slotselect
 /dev/block/platform/44000000.ocp/480b4000.mmc/by-name/userdata          /data           ext4    noatime,nosuid,nodev    wait,check,quota
 /dev/block/platform/44000000.ocp/480b4000.mmc/by-name/recovery          /recovery       emmc    defaults                defaults
 /dev/block/platform/44000000.ocp/480b4000.mmc/by-name/boot              /boot           emmc    defaults                defaults
diff --git a/fstab.beagle_x15board_v5 b/fstab.beagle_x15board_v5
index 8b8ab10..b3dd7d1 100644
--- a/fstab.beagle_x15board_v5
+++ b/fstab.beagle_x15board_v5
@@ -4,6 +4,7 @@
 # specify 'check', and must come before any filesystems that do specify 'check'
 
 #<src>                                                                                                                                          <mnt_point>     <type>  <mnt_flags and options> <fs_mgr_flags>
+/dev/block/platform/44000000.ocp/48000000.interconnect/48000000.interconnect:segment@0/480b4000.target-module/480b4000.mmc/by-name/system       /               ext4    ro,barrier=1            wait,slotselect
 /dev/block/platform/44000000.ocp/48000000.interconnect/48000000.interconnect:segment@0/480b4000.target-module/480b4000.mmc/by-name/userdata     /data           ext4    noatime,nosuid,nodev    wait,check,quota
 /dev/block/platform/44000000.ocp/48000000.interconnect/48000000.interconnect:segment@0/480b4000.target-module/480b4000.mmc/by-name/recovery     /recovery       emmc    defaults                defaults
 /dev/block/platform/44000000.ocp/48000000.interconnect/48000000.interconnect:segment@0/480b4000.target-module/480b4000.mmc/by-name/boot         /boot           emmc    defaults                defaults