ConoHa 上で必要な Linux Kernel 設定


ConoHa に Gentooを導入するときのメモ。

# デバイス情報

lspci は以下の通り。普通の440FXエミュレートなので、基本的には virtio さえ気にすればよい。

```shell-session
livecd ~ # lspci
00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02)
00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]
00:01.2 USB controller: Intel Corporation 82371SB PIIX3 USB [Natoma/Triton II] (rev 01)
00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 03)
00:02.0 VGA compatible controller: Device 1234:1111
00:03.0 Ethernet controller: Red Hat, Inc Virtio network device
00:04.0 Communication controller: Red Hat, Inc Virtio console
00:05.0 SCSI storage controller: Red Hat, Inc Virtio block device
00:06.0 Unclassified device [00ff]: Red Hat, Inc Virtio memory balloon
 ```

cpuinfo は以下の通り。今回のインスタンスは IvyBridge らしい。

```shell-session
livecd ~ # cat /proc/cpuinfo
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 62
model name      : Intel(R) Xeon(R) CPU E5-2650 v2 @ 2.60GHz
stepping        : 4
microcode       : 0x1
cpu MHz         : 2599.998
cache size      : 4096 KB
physical id     : 0
siblings        : 1
core id         : 0
cpu cores       : 1
apicid          : 0
initial apicid  : 0
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon rep_good nopl eagerfpu pni pclmulqdq ssse3 cx16 pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm fsgsbase tsc_adjust smep erms xsaveopt
bugs            :
bogomips        : 5199.99
clflush size    : 64
cache_alignment : 64
address sizes   : 46 bits physical, 48 bits virtual
power management:

<以下、core数繰り返し>
```

# genkernelでの注意

最近は genkernel --virtio がうまくいかない時がある。

```shell-session
livecd ~ # genkernel --virtio all

<snip>

* ERROR: Failed to compile the "prepare" target...
*
* -- Grepping log... --
*
*  HOSTCC  scripts/basic/fixdep
*  HOSTCC  scripts/kconfig/conf.o
*  HOSTCC  scripts/kconfig/zconf.tab.o
*  HOSTLD  scripts/kconfig/conf
*scripts/kconfig/conf  --silentoldconfig Kconfig
*.config:4897:warning: override: reassigning to symbol VIRTIO_PCI
*--
* Running with options: --virtio all
* Using genkernel.conf from /etc/genkernel.conf
* Sourcing arch-specific config.sh from /usr/share/genkernel/arch/x86_64/config.sh ..
* Sourcing arch-specific modules_load from /usr/share/genkernel/arch/x86_64/modules_load ..
*
* ERROR: Failed to compile the "prepare" target...
```

というより、genkernel --virtio はだいぶ古いようで色々おかしい。
素直に手動で以下を組み込もう。

# 要組み込み箇所

```shell-session
Device Drivers  --->
  Virtio drivers  --->
      <*> PCI driver for virtio devices
      <*> Virtio balloon driver
      <*> Platform bus driver for memory mapped virtio devices
  [*] Block devices  --->
      <*>   Virtio block driver
  -*- Network device support  --->
      [*]   Network core driver support
          <*>     Virtio network driver
  Character devices  --->
      <*> Virtio console
      <*> Hardware Random Number Generator Core support  --->
          <*>   VirtIO Random Number Generator support
```

これで一通りは問題ないはず。
VirtIO Random Number Generator は不要かもしれない（lspci上は出てこないし）。