kernel に組み込む

i8253 PIT をアクセスするドライバのうち、i8253 の channel 1 を platform device として登録する部分を kernel に組み込み、その結果を確かめることをします。

kernel source にパッチを当てる

添付ファイル filei8253_ref_setup.diff は kernel source に当てるパッチです。このファイルをダウンロードして、kernel source の root directory (linux-stable) にカレント・ディレクトリを移し、次の様にして kernel にパッチを当てます。色々と修正を試みた後、ソースを元に戻すことも考慮し、branch i8253_ref_setup を作る操作も込みで示しています。branch 名は好きに付けても良いです。

linux-stable $ git checkout -b i8253_ref_setup
linux-stable $ git patch down_loaded_directory/i8253_ref_setup.diff

続けて新しく追加した configuration 項目 (Kconfig の内容) を .config に反映するため make menuconfig を実行します。

linux-stable $ make menuconfig

menuconfig の中で Processor type and features を選択します。

 .config - Linux/x86 4.1.27 Kernel Configuration
 ──────────────────────────────────────────────────────────────────────────────
  ┌───────────────── Linux/x86 4.1.27 Kernel Configuration ─────────────────┐
  │  Arrow keys navigate the menu.  <Enter> selects submenus ---> (or empty │
  │  submenus ----).  Highlighted letters are hotkeys.  Pressing <Y>        │
  │  includes, <N> excludes, <M> modularizes features.  Press <Esc><Esc> to │
  │  exit, <?> for Help, </> for Search.  Legend: [*] built-in  [ ]         │
  │ ┌─────────────────────────────────────────────────────────────────────┐ │
  │ │    [*] 64-bit kernel                                                │ │
  │ │        General setup  --->                                          │ │
  │ │    [*] Enable loadable module support  --->                         │ │
  │ │    [*] Enable the block layer  --->                                 │ │
  │ │        Processor type and features  --->                            │ │
  │ │        Power management and ACPI options  --->                      │ │
  │ │        Bus options (PCI etc.)  --->                                 │ │
  │ │        Executable file formats / Emulations  --->                   │ │
  │ │    [*] Networking support  --->                                     │ │
  │ │        Device Drivers  --->                                         │ │
  │ │        Firmware Drivers  --->                                       │ │
  │ │        File systems  --->                                           │ │
  │ │        Kernel hacking  --->                                         │ │
  │ │        Security options  --->                                       │ │
  │ │    -*- Cryptographic API  --->                                      │ │
  │ │    -*- Virtualization  --->                                         │ │
  │ └────┴(+)─────────────────────────────────────────────────────────────┘ │
  ├─────────────────────────────────────────────────────────────────────────┤
  │        <Select>    < Exit >    < Help >    < Save >    < Load >         │
  └─────────────────────────────────────────────────────────────────────────┘

項目 I8253 PIT Refresh timer driver に * を付けた状態にします。menuconfig を .config に変更を反映する選択をして終了します。

 .config - Linux/x86 4.1.27 Kernel Configuration
 > Processor type and features; ────────────────────────────────────────────────
  ┌────────────────────── Processor type and features ──────────────────────┐
  │  Arrow keys navigate the menu.  <Enter> selects submenus ---> (or empty │
  │  submenus ----).  Highlighted letters are hotkeys.  Pressing <Y>        │
  │  includes, <N> excludes, <M> modularizes features.  Press <Esc><Esc> to │
  │  exit, <?> for Help, </> for Search.  Legend: [*] built-in  [ ]         │
  │ ┌────^(-)─────────────────────────────────────────────────────────────┐ │
  │ │    [*]   Enable IOSF sideband access through debugfs                │ │
  │ │    [*] Single-depth WCHAN output                                    │ │
  │ │    [*] Linux guest support  --->                                    │ │
  │ │        Processor family (Generic-x86-64)  --->                      │ │
  │ │    [*] Supported processor vendors  --->                            │ │
  │ │    [*] I8253 PIT Refresh timer driver (NEW)                         │ │
  │ │    [*] Enable DMI scanning                                          │ │
  │ │    [*] Old AMD GART IOMMU support                                   │ │
  │ │    [*] IBM Calgary IOMMU support                                    │ │
  │ │    [*]   Should Calgary be enabled by default?                      │ │
  │ │    [ ] Enable Maximum number of SMP Processors and NUMA Nodes       │ │
  │ │    (256) Maximum number of CPUs                                     │ │
  │ │    [*] SMT (Hyperthreading) scheduler support                       │ │
  │ │    [*] Multi-core scheduler support                                 │ │
  │ │        Preemption Model (Voluntary Kernel Preemption (Desktop))  ---│ │
  │ │    [*] Reroute for broken boot IRQs                                 │ │
  │ └────┴(+)─────────────────────────────────────────────────────────────┘ │
  ├─────────────────────────────────────────────────────────────────────────┤
  │        <Select>    < Exit >    < Help >    < Save >    < Load >         │
  └─────────────────────────────────────────────────────────────────────────┘

I8253 PIT Refresh timer driver の階層がおかしくないか?

"I8253 PIT Refresh timer driver" のメニュー階層に違和感があるのは確かです。メニュー階層を menu-endmenu で作るか、config 項目を "Device Drivers" の囲みの中に作るかすれば違和感は減ると思います。ソースファイルの位置と Kconfig ファイルの位置関係もなるべく近くにしつつ menuconfig も違和感なく構成するのに難しい題材なのかもしれません。Kconfig についての詳細は /Documentation/kbuild/kconfig-language.txt を見て下さい。

構築 と install

構築と install は チュートリアルページの構築編 を参考にして下さい。


トップ   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS