* VirtualBoxのカーネルドライバがコンパイルできない [#d46b5938]

- ページ: [[不具合報告/4.7]]
- 投稿者: [[kojima]]
- 優先順位: 低
- 状態: 完了
- カテゴリー: 不具合報告
- 投稿日: 2010-08-27 (金) 12:32:37
- バージョン: 4.73b2

** メッセージ [#b3cba430]
Out of the boxの状態だとカーネルソースがあっても、autoconf.h が無い、等のエラーで VirtualBoxのカーネルモジュールのコンパイルが失敗する。

/usr/src/linux で make prepare すると、上記のエラーは解決するが、scripts/mod/modpost コマンドが無い、とエラーになる

modpost コマンドを作成するには /usr/src/linux で make scripts を実行する必要がある。

多分、/usr/src/linux で make prepare && make scripts しておけば OK

--------
- ビルドスクリプトでカーネルのソースツリーをパッケージツリーにコピーした直後に,以下の手順を追加しておきました。

   make prepare scripts
   cp include/linux/{autoconf,bounds,version,utsrelease}.h \
       $P/usr/src/$src/include/linux
   cp scripts/mod/{elfconfig.h,mk_elfconfig,modpost} \
       $P/usr/src/$src/scripts/mod

Plamo-4.7ツリーに反映済みです。 -- [[tamu]] &new{2010-08-28 (土) 17:17:27};
- kernelsrc-2.6.32.16_plamoSMP-noarch-P2.tgz な環境で試してみましたが、まだ足りないものがある模様 

  VirtualBox 3.2.8 r64453 installer, built 2010-08-05T11:57:18Z.
 
  Testing system setup...
  System setup appears correct.
 
  Installing VirtualBox to /opt/VirtualBox
 
  Output from the module build process (the Linux kernel build system) follows:
 
  make KBUILD_VERBOSE=1 -C /lib/modules/2.6.32.16-plamoSMP/build SUBDIRS=/tmp/vbox.0 SRCROOT=/tmp/vbox.0 modules
  test -e include/linux/autoconf.h -a -e include/config/auto.conf || (          \
        echo;                                                           \
        echo "  ERROR: Kernel configuration is invalid.";               \
        echo "         include/linux/autoconf.h or include/config/auto.conf are missing.";      \
        echo "         Run 'make oldconfig && make prepare' on kernel src to fix it.";  \
        echo;                                                           \
        /bin/false)
 
    ERROR: Kernel configuration is invalid.
           include/linux/autoconf.h or include/config/auto.conf are missing.
           Run 'make oldconfig && make prepare' on kernel src to fix it.
 
  mkdir -p /tmp/vbox.0/.tmp_versions ; rm -f /tmp/vbox.0/.tmp_versions/*
  
    WARNING: Symbol version dump /usr/src/linux-2.6.32.16/Module.symvers
             is missing; modules will have no dependencies and modversions.
  
  make -f scripts/Makefile.build obj=/tmp/vbox.0
    gcc -Wp,-MD,/tmp/vbox.0/linux/.SUPDrv-linux.o.d  -nostdinc -isystem /usr/lib/gcc/i586-pc-linux/4.3.5/include
  -Iinclude  -I/usr/src/linux-2.6.32.16/arch/x86/include -include include/linux/autoconf.h -D__KERNEL__ 
 -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration
 -Wno-format-security -fno-delete-null-pointer-checks -O2 -m64 -mno-red-zone-mcmodel=kernel -maccumulate-outgoing-args
 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -fomit-frame-pointer
 -I/lib/modules/2.6.32.16-plamoSMP/build/include -I/tmp/vbox.0/ -I/tmp/vbox.0/include -I/tmp/vbox.0/r0drv/linux
 -D__KERNEL__ -DMODULE -DRT_OS_LINUX -DIN_RING0 -DIN_RT_R0 -DIN_SUP_R0 -DVBOX -DRT_WITH_VBOX -DVBOX_WITH_HARDENING
 -DCONFIG_VBOXDRV_AS_MISC -DRT_ARCH_X86 -DVBOX_WITH_64_BITS_GUESTS  -DMODULE -D"KBUILD_STR(s)=#s"
 -D"KBUILD_BASENAME=KBUILD_STR(SUPDrv_linux)"  -D"KBUILD_MODNAME=KBUILD_STR(vboxdrv)"  -c 
 -o /tmp/vbox.0/linux/SUPDrv-linux.o /tmp/vbox.0/linux/SUPDrv-linux.c  
 /tmp/vbox.0/linux/SUPDrv-linux.c:1: error: code model 'kernel' not supported in the 32 bit mode
 /tmp/vbox.0/linux/SUPDrv-linux.c:1: sorry, unimplemented: 64-bit mode not compiled in
  make[2]: *** [/tmp/vbox.0/linux/SUPDrv-linux.o] エラー 1
  make[1]: *** [_module_/tmp/vbox.0] エラー 2
  make: *** [vboxdrv] エラー 2
  
  End of the output from the Linux kernel build system.
  Installation successful
  

make prepare で解決するので、解決した環境と差分を取ってみると、結構足りないのがあって、
多分、このあたりが影響しているような印象

  diff -uprN ./usr/src/linux/include/config/auto.conf /usr/src/linux/include/config/auto.conf
  --- ./usr/src/linux/include/config/auto.conf  1970-01-01 09:00:00.000000000 +0900
  +++ /usr/src/linux/include/config/auto.conf   2010-08-30 21:08:11.180502448 +0900
  @@ -0,0 +1,3091 @@
  +#
  +# Automatically generated make config: don't edit
  +# Linux kernel version: 2.6.32.16
  +# Mon Aug 30 21:08:11 2010
  +#
  +CONFIG_USB_SISUSBVGA=m
  +CONFIG_DVB_STV6110=m
  +CONFIG_VIDEO_V4L1_COMPAT=y
  +CONFIG_SENSORS_WM8350=m
  +CONFIG_PCMCIA_FMVJ18X=m
  +CONFIG_BLK_DEV_FD=m
  +CONFIG_ACPI_AC=m
  +CONFIG_ACPI_SYSFS_POWER=y
  +CONFIG_PM_STD_PARTITION=""
  +CONFIG_SQUASHFS_LZMA=y
  +CONFIG_RTC_DRV_M41T80=m
  +CONFIG_USB_LEGOTOWER=m
  +CONFIG_HID_CHERRY=m
 ....

まぁ、/usr/src/linux で make prepare すれば解決するし、Plamoを使おうという人に、そこまで手取り足取りしなくてもいいんじゃないか、
という気はするところ(笑 -- [[kojima]] &new{2010-08-30 (月) 21:50:27};
- 個人的には、kernelsrcパッケージは、バニラなソースコードを make prepare 等して用意するのではなく、実際のバイナリを作った環境で make clean して消える不要なもの(主に *.o なファイル)を消した状態でパッケージした方が確実な印象。 -- [[kojima]] &new{2010-08-30 (月) 22:15:48};
- ふみ,ちょっと検討してみます。現状+make prepareで解決するんだったら,make prepare scripts → include/linux/bounds.hを退避 → make clean → bounds.hを復旧,みたいな手順で良さげかな。 -- [[tamu]] &new{2010-08-30 (月) 23:04:46};
- ビルドスクリプトを以下のように修正しました。

 --- old/PlamoBuild.kernelsrc-2.6.32.16_plamoSMP-20100828	2010-08-28 14:38:06.000000000 +0900
 +++ PlamoBuild.kernelsrc-2.6.32.16_plamoSMP	2010-08-31 10:42:24.000000000 +0900
 @@ -16,7 +16,7 @@
  pkgbase=kernelsrc
  vers=2.6.32.16_plamoSMP
  arch=noarch
 -build=P2
 +build=P3
  src=linux-2.6.32.16
  OPT_CONFIG=""
  DOCS=""
 @@ -258,8 +258,11 @@
  if [ $opt_build -eq 1 ] ; then
    for i in `seq 0 $((${#B[@]} - 1))` ; do
      cd ${B[$i]}
 -    false && if [ -f Makefile ] ; then
 -      make
 +    if [ -f Makefile ] ; then
 +      make prepare scripts
 +      mv include/linux/bounds.h $W
 +      make clean
 +      mv $W/bounds.h include/linux
      fi
    done
  fi
 @@ -281,11 +284,6 @@
    done
    install -d $P/usr/src
    cp -dR . $P/usr/src/$src
 -  make prepare scripts
 -  cp include/linux/{autoconf,bounds,version,utsrelease}.h \
 -      $P/usr/src/$src/include/linux
 -  cp scripts/mod/{elfconfig.h,mk_elfconfig,modpost} \
 -      $P/usr/src/$src/scripts/mod
    find $P/usr/src/$src \( -name ".gitignore" -o -name ".mailmap" \
        -o -name "*.orig" \) -exec rm {} \;
    ln -s $src $P/usr/src/linux
 @@ -349,8 +347,8 @@
    done
    convert
    prune_symlink $P/usr/src
 -  prune_symlink $P/usr/src/$src/arch/microblaze/boot/dts
    touch -t `date '+%m%d0900'` $P/usr/src/$src/arch/microblaze/boot/dts
 +  touch -t `date '+%m%d0900'` $P/usr/src/$src/include
    tar cvpf $pkg.tar -C $P `cd $P ; find usr/src -maxdepth 1 | tail -n+2`
    tar rvpf $pkg.tar -C $P `cd $P ; find sbin | tail -n+2`
    tar rvpf $pkg.tar -C $P usr/share/doc/$src

これにより増えたファイルは以下です。

 --- kernelsrc-2.6.32.16_plamoSMP-noarch-P2.txt	2010-08-31 09:00:00.000000000 +0900
 +++ kernelsrc-2.6.32.16_plamoSMP-noarch-P3.txt	2010-08-31 09:00:00.000000000 +0900
 @@ -29186,6 +29186,4308 @@
  -rw-r--r-- root/root       349 2010-08-31 09:00:00 usr/src/linux-2.6.32.16/include/xen/xen-ops.h
  -rw-r--r-- root/root      8215 2010-08-31 09:00:00 usr/src/linux-2.6.32.16/include/xen/xenbus.h
  -rw-r--r-- root/root      2609 2010-08-31 09:00:00 usr/src/linux-2.6.32.16/include/xen/xencomm.h
 +drwxr-xr-x root/root         0 2010-08-31 09:00:00 usr/src/linux-2.6.32.16/include/config/
 +-rw-r--r-- root/root     14363 2010-08-31 09:00:00 usr/src/linux-2.6.32.16/include/config/auto.conf.cmd
 +drwxr-xr-x root/root         0 2010-08-31 09:00:00 usr/src/linux-2.6.32.16/include/config/usb/
 (snip)
 +-rw-r--r-- root/root         0 2010-08-31 09:00:00 usr/src/linux-2.6.32.16/include/config/highmem.h
 +-rw-r--r-- root/root     71839 2010-08-31 09:00:00 usr/src/linux-2.6.32.16/include/config/auto.conf
 +-rw-r--r-- root/root        19 2010-08-31 09:00:00 usr/src/linux-2.6.32.16/include/config/kernel.release
 +drwxr-xr-x root/root         0 2010-08-31 09:00:00 usr/src/linux-2.6.32.16/include/asm-x86/
 +-rw-r--r-- root/root         0 2010-08-31 09:00:00 usr/src/linux-2.6.32.16/include/asm
  drwxr-xr-x root/root         0 2010-08-31 09:00:00 usr/src/linux-2.6.32.16/init/
  -rw-r--r-- root/root     39239 2010-08-31 09:00:00 usr/src/linux-2.6.32.16/init/Kconfig
  -rw-r--r-- root/root      1129 2010-08-31 09:00:00 usr/src/linux-2.6.32.16/init/Makefile
 @@ -30882,6 +35184,9 @@
  -rw-r--r-- root/root     11835 2010-08-31 09:00:00 usr/src/linux-2.6.32.16/scripts/basic/docproc.c
  -rw-r--r-- root/root      9802 2010-08-31 09:00:00 usr/src/linux-2.6.32.16/scripts/basic/fixdep.c
  -rw-r--r-- root/root      1104 2010-08-31 09:00:00 usr/src/linux-2.6.32.16/scripts/basic/hash.c
 +-rwxr-xr-x root/root      8363 2010-08-31 09:00:00 usr/src/linux-2.6.32.16/scripts/basic/fixdep
 +-rwxr-xr-x root/root     13065 2010-08-31 09:00:00 usr/src/linux-2.6.32.16/scripts/basic/docproc
 +-rwxr-xr-x root/root      4689 2010-08-31 09:00:00 usr/src/linux-2.6.32.16/scripts/basic/hash
  -rw-r--r-- root/root       702 2010-08-31 09:00:00 usr/src/linux-2.6.32.16/scripts/bin2c.c
  -rw-r--r-- root/root      4039 2010-08-31 09:00:00 usr/src/linux-2.6.32.16/scripts/binoffset.c
  -rwxr-xr-x root/root      1711 2010-08-31 09:00:00 usr/src/linux-2.6.32.16/scripts/bloat-o-meter
 @@ -30991,6 +35296,10 @@
  -rw-r--r-- root/root      6540 2010-08-31 09:00:00 usr/src/linux-2.6.32.16/scripts/kconfig/zconf.l
  -rw-r--r-- root/root     69973 2010-08-31 09:00:00 usr/src/linux-2.6.32.16/scripts/kconfig/zconf.tab.c_shipped
  -rw-r--r-- root/root     14905 2010-08-31 09:00:00 usr/src/linux-2.6.32.16/scripts/kconfig/zconf.y
 +-rw-r--r-- root/root     69973 2010-08-31 09:00:00 usr/src/linux-2.6.32.16/scripts/kconfig/zconf.tab.c
 +-rw-r--r-- root/root     58454 2010-08-31 09:00:00 usr/src/linux-2.6.32.16/scripts/kconfig/lex.zconf.c
 +-rw-r--r-- root/root     10154 2010-08-31 09:00:00 usr/src/linux-2.6.32.16/scripts/kconfig/zconf.hash.c
 +-rwxr-xr-x root/root     75794 2010-08-31 09:00:00 usr/src/linux-2.6.32.16/scripts/kconfig/conf
  -rwxr-xr-x root/root     62295 2010-08-31 09:00:00 usr/src/linux-2.6.32.16/scripts/kernel-doc
  drwxr-xr-x root/root         0 2010-08-31 09:00:00 usr/src/linux-2.6.32.16/scripts/ksymoops/
  -rw-r--r-- root/root       386 2010-08-31 09:00:00 usr/src/linux-2.6.32.16/scripts/ksymoops/README
 @@ -31054,6 +35363,10 @@
  -rw-r--r-- root/root      3560 2010-08-31 09:00:00 usr/src/linux-2.6.32.16/scripts/tracing/draw_functrace.py
  -rw-r--r-- root/root     30196 2010-08-31 09:00:00 usr/src/linux-2.6.32.16/scripts/unifdef.c
  -rwxr-xr-x root/root      3165 2010-08-31 09:00:00 usr/src/linux-2.6.32.16/scripts/ver_linux
 +-rwxr-xr-x root/root      8280 2010-08-31 09:00:00 usr/src/linux-2.6.32.16/scripts/conmakehash
 +-rwxr-xr-x root/root     12784 2010-08-31 09:00:00 usr/src/linux-2.6.32.16/scripts/kallsyms
 +-rwxr-xr-x root/root     12537 2010-08-31 09:00:00 usr/src/linux-2.6.32.16/scripts/pnmtologo
 +-rwxr-xr-x root/root      4819 2010-08-31 09:00:00 usr/src/linux-2.6.32.16/scripts/bin2c
  drwxr-xr-x root/root         0 2010-08-31 09:00:00 usr/src/linux-2.6.32.16/security/
  -rw-r--r-- root/root      6120 2010-08-31 09:00:00 usr/src/linux-2.6.32.16/security/Kconfig
  -rw-r--r-- root/root       883 2010-08-31 09:00:00 usr/src/linux-2.6.32.16/security/Makefile
 @@ -32421,5 +36734,5 @@
  -rw-r--r-- root/root         0 2010-08-31 09:00:00 usr/src/linux
  -rwxr-xr-x root/root       779 2010-08-31 09:00:00 sbin/installkernel
  drwxr-xr-x root/root         0 2010-07-06 03:14:00 usr/share/doc/linux-2.6.32.16/
 --rwxr-xr-x root/root      3770 2010-08-31 09:00:00 usr/share/doc/linux-2.6.32.16/PlamoBuild.kernelsrc-2.6.32.16_plamoSMP.gz
 --rw-r--r-- root/root       262 2010-08-31 09:00:00 install/doinst.sh
 +-rwxr-xr-x root/root      3729 2010-08-31 09:00:00 usr/share/doc/linux-2.6.32.16/PlamoBuild.kernelsrc-2.6.32.16_plamoSMP.gz
 +-rw-r--r-- root/root       374 2010-08-31 09:00:00 install/doinst.sh

パッケージは今晩あたり置く予定です。 -- [[tamu]] &new{2010-08-31 (火) 14:07:24};
- Plamo-test/for-4.7xに置いたのでお試しください。今回作成したのと,実際のバイナリを作った環境でmake cleanしたのを比較すると,.versionとModule.symversとusr/include/以下が抜けている以外は,ほぼ一致してます(後者には,radeon関連とaufs関連の生成ファイルが残っているけど,これは本来make cleanで消えるべきものだと思ふ)。 -- [[tamu]] &new{2010-09-01 (水) 07:04:13};
- これ(P3)で VirtualBox も VMware-server もコンパイルできました。 -- [[kojima]] &new{2010-09-01 (水) 09:42:55};

#comment

トップ   編集 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS