Compare commits
39 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
625ae04c38 | ||
|
|
5f42dd279b | ||
|
|
a1efb3bbd4 | ||
|
|
a9565919c6 | ||
|
|
fd9875e826 | ||
|
|
ea39b5ed3f | ||
|
|
17f75dfc21 | ||
|
|
1ad86c65df | ||
|
|
d69eda94a2 | ||
|
|
3050ae6466 | ||
|
|
ef9cd1ba66 | ||
|
|
80a890dd28 | ||
|
|
4b5fce978f | ||
|
|
d5ace93de9 | ||
|
|
a15386bbe5 | ||
|
|
6e8fc56252 | ||
|
|
909fcb7651 | ||
|
|
b9306384ad | ||
|
|
36ad0f8830 | ||
|
|
be391b66ae | ||
|
|
fbb75859b3 | ||
|
|
8660d1e689 | ||
|
|
fdcf849b0f | ||
|
|
ac97a91dd9 | ||
|
|
6974f7ddf0 | ||
|
|
c135a09d46 | ||
|
|
c6e40c97c8 | ||
|
|
dc709de686 | ||
|
|
5729d8bb96 | ||
|
|
b819c194be | ||
|
|
e206e787b0 | ||
|
|
02588226a6 | ||
|
|
979d9f69f3 | ||
|
|
71bfb09083 | ||
|
|
e530e04500 | ||
|
|
a6c3430e54 | ||
|
|
a95be2b8ab | ||
|
|
53fb7db162 | ||
|
|
f71d09f43c |
5 changed files with 185 additions and 9 deletions
26
README.md
26
README.md
|
|
@ -1,6 +1,17 @@
|
||||||
# Adafruit-PiTFT-Helper
|
# Adafruit-PiTFT-Helper
|
||||||
|
|
||||||
A script for configuring Adafruit's PiTFT displays on a Raspberry Pi.
|
### This script/repository is deprecated, as trying to do kernel updates on the fast-moving Raspberry Pi wasn't sustainable! We're now using a simpler device-tree-only script, available at https://github.com/adafruit/Raspberry-Pi-Installer-Scripts/blob/main/adafruit-pitft.py
|
||||||
|
|
||||||
|
We'll keep this repo public but archived for the curious.
|
||||||
|
|
||||||
|
---------------------------------
|
||||||
|
|
||||||
|
A (deprecated) script for configuring Adafruit's PiTFT displays on a Raspberry Pi.
|
||||||
|
|
||||||
|
## Attention RETROPIE Users:
|
||||||
|
|
||||||
|
Do not use the adafruit-pitft-helper script with RetroPie. Instead, follow the directions on this page:
|
||||||
|
https://learn.adafruit.com/running-opengl-based-games-and-emulators-on-adafruit-pitft-displays/pitft-setup
|
||||||
|
|
||||||
## PiTFT Documentation
|
## PiTFT Documentation
|
||||||
|
|
||||||
|
|
@ -81,6 +92,19 @@ sudo adafruit-pitft-chroot-install -t 28r -i ~/2015-02-16-raspbian-wheezy.img
|
||||||
...where `-t` specifies the type of PiTFT just like the same option to
|
...where `-t` specifies the type of PiTFT just like the same option to
|
||||||
`adafruit-pitft-helper`, and `-i` specifies the path to an image file.
|
`adafruit-pitft-helper`, and `-i` specifies the path to an image file.
|
||||||
|
|
||||||
|
You can also use [`adafruit-pi-chroot`][pi-chroot] to run a `chroot`ed shell
|
||||||
|
inside of a Raspbian ISO image. Like the install wrapper, this relies on
|
||||||
|
`kpartx`.
|
||||||
|
|
||||||
|
These are the scripts we use to produce the Easy Install images offered in
|
||||||
|
Adafruit product documentation. They may be a bit rough around the edges.
|
||||||
|
|
||||||
|
## Older Versions
|
||||||
|
|
||||||
|
For the version supporting Raspbian Wheezy, check out the `wheezy` branch
|
||||||
|
on this repository.
|
||||||
|
|
||||||
[o]: https://github.com/adafruit/Adafruit-Occidentalis
|
[o]: https://github.com/adafruit/Adafruit-Occidentalis
|
||||||
[p]: https://github.com/adafruit/Adafruit-Pi-Finder
|
[p]: https://github.com/adafruit/Adafruit-Pi-Finder
|
||||||
[c]: https://github.com/adafruit/Adafruit-PiTFT-Helper/blob/master/adafruit-pitft-chroot-install
|
[c]: https://github.com/adafruit/Adafruit-PiTFT-Helper/blob/master/adafruit-pitft-chroot-install
|
||||||
|
[pi-chroot]: https://github.com/adafruit/Adafruit-PiTFT-Helper/blob/master/adafruit-pi-chroot
|
||||||
|
|
|
||||||
58
adafruit-pi-chroot
Executable file
58
adafruit-pi-chroot
Executable file
|
|
@ -0,0 +1,58 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
function print_help() {
|
||||||
|
echo "$0: get a chroot shell inside of a Raspbian ISO"
|
||||||
|
echo "Usage: $0 target.img"
|
||||||
|
echo " -h Print this help"
|
||||||
|
echo " -i [target] Specify an ISO to chroot to (probably a Pi Foundation Raspbian)"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
args=$(getopt -uo 'ht:i:' -- $*)
|
||||||
|
[ $? != 0 ] && print_help
|
||||||
|
set -- $args
|
||||||
|
|
||||||
|
for i
|
||||||
|
do
|
||||||
|
case "$i"
|
||||||
|
in
|
||||||
|
-h)
|
||||||
|
print_help
|
||||||
|
;;
|
||||||
|
-i)
|
||||||
|
target_image="$2"
|
||||||
|
echo "Image = ${2}"
|
||||||
|
shift
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ $EUID -ne 0 ]]; then
|
||||||
|
echo "$0 must be run as root. try: sudo $0"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
target_mnt="/media/raspbian-target"
|
||||||
|
|
||||||
|
# assemble a mostly-legit filesystem by mounting / and /boot from the target
|
||||||
|
# iso, plus /dev from the host pi (/dev/(u)random seems to be required by
|
||||||
|
# recent versions of GPG):
|
||||||
|
echo "Mounting $target_image on $target_mnt"
|
||||||
|
kpartx -av $target_image
|
||||||
|
mkdir -p $target_mnt
|
||||||
|
mount /dev/dm-1 $target_mnt
|
||||||
|
mount /dev/dm-0 $target_mnt/boot
|
||||||
|
mkdir -p $target_mnt/dev
|
||||||
|
mount --bind /dev $target_mnt/dev
|
||||||
|
|
||||||
|
echo "Dropping you into Bash - image will be unmounted after exit"
|
||||||
|
chroot $target_mnt sudo /bin/bash
|
||||||
|
|
||||||
|
echo "Unmounting $target_image"
|
||||||
|
umount $target_mnt/boot
|
||||||
|
umount $target_mnt/dev
|
||||||
|
umount $target_mnt
|
||||||
|
kpartx -d $target_image
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
function print_help() {
|
function print_help() {
|
||||||
echo "Usage: $0 -t [pitfttype] -i target.img"
|
echo "Usage: $0 -t [pitfttype] -i target.img"
|
||||||
echo " -h Print this help"
|
echo " -h Print this help"
|
||||||
|
|
@ -51,11 +49,16 @@ fi
|
||||||
|
|
||||||
target_mnt="/media/raspbian-target"
|
target_mnt="/media/raspbian-target"
|
||||||
|
|
||||||
|
# assemble a mostly-legit filesystem by mounting / and /boot from the target
|
||||||
|
# iso, plus /dev from the host pi (/dev/(u)random seems to be required by
|
||||||
|
# recent versions of GPG):
|
||||||
echo "Mounting $target_image on $target_mnt"
|
echo "Mounting $target_image on $target_mnt"
|
||||||
kpartx -av $target_image
|
kpartx -av $target_image
|
||||||
mkdir -p $target_mnt
|
mkdir -p $target_mnt
|
||||||
mount /dev/dm-1 $target_mnt
|
mount /dev/dm-1 $target_mnt
|
||||||
mount /dev/dm-0 $target_mnt/boot
|
mount /dev/dm-0 $target_mnt/boot
|
||||||
|
mkdir -p $target_mnt/dev
|
||||||
|
mount --bind /dev $target_mnt/dev
|
||||||
|
|
||||||
echo "Dropping you into Bash before install"
|
echo "Dropping you into Bash before install"
|
||||||
chroot $target_mnt sudo /bin/bash
|
chroot $target_mnt sudo /bin/bash
|
||||||
|
|
@ -67,8 +70,8 @@ curl -SLs https://apt.adafruit.com/add | chroot $target_mnt /bin/bash
|
||||||
echo -e "Package: *\nPin: origin \"apt.adafruit.com\"\nPin-Priority: 1001" | chroot $target_mnt bash -c "cat > /etc/apt/preferences.d/adafruit"
|
echo -e "Package: *\nPin: origin \"apt.adafruit.com\"\nPin-Priority: 1001" | chroot $target_mnt bash -c "cat > /etc/apt/preferences.d/adafruit"
|
||||||
|
|
||||||
echo "Installing kernel and adafruit-pitft-helper"
|
echo "Installing kernel and adafruit-pitft-helper"
|
||||||
chroot $target_mnt sudo apt-get install -y raspberrypi-bootloader
|
chroot $target_mnt sudo apt-get install raspberrypi-bootloader
|
||||||
chroot $target_mnt sudo apt-get install -y adafruit-pitft-helper
|
chroot $target_mnt sudo apt-get install adafruit-pitft-helper
|
||||||
|
|
||||||
echo "Running adafruit-pitft-helper"
|
echo "Running adafruit-pitft-helper"
|
||||||
chroot $target_mnt sudo adafruit-pitft-helper -t $pitfttype
|
chroot $target_mnt sudo adafruit-pitft-helper -t $pitfttype
|
||||||
|
|
@ -78,5 +81,6 @@ chroot $target_mnt sudo /bin/bash
|
||||||
|
|
||||||
echo "Unmounting $target_image"
|
echo "Unmounting $target_image"
|
||||||
umount $target_mnt/boot
|
umount $target_mnt/boot
|
||||||
|
umount $target_mnt/dev
|
||||||
umount $target_mnt
|
umount $target_mnt
|
||||||
kpartx -d $target_image
|
kpartx -d $target_image
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
function print_version() {
|
function print_version() {
|
||||||
echo "Adafruit PiTFT Helper v0.7.2"
|
echo "Adafruit PiTFT Helper v0.8.0"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -87,7 +87,7 @@ function update_configtxt() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${pitfttype}" == "28r" ]; then
|
if [ "${pitfttype}" == "28r" ]; then
|
||||||
overlay="dtoverlay=pitft28r,rotate=90,speed=32000000,fps=20"
|
overlay="dtoverlay=pitft28-resistive,rotate=90,speed=32000000,fps=20"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${pitfttype}" == "28c" ]; then
|
if [ "${pitfttype}" == "28c" ]; then
|
||||||
|
|
@ -95,7 +95,7 @@ function update_configtxt() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${pitfttype}" == "35r" ]; then
|
if [ "${pitfttype}" == "35r" ]; then
|
||||||
overlay="dtoverlay=pitft35r,rotate=90,speed=42000000,fps=20"
|
overlay="dtoverlay=pitft35-resistive,rotate=270,speed=25000000,fps=20"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
date=`date`
|
date=`date`
|
||||||
|
|
@ -121,6 +121,14 @@ EOF
|
||||||
function update_xorg() {
|
function update_xorg() {
|
||||||
mkdir -p /etc/X11/xorg.conf.d
|
mkdir -p /etc/X11/xorg.conf.d
|
||||||
|
|
||||||
|
cat > /etc/X11/xorg.conf.d/99-fbdev.conf <<EOF
|
||||||
|
Section "Device"
|
||||||
|
Identifier "myfb"
|
||||||
|
Driver "fbdev"
|
||||||
|
Option "fbdev" "/dev/fb1"
|
||||||
|
EndSection
|
||||||
|
EOF
|
||||||
|
|
||||||
if [ "${pitfttype}" == "28r" ]; then
|
if [ "${pitfttype}" == "28r" ]; then
|
||||||
cat > /etc/X11/xorg.conf.d/99-calibration.conf <<EOF
|
cat > /etc/X11/xorg.conf.d/99-calibration.conf <<EOF
|
||||||
Section "InputClass"
|
Section "InputClass"
|
||||||
|
|
@ -203,7 +211,7 @@ EOF
|
||||||
|
|
||||||
if [ "${pitfttype}" == "28c" ]; then
|
if [ "${pitfttype}" == "28c" ]; then
|
||||||
cat > /etc/udev/rules.d/95-ft6206.rules <<EOF
|
cat > /etc/udev/rules.d/95-ft6206.rules <<EOF
|
||||||
SUBSYSTEM=="input", ATTRS{name}=="ft6x06_ts", ENV{DEVNAME}=="*event*", SYMLINK+="input/touchscreen"
|
SUBSYSTEM=="input", ATTRS{name}=="ft6x06_ts", ENV{DEVNAME}=="*event*", SYMLINK+="input/touchscreen"
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
@ -216,12 +224,59 @@ function install_console() {
|
||||||
echo "/boot/cmdline.txt already updated"
|
echo "/boot/cmdline.txt already updated"
|
||||||
fi
|
fi
|
||||||
sed -i 's/BLANK_TIME=.*/BLANK_TIME=0/g' "/etc/kbd/config"
|
sed -i 's/BLANK_TIME=.*/BLANK_TIME=0/g' "/etc/kbd/config"
|
||||||
|
cat > /etc/rc.local <<EOF
|
||||||
|
#!/bin/sh -e
|
||||||
|
#
|
||||||
|
# rc.local
|
||||||
|
#
|
||||||
|
# This script is executed at the end of each multiuser runlevel.
|
||||||
|
# Make sure that the script will "exit 0" on success or any other
|
||||||
|
# value on error.
|
||||||
|
#
|
||||||
|
# In order to enable or disable this script just change the execution
|
||||||
|
# bits.
|
||||||
|
#
|
||||||
|
# By default this script does nothing.
|
||||||
|
|
||||||
|
# Print the IP address
|
||||||
|
_IP=$(hostname -I) || true
|
||||||
|
if [ "$_IP" ]; then
|
||||||
|
printf "My IP address is %s\n" "$_IP"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# disable console blanking on PiTFT
|
||||||
|
sudo sh -c "TERM=linux setterm -blank 0 >/dev/tty0"
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
function uninstall_console() {
|
function uninstall_console() {
|
||||||
sed -i 's/rootwait fbcon=map:10 fbcon=font:VGA8x8/rootwait/g' "/boot/cmdline.txt"
|
sed -i 's/rootwait fbcon=map:10 fbcon=font:VGA8x8/rootwait/g' "/boot/cmdline.txt"
|
||||||
sed -i 's/BLANK_TIME=0/BLANK_TIME=10/g' "/etc/kbd/config"
|
sed -i 's/BLANK_TIME=0/BLANK_TIME=10/g' "/etc/kbd/config"
|
||||||
echo "Screen blanking time reset to 10 minutes"
|
echo "Screen blanking time reset to 10 minutes"
|
||||||
|
cat > /etc/rc.local <<EOF
|
||||||
|
#!/bin/sh -e
|
||||||
|
#
|
||||||
|
# rc.local
|
||||||
|
#
|
||||||
|
# This script is executed at the end of each multiuser runlevel.
|
||||||
|
# Make sure that the script will "exit 0" on success or any other
|
||||||
|
# value on error.
|
||||||
|
#
|
||||||
|
# In order to enable or disable this script just change the execution
|
||||||
|
# bits.
|
||||||
|
#
|
||||||
|
# By default this script does nothing.
|
||||||
|
|
||||||
|
# Print the IP address
|
||||||
|
_IP=$(hostname -I) || true
|
||||||
|
if [ "$_IP" ]; then
|
||||||
|
printf "My IP address is %s\n" "$_IP"
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
function update_etcmodules() {
|
function update_etcmodules() {
|
||||||
|
|
@ -263,6 +318,19 @@ EOF
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function update_bootprefs() {
|
||||||
|
echo "Turning off boot-to-desktop"
|
||||||
|
if [ -e /etc/init.d/lightdm ]; then
|
||||||
|
if [ $SYSTEMD -eq 1 ]; then
|
||||||
|
systemctl set-default multi-user.target
|
||||||
|
ln -fs /lib/systemd/system/getty@.service /etc/systemd/system/getty.target.wants/getty@tty1.service
|
||||||
|
else
|
||||||
|
update-rc.d lightdm disable 2
|
||||||
|
sed /etc/inittab -i -e "s/1:2345:respawn:\/bin\/login -f pi tty1 <\/dev\/tty1 >\/dev\/tty1 2>&1/1:2345:respawn:\/sbin\/getty --noclear 38400 tty1/"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# MAIN
|
# MAIN
|
||||||
|
|
||||||
target_homedir="/home/pi"
|
target_homedir="/home/pi"
|
||||||
|
|
@ -300,6 +368,18 @@ if [[ $EUID -ne 0 ]]; then
|
||||||
bail "adafruit-pitft-helper must be run as root. try: sudo adadfruit-pitft-helper"
|
bail "adafruit-pitft-helper must be run as root. try: sudo adadfruit-pitft-helper"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# check init system (technique borrowed from raspi-config):
|
||||||
|
info PITFT 'Checking init system...'
|
||||||
|
if command -v systemctl > /dev/null && systemctl | grep -q '\-\.mount'; then
|
||||||
|
echo "Found systemd"
|
||||||
|
SYSTEMD=1
|
||||||
|
elif [ -f /etc/init.d/cron ] && [ ! -h /etc/init.d/cron ]; then
|
||||||
|
echo "Found sysvinit"
|
||||||
|
SYSTEMD=0
|
||||||
|
else
|
||||||
|
bail "Unrecognised init system"
|
||||||
|
fi
|
||||||
|
|
||||||
if grep -q boot /proc/mounts; then
|
if grep -q boot /proc/mounts; then
|
||||||
echo "/boot is mounted"
|
echo "/boot is mounted"
|
||||||
else
|
else
|
||||||
|
|
@ -357,6 +437,8 @@ if [ "${pitfttype}" != "35r" ]; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# update_bootprefs || bail "Unable to set boot preferences"
|
||||||
|
|
||||||
info PITFT "Updating /boot/config.txt..."
|
info PITFT "Updating /boot/config.txt..."
|
||||||
update_configtxt || bail "Unable to update /boot/config.txt"
|
update_configtxt || bail "Unable to update /boot/config.txt"
|
||||||
|
|
||||||
|
|
|
||||||
8
adafruit-pitft-helper2.sh
Normal file
8
adafruit-pitft-helper2.sh
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo "This script has been updated and now lives at https://github.com/adafruit/Raspberry-Pi-Installer-Scripts/blob/master/adafruit-pitft.sh"
|
||||||
|
echo "please run:"
|
||||||
|
echo "-----------"
|
||||||
|
echo "# wget https://raw.githubusercontent.com/adafruit/Raspberry-Pi-Installer-Scripts/master/adafruit-pitft.sh"
|
||||||
|
echo "# chmod +x adafruit-pitft.sh"
|
||||||
|
echo "# sudo ./adafruit-pitft.sh"
|
||||||
Loading…
Reference in a new issue