Skip to content

Commit 53066c2

Browse files
authored
Update build install script name to match the current situation (#75)
* Update file name to match the current situation * Add symbolic link for backward compatibility * Add debug output
1 parent 8c36a6c commit 53066c2

10 files changed

+80
-45
lines changed

src/drivers/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Makefile.ubuntu14
1+
Makefile.header_from_apt
File renamed without changes.

utils/build_install.bash

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,26 @@ set -eu
44
SRC_DIR=$(cd $(dirname ${BASH_SOURCE:-$0})/../; pwd)
55

66
if [ -e /usr/src/linux ]; then
7-
# Raspbian/Raspberry Pi OS
8-
$SRC_DIR/utils/build_install.raspbian.bash && exit 0
7+
# build with linux headers installed from source
8+
if grep -q "Raspberry Pi 4" /proc/cpuinfo; then
9+
echo build_install_header_from_source_raspi4.bash
10+
$SRC_DIR/utils/build_install_header_from_source_raspi4.bash
11+
exit 0
12+
else
13+
echo build_install_header_from_source_raspi2.bash
14+
$SRC_DIR/utils/build_install_header_from_source_raspi2.bash
15+
exit 0
16+
fi
917
elif [ "$(ls /usr/src/linux-* 2> /dev/null)" != '' ]; then
10-
# Ubuntu
18+
# build with linux headers installed with apt
1119
if grep -q "Raspberry Pi 4" /proc/cpuinfo; then
12-
$SRC_DIR/utils/build_install.raspi4ubuntu.bash && exit 0
20+
echo build_install_header_from_apt_raspi4.bash
21+
$SRC_DIR/utils/build_install_header_from_apt_raspi4.bash
22+
exit 0
1323
else
14-
$SRC_DIR/utils/build_install.ubuntu14.bash && exit 0
24+
echo build_install_header_from_apt_raspi2.bash
25+
$SRC_DIR/utils/build_install_header_from_apt_raspi2.bash
26+
exit 0
1527
fi
1628
else
1729
# Error

utils/build_install.raspbian.bash

Lines changed: 0 additions & 19 deletions
This file was deleted.

utils/build_install.raspbian.bash

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
build_install_header_from_source_raspi2.bash

utils/build_install.ubuntu14.bash

Lines changed: 0 additions & 19 deletions
This file was deleted.

utils/build_install.ubuntu14.bash

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
build_install_header_from_apt_raspi2.bash
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash -eu
2+
3+
SRC_DIR=$(cd $(dirname ${BASH_SOURCE:-$0})/../; pwd)
4+
5+
# check kernel headers
6+
[ ! -e /usr/src/linux-headers-$(uname -r) ] && { bash -e $SRC_DIR/utils/print_env.bash "No kernel header files found."; exit 1; }
7+
8+
# build and install the driver
9+
cd $SRC_DIR/src/drivers/
10+
rm Makefile
11+
ln -s Makefile.header_from_apt Makefile
12+
make clean
13+
make
14+
sudo insmod rtmouse.ko
15+
16+
# initialize the driver
17+
sleep 1
18+
sudo chmod 666 /dev/rt*
19+
echo 0 > /dev/rtmotoren0

utils/build_install.raspi4ubuntu.bash renamed to utils/build_install_header_from_apt_raspi4.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ SRC_DIR=$(cd $(dirname ${BASH_SOURCE:-$0})/../; pwd)
88
# build and install the driver
99
cd $SRC_DIR/src/drivers/
1010
rm Makefile
11-
ln -s Makefile.ubuntu14 Makefile
11+
ln -s Makefile.header_from_apt Makefile
1212
make clean
1313
# Update for Raspberry Pi 4
1414
sed -i -e "s/#define RASPBERRYPI 2/#define RASPBERRYPI 4/g" rtmouse.c
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash -eu
2+
3+
SRC_DIR=$(cd $(dirname ${BASH_SOURCE:-$0})/../; pwd)
4+
5+
# check kernel headers
6+
[ ! -e /usr/src/linux ] && { bash -e $SRC_DIR/utils/print_env.bash "No kernel header files found."; exit 1; }
7+
8+
# build and install the driver
9+
cd $SRC_DIR/src/drivers/
10+
rm Makefile
11+
ln -s Makefile.header_from_source Makefile
12+
make clean
13+
make
14+
sudo insmod rtmouse.ko
15+
16+
# initialize the driver
17+
sleep 1
18+
sudo chmod 666 /dev/rt*
19+
echo 0 > /dev/rtmotoren0
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash -eu
2+
3+
SRC_DIR=$(cd $(dirname ${BASH_SOURCE:-$0})/../; pwd)
4+
5+
# check kernel headers
6+
[ ! -e /usr/src/linux ] && { bash -e $SRC_DIR/utils/print_env.bash "No kernel header files found."; exit 1; }
7+
8+
# build and install the driver
9+
cd $SRC_DIR/src/drivers/
10+
rm Makefile
11+
ln -s Makefile.header_from_source Makefile
12+
make clean
13+
# Update for Raspberry Pi 4
14+
sed -i -e "s/#define RASPBERRYPI 2/#define RASPBERRYPI 4/g" rtmouse.c
15+
make
16+
sudo insmod rtmouse.ko
17+
18+
# initialize the driver
19+
sleep 1
20+
sudo chmod 666 /dev/rt*
21+
echo 0 > /dev/rtmotoren0

0 commit comments

Comments
 (0)