rt-net / RaspberryPiMouse

Raspberry Pi Mouse Device Driver
Other
60 stars 458 forks source link

Raspberry Pi OSカーネル6.1.21-v8+でビルドに失敗する #79

Open ShotaAk opened 1 year ago

ShotaAk commented 1 year ago

不具合の概要

23年5月にリリースされたRaspberry Pi OSでデバイスドライバのソースビルドに失敗します。

実行環境

$ lsb_release -a
No LSB modules are available.
Distributor ID: Raspbian
Description:    Raspbian GNU/Linux 11 (bullseye)
Release:    11
Codename:   bullseye
$ uname -a
Linux raspberrypi 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr  3 17:24:16 BST 2023 aarch64 GNU/Linux

再現方法

  1. 'utils/build_install.bash ' を実行する
  2. 下記のエラーが表示される
$ ./build_install.bash 
build_install_header_from_apt_raspi4.bash
===================
ERROR: No kernel header files found.
If you need someone's support, you should share this information.
Linux raspberrypi 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr  3 17:24:16 BST 2023 aarch64 GNU/Linux
No LSB modules are available.
Distributor ID: Raspbian
Description:    Raspbian GNU/Linux 11 (bullseye)
Release:    11
Codename:   bullseye
/usr/src/linux-headers-6.1.21+:
Documentation  Makefile        arch   certs   drivers  include  io_uring  kernel  mm   rust scripts   sound  usr
Kconfig        Module.symvers  block  crypto  fs       init ipc   lib     net  samples  security  tools  virt

/usr/src/linux-headers-6.1.21-v7+:
Documentation  Makefile        arch   certs   drivers  include  io_uring  kernel  mm   rust scripts   sound  usr
Kconfig        Module.symvers  block  crypto  fs       init ipc   lib     net  samples  security  tools  virt

/usr/src/linux-headers-6.1.21-v7l+:
Documentation  Makefile        arch   certs   drivers  include  io_uring  kernel  mm   rust scripts   sound  usr
Kconfig        Module.symvers  block  crypto  fs       init ipc   lib     net  samples  security  tools  virt
===================

期待する動作

ビルドに成功する

その他

どうやら、Raspberry Pi 4だと、32bit版のOSをインストールしても、64bit版のカーネルが起動するようです。

/boot/config.txtarm_64bit=0を追記して再起動しました。 デバイスドライバのビルドが始まりましたが、別のエラーが表示されます。

こちらは、#78 取り入れ済みです。

# 32bit版のカーネルが適用されていることの確認
$ uname -a
Linux raspberrypi 6.1.21-v7l+ #1642 SMP Mon Apr  3 17:22:30 BST 2023 armv7l GNU/Linux
# デバイスドライバのビルド
$ ./build_install.bash 
build_install_header_from_apt_raspi4.bash
make -C /usr/src/linux-headers-6.1.21-v7l+ M=/home/pi/RaspberryPiMouse/src/drivers V=0 clean
make[1]: ディレクトリ '/usr/src/linux-headers-6.1.21-v7l+' に入ります
make[1]: ディレクトリ '/usr/src/linux-headers-6.1.21-v7l+' から出ます
make -C /usr/src/linux-headers-6.1.21-v7l+ M=/home/pi/RaspberryPiMouse/src/drivers V=0 modules
make[1]: ディレクトリ '/usr/src/linux-headers-6.1.21-v7l+' に入ります
  CC [M]  /home/pi/RaspberryPiMouse/src/drivers/rtmouse.o
/home/pi/RaspberryPiMouse/src/drivers/rtmouse.c:323:15: error: initialization of ‘void (*)(struct spi_device *)’ from incompatible pointer type ‘int (*)(struct spi_device *)’ [-Werror=incompatible-pointer-types]
  323 |     .remove = mcp3204_remove,
      |               ^~~~~~~~~~~~~~
/home/pi/RaspberryPiMouse/src/drivers/rtmouse.c:323:15: note: (near initialization for ‘mcp3204_driver.remove’)
/home/pi/RaspberryPiMouse/src/drivers/rtmouse.c:361:15: error: initialization of ‘void (*)(struct i2c_client *)’ from incompatible pointer type ‘int (*)(struct i2c_client *)’ [-Werror=incompatible-pointer-types]
  361 |     .remove = rtcnt_i2c_remove,
      |               ^~~~~~~~~~~~~~~~
/home/pi/RaspberryPiMouse/src/drivers/rtmouse.c:361:15: note: (near initialization for ‘i2c_counter_driver.remove’)
/home/pi/RaspberryPiMouse/src/drivers/rtmouse.c: In function ‘mcp3204_get_value’:
/home/pi/RaspberryPiMouse/src/drivers/rtmouse.c:1747:11: error: implicit declaration of function ‘spi_busnum_to_master’ [-Werror=implicit-function-declaration]
 1747 |  master = spi_busnum_to_master(mcp3204_info.bus_num);
      |           ^~~~~~~~~~~~~~~~~~~~
/home/pi/RaspberryPiMouse/src/drivers/rtmouse.c:1747:9: warning: assignment to ‘struct spi_controller *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
 1747 |  master = spi_busnum_to_master(mcp3204_info.bus_num);
      |         ^
/home/pi/RaspberryPiMouse/src/drivers/rtmouse.c: In function ‘mcp3204_init’:
/home/pi/RaspberryPiMouse/src/drivers/rtmouse.c:1809:9: warning: assignment to ‘struct spi_controller *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
 1809 |  master = spi_busnum_to_master(mcp3204_info.bus_num);
      |         ^
/home/pi/RaspberryPiMouse/src/drivers/rtmouse.c: In function ‘mcp3204_exit’:
/home/pi/RaspberryPiMouse/src/drivers/rtmouse.c:1838:9: warning: assignment to ‘struct spi_controller *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
 1838 |  master = spi_busnum_to_master(mcp3204_info.bus_num);
      |         ^
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:250: /home/pi/RaspberryPiMouse/src/drivers/rtmouse.o] エラー 1
make[1]: *** [Makefile:2012: /home/pi/RaspberryPiMouse/src/drivers] エラー 2
make[1]: ディレクトリ '/usr/src/linux-headers-6.1.21-v7l+' から出ます
make: *** [Makefile:9: rtmouse.ko] エラー 2