Skip to content

Commit bc5b66d

Browse files
authored
デバイスドライバのUbuntu Server 24.04への対応 (#84)
1 parent f5dfa98 commit bc5b66d

File tree

3 files changed

+348
-39
lines changed

3 files changed

+348
-39
lines changed

.github/workflows/driver-cross-build.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ jobs:
3939
- { HOST: 20.04, KERNEL_VER: rpi-5.4.y, OS_BIT: armhf } # Debian 10 (Buster)
4040
- { HOST: 20.04, KERNEL_VER: rpi-5.10.y, OS_BIT: armhf } # Debian 11 (Bullseye)
4141
- { HOST: 22.04, KERNEL_VER: rpi-5.15.y, OS_BIT: armhf } # Debian 11 (Bullseye)
42-
# - { HOST: 24.04, KERNEL_VER: rpi-6.6.y, OS_BIT: armhf } # Debian 12 (Bookworm) 32-bit
43-
# - { HOST: 24.04, KERNEL_VER: rpi-6.6.y, OS_BIT: arm64 } # Debian 12 (Bookworm) 64-bit
42+
- { HOST: 24.04, KERNEL_VER: rpi-6.6.y, OS_BIT: armhf } # Debian 12 (Bookworm) 32-bit
43+
- { HOST: 24.04, KERNEL_VER: rpi-6.6.y, OS_BIT: arm64 } # Debian 12 (Bookworm) 64-bit
4444

4545
runs-on: ubuntu-${{ matrix.env.HOST }}
4646

@@ -76,7 +76,7 @@ jobs:
7676
run: |
7777
cd linux
7878
if [ "${{ matrix.env.OS_BIT }}" == "armhf" ]; then
79-
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- M=$GITHUB_WORKSPACE/src/drivers V=1 modules
79+
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- M=$GITHUB_WORKSPACE/src/drivers V=1 KBUILD_MODPOST_WARN=1 modules
8080
else
81-
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- M=$GITHUB_WORKSPACE/src/drivers V=1 modules
81+
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- M=$GITHUB_WORKSPACE/src/drivers V=1 KBUILD_MODPOST_WARN=1 modules
8282
fi

README.md

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,19 @@ Run the installation script ([`./utils/build_install.bash`](https://github.com/r
1111

1212
インストール用のシェルスクリプト([`./utils/build_install.bash`](https://github.com/rt-net/RaspberryPiMouse/blob/master/utils/build_install.bash))を実行します。
1313

14-
### for Raspbian
14+
### for Raspberry Pi OS
15+
16+
`/boot/firmware/config.txt`を編集し、ファイル末尾に以下の設定を追加します。
17+
18+
```sh
19+
arm_64bit=0 # "64-bit"版では不要です
20+
dtoverlay=anyspi:spi0-0,dev="microchip,mcp3204",speed=1000000 # カーネル5.16未満の場合は不要です
21+
dtparam=i2c_baudrate=62500
22+
```
23+
24+
Raspberry Piを再起動します。
25+
26+
以下のコマンドでインストールを実行します。
1527

1628
```sh
1729
$ git clone https://github.com/rt-net/RaspberryPiMouse.git
@@ -22,6 +34,17 @@ $ ./build_install.bash
2234

2335
### for Ubuntu
2436

37+
`/boot/firmware/config.txt`を編集し、ファイル末尾に以下の設定を追加します。
38+
39+
```sh
40+
dtoverlay=anyspi:spi0-0,dev="microchip,mcp3204",speed=1000000 # "Ubuntu Server 22.04"では不要です
41+
dtparam=i2c_baudrate=62500
42+
```
43+
44+
Raspberry Piを再起動します。
45+
46+
以下のコマンドでインストールを実行します。
47+
2548
```sh
2649
$ git clone https://github.com/rt-net/RaspberryPiMouse.git
2750
$ cd RaspberryPiMouse/utils
@@ -40,7 +63,7 @@ $ sudo insmod rtmouse.ko
4063

4164
## Notes for the installation (ドライバの導入の際の注意)
4265

43-
### for Raspbian
66+
### for Raspberry Pi OS
4467

4568
Enable SPI and I2C functions via `raspi-config` command.
4669

@@ -50,17 +73,13 @@ Enable SPI and I2C functions via `raspi-config` command.
5073
* SPI機能を「入」にする。
5174
* I2C機能を「入」にする。
5275

53-
2017年1月現在、以下の設定は不要です。
54-
rtmouseをインストールして不具合が出た場合のみ以下の設定を追加で行ってください。
55-
56-
* Device Tree機能を「切」にする。
5776

5877
### for Raspberry Pi 4
5978

6079
Edit [`rtmouse.c`](https://github.com/rt-net/RaspberryPiMouse/blob/dd0343449951a99b067e24aef3c03ae5ed9ab936/src/drivers/rtmouse.c#L54) to change the defined value `RASPBERRYPI` from '2' to '4'.
6180

62-
Raspberry Pi 4ではCPUのレジスタがそれまでのRaspberry Piとは異なります([issues#21](https://github.com/rt-net/RaspberryPiMouse/issues/21))。
63-
Raspberry Pi 4で本ドライバを使用する際には`rtmouse.c`の以下の行(2020年4月13日現在の最新版のv2.1.0では[54行目](https://github.com/rt-net/RaspberryPiMouse/blob/dd0343449951a99b067e24aef3c03ae5ed9ab936/src/drivers/rtmouse.c#L54))を`RASPBERRYPI 4`に書き換えてビルドする必要があります。
81+
Raspberry Pi 4ではCPUのレジスタがそれまでのRaspberry Piとは異なります([issues#21](https://github.com/rt-net/RaspberryPiMouse/issues/21))。
82+
Raspberry Pi 4で本ドライバを使用する際には`rtmouse.c`の以下の行(2020年4月13日現在の最新版のv2.1.0では[54行目](https://github.com/rt-net/RaspberryPiMouse/blob/dd0343449951a99b067e24aef3c03ae5ed9ab936/src/drivers/rtmouse.c#L54))を`RASPBERRYPI 4`に書き換えてビルドする必要があります。
6483
[`./utils/build_install.bash`](./utils/build_install.bash)を実行すると、Raspberry Piのモデルに合わせて[`rtmouse.c`](./src/drivers/rtmouse.c)[自動で書き換わります](https://github.com/rt-net/RaspberryPiMouse/blob/a9af4fa2b2a8e34c0f93a6ce5cf88ebd50ff39c2/utils/build_install.raspi4ubuntu.bash#L13-L14)
6584

6685
```c
@@ -74,7 +93,7 @@ Raspberry Pi 4で本ドライバを使用する際には`rtmouse.c`の以下の
7493
7594
### パルスカウンタについて
7695
77-
パルスカウンタは値の読み取りにI2Cを使用しています。仕様上は400kHzまでbaudrateを上げることができます(※1)。
96+
パルスカウンタは値の読み取りにI2Cを使用しています。仕様上は400kHzまでbaudrateを上げることができます(※1)。
7897
I2Cのbaudrateを上げると通信に失敗する場合がある([issues#13](https://github.com/rt-net/RaspberryPiMouse/issues/13))ので、基本的にはI2Cのbaudrateはデフォルト値(※2)から変更して62.5kHzに固定してください。
7998
8099
According to
@@ -86,7 +105,7 @@ Add a following new line in `/boot/firmware/config.txt` to change the i2c_baudra
86105
```
87106
dtparam=i2c_baudrate=62500
88107
```
89-
※1 Raspberry Pi 4 Model B(Ubuntu 18.04とUbuntu 20.04)を搭載して400kHzで通信できることを確認しています。
108+
※1 Raspberry Pi 4 Model B(Ubuntu Server `18.04` / `20.04` / `22.04` / `24.04`)を搭載して400kHzで通信できることを確認しています。
90109
※2 現在設定されているI2Cのbaudrateは以下のコマンドを実行することで確認できます。
91110
```
92111
$ printf "%d\n" 0x$(xxd -ps /sys/class/i2c-adapter/i2c-1/of_node/clock-frequency)

0 commit comments

Comments
 (0)