Merge "Support uncompressed cpio"
This commit is contained in:
@@ -48,8 +48,8 @@ type filesystemProperties struct {
|
|||||||
// Hash and signing algorithm for avbtool. Default is SHA256_RSA4096.
|
// Hash and signing algorithm for avbtool. Default is SHA256_RSA4096.
|
||||||
Avb_algorithm *string
|
Avb_algorithm *string
|
||||||
|
|
||||||
// Type of the filesystem. Currently, ext4 and compressed_cpio are supported. Default is
|
// Type of the filesystem. Currently, ext4, cpio, and compressed_cpio are supported. Default
|
||||||
// ext4.
|
// is ext4.
|
||||||
Type *string
|
Type *string
|
||||||
|
|
||||||
// file_contexts file to make image. Currently, only ext4 is supported.
|
// file_contexts file to make image. Currently, only ext4 is supported.
|
||||||
@@ -83,6 +83,7 @@ type fsType int
|
|||||||
const (
|
const (
|
||||||
ext4Type fsType = iota
|
ext4Type fsType = iota
|
||||||
compressedCpioType
|
compressedCpioType
|
||||||
|
cpioType // uncompressed
|
||||||
unknown
|
unknown
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -93,6 +94,8 @@ func (f *filesystem) fsType(ctx android.ModuleContext) fsType {
|
|||||||
return ext4Type
|
return ext4Type
|
||||||
case "compressed_cpio":
|
case "compressed_cpio":
|
||||||
return compressedCpioType
|
return compressedCpioType
|
||||||
|
case "cpio":
|
||||||
|
return cpioType
|
||||||
default:
|
default:
|
||||||
ctx.PropertyErrorf("type", "%q not supported", typeStr)
|
ctx.PropertyErrorf("type", "%q not supported", typeStr)
|
||||||
return unknown
|
return unknown
|
||||||
@@ -110,7 +113,9 @@ func (f *filesystem) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
case ext4Type:
|
case ext4Type:
|
||||||
f.output = f.buildImageUsingBuildImage(ctx)
|
f.output = f.buildImageUsingBuildImage(ctx)
|
||||||
case compressedCpioType:
|
case compressedCpioType:
|
||||||
f.output = f.buildCompressedCpioImage(ctx)
|
f.output = f.buildCpioImage(ctx, true)
|
||||||
|
case cpioType:
|
||||||
|
f.output = f.buildCpioImage(ctx, false)
|
||||||
default:
|
default:
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -218,7 +223,7 @@ func (f *filesystem) buildPropFile(ctx android.ModuleContext) (propFile android.
|
|||||||
return propFile, deps
|
return propFile, deps
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *filesystem) buildCompressedCpioImage(ctx android.ModuleContext) android.OutputPath {
|
func (f *filesystem) buildCpioImage(ctx android.ModuleContext, compressed bool) android.OutputPath {
|
||||||
if proptools.Bool(f.properties.Use_avb) {
|
if proptools.Bool(f.properties.Use_avb) {
|
||||||
ctx.PropertyErrorf("use_avb", "signing compresed cpio image using avbtool is not supported."+
|
ctx.PropertyErrorf("use_avb", "signing compresed cpio image using avbtool is not supported."+
|
||||||
"Consider adding this to bootimg module and signing the entire boot image.")
|
"Consider adding this to bootimg module and signing the entire boot image.")
|
||||||
@@ -239,18 +244,22 @@ func (f *filesystem) buildCompressedCpioImage(ctx android.ModuleContext) android
|
|||||||
Input(zipFile)
|
Input(zipFile)
|
||||||
|
|
||||||
output := android.PathForModuleOut(ctx, f.installFileName()).OutputPath
|
output := android.PathForModuleOut(ctx, f.installFileName()).OutputPath
|
||||||
builder.Command().
|
cmd := builder.Command().
|
||||||
BuiltTool("mkbootfs").
|
BuiltTool("mkbootfs").
|
||||||
Text(rootDir.String()). // input directory
|
Text(rootDir.String()) // input directory
|
||||||
Text("|").
|
if compressed {
|
||||||
BuiltTool("lz4").
|
cmd.Text("|").
|
||||||
Flag("--favor-decSpeed"). // for faster boot
|
BuiltTool("lz4").
|
||||||
Flag("-12"). // maximum compression level
|
Flag("--favor-decSpeed"). // for faster boot
|
||||||
Flag("-l"). // legacy format for kernel
|
Flag("-12"). // maximum compression level
|
||||||
Text(">").Output(output)
|
Flag("-l"). // legacy format for kernel
|
||||||
|
Text(">").Output(output)
|
||||||
|
} else {
|
||||||
|
cmd.Text(">").Output(output)
|
||||||
|
}
|
||||||
|
|
||||||
// rootDir is not deleted. Might be useful for quick inspection.
|
// rootDir is not deleted. Might be useful for quick inspection.
|
||||||
builder.Build("build_compressed_cpio_image", fmt.Sprintf("Creating filesystem %s", f.BaseModuleName()))
|
builder.Build("build_cpio_image", fmt.Sprintf("Creating filesystem %s", f.BaseModuleName()))
|
||||||
|
|
||||||
return output
|
return output
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user