load_module.sh

来自「bochs : one pc simulator.」· Shell 代码 · 共 56 行

SH
56
字号
#! /bin/bash## A simple script to load up the kernel module and create the device nodes# for it.## Note:# this must be run as root## Work out where the module iskmodule="`dirname $0`/../kernel/plex86.o"# Check that root is executing usif [ "$EUID" != "0" ]; then    echo "Sorry, you need to be root for this script to work."    echo "use 'su -c $0' and enter the root password when prompted"    exit -1fi# Check if the module existsif [ ! -f "$kmodule" ]; then    echo "The kernel module ($kmodule) does not exist!"    exit -1fi# Check if the module is already loadedif [ "x`grep plex86 /proc/devices`" != "x" ]; then    echo "The kernel module is already loaded!"    exit -1fi# Remove any stale device nodes# (extend for any minor devices created in the future)rm -f /dev/plex86# Load up the module with insmod/sbin/insmod $kmodule# Check if the module loadedmajor=`grep plex86 /proc/devices | awk '/plex86/ {print $1;}'`if [ "x$major" = "x" ]; then    echo "The kernel module failed to load!"    exit -1fi# Create the device node and set its permissions# (extend for any minor devices created in the future)if [ ! -c /dev/plex86 ]; then    /bin/mknod /dev/plex86 c $major 0fichmod a+rw /dev/plex86# Job done - Give a little positive feedbackecho "The kernel module is sucessfully installed."exit 0

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?