Compare commits

..

No commits in common. "master" and "wheezy" have entirely different histories.

5 changed files with 9 additions and 185 deletions

View file

@ -1,17 +1,6 @@
# Adafruit-PiTFT-Helper # Adafruit-PiTFT-Helper
### 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 A script for configuring Adafruit's PiTFT displays on a Raspberry Pi.
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
@ -92,19 +81,6 @@ 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

View file

@ -1,58 +0,0 @@
#!/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

View file

@ -1,5 +1,7 @@
#!/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"
@ -49,16 +51,11 @@ 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
@ -70,8 +67,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 raspberrypi-bootloader chroot $target_mnt sudo apt-get install -y raspberrypi-bootloader
chroot $target_mnt sudo apt-get install adafruit-pitft-helper chroot $target_mnt sudo apt-get install -y 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
@ -81,6 +78,5 @@ 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

View file

@ -3,7 +3,7 @@
set -e set -e
function print_version() { function print_version() {
echo "Adafruit PiTFT Helper v0.8.0" echo "Adafruit PiTFT Helper v0.7.2"
exit 1 exit 1
} }
@ -87,7 +87,7 @@ function update_configtxt() {
fi fi
if [ "${pitfttype}" == "28r" ]; then if [ "${pitfttype}" == "28r" ]; then
overlay="dtoverlay=pitft28-resistive,rotate=90,speed=32000000,fps=20" overlay="dtoverlay=pitft28r,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=pitft35-resistive,rotate=270,speed=25000000,fps=20" overlay="dtoverlay=pitft35r,rotate=90,speed=42000000,fps=20"
fi fi
date=`date` date=`date`
@ -121,14 +121,6 @@ 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"
@ -211,7 +203,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
} }
@ -224,59 +216,12 @@ 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() {
@ -318,19 +263,6 @@ 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"
@ -368,18 +300,6 @@ 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
@ -437,8 +357,6 @@ 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"

View file

@ -1,8 +0,0 @@
#!/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"