Use first_stage_mount feature for 4.19
This allows us to deprecate the dtb fstab dependency. Because 4.19 also
does not support android-verity, disable the feature at the same time.
Bug: 121043321
Test: not yet tested
Change-Id: I9c2a8c140ed64faecee0d66e00033fdffa398a4b
Signed-off-by: Alistair Strachan <astrachan@google.com>
diff --git a/fstab.ramdisk b/fstab.ramdisk
new file mode 100644
index 0000000..f64417e
--- /dev/null
+++ b/fstab.ramdisk
@@ -0,0 +1,2 @@
+/dev/block/by-name/system /system ext4 ro,errors=panic wait,first_stage_mount
+/dev/block/by-name/vendor /vendor ext4 ro,errors=panic wait,first_stage_mount
diff --git a/hikey/BoardConfig.mk b/hikey/BoardConfig.mk
index 1e21446..0ba3dd8 100644
--- a/hikey/BoardConfig.mk
+++ b/hikey/BoardConfig.mk
@@ -6,14 +6,21 @@
TARGET_CPU_VARIANT := cortex-a53
TARGET_2ND_CPU_VARIANT := cortex-a53
-BOARD_KERNEL_CMDLINE := console=ttyAMA3,115200 androidboot.console=ttyAMA3 androidboot.hardware=hikey firmware_class.path=/vendor/firmware efi=noruntime
+BOARD_KERNEL_CMDLINE := androidboot.hardware=hikey firmware_class.path=/vendor/firmware efi=noruntime init=/init
+BOARD_KERNEL_CMDLINE += androidboot.boot_devices=soc/f723d000.dwmmc0
+BOARD_KERNEL_CMDLINE += console=ttyAMA3,115200 androidboot.console=ttyAMA3
-# Enable dtb fstab for treble, with verity and system-as-root
-# NOTE: Disabled by default until b/111829702 is fixed
+# On kernels before 4.19, enable dtb fstab with android-verity. On kernels >=
+# 4.19, both dtb fstab and android-verity are deprecated, so until we have
+# avb2 support in the bootloader, don't enable either feature. The ramdisk
+# fstab needed for the new mechanism will be installed unconditionally; if
+# dtb fstab is present, it will override it automatically.
+ifneq ($(TARGET_KERNEL_USE),4.19)
BOARD_KERNEL_CMDLINE += overlay_mgr.overlay_dt_entry=hardware_cfg_enable_android_fstab_v2
-BOARD_KERNEL_CMDLINE += rootwait ro init=/init root=/dev/dm-0
+BOARD_KERNEL_CMDLINE += rootwait ro root=/dev/dm-0
BOARD_KERNEL_CMDLINE += dm=\"system none ro,0 1 android-verity 179:9\"
BOARD_BUILD_SYSTEM_ROOT_IMAGE := true
+endif
ifneq ($(TARGET_SENSOR_MEZZANINE),)
BOARD_KERNEL_CMDLINE += overlay_mgr.overlay_dt_entry=hardware_cfg_$(TARGET_SENSOR_MEZZANINE)
diff --git a/hikey/device-hikey.mk b/hikey/device-hikey.mk
index 33be0f1..99fdb50 100644
--- a/hikey/device-hikey.mk
+++ b/hikey/device-hikey.mk
@@ -17,6 +17,7 @@
PRODUCT_COPY_FILES += $(TARGET_PREBUILT_KERNEL):kernel \
$(TARGET_PREBUILT_DTB):hi6220-hikey.dtb \
$(LOCAL_PATH)/$(TARGET_FSTAB):$(TARGET_COPY_OUT_VENDOR)/etc/fstab.hikey \
+ device/linaro/hikey/fstab.ramdisk:$(TARGET_COPY_OUT_RAMDISK)/fstab.hikey \
device/linaro/hikey/init.common.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/init.hikey.rc \
device/linaro/hikey/init.hikey.power.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/init.hikey.power.rc \
device/linaro/hikey/init.common.usb.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/init.hikey.usb.rc \
diff --git a/hikey960/BoardConfig.mk b/hikey960/BoardConfig.mk
index bfaa560..d382d42 100644
--- a/hikey960/BoardConfig.mk
+++ b/hikey960/BoardConfig.mk
@@ -8,28 +8,36 @@
TARGET_NO_DTIMAGE := false
-BOARD_KERNEL_CMDLINE := androidboot.hardware=hikey960
-BOARD_KERNEL_CMDLINE += firmware_class.path=/vendor/firmware loglevel=15 efi=noruntime
+BOARD_KERNEL_CMDLINE := androidboot.hardware=hikey960 firmware_class.path=/vendor/firmware efi=noruntime init=/init
+BOARD_KERNEL_CMDLINE += androidboot.boot_devices=soc/ff3b0000.ufs
+BOARD_KERNEL_CMDLINE += loglevel=15
ifeq ($(TARGET_BUILTIN_EDID), true)
BOARD_KERNEL_CMDLINE += drm_kms_helper.edid_firmware=edid/1920x1080.bin
endif
+# On kernels before 4.19, enable dtb fstab. On kernels >= 4.19, both dtb
+# fstab and android-verity are deprecated, so until we have avb2 support
+# in the bootloader, don't enable either feature. The ramdisk fstab
+# needed for the new mechanism will be installed unconditionally; if dtb
+# fstab is present, it will override it automatically.
+ifneq ($(TARGET_KERNEL_USE),4.19)
+# Enable treble dtb fstab with verity
ifneq ($(TARGET_ANDROID_VERITY),)
-# Enable dtb fstab for treble, with verity and system-as-root
-# NOTE: Disabled by default until b/111829702 is fixed
BOARD_KERNEL_CMDLINE += overlay_mgr.overlay_dt_entry=hardware_cfg_enable_android_fstab_v2
-BOARD_KERNEL_CMDLINE += rootwait ro init=/init root=/dev/dm-0
+BOARD_KERNEL_CMDLINE += rootwait ro root=/dev/dm-0
BOARD_KERNEL_CMDLINE += dm=\"system none ro,0 1 android-verity 8:58\"
BOARD_BUILD_SYSTEM_ROOT_IMAGE := true
else
-# Enable dtb fstab for treble
+# Enable treble dtb fstab without verity
BOARD_KERNEL_CMDLINE += overlay_mgr.overlay_dt_entry=hardware_cfg_enable_android_fstab
endif
+endif
ifneq ($(TARGET_SENSOR_MEZZANINE),)
BOARD_KERNEL_CMDLINE += overlay_mgr.overlay_dt_entry=hardware_cfg_$(TARGET_SENSOR_MEZZANINE)
endif
+
BOARD_MKBOOTIMG_ARGS := --base 0x0 --tags_offset 0x07a00000 --kernel_offset 0x00080000 --ramdisk_offset 0x07c00000
BOARD_SYSTEMIMAGE_PARTITION_SIZE := 4915724288 # 4688MB
diff --git a/hikey960/device-hikey960.mk b/hikey960/device-hikey960.mk
index 792277f..c1d697a 100644
--- a/hikey960/device-hikey960.mk
+++ b/hikey960/device-hikey960.mk
@@ -18,6 +18,7 @@
$(TARGET_PREBUILT_DTB):hi3660-hikey960.dtb
PRODUCT_COPY_FILES += $(LOCAL_PATH)/fstab.hikey960:$(TARGET_COPY_OUT_VENDOR)/etc/fstab.hikey960 \
+ device/linaro/hikey/fstab.ramdisk:$(TARGET_COPY_OUT_RAMDISK)/fstab.hikey960 \
device/linaro/hikey/init.common.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/init.hikey960.rc \
device/linaro/hikey/init.hikey960.power.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/init.hikey960.power.rc \
device/linaro/hikey/init.common.usb.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/init.hikey960.usb.rc \