Skip to content

Commit

Permalink
update README and add install.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
neggles committed May 9, 2021
1 parent 2bc76d8 commit 72686ed
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,21 @@ sudo dkms install cm4io-fan/0.1.0
dtoverlay=cm4io-fan,minrpm=1000,maxrpm=5000
```

## Install from git
1. Install dkms if you haven't already:
```
sudo apt install dkms
```
2. Clone the repo
```
mkdir -p ~/src
cd ~/src
git clone https://github.com/neg2led/cm4io-fan.git
cd cm4io-fan
```
3. Run install.sh, feel free to inspect it yourself first. It will archive the current HEAD to /usr/src with an appropriate version, and run DKMS.


## Config options
The device tree overlay has a few options, here's the equivalent of a `/boot/overlays/README` info section:

Expand Down
35 changes: 35 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env bash
set -e

# version/name strings
DRV_NAME="cm4io-fan"
DRV_VERSION="0.1.0-1"

# check kernel arch
KERN_ARCH=$(uname -m)
# uncomment this to override kernel arch check
# I don't think this works on 32-bit, but maybe?
#KERN_ARCH="aarch64"

# kernel arch check
if [[ ${KERN_ARCH} -ne "aarch64" ]]; then
echo "Error! aarch64 kernel not detected"
echo "If you'd like to continue anyway, uncomment the override in install.sh"
exit 1
fi

# make git archive the repo to the right spot
git archive HEAD | tar -x -C "/usr/src/${DRV_NAME}-${DRV_VERSION}"

# run dkms
sudo dkms install "${DRV_NAME}/${DRV_VERSION}"

# add line to /boot/config.txt
if (grep -q "^dtoverlay=${DRV_NAME}" /boot/config.txt); then
echo "config.txt param already present"
else
echo "Adding line to config.txt..."
sudo echo "dtoverlay=cm4io-fan,minrpm=500,maxrpm=2500" >> /boot/config.txt
fi

exit 0

0 comments on commit 72686ed

Please sign in to comment.