KernelModuleUtils

public class KernelModuleUtils
extends Object

java.lang.Object
   ↳ com.android.tradefed.util.KernelModuleUtils


摘要

公用建構函式

KernelModuleUtils()

公用方法

static String[] getDependentModules(String modName, String lsmodOutput)

傳回指定模組依附的模組名稱。

static String getDisplayedModuleName(String fullPath)

傳回模組名稱,如同載入後顯示的名稱。

static CommandResult installModule(ITestDevice device, String modulePath, String arg, long timeoutMs)

在指定裝置上安裝核心模組。

static String removeKoExtension(String s)

移除 `.ko` 副檔名 (如果有的話)

static CommandResult removeModuleWithDependency(ITestDevice device, String moduleName)

從指定裝置中移除核心模組和相關模組。

static CommandResult removeSingleModule(ITestDevice device, String moduleName)

從指定裝置移除核心模組。

公用建構函式

KernelModuleUtils

public KernelModuleUtils ()

公用方法

getDependentModules

public static String[] getDependentModules (String modName, 
                String lsmodOutput)

傳回指定模組所依附的模組名稱。

舉例來說,如果指定的模組為 `kunit`,而 `lsmod` 輸出內容為:

$ lsmod
 Module        Size    Used by
 kunit_test    663552  0
 time_test     663558  0
 kunit         57344   15 kunit_test,time_test
 
接著,這個方法會傳回包含 `kunit_test` 和 `time_test` 的陣列。

參數
modName String

lsmodOutput String

傳回
String[]

getDisplayedModuleName

public static String getDisplayedModuleName (String fullPath)

傳回模組名稱,如同載入後顯示的名稱。

舉例來說,請比較檔案名稱和 `lsmod` 傳回的名稱之間的差異:

$ insmod kunit.ko
 $ lsmod | grep kunit
 kunit 20480 0
 

參數
fullPath String

傳回
String

installModule

public static CommandResult installModule (ITestDevice device, 
                String modulePath, 
                String arg, 
                long timeoutMs)

在指定裝置上安裝核心模組。

參數
device ITestDevice:要安裝模組的裝置

modulePath String:要安裝的模組路徑

arg String:要傳遞至安裝指令的引數

timeoutMs long:逾時時間,以毫秒為單位

傳回
CommandResult

擲回
TargetSetupError 如果無法安裝模組
DeviceNotAvailableException 如果裝置無法使用

removeKoExtension

public static String removeKoExtension (String s)

移除 `.ko` 副檔名 (如果有的話)

參數
s String

傳回
String

removeModuleWithDependency

public static CommandResult removeModuleWithDependency (ITestDevice device, 
                String moduleName)

從指定裝置中移除核心模組和相關模組。

這個方法會嘗試從裝置中移除目標核心模組。如果模組有任何依附元件,系統會盡可能在目標模組前移除這些依附元件模組。

參數
device ITestDevice:要移除模組的裝置

moduleName String:要移除的模組名稱

傳回
CommandResult

擲回
DeviceNotAvailableException 如果裝置無法使用

removeSingleModule

public static CommandResult removeSingleModule (ITestDevice device, 
                String moduleName)

從指定裝置移除核心模組。

這個方法會嘗試從裝置中移除目標核心模組。不會移除任何依附的模組。

參數
device ITestDevice:要移除模組的裝置

moduleName String:要移除的模組名稱

傳回
CommandResult

擲回
DeviceNotAvailableException 如果裝置無法使用