mdev自動加 解除安裝usb儲存裝置

2021-06-19 08:05:15 字數 2830 閱讀 9522

1、編輯mdev配置檔案/etc/mdev.conf,新增如下語句

sd[a-z]*[0-9]    0:0    0660    @(mount -t vfat -o iocharset=

cp936 /dev/$mdev /mnt/udisk)

sd[a-z]*[0-9]    0:0    0660    *(umount /mnt/udisk)

2、核心配置,核心需要支援fat檔案系統

file systems  --->

dos/fat/nt filesystems  --->

<*> msdos fs support

<*> vfat (windows-95) fs support

(437) default codepage for fat

(iso8859-1) default iocharset for fat

-*- native language support  --->

(cp437) default nls option

codepage 437 (united states, canada)

simplified chinese charset (cp

936, gb2312)

ascii (united states)

nls iso 8859-1  (latin 1; western european languages)

device drivers  --->

scsi device support  --->

scsi device support

scsi disk support

[*] usb support  --->

<*>   support for host-side usb

usb mass storage support

realtek card reader support

make -j4    #這樣才會編譯模組

#"-j4"4執行緒,一般幾核心cpu則-j後面就是幾。這樣可以加快編譯速度

3、載入驅動,熱拔插realtek讀卡器需要的驅動模組,建議按照下面順序載入

mount -t nfs -o nolock 192.168.0.101:/develop /mnt/develop

insmod /mnt/develop/project/linux-3.1.6/fs/nls/nls_cp

437.ko    #下面4個驅動模組系統字元編碼支援,

insmod /mnt/develop/project/linux-3.1.6/fs/nls/nls_

cp936.ko

insmod /mnt/develop/project/linux-3.1.6/fs/nls/nls_ascii.ko        #不是必須

insmod /mnt/develop/project/linux-3.1.6/fs/nls/nls_iso8859-1.ko    #不是必須

insmod /mnt/develop/project/linux-3.1.6/drivers/scsi/scsi_mod.ko    #usb磁碟在linux中被當作scsi裝置

insmod /mnt/develop/project/linux-3.1.6/drivers/scsi/sd_mod.ko #很多人都忘記這個模組,讀卡器必須

insmod /mnt/develop/project/linux-3.1.6/drivers/usb/storage/usb-storage.ko  #usb儲存器驅動

insmod /mnt/develop/project/linux-3.1.6/drivers/usb/storage/ums-realtek.ko  #realtek讀卡器驅動

我的飈王讀卡器(用的realtek晶元方案)例項

usb 1-1: new full speed usb device number 11 using s3c2410-ohci

scsi8 : usb-storage 1-1:1.0

scsi 8:0:0:0: direct-access     generic- multi-card       1.00 pq: 0 ansi: 0 ccs

sd 8:0:0:0: [sda] 15646720 512-byte logical blocks: (8.01 gb/7.46 gib)

sd 8:0:0:0: [sda] write protect is off

sd 8:0:0:0: [sda] no caching mode page present

sd 8:0:0:0: [sda] assuming drive cache: write through

sd 8:0:0:0: [sda] no caching mode page present

sd 8:0:0:0: [sda] assuming drive cache: write through

sda:

sda1

sd 8:0:0:0: [sda] no caching mode page present

sd 8:0:0:0: [sda] assuming drive cache: write through

sd 8:0:0:0: [sda] attached scsi removable disk

此時讀卡器上的sd卡已經掛載到了/mnt/udisk目錄

4、解除安裝讀卡器

umount /mnt/udisk或者umount /dev/

sda1

注意:要執行rmmod命令必須先執行如下命令

mkdir -p /lib/modules/`uname -r` 0

給主人留下些什麼吧!~~

mdev 自動建立裝置結點

自動建立裝置檔案 基本原理 驅動程式提供資訊 裝置檔名 裝置號 mdev會根據驅動提供的資訊自動建立裝置檔案 class create device create mdev是busybox自帶的乙個簡化版的udev 作用是在系統啟動和熱插拔 或動態載入驅動程式時,自動產生驅動程式所需的節點檔案,在檔...

使用mdev自動建立多個major相同的裝置節點

include include include include include include include include include include include include include include include include include include module...

mdev自動載入u盤和sd卡

1 用busybox製作根檔案系統的時候,要選擇支援mdev機制 linux system utilities mdev support etc mdev.conf support command execution at device addition removal 2 核心配置時要支援hotp...