diff --git a/src/build/make.ts b/src/build/make.ts index 33f84f6..90a47ea 100644 --- a/src/build/make.ts +++ b/src/build/make.ts @@ -29,6 +29,13 @@ export interface ModulesMakefile { symlinks: Array } +export interface BoardMakefile { + abOtaPartitions?: Array + + boardInfo?: string + secontextResolutions?: SelinuxPartResolutions +} + export interface ProductMakefile { namespaces?: Array copyFiles?: Array @@ -38,12 +45,6 @@ export interface ProductMakefile { fingerprint?: string } -export interface BoardMakefile { - abOtaPartitions?: Array - boardInfo?: string - secontextResolutions?: SelinuxPartResolutions -} - function startBlocks() { return [MAKEFILE_HEADER] } @@ -108,6 +109,52 @@ function addContBlock(blocks: Array, variable: String, items: Array 0) { + addContBlock(blocks, partVar, sepolicyDirs) + } + + if (missingContexts.length > 0) { + blocks.push(missingContexts.map(c => `# Missing ${partition} SELinux context: ${c}`) + .join('\n')) + } + } + } + + return finishBlocks(blocks) +} + export function serializeProductMakefile(mk: ProductMakefile) { let blocks = startBlocks() @@ -134,37 +181,3 @@ export function serializeProductMakefile(mk: ProductMakefile) { return finishBlocks(blocks) } - -export function serializeBoardMakefile(mk: BoardMakefile) { - let blocks = startBlocks() - - // TODO: remove when all ELF prebuilts work with Soong - blocks.push('BUILD_BROKEN_ELF_PREBUILT_PRODUCT_COPY_FILES := true') - - // Build vendor? - if (mk.abOtaPartitions?.includes('vendor')) { - blocks.push('BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4') - } - - addContBlock(blocks, 'AB_OTA_PARTITIONS', mk.abOtaPartitions) - - if (mk.boardInfo != undefined) { - blocks.push(`TARGET_BOARD_INFO_FILE := ${mk.boardInfo}`) - } - - if (mk.secontextResolutions != undefined) { - for (let [partition, {sepolicyDirs, missingContexts}] of mk.secontextResolutions.entries()) { - let partVar = SEPOLICY_PARTITION_VARS[partition] - if (sepolicyDirs.length > 0) { - addContBlock(blocks, partVar, sepolicyDirs) - } - - if (missingContexts.length > 0) { - blocks.push(missingContexts.map(c => `# Missing ${partition} SELinux context: ${c}`) - .join('\n')) - } - } - } - - return finishBlocks(blocks) -}