if prebuiltBootImagePath != "" { file := android.ExistentPathForSource(ctx, prebuiltBootImagePath)
// If the prebuilt doesn't exist yet, something else in the build is expected to populate it
// (along with the corresponding prebuilt vbmeta if necessary).
// TODO(b/465530439): this works for the current use case, but may not be the right long-term solution. if !file.Valid() && ctx.Config().KatiEnabled() {
return false
}
if kernelPath == "" {
// There are potentially code paths that don't use `PRODUCT_COPY_FILES` to copy the kernel to
// ANDROID_PRODUCT_OUT
return false
}
kernelDir := filepath.Dir(kernelPath)
kernelBase := filepath.Base(kernelPath)
kernelFilegroupName := generatedModuleName(ctx.Config(), "kernel"+*stem) // to prevent name collisions.
func createBootImage16k(ctx android.LoadHookContext) bool {
partitionVariables := ctx.Config().ProductVariables().PartitionVarsForSoongMigrationOnlyDoNotUse
// TODO: prebuilt boot_16k.img and dtb is currently not supported in fsgen.
return createBootImageCommon(ctx, partitionVariables.BoardKernelPath16k, "", dtbImg{include: false}, proptools.StringPtr("boot_16k.img"))
}
func getPartitionSizeFromString(ctx android.LoadHookContext, s string, name string) proptools.Configurable[int64] { if s == "" {
return proptools.NewEmptyConfigurable[int64]()
}
// Base of zero will allow base 10or base 16if starting with 0x
parsed, err := strconv.ParseInt(s, 0, 64) if err != nil {
ctx.ModuleErrorf("%s must be an int, got %s", name, s)
}
return proptools.NewSimpleConfigurable(parsed)
}
// The first return arg will be true if a vendor_boot.img bootimg moduleis autogenerated.
// The second arg is the ramdisk fragments.
func createVendorBootImage(ctx android.LoadHookContext, dtbImg dtbImg) (bool, []string) {
partitionVariables := ctx.Config().ProductVariables().PartitionVarsForSoongMigrationOnlyDoNotUse
// Same as vendor_boot, with the exception of the ramdisk module.
func createVendorBootDebugImage(ctx android.LoadHookContext, dtbImg dtbImg, ramdiskFragmentModules []string) bool {
partitionVariables := ctx.Config().ProductVariables().PartitionVarsForSoongMigrationOnlyDoNotUse
// Same as vendor_boot-debug, with the exception of some additional properties in the installed adb_debug.prop file.
func createVendorBootTestHarnessImage(ctx android.LoadHookContext, dtbImg dtbImg, ramdiskFragmentModules []string) bool {
partitionVariables := ctx.Config().ProductVariables().PartitionVarsForSoongMigrationOnlyDoNotUse
// Returns true if the product contains a boot image (built from source or prebuilt)
func buildingBootImage(partitionVars android.PartitionVariables) bool { if partitionVars.BoardUsesRecoveryAsBoot {
return false
}
if partitionVars.ProductBuildBootImage {
return true
}
if len(partitionVars.BoardBootimagePartitionSize) > 0 {
return true
}
// TODO: return true if BOARD_KERNEL_BINARIES issetand has a *_BOOTIMAGE_PARTITION_SIZE
// variable. However, I don't think BOARD_KERNEL_BINARIES is ever set in practice.