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

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

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 如果無法使用裝置