From 3f28681742bb6aee1ae7ecbdbbf670d11101d50b Mon Sep 17 00:00:00 2001 From: Preetam D'Souza Date: Fri, 9 Apr 2021 21:06:35 -0400 Subject: [PATCH] Support vendors overriding desktop rootfs img Signed-off-by: Preetam D'Souza (cherry picked from commit a27420a8acb6bc36cb12743c158c94ed3a991ae7) --- device-maru.mk | 10 +--------- prebuilts/Android.mk | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/device-maru.mk b/device-maru.mk index b57fe7d..34c4d7d 100644 --- a/device-maru.mk +++ b/device-maru.mk @@ -15,9 +15,6 @@ # limitations under the License. # -# lazy set prebuilt rootfs to maru if empty -PREBUILT_REPO ?= maruos - # early build definitions for maru include $(LOCAL_PATH)/maru_build.mk @@ -26,17 +23,12 @@ PRODUCT_COPY_FILES += \ $(LOCAL_PATH)/init.maru.rc:root/init.maru.rc # container +PRODUCT_PACKAGES += rootfs.tar.gz PRODUCT_COPY_FILES += \ $(LOCAL_PATH)/container/default/config:system/maru/containers/default/config \ $(LOCAL_PATH)/container/default/fstab:system/maru/containers/default/fstab \ $(LOCAL_PATH)/container/mcprepare.sh:system/bin/mcprepare -# prebuilt rootfs -ifeq ($(PREBUILT_REPO),maruos) -PRODUCT_COPY_FILES += \ - $(LOCAL_PATH)/prebuilts/desktop-rootfs.tar.gz:system/maru/containers/default/rootfs.tar.gz -endif - # LXC PRODUCT_PACKAGES += \ liblxc \ diff --git a/prebuilts/Android.mk b/prebuilts/Android.mk index 5cbfa3c..c0be5f8 100644 --- a/prebuilts/Android.mk +++ b/prebuilts/Android.mk @@ -16,4 +16,26 @@ # LOCAL_PATH := $(call my-dir) +# TARGET_DESKTOP_ROOTFS can be set in vendor makefiles to override the default +# desktop rootfs image for Maru. Note that the path must be relative to the +# AOSP workspace root directory, which can easily be done by prefixing the path +# with $(LOCAL_PATH). +ifeq ($(TARGET_DESKTOP_ROOTFS),) + TARGET_DESKTOP_ROOTFS := $(LOCAL_PATH)/desktop-rootfs.tar.gz +endif + +include $(CLEAR_VARS) +LOCAL_MODULE := rootfs.tar.gz +LOCAL_MODULE_TAGS := optional +LOCAL_MODULE_CLASS := ETC +LOCAL_MODULE_PATH := $(TARGET_OUT)/maru/containers/default + +# Instead of using LOCAL_SRC_FILES and $(BUILD_PREBUILT), we explicitly set up +# the rule ourselves so that we can copy a rootfs path from outside of this +# directory if a vendor overrides TARGET_DESKTOP_ROOTFS. +include $(BUILD_SYSTEM)/base_rules.mk +$(LOCAL_BUILT_MODULE): $(TARGET_DESKTOP_ROOTFS) + @mkdir -p $(dir $@) + @cp $(TARGET_DESKTOP_ROOTFS) $@ + include $(call all-makefiles-under, $(LOCAL_PATH))