slitaz-arm view rpi/pitft-setup @ rev 214
tazbian: typo
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Thu May 05 17:03:59 2016 +0200 (2016-05-05) |
parents | abffc259e9cb |
children |
line source
1 #!/bin/sh
2 #
3 # Setup Adafruit PiTFT on SliTaz Raspberry Pi
4 #
5 . /etc/slitaz/slitaz.conf
7 linux="linux-pitft-3.10.32+-arm.tazpkg"
8 mirror="http://mirror.slitaz.org/arm/rpi/packages"
9 cache="/var/cache/tazpkg"
11 module_conf="/etc/modprobe.d/pitft.conf"
12 calibration_conf="/etc/X11/xorg.conf.d/99-calibration.conf"
13 udev_rules="/etc/udev/rules.d/95-stmpe.rules"
15 # Kernel
16 if [ ! -d "$PKGS_DB/installed/linux-pitft" ]; then
17 cd ${cache}
18 if [ ! -f "$linux" ]; then
19 echo "Downloading custom Linux kernel..."
20 busybox wget ${mirror}/${linux}
21 fi
22 spk-add ${linux}
23 fi
25 # Modules
26 if [ ! -f "$module_conf" ]; then
27 echo "Creating: $module_conf"
28 cat > ${module_conf} << EOT
29 # PiTFT kernel module options
30 #
31 options fbtft_device name=adafruitts rotate=90 frequency=32000000
32 options rpi_power_switch gpio_pin=23 mode=0
33 EOT
34 fi
35 modprobe -v spi-bcm2708
36 modprobe -v fbtft_device
38 # Xorg calibration
39 if [ ! -f "$calibration_conf" ]; then
40 echo "Creating: $calibration_conf"
41 cat > ${calibration_conf} << EOT
42 Section "InputClass"
43 Identifier "calibration"
44 MatchProduct "stmpe-ts"
45 Option "Calibration" "3692 48 154 3892"
46 Option "SwapAxes" "1"
47 EndSection
48 EOT
49 fi
51 # Udev
52 if [ ! -f "$udev_rules" ]; then
53 echo "Creating: $udev_rules"
54 cat > ${udev_rules} << EOT
55 SUBSYSTEM=="input", ATTRS{name}=="stmpe-ts", ENV{DEVNAME}=="*event*", SYMLINK+="input/touchscreen"
56 EOT
57 fi
59 # Autologin and use PiTFT kernel
60 echo "Configuring autologin..."
61 sed -i s'/#auto_login.*/auto_login yes/' /etc/slim.conf
62 echo "Configuring bootloader..."
63 sed -i s'/kernel=.*/kernel=kernel-pitft.img/' /boot/config.txt
65 # Start on boot
66 if ! grep -q 'FRAMEBUFFER' /etc/init.d/local.sh; then
67 echo "Enabling PiTFT at boot time..."
68 cat >> /etc/init.d/local.sh << EOT
70 echo "Setting up PiTFT touchscreen..."
71 modprobe -v spi-bcm2708
72 modprobe -v fbtft_device
73 #modprobe -v rpi_power_switch
74 export FRAMEBUFFER=/dev/fb1
75 startd slim
77 EOT
78 fi
80 echo "----"
81 echo "PiTFT initialization finished: you can reboot"
82 echo "----"
84 exit 0