Skip to content

Update build install script name to match the current situation #75

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

意図した差分が出ていないので、コメントで補足。
このファイルは旧build_install.ubunt14.bashの名前を変えたもので、
差分は11行目のln -s Makefile.ubuntu14 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

意図した差分が出ていないので、コメントで補足。
このファイルは旧build_install.raspbian.bashの名前を変えたもので、
差分は11行目のln -s Makefile.raspbian 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
Comment on lines +13 to +14
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

コメントで補足。
このファイルと、build_install_header_from_source_raspi2.bashの差分は13, 14行目のみ。

make
sudo insmod rtmouse.ko

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