MixKernelTargetPreparer

public class MixKernelTargetPreparer
extends BaseTargetPreparer implements IConfigurationReceiver, ILabPreparer

java.lang.Object
   ↳ com.android.tradefed.targetprep.BaseTargetPreparer
     ↳ com.android.tradefed.targetprep.MixKernelTargetPreparer


A ITargetPreparer that allows to mix a kernel image with the device image.

Summary

Public constructors

MixKernelTargetPreparer()

Public methods

void setConfiguration(IConfiguration configuration)

Injects the IConfiguration in use.

void setUp(TestInformation testInfo)

Perform the target setup for testing.

Protected methods

String[] getKernelVersionFromImage(File image)

Extracts the kernel version from a boot/vendor_boot/system_dlkm/vendor_dlkm image files.

IRunUtil getRunUtil()

Get the IRunUtil instance to use.

String[] parseKernelVersion(String source, String kernelVersionString)
void runMixKernelTool(ITestDevice device, File oldDeviceDir, File kernelDir, File gkiDir, File newDeviceDir)

Run mix kernel tool to generate the new device build

Mixing tool Usage: build_mixed_kernels device_dir out_dir target flavor kernel_dir

void validateKernelCompatibility(String imageName, String[] imageVersion, String[] bootVersion, ITestDevice device)
void validateKernelVersion(File kernelDir, File gkiDir, ITestDevice device)

Validate kernel versions in the images are expected.

Public constructors

MixKernelTargetPreparer

public MixKernelTargetPreparer ()

Public methods

setConfiguration

public void setConfiguration (IConfiguration configuration)

Injects the IConfiguration in use.

Parameters
configuration IConfiguration

setUp

public void setUp (TestInformation testInfo)

Perform the target setup for testing.

Parameters
testInfo TestInformation: The TestInformation of the invocation.

Throws
BuildError
DeviceNotAvailableException
TargetSetupError

Protected methods

getKernelVersionFromImage

protected String[] getKernelVersionFromImage (File image)

Extracts the kernel version from a boot/vendor_boot/system_dlkm/vendor_dlkm image files.

Parameters
image File: The File to the image file.

Returns
String[] A ERROR(/String[]) containing the parsed kernel version info: [kernelVersion, patchLevel, pageSize]. Returns null if the version string cannot be parsed.

getRunUtil

protected IRunUtil getRunUtil ()

Get the IRunUtil instance to use.

Returns
IRunUtil the IRunUtil to use

parseKernelVersion

protected String[] parseKernelVersion (String source, 
                String kernelVersionString)

Parameters
source String

kernelVersionString String

Returns
String[]

runMixKernelTool

protected void runMixKernelTool (ITestDevice device, 
                File oldDeviceDir, 
                File kernelDir, 
                File gkiDir, 
                File newDeviceDir)

Run mix kernel tool to generate the new device build

Mixing tool Usage: build_mixed_kernels device_dir out_dir target flavor kernel_dir

Parameters
device ITestDevice: the test device

oldDeviceDir File: the directory File contains old device images

kernelDir File: the directory File contains kernel images destination

gkiDir File: the directory File contains GKI kernel images destination

newDeviceDir File: the directory File where new device images will be generated to

Throws
TargetSetupError if fails to run mix kernel tool
java.io.IOException

validateKernelCompatibility

protected void validateKernelCompatibility (String imageName, 
                String[] imageVersion, 
                String[] bootVersion, 
                ITestDevice device)

Parameters
imageName String

imageVersion String

bootVersion String

device ITestDevice

Throws
TargetSetupError

validateKernelVersion

protected void validateKernelVersion (File kernelDir, 
                File gkiDir, 
                ITestDevice device)

Validate kernel versions in the images are expected. Throw exception if not valid.

Parameters
kernelDir File: the directory File contains kernel images

gkiDir File: the directory File contains GKI images

device ITestDevice: the ITestDevice

Throws
TargetSetupError if there is no valid gki boot.img