make file system type of OS partitions part of device config

This commit is contained in:
Dmitry Muhomor 2023-08-25 18:44:22 +03:00 committed by Daniel Micay
parent 694afd844b
commit d7594443cd
5 changed files with 24 additions and 7 deletions

View file

@ -5,6 +5,8 @@ includes:
device:
vendor: google_devices
system_fs_type: ext4
build_id: TQ3A.230805.001
prev_build_id: TQ3A.230705.001

View file

@ -25,6 +25,7 @@ import {
SPECIAL_FILE_EXTENSIONS,
TYPE_SHARED_LIBRARY,
} from '../build/soong'
import { DeviceConfig } from '../config/device'
import { BlobEntry, blobNeedsSoong } from './entry'
export interface BuildFiles {
@ -206,7 +207,11 @@ export async function createVendorDirs(vendor: string, device: string) {
} as VendorDirectories
}
export async function writeBuildFiles(build: BuildFiles, dirs: VendorDirectories) {
export async function writeBuildFiles(
build: BuildFiles,
dirs: VendorDirectories,
config?: DeviceConfig
) {
if (build.rootBlueprint != undefined) {
let bp = serializeBlueprint(build.rootBlueprint)
await fs.writeFile(`${dirs.out}/Android.bp`, bp)
@ -228,7 +233,7 @@ export async function writeBuildFiles(build: BuildFiles, dirs: VendorDirectories
}
if (build.boardMakefile != undefined) {
let mk = serializeBoardMakefile(build.boardMakefile)
let mk = serializeBoardMakefile(build.boardMakefile, config)
await fs.writeFile(`${dirs.proprietary}/BoardConfigVendor.mk`, mk)
}

View file

@ -1,6 +1,7 @@
import { basename, dirname } from 'path'
import { BlobEntry } from '../blobs/entry'
import { PartitionProps } from '../blobs/props'
import { DeviceConfig } from '../config/device'
import { SelinuxPartResolutions } from '../selinux/contexts'
import { MAKEFILE_HEADER } from '../util/headers'
@ -137,26 +138,28 @@ function addContBlock(blocks: Array<string>, variable: string, items: Array<stri
}
}
export function serializeBoardMakefile(mk: BoardMakefile) {
export function serializeBoardMakefile(mk: BoardMakefile, config?: DeviceConfig) {
let blocks = startBlocks()
// TODO: remove this when all ELF prebuilts work with Soong
blocks.push('BUILD_BROKEN_ELF_PREBUILT_PRODUCT_COPY_FILES := true')
let systemFsType = config?.device?.system_fs_type ?? 'ext4'
// Build vendor?
if (mk.buildPartitions?.includes('vendor')) {
blocks.push('BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4')
blocks.push(`BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ${systemFsType}`)
}
// Build DLKM partitions?
if (mk.buildPartitions?.includes('vendor_dlkm')) {
blocks.push(`BOARD_USES_VENDOR_DLKMIMAGE := true
BOARD_VENDOR_DLKMIMAGE_FILE_SYSTEM_TYPE := ext4
BOARD_VENDOR_DLKMIMAGE_FILE_SYSTEM_TYPE := ${systemFsType}
TARGET_COPY_OUT_VENDOR_DLKM := vendor_dlkm`)
}
if (mk.buildPartitions?.includes('odm_dlkm')) {
blocks.push(`BOARD_USES_ODM_DLKIMAGE := true
BOARD_ODM_DLKIMAGE_FILE_SYSTEM_TYPE := ext4
BOARD_ODM_DLKIMAGE_FILE_SYSTEM_TYPE := ${systemFsType}
TARGET_COPY_OUT_ODM_DLKM := odm_dlkm`)
}

View file

@ -15,11 +15,18 @@ export enum ConfigType {
DeviceList = 'device-list',
}
export enum FsType {
EXT4 = 'ext4',
EROFS = 'erofs',
}
export interface DeviceConfig {
// Required
device: {
name: string
vendor: string
// file system type of OS partitions
system_fs_type: FsType
build_id: string
prev_build_id: string
}

View file

@ -376,5 +376,5 @@ export async function generateBuildFiles(
}
}
await writeBuildFiles(build, dirs)
await writeBuildFiles(build, dirs, config)
}