⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 kernel_patch.sh

📁 无线网卡驱动程序 802.11b无线网卡可直接移植到2.6内核中去
💻 SH
字号:
#!/bin/bash# arg1: kernel source root dir# arg2..n: files to copy#set -xif [ $# -ne 1 ]; then        echo "#ERR call $0 kernel_root_dir"        echo "set environment vars DRV_SRC, DRV_HDR to the file names"        exit 1fiKSRC=$1DEST=$KSRC/drivers/net/wireless# subdir created in the above pathSUBDIR=at76c503# source of the makefile for the kernel subdirKMAKEFILE=Makefile.k26if [ "$DRV_SRC" == "" ]; then echo "#ERR env var DRV_SRC not set or empty"; exit 1; fiif [ "$DRV_HDR" == "" ]; then echo "#ERR env var DRV_HDR not set or empty"; exit 1; fiif [ ! -r at76c503.h ]; then echo "#ERR cannot read at76c503.h"; exit 2; fiif [ ! -d $DEST ]; then echo "#ERR $DEST is no directory"; exit 3; fiif [ ! -w $DEST ]; then  echo "#ERR cannot write to directory $DEST"; exit 4; fiif [ ! -d $DEST/$SUBDIR ]; then    echo "creating $DEST/$SUBDIR"    if  mkdir -p $DEST/$SUBDIR; then true; else echo "#ERR cannot create dir $DEST/$SUBDIR" && exit 5; fielse    if [ ! -d $DEST/$SUBDIR ]; then        echo "#ERR $DEST/$SUBDIR exists and is no directory"; exit 5    fi    if [ ! -w $DEST/$SUBDIR ]; then        echo "#ERR dir $DEST/$SUBDIR exists and is not writable"; exit 5    fifiVERSION=`grep '^#define DRIVER_VERSION' at76c503.h | sed 's/#define.*DRIVER_VERSION.*\"\(.*\)\".*$/\1/g'`echo "patching driver version $VERSION into kernel source $KSRC"echo "copying $DRV_SRC $DRV_HDR $KMAKEFILE into $DEST/$SUBDIR"# for tests only#exit 0for f in $DRV_SRC $DRV_HDR; do    if cp -v $f $DEST/$SUBDIR; then true; else echo "#ERR cannot copy $i into $DEST/$SUBDIR"; exit 5; fidone# copy the Makefileif cp -v $KMAKEFILE $DEST/$SUBDIR/Makefile; then     true;else    echo "#ERR cannot copy $KMAKEFILE into $DEST/$SUBDIR/Makefile"    exit 5fi# patch KconfigPWD=`pwd`cd $DESTif grep "^config USB_ATMEL" Kconfig; then    echo "found \"config USB_ATMEL\" in $DEST/Kconfig - leave it untouched"else    echo "going to patch $DEST/Kconfig (original copied into Kconfig.orig)"    mv Kconfig Kconfig.orig# remove the last endmenu in Kconfig    head -$((`grep -n endmenu Kconfig.orig | tail -1 | sed 's/\([0-9]*\).*/\1/'`-1)) Kconfig.orig > Kconfig     (cat <<"EOF"config USB_ATMEL	tristate "Atmel at76c503a/505/505a USB adapter"	depends on NET_RADIO && ATMEL && USB	select FW_LOADER	---help---	  Enable support for WLAN USB adapters containing the	  Atmel at76c503a, 505 and 505a chips.endmenuEOF  ) >> Kconfigfi     # patch the Makefileif grep "CONFIG_USB_ATMEL" Makefile; then    echo "found \"config CONFIG_USB_ATMEL\" in $DEST/Makefile - leave it untouched"else    echo "going to patch $DEST/Makefile (original copied into Makefile.orig)"    cp Makefile Makefile.orig    (cat <<EOFobj-\$(CONFIG_USB_ATMEL)		+= $SUBDIR/EOF  ) >> Makefilefi        

⌨️ 快捷键说明

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