NeXTSTEPDRIVERKIT:Chapter4 1

From 흡혈양파의 번역工房
Jump to navigation Jump to search
Driver Bundles

드라이버 Bundles(Driver Bundles)

To load your driver into the kernel--even if only for testing--you need to create a driver bundle for it with Project Builder. A driver bundle contains all the files needed to load and configure a driver: Its relocatable code and configuration information. A bundle may also contain help information and a configuration inspector for Configure to access configuration data. A driver bundle is also called a config bundle because it contains configuration information for the driver and typically has the name Driver.config, where Driver is the driver's name.
테스트용도 한정으로만 커널에 드라이버를 로드하려면 Project Builder 에서 driver bundle 을 생성해야 합니다. driver bundle 은 드라이버를 로드하고 구성하는데 필요한 모든 파일(재배치 가능한 코드 및 구성 정보)을 포함합니다. bundle 에는 설정 정보(configuration information)에 접근 설정에 대한 도움말 정보 및 설정 관리자(configuration inspector)가 포함될 수도 있습니다. 드라이버 번들은 드라이버의 설정 정보를 포함하며 일반적으로 Driver.config 이라는 이름을 가지기 때문에 설정 번들이라고도합니다. 여기서 Driver 는 드라이버의 이름입니다.


The driver name should be of the form
드라이버 이름은 다음과 같은 형식이어야 합니다.

<vendor><model><type>Driver


The driver name Adaptec1542SCSIDriver follows this form.
Adaptec1542SCSIDriver 드라이버 이름이 이 양식을 따릅니다.


Bundle 경로

Driver bundles for each system device--like the mouse, display, network card, SCSI devices, and so on--reside in a special directory called /NextLibrary/Devices. The bundles for each type of device are called Driver.config, where Driver is a type of device or a device name. In addition, every system has a bundle called System.config that configures the whole system.
마우스, 디스플레이, 네트워크 카드, SCSI 장치 등과 같은 각 시스템 장치용 드라이버 번들은 /NextLibrary/Devices 라는 특수 디렉토리에 있습니다. 각 유형의 장치에 대한 번들은 Driver.config 이라고 하며 여기서 Driver 는 장치 유형 또는 장치 이름입니다. 또한 모든 시스템에는 전체 시스템을 구성하는 System.config 이라는 번들이 있습니다.


An average system's directory /NextLibrary/Devices might contain the following directories, each of which is a bundle for a specific device:
평균적인 시스템의 디렉토리인 /NextLibrary/Devices 에는 다음과 같은 디렉토리들이 있을 수 있으며, 각 디렉토리는 특정 장치에 대한 번들입니다:

ATI.config
Adaptec1542B.config
Beep.config
BusMouse.config
CirrusLogicGD542X.config
CompaqAudio.config
DPT2012.config
EtherExpress16.config
EtherLink3.config
Floppy.config
IDE.config
IntelGXProAudio.config
JAWS.config
MSWSoundSystem.config
PS2Keyboard.config
PS2Mouse.config
ParallelPort.config
ProAudioSpectrum.config
QVision.config
S3.config
SCSITape.config
SMC16.config
SerialMouse.config
SerialPorts.config
System.config
TokenExpress.config
TsengLabsET4000.config
VGA.config
Wingine.config


/NextLibrary/Devices is a link to the /private/Devices directory, which is a link to the driver directory for the current architecture (for example, /private/Drivers/i386). This link is always valid.
/NextLibrary/Devices 는 현재 아키텍처의 드라이버 디렉토리에 대한 링크인 /private/Devices 디렉토리에 대한 링크입니다. (예를 들어 /private/Drivers/i386). 이 링크는 항상 유효합니다.


Bundle 포함된 것(What's in a Bundle)

Each driver bundle (including System.config) can contain the following files and directories:
각 드라이버 번들(System.config 을 포함하는)은 다음 파일과 디렉토리를 포함할 수 있습니다.

Default.table
Instancen.table (created by Configure)
x.table
Display.modes
x.modes
CustomInspector (optional binary)
Language.lproj/
CustomInspector.nib (optional)
Localizable.strings
Help/ (replaces Info.rtf)
Driver_reloc (omitted for NeXT drivers that are compiled into the kernel)
Pre-Load
Post-Load


Default.table is a commented, read-only file that gives the default configuration settings for a generic device. Configure uses Default.table to build Instancen.table files, which contain specific configuration information for each device you have. There may be other x.table files, each expressing a different possible instance of the driver.
Default.table 은 일반 장치에 대한 기본 구성 설정( default configuration settings)을 제공하는 주석 처리된 읽기 전용 파일입니다. Configure[1] 는 각 장치에 대한 특정 구성 정보가 들어있는 Instancen.table 파일을 작성하기 위해 Default.table 를 사용합니다. 드라이버의 가능한 다른 인스턴스를 표현하는 다른 x.table 파일이 있을 수 있습니다.


Each .table file is the ASCII representation of an NXStringTable object. Drivers and nondrivers can get access to these tables by using the IOConfigTable class. In addition, Driver Kit classes automatically interpret and use some of the standard keys in these tables.
.table 파일은 NXStringTable 객체의 ASCII 표현입니다. 드라이버 및 비드라이버(nondrivers)는 IOConfigTable 클래스를 사용해서 이러한 테이블에 접근할 수 있습니다. Driver Kit 클래스는 이러한 테이블의 표준 키 중 일부를 자동으로 해석하고 사용합니다.


Direct drivers have one Instancen.table for each device. For example, if you have two of the same card, Configure makes two files called Instance0.table and Instance1.table in the card's bundle. Indirect drivers and the system bundle have only one file, called Instance0.table.
직접 드라이버는 각 장치에 대해 하나의 Instancen.table 가 있습니다. 예를 들어 동일한 카드가 두 개 있는 경우 Configure는 카드 번들에 Instance0.tableInstance1.table 라는 두 개의 파일을 만듭니다. 간접 드라이버 및 시스템 번들에는 Instance0.table 라는 파일이 하나만 있습니다.


Note: Because Configure's default device inspector has no way of knowing whether a device is direct or indirect, it can create more than one Instancen.table for an indirect driver. The consequence is that the driver's probe: method gets invoked more than once for each direct driver it might want to attach to. To get around this, you should either write your own device inspector or ensure that your driver's probe: method can handle more than one probe per direct driver.
Note: Configure 의 기본 장치 검사기는 장치가 직접 또는 간접적인지 여부를 알 수 없기 때문에, 간접 드라이버에 대해 하나 이상의 Instancen.table 를 만들 수 있습니다. 결과적으로 드라이버의 probe: 메서드는 첨부하려는 각 직접 드라이버에 대해 두 번 이상 호출됩니다. 이 문제를 해결하려면 자체 장치 검사기(own device inspector)를 작성하거나, 드라이버의 probe: 메소드가 직접 드라이버당 둘 이상의 검사를 처리할 수 ​​있도록 해야합니다.


The Display.mode and x.mode files hold display mode information. Default information is in Display.mode, and x.mode holds the information for other instances of the driver (just as x.table expresses configuration information for other driver instances).
Display.modex.mode 파일은 디스플레이 모드 정보를 보유합니다. 기본 정보는 Display.mode 에 있으며 x.mode 는 드라이버의 다른 인스턴스에 대한 정보를 보유합니다(x.table 가 다른 드라이버 인스턴스에 대한 구성 정보를 표현하는 것처럼).


For each language, Localizable.strings' contains the text strings that applications display about the device. For example, it includes the name of the device as it appears in the list of devices in Configure. The Help/ directory contains files to inform the user about the driver and help them use it.
각 언어에 대해
Localizable.strings 는 응용 프로그램이 장치에 대해 표시하는 텍스트 문자열을 포함합니다. 예를 들어 Configure 에 있는 장치 목록에 나타나는 장치의 이름이 포함됩니다. Help
/ 디렉토리에는 사용자에게 드라이버에 대해 알려주며 드라이버 사용에 도움이 되는 파일이 있습니다.


The Driver_reloc file is the relocatable object file of the device driver. The CustomInspector binary is the executable file for the Inspector panel; its name is the same as the bundle name (without the .config suffix). CustomInspector.nib is the nib file for the Inspector panel.
'Driver_reloc 파일은 장치 드라이버의 재배치 가능한 개체 파일입니다. CustomInspector 바이너리는 Inspector 패널의 실행 파일입니다. 그 이름은 번들 명과 동일합니다(.config 접미사를 제외한). CustomInspector.nib 는 Inspector 패널의 nib 파일입니다.


The bundle may contain Pre-Load and/or Post-Load programs that are run before and/or after the driver is loaded.
번들에는 드라이버가 로드되기전 및/또는 로드된 후 실행되는 Pre-Load 및/또는 Post-Load 프로그램이 포함될 수 있습니다.


설정 테이블(Configuration Tables)

Files with a .table suffix contain strings of key/value pairs that describe a configuration. See "Configuration Keys" in the Appendix for information on what these tables should contain.
.table 접미사가 있는 파일에는 구성을 설명하는 key/value 쌍 문자열이 들어 있습니다. 이들 테이블에 포함되어야할 내용에 대해서는 부록의 "Configuration Keys" 를 참조하십시오.


You can use the Default.table of an existing driver as a starting point for a configuration. Later, you should let the Configure application (with your custom inspector, if any) create the Instancen.table files.
기존 드라이버의 Default.table 를 구성의 시작점으로 사용할 수 있습니다. 나중에 구성 응용 프로그램에서 (맞춤 탐색기가 있는 경우) Instancen.table 파일을 만들도록 해야합니다.


Here's a sample Instancen.table for a parallel port driver:
다음 Instancen.table 은 병렬 포트 드라이버용 샘플입니다.

"Driver Name"  = "IOParallelPort";
"Title"   = "System Parallel";
"Location"   = "System Baseboard";
"Family"   = "Parallel";
"Version"   = "1.0";
"Server Name"  = "ParallelPort";
"Path 0"   = "/dev/pp0";
"Post-Load"   = "InstallPPDev";
"Memory Maps"  = "";
"Pre-Load"   = "RemovePPDev";
"DMA Channels"  = "";
"Minor Device Number" = "0";
"Valid IRQ Levels"  = "7";
"I/O Ports"   = "0x378-0x37f";
"Instance"   = "0";
"Port Count"   = "1";
"IRQ Levels"   = "7";


Warning: C-style comment delimiters (that is, /* */) aren't recognized in configuration tables, such as Default.table or Instance0.table. Anything inside the delimiters will be parsed along with the rest of the file. This means that, for example, if you are testing a driver under development, you can't remove a key-value pair by simply commenting it out.
Warning: C 스타일의 주석 구분 기호(that is, /* */)는 Default.table 또는 Instance0.table 와 같은 설정 테이블(configuration tables)에서 인식되지 않습니다. 구분 기호 안에있는 내용은 나머지 파일과 함께 구문 분석됩니다. 예를 들어 개발중인 드라이버를 테스트하는 경우 key-value 쌍을 주석 처리해서 제거할 수는 없습니다.


다른 설정 테이블(Other Configuration Tables)

A bundle may also contain other configuration tables of the form x.table, where x is a prefix such as "PCI". Each of these is a table like default.table but expresses a possible instance of the driver with a slightly different "personality" than default.table. For example, PCI.table might be identical to Default.table except that it contains a line specifying a PCI-compliant driver:
번들에는 x.table 양식의 다른 구성 테이블이있을 수 있습니다. 여기서 x 는 "PCI" 와 같은 접두어입니다. 이들 각각은 default.table 와 비슷한 테이블 이지만, default.table 과 약간 다른 "personality" 를 가진 가능한 드라이버의 인스턴스를 표현(expresses)합니다. 예를 들어, PCI.table 은 PCI 호환 드라이버를 지정하는 행을 포함한다는 점을 제외하면 Default.table 와 동일 할 수 있습니다:

"Bus Type" = "PCI";


By convention, Default.table specifies an ISA or VL-bus compliant driver--the simplest case. The prefix x in x.table usually designates the bus type.
규칙에 따라 Default.table 은 ISA 또는 VL 버스 호환 드라이버를 지정합니다. 가장 간단한 경우입니다. x.table 에서 접두사 x 는 대개의 경우 버스 유형을 지정합니다.


These configuration table files should contain all information appropriate for the bus type. PCI-compliant drivers, for instance, contain a line specifying the auto detect IDs, such as this:
이러한 설정 테이블 파일에는 버스 유형에 적합한 모든 정보가 들어 있어야 합니다. 예를 들어, PCI 호환 드라이버에는 다음과 같이 자동 감지 ID(auto detect IDs)를 지정하는 줄이 들어 있습니다:

"Auto Detect IDs" = "0x71789004 0x0e111234";


사용자 정의 장치 검사기 파일(Custom Device Inspector Files)

For initial testing, you probably don't need a custom inspector. Instead, you can put the appropriate values directly into your test Default.table or Instancen.table files.
초기 테스트의 경우 사용자 정의 관리자가 필요한것은 아닙니다. 대신 적절한 값을 테스트 하게될 Default.table 또는 Instancen.table 파일에 직접 입력할 수 있습니다.


If you create a custom inspector, you should put the executable file and nib file in the places described in "What's in a Bundle," earlier in this chapter. Project Builder does this for you automatically. See "Writing a Custom Inspector" later in this chapter for information on creating custom inspectors.
커스텀 인스펙터(custom inspector)를 생성했다면, 이 장의 앞부분에 있는 "What's in a Bundle," 에 설명된 장소에 실행 파일과 nib 파일을 저장해야 합니다. Project Builder 가 자동으로 이 작업을 수행합니다. 사용자 정의 관리자를 만드는 방법은 이 장 뒷부분의 "Writing a Custom Inspector" 를 참조하십시오.


Note: Project Builder creates an Inspector Panel executable file in the bundle and gives it the same name as the bundle (without the .config suffix). This executable loads the default inspector.
Note: Project Builder는 번들에 인스펙터 패널(Inspector Panel) 실행 파일을 생성하고 번들(bundle)과 동일한 이름을 부여합니다(.config 접미사를 제외하고). 이 실행 파일은 기본 관리자(inspector)를 로드합니다.


현지화 가능 문자열 파일(Localizable Strings File)

This file should contain any strings you add to your Configure inspector's user interface, plus the following strings:

"Driver" = "UltimateTech XYZ-12";
    "Long Name" = "Ultimate Technologies XYZ-12 Transmogrifier";


where Driver is the name of the bundle (minus the .config suffix). Configure uses the string associated with the Driver key ("UltimateTech XYZ-12") whenever space is tight. When Configure has more space to display the driver's name, it uses the string associated with the "Long Name" key.
여기서 Driver 는 번들의 이름입니다('.config' 접미사를 제거한). Configure 는 공간이 부족할 때마다 Driver 키 ("UltimateTech XYZ-12") 와 연결된 문자열을 사용합니다. Configure 에 드라이버 이름을 표시할 공간이 있으면 "Long Name" 키와 연관된 문자열이 사용됩니다.


Display Mode Tables

If your driver is a display driver that supports multiple display modes, you need to specify which modes the user can choose. This information is supplied in the Display.modes file. Here's a sample file:
드라이버가 다중 디스플레이 모드를 지원하는 디스플레이 드라이버인 경우 사용자가 선택할 수 있는 모드를 지정해야 합니다. 이 정보는 Display.modes 파일로 제공됩니다. 다음은 샘플 파일입니다.

"Height: 600 Width: 800 Refresh: 60Hz ColorSpace: RGB:555/16";
"Height: 600 Width: 800 Refresh: 72Hz ColorSpace: RGB:555/16";
"Height: 768 Width:1024 Refresh: 60Hz ColorSpace: RGB:256/8";
"Height: 768 Width:1024 Refresh: 66Hz ColorSpace: RGB:256/8";
"Height: 768 Width:1024 Refresh: 72Hz ColorSpace: RGB:256/8";
"Height: 768 Width:1024 Refresh: 76Hz ColorSpace: RGB:256/8";
"Height: 768 Width:1024 Refresh: 60Hz ColorSpace: BW:8";
"Height: 768 Width:1024 Refresh: 66Hz ColorSpace: BW:8";
"Height: 768 Width:1024 Refresh: 72Hz ColorSpace: BW:8";
"Height: 768 Width:1024 Refresh: 76Hz ColorSpace: BW:8";
"Height: 768 Width:1024 Refresh: 60Hz ColorSpace: RGB:555/16";
"Height: 768 Width:1024 Refresh: 72Hz ColorSpace: RGB:555/16";
"Height:1024 Width:1280 Refresh: 68Hz ColorSpace: RGB:256/8";
"Height:1024 Width:1280 Refresh: 68Hz ColorSpace: BW:8";
"Height: 400 Width: 640 Refresh: 60Hz ColorSpace: RGB:888/32";
"Height: 400 Width: 640 Refresh: 70Hz ColorSpace: RGB:888/32";
"Height: 480 Width: 640 Refresh: 60Hz ColorSpace: RGB:888/32";


If your driver has more than one "personality," specify alternate display information in x.modes files where x is the appropriate prefix such as "PCI".
드라이버에 "personality" 가 두 개 이상 있는 경우 x.modes 파일에 대체 디스플레이 정보를 지정하하게 되는데, 여기서 x 는 "PCI"와 같은 적절한 접두어입니다.


See the specification for the IODisplayInspector, IOFrameBufferDisplay, and IOSVGADisplay classes for more information on display modes.
디스플레이 모드에 대한 자세한 내용은 IODisplayInspector, IOFrameBufferDisplay 및 IOSVGADisplay 클래스의 사양을 참조하십시오.


Help Directory

This directory contains the help files supported by the NeXT help facility. You add this directory to your project with Project Builder's Add Help Directory command. For more information on adding help to your driver, see "Attaching Help to Objects" in Chapter 3, "The Interface Builder Application" of NEXTSTEP Development Tools and Techniques'.
이 디렉토리에는 NeXT 도움말 기능에서 지원하는 도움말 파일이 들어 있습니다. Project Builder의 Help Directory 추가 명령을 사용하여이 디렉토리를 프로젝트에 추가합니다.


The Help directory replaces the Info.rtf file, formerly used to provide information about the driver.
Help 디렉토리는 이전에 드라이버에 대한 정보를 제공하는데 사용되었던 Info.rtf 파일을 대체합니다.


드라이버 재배치 가능 코드(Driver Relocatable Code)

This file contains the driver's relocatable code. An example of building a driver relocatable object file is located in /NextLibrary/Documentation/NextDev/Examples/DriverKit/TestDriver.
이 파일에는 드라이버의 재배치 가능 코드가 들어 있습니다. 드라이버 재배치 가능 객체 파일을 작성하는 예제는 /NextLibrary/Documentation/NextDev/Examples/DriverKit/TestDriver 에 있습니다.


사전로드/로드이후 프로그램(Pre-and Post-Load Programs)

Your driver may require some action to be taken before and/or after it is loaded. For instance, you may want to run a program after the driver is loaded to look up its major device number and create a device node for the driver. Use the "Pre-Load" configuration key to specify a program that will run prior to your driver being loaded; use the "Post-Load" key to specify a program that runs after the driver is loaded.
드라이버가 로드되기전 및/또는 로드 한 후 조치를 취해야 할 수도 있습니다. 예를 들어 드라이버를 로드 한 후에 프로그램을 실행해서 주요 장치 번호를 조회하고 해당 드라이버의 장치 노드를 만들 수 있습니다. "Pre-Load" 구성 키를 사용해서 드라이버로드 전에 실행될 프로그램을 지정하고, "Post-Load" 키를 사용해서 드라이버가 로드된 후 실행되는 프로그램을 지정하십시오.


시스템 설정 Bundle(The System Configuration Bundle)

The System.config bundle is special in several ways. Its Instance0.table has default configuration information for the system as a whole. For example, it specifies which device drivers to load at boot time ("Boot Drivers") and which to load later ("Active Drivers"). Here's a sample Default.table from a System.config bundle:
System.config 번들은 여러 가지면에서 특별합니다. Instance0.table 에는 시스템 전체에 대한 기본 구성 정보가 있습니다. 예를 들어, 부팅할 때 로드할 장치 드라이버("Boot Drivers")와 나중에 로드할 장치 드라이버("Active Drivers")를 지정합니다. 다음은 System.config 번들의 샘플 Default.table 입니다.

"Version" = "2.0";
"Boot Drivers" = "PS2Keyboard PS2Mouse BusMouse Adaptec1542B DPT2012 IDE Floppy VGA";
"Active Drivers" = "SerialPorts SerialMouse ParallelPort";
"Kernel" = "mach_kernel";
"Kernel Flags" = "";
"Boot Graphics" = "No";


For writers of Driver Kit drivers, "Active Drivers" and "Boot Drivers" are the most important keywords. They specify which drivers are automatically loaded into the system the next time it's started. When someone uses Configure to add a device that has a loadable driver, the driver is added to one of these two lists. See the "Boot Drivers" and "Active Drivers" keys in the "Configuration Keys" section of the Appendix to see how to specify which list a driver should be in. This section also lists the other keywords for the system configuration table.
Driver Kit 드라이버 작성자의 경우 "Active Drivers" 와 "Boot Drivers" 가 가장 중요한 키워드입니다. 다음에 시작할 때 시스템에 자동으로 로드되는 드라이버를 지정합니다. 누군가가 Configure 를 사용해서 로드 가능한 드라이버가 있는 장치를 추가하면 이 두 목록 중 하나에 드라이버가 추가됩니다. 드라이버 목록을 지정하는 방법은 부록의 "Configuration Keys" 절에있는 "Boot Drivers" 및 "Active Drivers" 키를 참조하십시오. 이 절에는 시스템 설정 테이블(system configuration table)에 대한 다른 키워드도 나열되어 있습니다.


Note: Changes to system configuration information don't take effect until the system is restarted. However, you can load a driver without rebooting by using the d option of driverLoader (documented in "Loading a Driver with driverLoader" later in this chapter).
Note: 시스템 구성 정보(system configuration information)의 변경 사항은 시스템을 다시 시작할 때까지 적용되지 않습니다. 그러나 driverLoaderd 옵션을 사용하면 재부팅하지 않고 드라이버를 로드 할 수 있습니다(이 장의 뒷부분에 있는 "Loading a Driver with driverLoader" 에 문서화되어 있습니다.)


드라이버 번들 생성(Creating a Driver Bundle)

Create a project for your driver with Project Builder, and give the project the name you want your driver to have. Copy your driver files into the project by dragging them into the appropriate suitcase (header files to the Header suitcase and so on) or by using the Add command in the Files menu. Switch to the Builder view in the project window and select "bundle" as the Target. Click the Build button. Project Builder builds the driver and puts it in a driver bundle called Driver.config where Driver is the name you chose for the driver. Now you can configure and load the driver.
Project Builder 를 사용해서 드라이버용 프로젝트를 생성하고 프로젝트에 드라이버에 필요한 이름을 지정하십시오. 드라이버 파일을 적절한 가방[2]으로 드래그하거나(헤더 파일을 헤더 가방으로 저장하는등의 작업) 파일 메뉴의 추가 명령을 사용하여 프로젝트에 복사하십시오. 프로젝트 창에서 빌더보기로 전환하고 대상으로 "bundle" 을 선택하십시오. Build 버튼을 눌러주세요. Project Builder 는 드라이버를 빌드하고 Driver.config 이라는 드라이버 번들에 저장하는데, 여기서 Driver 는 드라이버를 위해서 고른 이름입니다. 이제 드라이버를 구성하고 로드할 수 있습니다.


See NEXTSTEP Development Tools and Techniques for more information about using Project Builder. The example in /NextLibrary/Documentation/NextDev/Examples/DriverKit/TestDriver shows building a bundle with Project Builder.
Project Builder 사용에 대한 자세한 정보는 NEXTSTEP Development Tools and Techniques 을 참조하십시오. /NextLibrary/Documentation/NextDev/Examples/DriverKit/TestDriver 안의 예제는 Project Builder 로 bundle 을 빌드하는 것을 보여줍니다.


Notes

  1. NeXTSTEP 에 있는 Configure.app 프로그램을 의미합니다.
  2. 원문은 suitcase. NeXTSTEP 에서 헤더등이 슈트케이스 아이콘이기 때문에 사용된 용어