Skip to content

Commit

Permalink
Update build install script name to match the current situation (#75)
Browse files Browse the repository at this point in the history
* Update file name to match the current situation

* Add symbolic link for backward compatibility

* Add debug output
  • Loading branch information
Tiryoh committed Oct 27, 2021
1 parent 8c36a6c commit 53066c2
Show file tree
Hide file tree
Showing 10 changed files with 80 additions and 45 deletions.
2 changes: 1 addition & 1 deletion src/drivers/Makefile
File renamed without changes.
File renamed without changes.
22 changes: 17 additions & 5 deletions utils/build_install.bash
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,26 @@ set -eu
SRC_DIR=$(cd $(dirname ${BASH_SOURCE:-$0})/../; pwd)

if [ -e /usr/src/linux ]; then
# Raspbian/Raspberry Pi OS
$SRC_DIR/utils/build_install.raspbian.bash && exit 0
# build with linux headers installed from source
if grep -q "Raspberry Pi 4" /proc/cpuinfo; then
echo build_install_header_from_source_raspi4.bash
$SRC_DIR/utils/build_install_header_from_source_raspi4.bash
exit 0
else
echo build_install_header_from_source_raspi2.bash
$SRC_DIR/utils/build_install_header_from_source_raspi2.bash
exit 0
fi
elif [ "$(ls /usr/src/linux-* 2> /dev/null)" != '' ]; then
# Ubuntu
# build with linux headers installed with apt
if grep -q "Raspberry Pi 4" /proc/cpuinfo; then
$SRC_DIR/utils/build_install.raspi4ubuntu.bash && exit 0
echo build_install_header_from_apt_raspi4.bash
$SRC_DIR/utils/build_install_header_from_apt_raspi4.bash
exit 0
else
$SRC_DIR/utils/build_install.ubuntu14.bash && exit 0
echo build_install_header_from_apt_raspi2.bash
$SRC_DIR/utils/build_install_header_from_apt_raspi2.bash
exit 0
fi
else
# Error
Expand Down
19 changes: 0 additions & 19 deletions utils/build_install.raspbian.bash

This file was deleted.

1 change: 1 addition & 0 deletions utils/build_install.raspbian.bash
19 changes: 0 additions & 19 deletions utils/build_install.ubuntu14.bash

This file was deleted.

1 change: 1 addition & 0 deletions utils/build_install.ubuntu14.bash
19 changes: 19 additions & 0 deletions utils/build_install_header_from_apt_raspi2.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash -eu

SRC_DIR=$(cd $(dirname ${BASH_SOURCE:-$0})/../; pwd)

# check kernel headers
[ ! -e /usr/src/linux-headers-$(uname -r) ] && { bash -e $SRC_DIR/utils/print_env.bash "No kernel header files found."; exit 1; }

# build and install the driver
cd $SRC_DIR/src/drivers/
rm Makefile
ln -s Makefile.header_from_apt Makefile
make clean
make
sudo insmod rtmouse.ko

# initialize the driver
sleep 1
sudo chmod 666 /dev/rt*
echo 0 > /dev/rtmotoren0
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ SRC_DIR=$(cd $(dirname ${BASH_SOURCE:-$0})/../; pwd)
# build and install the driver
cd $SRC_DIR/src/drivers/
rm Makefile
ln -s Makefile.ubuntu14 Makefile
ln -s Makefile.header_from_apt Makefile
make clean
# Update for Raspberry Pi 4
sed -i -e "s/#define RASPBERRYPI 2/#define RASPBERRYPI 4/g" rtmouse.c
Expand Down
19 changes: 19 additions & 0 deletions utils/build_install_header_from_source_raspi2.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash -eu

SRC_DIR=$(cd $(dirname ${BASH_SOURCE:-$0})/../; pwd)

# check kernel headers
[ ! -e /usr/src/linux ] && { bash -e $SRC_DIR/utils/print_env.bash "No kernel header files found."; exit 1; }

# build and install the driver
cd $SRC_DIR/src/drivers/
rm Makefile
ln -s Makefile.header_from_source Makefile
make clean
make
sudo insmod rtmouse.ko

# initialize the driver
sleep 1
sudo chmod 666 /dev/rt*
echo 0 > /dev/rtmotoren0
21 changes: 21 additions & 0 deletions utils/build_install_header_from_source_raspi4.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash -eu

SRC_DIR=$(cd $(dirname ${BASH_SOURCE:-$0})/../; pwd)

# check kernel headers
[ ! -e /usr/src/linux ] && { bash -e $SRC_DIR/utils/print_env.bash "No kernel header files found."; exit 1; }

# build and install the driver
cd $SRC_DIR/src/drivers/
rm Makefile
ln -s Makefile.header_from_source Makefile
make clean
# Update for Raspberry Pi 4
sed -i -e "s/#define RASPBERRYPI 2/#define RASPBERRYPI 4/g" rtmouse.c
make
sudo insmod rtmouse.ko

# initialize the driver
sleep 1
sudo chmod 666 /dev/rt*
echo 0 > /dev/rtmotoren0

0 comments on commit 53066c2

Please sign in to comment.