diff options
author | Usama Arif <usama.arif@arm.com> | 2021-03-23 11:07:30 +0000 |
---|---|---|
committer | Tushar Khandelwal <tushar.khandelwal@arm.com> | 2021-04-22 20:27:11 +0100 |
commit | c4b72b9ca7eaa5bcef9ae3e8e384eaf6f5c0a09e (patch) | |
tree | 6e3be91b23720eef1a95d463e62fa4dd79121f88 | |
parent | 55d05aad803bd258ee6f79d71629a59e80aa8d97 (diff) |
tc0: nano: Update Makefiles for android 11
This includes build flags to allow build and boot for android 11.
This also aligns tc0_nano with the minimal_system.mk from
https://android-review.googlesource.com/c/device/generic/goldfish/+/1354904
which is hosted as a patch file.
Signed-off-by: Usama Arif <usama.arif@arm.com>
Change-Id: I922a85a2f11069756f1eed7d84fc99e4d893064d
-rw-r--r-- | tc0/nano_core.mk | 87 | ||||
-rw-r--r-- | tc0/patches/0001-Add-fvp_mini-launch-target.patch | 325 | ||||
-rw-r--r-- | tc0/tc0_nano.mk | 5 | ||||
-rw-r--r-- | tc0/vendorsetup.sh | 1 |
4 files changed, 338 insertions, 80 deletions
diff --git a/tc0/nano_core.mk b/tc0/nano_core.mk index 1bef22a..61b0e3a 100644 --- a/tc0/nano_core.mk +++ b/tc0/nano_core.mk @@ -21,97 +21,22 @@ PRODUCT_COPY_FILES += \ $(LOCAL_PATH)/init.common.rc:root/init.common.rc \ $(LOCAL_PATH)/ueventd.total_compute.rc:root/ueventd.total_compute.rc - -# https://source.android.com/devices/tech/ota/apex#configuring_system_to_support_apex_updates $(call inherit-product, $(SRC_TARGET_DIR)/product/updatable_apex.mk) -# https://source.android.com/devices/tech/ota/dynamic_partitions/implement -# https://source.android.com/devices/tech/ota/dynamic_partitions/implement#adb-remount -PRODUCT_USE_DYNAMIC_PARTITIONS := false - -# bionic -PRODUCT_PACKAGES += \ - libstdc++ \ - linker - -# system/core PRODUCT_PACKAGES += \ - adbd \ + com.android.runtime \ crash_dump \ - debuggerd \ + gdbserver \ grep \ - init \ - init.rc \ - init.environ.rc \ - ld.config.txt \ - logcat \ - logd \ - logwrapper \ - reboot \ - run-as \ - tombstoned \ - toolbox - -# system/extras -PRODUCT_PACKAGES += \ - su \ - simpleperf - -# frameworks/native -PRODUCT_PACKAGES += \ - servicemanager \ - libbinder - -# external -PRODUCT_PACKAGES += \ + init_vendor \ ip \ - mkshrc \ - sh \ - strace \ - toybox - -# prebuilts -PRODUCT_PACKAGES += \ - gdbserver64 - -# SELinux packages -PRODUCT_PACKAGES += \ + ping \ selinux_policy_nonsystem \ - selinux_policy_system - -# First and second stage inits. -PRODUCT_PACKAGES += \ - apexd \ - com.android.runtime \ - init_system \ - init_vendor \ - cgroups.json - -# Bootstrap some libraries. -# apexd starts early but /system/bin/init is dynamic. -# https://source.android.com/devices/architecture/modular-system/runtime -PRODUCT_PACKAGES += \ - libc.bootstrap \ - libm.bootstrap \ - libdl.bootstrap # Required host packages PRODUCT_HOST_PACKAGES += \ - adb \ fastboot -# Ensure that this property is always defined so that bionic_systrace.cpp -# can rely on it being initially set by init. -PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \ - debug.atrace.tags.enableflags=0 - -# We always need init.usb.rc even if the device has no USB (for adbd) -PRODUCT_COPY_FILES += \ - system/core/rootdir/init.usb.rc:root/init.usb.rc \ - system/core/rootdir/init.usb.configfs.rc:root/init.usb.configfs.rc \ - system/core/rootdir/ueventd.rc:root/ueventd.rc \ - system/core/rootdir/etc/hosts:system/etc/hosts - # Use a custom public library list, since we don't build most of the libraries # in the standard list. PRODUCT_COPY_FILES += \ @@ -124,9 +49,11 @@ PRODUCT_BRAND := nano # The default setting is to support 32-bit apps only. TARGET_SUPPORTS_64_BIT_APPS := true - # Never build test modules, as they pull a huge number of dependencies. ANDROID_NO_TEST_CHECK := true # Don't use the precollected boot image profile for generating boot image PRODUCT_USE_PROFILE_FOR_BOOT_IMAGE := false + +# The check would fail because there are no boot jars. +SKIP_BOOT_JARS_CHECK ?= true diff --git a/tc0/patches/0001-Add-fvp_mini-launch-target.patch b/tc0/patches/0001-Add-fvp_mini-launch-target.patch new file mode 100644 index 0000000..39b540a --- /dev/null +++ b/tc0/patches/0001-Add-fvp_mini-launch-target.patch @@ -0,0 +1,325 @@ +From 6d952204e0cc797383596a14554481dab08993ec Mon Sep 17 00:00:00 2001 +From: Branislav Rankov <branislav.rankov@arm.com> +Date: Fri, 3 Jul 2020 15:27:26 +0100 +Subject: [PATCH] Add fvp_mini launch target. + +This target can be booted with the same procedure as fvp, but it +only boots to shell. There are no graphics. Only command line +executables can be used on it. It is therefore much smaller and +much faster to boot. + +Change-Id: Idcc79fe7324edec5a59d2f4b9a9ac98ec2533457 +--- + AndroidProducts.mk | 3 +- + fvp.mk | 11 ++---- + fvp_mini.mk | 57 +++++++++++++++++++++++++++++ + fvpbase/BoardConfig.mk | 4 ++- + fvpbase/README.md | 10 +++++- + fvpbase/mini_network.rc | 19 ++++++++++ + fvpbase/mini_network.sh | 24 +++++++++++++ + fvpbase/sepolicy/file_contexts | 1 + + fvpbase/sepolicy/mini_network.te | 10 ++++++ + minimal_system.mk | 61 ++++++++++++++++++++++++++++++++ + 10 files changed, 189 insertions(+), 11 deletions(-) + create mode 100644 fvp_mini.mk + create mode 100644 fvpbase/mini_network.rc + create mode 100755 fvpbase/mini_network.sh + create mode 100644 fvpbase/sepolicy/mini_network.te + create mode 100644 minimal_system.mk + +diff --git a/AndroidProducts.mk b/AndroidProducts.mk +index 364f4ed..9043718 100644 +--- a/AndroidProducts.mk ++++ b/AndroidProducts.mk +@@ -1,3 +1,4 @@ + PRODUCT_MAKEFILES := \ + $(LOCAL_DIR)/sdk_phone_x86_vendor.mk \ +- $(LOCAL_DIR)/fvp.mk ++ $(LOCAL_DIR)/fvp.mk \ ++ $(LOCAL_DIR)/fvp_mini.mk +diff --git a/fvp.mk b/fvp.mk +index 2f7b36f..7ed5c9d 100644 +--- a/fvp.mk ++++ b/fvp.mk +@@ -1,5 +1,5 @@ + # +-# Copyright 2019 The Android Open Source Project ++# Copyright 2020 The Android Open Source Project + # + # Licensed under the Apache License, Version 2.0 (the "License"); + # you may not use this file except in compliance with the License. +@@ -96,11 +96,6 @@ WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY := false + + DEVICE_MANIFEST_FILE := device/generic/goldfish/fvpbase/manifest.xml + +-# Normally, the bootloader is supposed to concatenate the Android initramfs +-# and the initramfs for the kernel modules and let the kernel combine +-# them. However, the bootloader that we're using with FVP (U-Boot) doesn't +-# support concatenation, so we implement it in the build system. +-droid: $(OUT_DIR)/target/product/$(PRODUCT_DEVICE)/boot/ramdisk.img ++ Use a multilib setup (see fvpbase/BoardConfig.mk). ++FVP_MULTILIB_BUILD := true + +-$(OUT_DIR)/target/product/$(PRODUCT_DEVICE)/boot/ramdisk.img: $(OUT_DIR)/target/product/$(PRODUCT_DEVICE)/ramdisk.img $(OUT_DIR)/target/product/$(PRODUCT_DEVICE)/boot/initramfs.img +- gzip -dc $^ > $@ +diff --git a/fvp_mini.mk b/fvp_mini.mk +new file mode 100644 +index 0000000..e0e3721 +--- /dev/null ++++ b/fvp_mini.mk +@@ -0,0 +1,57 @@ ++# ++# Copyright 2020 Arm Ltd. All rights reserved. ++# ++# Licensed under the Apache License, Version 2.0 (the "License"); ++# you may not use this file except in compliance with the License. ++# You may obtain a copy of the License at ++# ++# http://www.apache.org/licenses/LICENSE-2.0 ++# ++# Unless required by applicable law or agreed to in writing, software ++# distributed under the License is distributed on an "AS IS" BASIS, ++# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++# See the License for the specific language governing permissions and ++# limitations under the License. ++# ++ ++$(call inherit-product, $(LOCAL_PATH)/minimal_system.mk) ++ ++$(call inherit-product, $(SRC_TARGET_DIR)/product/updatable_apex.mk) ++ ++$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit_only.mk) ++ ++PRODUCT_NAME := fvp_mini ++PRODUCT_DEVICE := fvpbase ++PRODUCT_BRAND := Android ++PRODUCT_MODEL := AOSP on FVP ++PRODUCT_SOONG_NAMESPACES += device/generic/goldfish ++ ++PRODUCT_SHIPPING_API_LEVEL := 29 ++PRODUCT_USE_DYNAMIC_PARTITIONS := true ++PRODUCT_FULL_TREBLE_OVERRIDE := true ++PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS := false ++PRODUCT_BUILD_BOOT_IMAGE := true ++ ++OVERRIDE_TARGET_FLATTEN_APEX := true ++ ++# Use a multilib setup (see fvpbase/BoardConfig.mk). ++FVP_MULTILIB_BUILD ?= true ++ ++PRODUCT_PACKAGES += \ ++ com.android.runtime \ ++ gdbserver \ ++ init_vendor \ ++ ip \ ++ ping \ ++ selinux_policy_nonsystem \ ++ ++PRODUCT_HOST_PACKAGES += \ ++ bind_to_localhost ++ ++PRODUCT_COPY_FILES += \ ++ device/generic/goldfish/fvpbase/fstab.fvpbase:$(TARGET_COPY_OUT_VENDOR)/etc/fstab.fvpbase \ ++ device/generic/goldfish/fvpbase/fstab.fvpbase.initrd:$(TARGET_COPY_OUT_RAMDISK)/fstab.fvpbase \ ++ device/generic/goldfish/fvpbase/init.fvpbase.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/hw/init.fvpbase.rc \ ++ device/generic/goldfish/fvpbase/mini_network.rc:system/etc/init/mini_network.rc \ ++ device/generic/goldfish/fvpbase/mini_network.sh:/system/bin/mini_network.sh \ ++ device/generic/goldfish/fvpbase/required_images:required_images \ +diff --git a/fvpbase/BoardConfig.mk b/fvpbase/BoardConfig.mk +index 234645e..8d99086 100644 +--- a/fvpbase/BoardConfig.mk ++++ b/fvpbase/BoardConfig.mk +@@ -1,4 +1,4 @@ +-# Copyright (C) 2019 The Android Open Source Project ++# Copyright (C) 2020 The Android Open Source Project + # + # Licensed under the Apache License, Version 2.0 (the "License"); + # you may not use this file except in compliance with the License. +@@ -18,11 +18,13 @@ TARGET_ARCH_VARIANT := armv8-a + TARGET_CPU_VARIANT := generic + TARGET_CPU_ABI := arm64-v8a + ++ifeq ($(FVP_MULTILIB_BUILD),true) + TARGET_2ND_ARCH := arm + TARGET_2ND_CPU_ABI := armeabi-v7a + TARGET_2ND_CPU_ABI2 := armeabi + TARGET_2ND_ARCH_VARIANT := armv8-a + TARGET_2ND_CPU_VARIANT := generic ++endif + + include build/make/target/board/BoardConfigMainlineCommon.mk + +diff --git a/fvpbase/README.md b/fvpbase/README.md +index 7a15d7c..d05c7ee 100644 +--- a/fvpbase/README.md ++++ b/fvpbase/README.md +@@ -5,10 +5,18 @@ the ARM Fixed Virtual Platform. + + ``` + . build/envsetup.sh +-lunch fvp-eng # or fvp-userdebug ++lunch $TARGET + m + ``` + ++Where $TARGET above is one of: fvp-eng, fvp-userdebug, fvp_mini-eng or fvp_mini-userdebug ++The fvp-* will build a full Android with UI support, while fvp_mini-* will build a small ++subset needed to boot to shell and support command line executables. ++ ++It is possible to disable 32 bit support in fvp_mini-* targets with the following command ++before ``m``: ++`export FVP_MULTILIB_BUILD=false` ++ + Note that running ``m`` requires that the kernel is built first following + the instructions below. + +diff --git a/fvpbase/mini_network.rc b/fvpbase/mini_network.rc +new file mode 100644 +index 0000000..15a13f8 +--- /dev/null ++++ b/fvpbase/mini_network.rc +@@ -0,0 +1,19 @@ ++# ++# Copyright 2020 Arm Ltd. All rights reserved. ++# ++# Licensed under the Apache License, Version 2.0 (the "License"); ++# you may not use this file except in compliance with the License. ++# You may obtain a copy of the License at ++# ++# http://www.apache.org/licenses/LICENSE-2.0 ++# ++# Unless required by applicable law or agreed to in writing, software ++# distributed under the License is distributed on an "AS IS" BASIS, ++# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++# See the License for the specific language governing permissions and ++# limitations under the License. ++# ++ ++service mini_network /system/bin/mini_network.sh ++ class core ++ oneshot +diff --git a/fvpbase/mini_network.sh b/fvpbase/mini_network.sh +new file mode 100755 +index 0000000..f2c9067 +--- /dev/null ++++ b/fvpbase/mini_network.sh +@@ -0,0 +1,24 @@ ++#!/system/bin/sh ++# ++# Copyright 2020 Arm Ltd. All rights reserved. ++# ++# Licensed under the Apache License, Version 2.0 (the "License"); ++# you may not use this file except in compliance with the License. ++# You may obtain a copy of the License at ++# ++# http://www.apache.org/licenses/LICENSE-2.0 ++# ++# Unless required by applicable law or agreed to in writing, software ++# distributed under the License is distributed on an "AS IS" BASIS, ++# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++# See the License for the specific language governing permissions and ++# limitations under the License. ++# ++ ++# The Android network stack is not included in Nano, so we need to ++# configure the network manually. The configuration below is the same as ++# would be obtained from the fast model's emulated DHCP. ++ ++ip address add 172.20.51.1/24 broadcast 172.20.51.255 dev eth0 ++ip link set eth0 up ++ip route add default via 172.20.51.254 +diff --git a/fvpbase/sepolicy/file_contexts b/fvpbase/sepolicy/file_contexts +index 31cea9a..476231c 100644 +--- a/fvpbase/sepolicy/file_contexts ++++ b/fvpbase/sepolicy/file_contexts +@@ -5,3 +5,4 @@ + /vendor/lib(64)?/libEGL_swiftshader\.so u:object_r:same_process_hal_file:s0 + /vendor/lib(64)?/libGLESv1_CM_swiftshader\.so u:object_r:same_process_hal_file:s0 + /vendor/lib(64)?/libGLESv2_swiftshader\.so u:object_r:same_process_hal_file:s0 ++/system/bin/mini_network.sh u:object_r:mini_network_exec:s0 +diff --git a/fvpbase/sepolicy/mini_network.te b/fvpbase/sepolicy/mini_network.te +new file mode 100644 +index 0000000..c330c8c +--- /dev/null ++++ b/fvpbase/sepolicy/mini_network.te +@@ -0,0 +1,10 @@ ++type mini_network, domain, coredomain; ++type mini_network_exec, exec_type, system_file_type, file_type; ++ ++init_daemon_domain(mini_network) ++ ++allow mini_network self:capability net_admin; ++allow mini_network self:netlink_route_socket { bind create getattr nlmsg_write read setopt write }; ++allow mini_network self:udp_socket { create ioctl }; ++allow mini_network shell_exec:file { execute getattr map read }; ++allow mini_network system_file:file execute_no_trans; +diff --git a/minimal_system.mk b/minimal_system.mk +new file mode 100644 +index 0000000..97851eb +--- /dev/null ++++ b/minimal_system.mk +@@ -0,0 +1,61 @@ ++# ++# Copyright 2020 Arm Ltd. All rights reserved. ++# ++# Licensed under the Apache License, Version 2.0 (the "License"); ++# you may not use this file except in compliance with the License. ++# You may obtain a copy of the License at ++# ++# http://www.apache.org/licenses/LICENSE-2.0 ++# ++# Unless required by applicable law or agreed to in writing, software ++# distributed under the License is distributed on an "AS IS" BASIS, ++# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++# See the License for the specific language governing permissions and ++# limitations under the License. ++# ++ ++# This file contains system partition contents needed for a minimal ++# Android build that boots to shell. The items here should be present in ++# build/make/target/product/base_system.mk. ++ ++PRODUCT_PACKAGES += \ ++ adbd_system_api \ ++ apexd \ ++ boringssl_self_test \ ++ cgroups.json \ ++ com.android.adbd \ ++ com.android.conscrypt \ ++ debuggerd \ ++ hwservicemanager \ ++ init.environ.rc \ ++ init_system \ ++ libbinder \ ++ libc.bootstrap \ ++ libdl.bootstrap \ ++ libdl_android.bootstrap \ ++ libm.bootstrap \ ++ libstdc++ \ ++ linker \ ++ linkerconfig \ ++ logcat \ ++ logd \ ++ run-as \ ++ selinux_policy_system \ ++ servicemanager \ ++ shell_and_utilities_system \ ++ tombstoned \ ++ vold \ ++ ++PRODUCT_HOST_PACKAGES += \ ++ adb \ ++ ++PRODUCT_COPY_FILES += \ ++ system/core/rootdir/init.usb.rc:system/etc/init/hw/init.usb.rc \ ++ system/core/rootdir/init.usb.configfs.rc:system/etc/init/hw/init.usb.configfs.rc \ ++ system/core/rootdir/etc/hosts:system/etc/hosts ++ ++PRODUCT_SYSTEM_PROPERTIES += debug.atrace.tags.enableflags=0 ++ ++PRODUCT_PACKAGES_DEBUG := \ ++ strace \ ++ su \ +-- +2.17.1 + diff --git a/tc0/tc0_nano.mk b/tc0/tc0_nano.mk index 3979de6..91a2586 100644 --- a/tc0/tc0_nano.mk +++ b/tc0/tc0_nano.mk @@ -14,6 +14,7 @@ # limitations under the License. # +$(call inherit-product, device/generic/goldfish/minimal_system.mk) $(call inherit-product, $(LOCAL_PATH)/nano_core.mk) $(call inherit-product, $(LOCAL_PATH)/nano_art_minimal.mk) $(call inherit-product, $(LOCAL_PATH)/device.mk) @@ -23,5 +24,9 @@ PRODUCT_MANUFACTURER := Arm PRODUCT_DEVICE := tc0_nano PRODUCT_MODEL := Total Compute Fast Model (Nano build) +OVERRIDE_TARGET_FLATTEN_APEX := true + +MULTILIB_BUILD := true + PRODUCT_COPY_FILES += \ $(LOCAL_PATH)/tc0_nano/init.tc0_nano.rc:root/init.total_compute.rc
\ No newline at end of file diff --git a/tc0/vendorsetup.sh b/tc0/vendorsetup.sh index aecf073..60f548a 100644 --- a/tc0/vendorsetup.sh +++ b/tc0/vendorsetup.sh @@ -36,3 +36,4 @@ PATCHES_DIR=$ANDROID_TOP_DIR/device/arm/tc0/patches apply_patch "system/core" "0001-Add-amba-bus-support-to-platform-devices.patch" apply_patch "external/minigbm" "0001-minigbm-komeda-Add-driver.patch" apply_patch "external/swiftshader" "0001-Don-t-unlock-Android-buffers-immediately-after-locki.patch" +apply_patch "device/generic/goldfish" "0001-Add-fvp_mini-launch-target.patch" |