SW 개발

[Linux Kernel] spi 드라이버 커널 컴파일 옵션에 추가하기

. . . 2011. 4. 21. 10:22
반응형

이전 2.6 커널기준 이며, 최신커널에서는 해당내용들에 해당하지 않습니다.

Step1. Driver/spi 내의 kconfig 추가

make menuconfig 할때 준 옵션으로 해서 kernel 내의 디렉토리네에 특정 arch 디렉토리 드라이버 내의 Kconfig 를 사용할것이다. 이때 그 Kconfig 내에서 적당한 위치에 아래의 내용을 추가한다.

source "drivers/spi/Kconfig"

Step2. make menuconfig 에서 SPI 메뉴 확인하기

Step1. 의 설정을 제대로 하였다면, make menuconfig 에서 spi 메뉴가 나올것이다. 여기서 적절하게 옵션을 켜주면 된다.

Step3. spidev 드라이버 옵션 키기

최초에 spi 메뉴를 보면 spidev 옵션이 활성화 되어있지 않다. 그럼 spidev 옵션을 활성화 시키는 방법을 알아보자.

drivers/spi/Kconfig 를 보면 아래와 같은 내용이있다.

#
# There are lots of SPI device types, with sensors and memory
# being probably the most widely used ones.
#
comment "SPI Protocol Masters"
config SPI_SPIDEV
tristate "User mode SPI device driver support"
depends on EXPERIMENTAL
help
  This supports user mode SPI protocol drivers.
  Note that this application programming interface is EXPERIMENTAL
  and hence SUBJECT TO CHANGE WITHOUT NOTICE while it stabilizes.

즉 EXPERIMENTAL 커널 옵션이 켜져있어야 한다.

init/Kconfig 내의 내용을 살펴보면..

menu "General setup"
config EXPERIMENTAL
bool "Prompt for development and/or incomplete code/drivers"
---help---
  Some of the various things that Linux supports (such as network
  drivers, file systems, network protocols, etc.) can be in a state
  of development where the functionality, stability, or the level of
  testing is not yet high enough for general use. This is usually
  known as the "alpha-test" phase among developers. If a feature is
  currently in alpha-test, then the developers usually discourage
  uninformed widespread use of this feature by the general public to
  avoid "Why doesn't this work?" type mail messages. However, active
  testing and use of these systems is welcomed. Just be aware that it
  may not meet the normal level of reliability or it may fail to work
  in some special cases. Detailed bug reports from people familiar
  with the kernel internals are usually welcomed by the developers
  (before submitting bug reports, please read the documents
  , , ,
  , and
   in the kernel source).
  This option will also make obsoleted drivers available. These are
  drivers that have been replaced by something else, and/or are
  scheduled to be removed in a future kernel release.
  Unless you intend to help test and develop a feature or driver that
  falls into this category, or you have a situation that requires
  using these features, you should probably say N here, which will
  cause the configurator to present you with fewer choices. If
  you say Y here, you will be offered the choice of using features or
  drivers that are currently considered to be in the alpha-test phase.

즉, 최상위 옵션에서 General setup -> Prompt for development and/or incomplete code/drivers 해당 옵션을 키면 spidev가 활성화 된다.

반응형