반응형
4.1 Device file의 개요
n
Device file이란?
Device file이란?
Device file은 kernel에 포함된 driver(device와 관련된 중요한 정보)를 참조하고
(major number를 통해서), device가 연결되어 있는 시스템의 H/W 위치를 지칭
한다.(minor number를 통해서)
HP-UX는 device file을 통해 주변기기의 동작을 수행하며, device file의 성격
에 따라 그 수행동작을 달리한다.
n Device file type
- Block device file or character device file
- 같은 device가 두 가지의 device file을 가지는 것도 있다.
a. Block device file
. 시스템 버퍼를 이용하여 데이터를 block 단위의 묶음으로 전송
. I/O 속도가 빠르다.
. 주로 기억 장치에 사용 (hard disk, optical disk)
b. Character device file
. 데이터를 한번에 한 문자씩 전송
. 단말기, 프린터, 플로터 등에 사용
n “/dev” Directory 구조
device file은 /dev에 저장되며 각각의 device에 따라 subdirectory로 분류된다.
n Device file naming convention
Device file naming conventions |
prefix [id or device spec] [options] | |
예제1 |
/dev/rmt/0m |
id 를 사용한 예제
즉 0m은 시스템 or 시스템 관리자에 의해 부여된 id일 뿐이다. |
예제2 |
/dev/dsk/c0t6d0 |
Device spec을 사용한 예제
c# : Interface Card instance
t# : Target address on bus
d# : Device unit at target |
4.2 Listing device file
b. ioscan
: 시스템에 구성된 devic의 h/w path, 해당 device와 관련된 모든 device file을
보여준다.
[예제1] # ioscan –fn
ð f : 시스템의 hardware를 scanning해서 full list 형태로 보여준다.
ð n : device file name 을 보여준다.
[예제2] # ioscan –fnkC disk
ð Kernel i/o system data structure(실제 h/w를 scanning하지는 않음)
를 scanning해서 class가 disk인 device만 full list 형태로 보여준다.
c. lsdev
: 시스템에 구성된 device driver를 보여준다.
[예제1] # lsdev
ð <character> <block> <driver> <class> 의 순서로 보여줌
[예제2] # lsdev –d spt
ð driver가 spt 인 device driver 의 list를 보여줌
d. lssf
: device file의 특성을 보여준다.
[예1] # lssf /dev/rmt/0m
4.3 Device file 의 생성 및 삭제
n Device file 생성방법
Ø autoconfiguration
부팅 시 “ioinit “ process에 의해서 new device가 인식되어 해당 device file
이 자동으로 생성 된다.
Ø SAM
Ø insf
- System에 의해 instance number가 할당되지 않았을 때 사용
- 한번에 여러 개를 구성 시 사용.
- 새로 모든 장치를 재구성 시 사용
# insf –H
ð 시스템에 있는 모든 device의 file을 새로 생성하거나 재생성
# insf –H 4/2/0 -e
ð address가 4/2/0에 있는 device의 device file 재생성
Ø mksf
- System에 의해 instance number가 할당되었을 때 사용
- 특정 device file을 구성 시 사용
# mksf –v –r –C disk –m 0x005000 /dev/rdsk/c0t5d0
ð scsi address가 5번인 disk의 character device file을 생성
# mksf –v –C disk –m 0x005000 /dev/dsk/c0t5d0
ð scsi address가 5번인 disk의 block device file을 생성
Ø mknod
- Major number와 minor number를 이용하여 만든다.
# mknod /dev/spt/robotic_arms c 231 0x110000
ð Major number가 231(driver number)이고 minor number(device
위치)가 0x110000인 device file을 생성
Ø rmsf
- 필요 없는 device의 관련된 device file(one or more)을 삭제할 때 사용
# rmsf –a –H 4/2/0
ð address가 4/2/0 이하인 모든 device file을 삭제
[예제 1] DLT library의 robotic controller를 위한 device file 만들기 (HP-PB)
① ioscan으로 robotic controller의 H/W path를 찾는다.
# ioscan –fn
ð 현재는 “unclaimed unknown”으로 display 된다.
② Kernel에 해당 driver를 포함시킨다. (다음 두 줄이 추가됨)
#vi /stand/system
spt
driver spt <H/W Path>
③ Kernel을 새로 구성한다.
☞ “Chap 4 kernel configuration” 참조
④ Spt driver의 character major number를 알아낸다.
# lsdev –d spt
ð Major number가 XXX 라고 가정
⑤ Robotic arm의 minor number를 알아내기 위해 해당 위치를 알아낸다.
a. Robotic controller가 연결되어 있는 ext_bus class의 instance
number 두 자리(AA)
b. Robotic controller의 target class의 SCSI address 한자리(B)
c. Robotic controller의 LUN number 한자리(C)
# ioscan –fn
⑥ “mknod” 명령어를 이용하여 device file을 만든다.
#mknod /dev/spt/robotic_arms c XXX 0xAABC0000
⑦ 생성된 Device file 을 확인한다.
# ioscan –fnH <H/W Path>
ð 새로 생성된 device file이 display 된다.
# mc –p /dev/spt/robotic_arms –r <I><D><S><M>
ð 생성된 robotic controller의 device file을 이용하여 DLT Library
상태를 display 해 본다.
[예제 2] DDS3를 사용하는 tape 장치에서 DDS2용 device file 만들기
① 기존 DDS3의 driver 및 H/W Path 알아내기
# ioscan –fnkC tape
ð drive 및 H/W path를 알아낸다.
Drive는 stape, H/W Path는 0/0/1/0.0.0 이라고 가정(N class)
② DDS2 용 device file 만들기
# mksf –d driver –H 0/0/1/0.0.0 –b DDS2 /dev/rmt/DDS2
③ Device file 확인하기
# ioscan –fnkC tape
ð 생성된 device file “/dev/rmt/DDS2” 가 display 된다.
# lssf /dev/rmt/DDS2
ð “DDS2 DAT” 라는 description이 display된다.
반응형