commit 0eb4092c0fd629e2ecc4ef0b7f20fcd4200e399a Author: Anonymous Date: Thu Apr 2 04:39:56 2020 +0200 Initial commit diff --git a/BoardConfig-product.md b/BoardConfig-product.md new file mode 100644 index 0000000..70c57dd --- /dev/null +++ b/BoardConfig-product.md @@ -0,0 +1,49 @@ +# Replacing Android.mk + +## What devices currently do + +Choose HAL variants, pass Make flags to HAL build systems + +Add packages + +Add prebuilt or config files -> can be moved into packages + +Set props + +Inherit product files, inherit stuff from build/make/target/product + +Set variables that configure HALs, initiate build guards + +Use conditionals massively + +Add soong namespaces, add soong configs + +Add overlays + +Add manifest files + +Use CleanSpec.mk files for deleted and moved module remnants + +Use shell tools invoked from make to manipulate files + +AndroidProducts.mk: Add `COMMON_LUNCH_CHOICES` and `PRODUCT_MAKEFILES`, +add lunch targets, set PRODUCT variables + +BoardConfig.mk: Set base stuff like target arch, kernel, more non-`PRODUCT` variables + +## Issues + +Currently, you have three stages: `PRODUCT` variables via `PRODUCT_MAKEFILES` +and `inherit-product` but also `include` chains, generic variables via +`BoardConfig` and `include` chains, module/package-specific via `Android.mk` and +`include` chains. + +## Terminology + +Product, board, device, sku, soc, customization + +`system, vendor, product, system_ext, odm, oem, cust, misc` +`soc_specific, device_specific, system_ext_specific` + +## Questions +Use CamelCase, smallCammelCase, under_scores for configs? diff --git a/Product.bp b/Product.bp new file mode 100644 index 0000000..e10f84d --- /dev/null +++ b/Product.bp @@ -0,0 +1,88 @@ +// Syntax: Blueprint + +// TODO: Should conditionally importing .bp files be allowed? +build = [ + "board.bp", + "overlays.bp", + "product_packages.bp", + "sysprops.bp", + "vintf.bp", +] + +product { + name: "aosp_roadrunner_product", + manufacturer: "ACME", + device: "roadrunner", + + board_configs: [ + "acme_board_config", + ], + + product_imports: [ + "aosp_base_system_product", + ], + + soong_namespaces: [ + "//vendor/acme/foo", + ], + // The whole SOONG_CONFIG_ kerfuffle not a very elegant solution + // imo, better to replace it entirely + soong_config_namespaces: [ + "acme", + ] + + // PRODUCT_ variables + // product_variables already taken + product_variables_config: { + // PRODUCT_BUILD_SUPER_PARTITION + build_super_partition: true, + shipping_api_level: 29, + } + // SOONG_CONFIG_acme variables + // soong_config_variables already taken + soong_config_variables_config: { + acme: { + enable_dsp_device: true, + use_drm_hwcomposer: false, + }, + } + // "Packages" are rather "modules" and often only virtual + product_packages: [ + ":aosp_phone_default_packages", + ":acme_packages", + "acme_sysprops", + ], + product_packages_debug: [ + ":aosp_generic_additional_debug_packages", + ], + + // PRODUCT_COPY_FILES is superseded by prebuilt_* + // For e.g. configs, define: + // prebuilt_etc { + // name: "init.acme.rc", + // src: "init.acme.rc", + // vendor: true, + // } + // and add init.acme.rc to product_packages + + product_overlays: [ + "acme_red_overlay", + ] + vintf_configs: [ + "acme_vintf_config", + ], + sysprop_configs: [ + "acme_sysprops", + ], +} + +product { + name: "aosp_coyote", + product_imports: [ + "aosp_roadrunner_product", + ], + product_packages: [ + "Dynamite", + // Might need product_exclude_packages as well + ], +} diff --git a/board.bp b/board.bp new file mode 100644 index 0000000..085e39e --- /dev/null +++ b/board.bp @@ -0,0 +1,93 @@ +// Syntax: Blueprint + +board_config { + name: "acme_board_config", + platform: "msmnile", + + target_arch: "arm64", + target_arch_variant: "armv8-a", + target_cpu_abi: "arm64-v8a", + target_cpu_abi2 :=", + target_cpu_variant: "generic", + target_cpu_variant_runtime: "cortex-a76", + + target_2nd_arch: "arm", + target_2nd_arch_variant: "armv8-a", + target_2nd_cpu_abi: "armeabi-v7a", + target_2nd_cpu_abi2: "armeabi", + target_2nd_cpu_variant: "generic", + target_2nd_cpu_variant_runtime: "cortex-a76", +} + +// boot.img but also kernel and dtbo configs, recovery +bootimg_config { + name: "acme_bootimg_config", + + kernel_base: "0x00000000", + kernel_page_size: "4096", + kernel_cmdline: [ + "androidboot.memcg=1", + "cgroup.memory=nokmem", + ], + + // TODO: Use prebuilt_ module class for this? + prebuilt_dtbo_image: "//device/acme/coyote-kernel/dtbo.img", + dtbo_image_partition_size: "10000", + include_dtb_in_bootimg: true, + mkbootimg_args: [ + "--header_version 2", + ], + recovery_as_boot: true, + no_kernel: false, +} + +filesystem_config { + name: "acme_filesystem_config", + + uses_metadata_partition: true, + fs_config_gen: "config.fs", + recovery_wipe: "recovery.wipe", + // This should match the name of the prebuilt_etc module + // for fstab.hardware: + fstab: "fstab.hardware", + + ab_ota: true, + ab_ota_partitions: [ + "boot", + "system", + "vbmeta", + "dtbo", + ], + // Dynamic partitions? +} + +avb_config: { + // AVB/vbmeta and dm-verity stuff + name: "acme_avb_vbmeta_system", + system: true, // default + partitions: [ + "system", + "system_ext", + ], + product_variables: { + platform_security_patch: { + rollback_index_system: "%s", + }, + }, + algorithm: "SHA256_RSA2048", + // Matches module avb_key(?) in external/avb/test/data + keys: ["avb_system_testkey_rsa2048.pem"], +} + +// Makes more sense to move this into +// device/acme/roadrunner-sepolicy/Android.bp +sepolicy_config { + // Match current DeviceConfig.VendorSepolicyDirs()? + vendor_sepolicy_dirs: [ + "sepolicy/acme/vendor", + "sepolicy/thirdparty/vendor", + ], + product_sepolicy_dirs: [ + "sepolicy/thirdparty/product", + ], +} diff --git a/overlays.bp b/overlays.bp new file mode 100644 index 0000000..189b469 --- /dev/null +++ b/overlays.bp @@ -0,0 +1,8 @@ +// Syntax: Blueprint + +overlay: { + name: "acme_red_overlay", + // DEVICE_PACKAGE_OVERLAYS + device: true, + srcs: ["overlay"], // allow only a single src per pkg? +} diff --git a/product_packages.bp b/product_packages.bp new file mode 100644 index 0000000..e024185 --- /dev/null +++ b/product_packages.bp @@ -0,0 +1,21 @@ +// Syntax: Blueprint + +// Similar to filegroup +package_group { + name: "acme_packages", + // TODO: This is way too convoluted + // Optional, for PRODUCT_PACKAGES_DEBUG + // If debug/eng set to true and filegroup is included in regular + // product_packages it should be empty + //debug: true, + // Or + //eng: true, + + // Maybe "modules" is a better terminology? + packages: [ + "WallpaperPicker", + "Dialer, + "update_engine", + "vndk_apex_snapshot_package", + ], +} diff --git a/sysprops.bp b/sysprops.bp new file mode 100644 index 0000000..8cbafb4 --- /dev/null +++ b/sysprops.bp @@ -0,0 +1,21 @@ +// Syntax: Blueprint + +sysprop_config { + name: "acme_sysprops", + //sysprop_section: { + // // Must match module name + // name: "android.sysprop.ChargerProperties", + // Matches sysprop_library module name + charger_sysprop: + // No need to specify which section this + // "overrides" because sysprops have "owner". + // If desired, could be overriden by e.g. + //oem: true, + // for PRODUCT_OEM_PROPERTIES + props: { + // Can just re-use api_name + draw_split_screen: false, + enable_suspend: true, + }, + }, +} diff --git a/vintf.bp b/vintf.bp new file mode 100644 index 0000000..92cc63b --- /dev/null +++ b/vintf.bp @@ -0,0 +1,8 @@ +// Syntax: Blueprint + +vintf_config { + name: "acme_vintf_config", + device_manifest: ["manifest.xml"], + device_matrix: ["compatibility_matrix.xml"], + device_fcm: ["device_framework_matrix"], +}