ramdisk_module and dtb_prebuild properties are optional

The two properties are now optional, so that we can split boot.img into
boot.img that doesn't have ramdisk and init_boot.img that has only the
ramdisk.

Bug: N/A
Test: m com.android.virt
Change-Id: I5dc8b140893dfbcf69a8b5c099d23b9216217b53
This commit is contained in:
Jiyong Park 2022-01-06 14:28:53 +09:00
parent 69e8731101
commit 393ebfc85c

View file

@ -145,12 +145,10 @@ func (b *bootimg) buildBootImage(ctx android.ModuleContext, vendor bool) android
} }
dtbName := proptools.String(b.properties.Dtb_prebuilt) dtbName := proptools.String(b.properties.Dtb_prebuilt)
if dtbName == "" { if dtbName != "" {
ctx.PropertyErrorf("dtb_prebuilt", "must be set") dtb := android.PathForModuleSrc(ctx, dtbName)
return output cmd.FlagWithInput("--dtb ", dtb)
} }
dtb := android.PathForModuleSrc(ctx, dtbName)
cmd.FlagWithInput("--dtb ", dtb)
cmdline := strings.Join(b.properties.Cmdline, " ") cmdline := strings.Join(b.properties.Cmdline, " ")
if cmdline != "" { if cmdline != "" {
@ -178,20 +176,18 @@ func (b *bootimg) buildBootImage(ctx android.ModuleContext, vendor bool) android
cmd.FlagWithArg("--header_version ", headerVersion) cmd.FlagWithArg("--header_version ", headerVersion)
ramdiskName := proptools.String(b.properties.Ramdisk_module) ramdiskName := proptools.String(b.properties.Ramdisk_module)
if ramdiskName == "" { if ramdiskName != "" {
ctx.PropertyErrorf("ramdisk_module", "must be set") ramdisk := ctx.GetDirectDepWithTag(ramdiskName, bootimgRamdiskDep)
return output if filesystem, ok := ramdisk.(*filesystem); ok {
} flag := "--ramdisk "
ramdisk := ctx.GetDirectDepWithTag(ramdiskName, bootimgRamdiskDep) if vendor {
if filesystem, ok := ramdisk.(*filesystem); ok { flag = "--vendor_ramdisk "
flag := "--ramdisk " }
if vendor { cmd.FlagWithInput(flag, filesystem.OutputPath())
flag = "--vendor_ramdisk " } else {
ctx.PropertyErrorf("ramdisk", "%q is not android_filesystem module", ramdisk.Name())
return output
} }
cmd.FlagWithInput(flag, filesystem.OutputPath())
} else {
ctx.PropertyErrorf("ramdisk", "%q is not android_filesystem module", ramdisk.Name())
return output
} }
bootconfig := proptools.String(b.properties.Bootconfig) bootconfig := proptools.String(b.properties.Bootconfig)