Starting March 27, 2025, we recommend using android-latest-release instead of aosp-main to build and contribute to AOSP. For more information, see Changes to AOSP.
         
       
     
  
  
  
  
  
    
    
      
    
    
      
      Stay organized with collections
    
    
      
      Save and categorize content based on your preferences.
    
  
  
    
  
  
  
  
    
  
  
    
    
  
  
KernelModuleUtils
  public
  
  
  
  class
  KernelModuleUtils
  
    extends Object
  
  
  
  
  
  
  
    
    | java.lang.Object
     | 
  
  
  
    
      |    ↳ | 
    
    com.android.tradefed.util.KernelModuleUtils
     | 
  
  
  
    
Summary
Public constructors
    KernelModuleUtils
    
public KernelModuleUtils ()
    
    
    
  
 
Public methods
    getDependentModules
    
public static String[] getDependentModules (String modName, 
                String lsmodOutput)
    
    
    
  Return the names of the modules that the given module depends on.
 
For example, if the given module is `kunit`, and the `lsmod` output is:
 
$ lsmod
 Module        Size    Used by
 kunit_test    663552  0
 time_test     663558  0
 kunit         57344   15 kunit_test,time_test
 
 Then this method will return an array containing `kunit_test` and `time_test`.
    
    | Parameters | 
      
        modName | 
        
          String  | 
      
      
        lsmodOutput | 
        
          String  | 
      
    
    
 
    getDisplayedModuleName
    
public static String getDisplayedModuleName (String fullPath)
    
    
    
  Return module name as it's displayed after loading.
 
For example, see the difference between the file name and that returned by `lsmod`:
 
$ insmod kunit.ko
 $ lsmod | grep kunit
 kunit 20480 0
 
    
    | Parameters | 
      
        fullPath | 
        
          String  | 
      
    
    
 
    installModule
    
public static CommandResult installModule (ITestDevice device, 
                String modulePath, 
                String arg, 
                long timeoutMs)
    
    
    
  Install a kernel module on the given device.
    
    | Parameters | 
      
        device | 
        
          ITestDevice: the device to install the module on | 
      
      
        modulePath | 
        
          String: the path to the module to install | 
      
      
        arg | 
        
          String: the argument to pass to the install command | 
      
      
        timeoutMs | 
        
          long: the timeout in milliseconds | 
      
    
    
      
  
 
    removeKoExtension
    
public static String removeKoExtension (String s)
    
    
    
  Remove `.ko` extension if present
    
    
 
    removeModuleWithDependency
    
public static CommandResult removeModuleWithDependency (ITestDevice device, 
                String moduleName)
    
    
    
  Remove a kernel module and dependent modules from the given device.
 
This method attempts to remove the target kernel module from the device. If the module has
 any dependencies, those dependent modules will be removed before the target module with best
 effort.
    
    | Parameters | 
      
        device | 
        
          ITestDevice: the device to remove the module from | 
      
      
        moduleName | 
        
          String: the name to the module to remove | 
      
    
    
      
  
 
    removeSingleModule
    
public static CommandResult removeSingleModule (ITestDevice device, 
                String moduleName)
    
    
    
  Remove a kernel module from the given device.
 
This method attempts to remove the target kernel module from the device. No dependent
 modules will be removed.
    
    | Parameters | 
      
        device | 
        
          ITestDevice: the device to remove the module from | 
      
      
        moduleName | 
        
          String: the name to the module to remove | 
      
    
    
      
  
 
 
 
  
  
 
  
    
    
      
    
    
  
       
    
    
  
  
  Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
  Last updated 2025-01-30 UTC.
  
  
  
    
      [[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-01-30 UTC."],[],[]]