# HG changeset patch # User Christophe Lincoln # Date 1400167154 -7200 # Node ID abffc259e9cb54581228bc8daabb40abe44820cd # Parent 15bddf06f52e7f9859e7cbc591f95642c66330ae Add support for PiTFT via a a small script diff -r 15bddf06f52e -r abffc259e9cb flavors/pitft/README --- a/flavors/pitft/README Mon May 12 21:27:55 2014 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -SliTaz PiTFT Touchscreen ------------------------- - -SliTaz runs nicely on PiTFT! Here is a custom flavor to get started. -Cross compiling the fbtft kernel driver is done with: - -# sat-rpi cook-linux --clean --gconfig --fbtft - -Then enable video drivers you want, close the config and it will build. -The default X session is powered by sts. - - -Adafruit Fork of FBTFT for use with Adafruit TS shield ------------------------------------------------------- -https://github.com/adafruit/adafruit-rpi-fbtft/ - - -Adafruit guides ---------------- -https://learn.adafruit.com/adafruit-pitft-28-inch-resistive-touchscreen-display-raspberry-pi - diff -r 15bddf06f52e -r abffc259e9cb flavors/pitft/flavor.conf --- a/flavors/pitft/flavor.conf Mon May 12 21:27:55 2014 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -# SliTaz ARM Flavor configuration file. -# - -FLAVOR="pitft" -VERSION="20140410" -MAINTAINER="pankso@slitaz.org" -SHORT_DESC="SliTaz Raspberry PiTFT (tiny touchscreen)" -WEB_SITE="http://arm.slitaz.org/rpi" diff -r 15bddf06f52e -r abffc259e9cb flavors/pitft/packages.list --- a/flavors/pitft/packages.list Mon May 12 21:27:55 2014 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,107 +0,0 @@ -busybox -gcc-lib-base -gettext-base -glibc-base -kbd-base -slitaz-base-files -slitaz-boot-scripts -slitaz-configs-base -slitaz-tools -slitaz-icon -slitaz-polar-cursors -spk -tazirc -util-linux-blkid -util-linux-uuid -ncurses-common -ncurses -ncursesw -libcomerr -e2fsprogs -dialog -zlib -dropbear -joe -nano -lynx -clex -wireless_tools -wpa_supplicant -libssl -libcrypto -libgcrypt -libgpg-error -libnl -dosfstools -udev -kmod -liblzma -bzip2 -usbids -bzlib -freetype -libxcb -attr -expat -libxml2 -acl -fontconfig -jpeg -pixman -xorg-libX11 -xorg-libXft -xorg-libXrender -xorg-libXpm -xorg-libXext -xorg-libXmu -xorg-libXau -xorg-libXdmcp -xorg-libXt -xorg-libXinerama -xorg-libXcomposite -xorg-libXv -xorg-libxkbfile -xorg-libXaw -xorg-libXaw -xorg-libSM -xorg-libICE -xorg-xkeyboard-config -xorg-libpciaccess -xorg-libXxf86vm -xorg-libXfont -xorg-libXcursor -xorg-libXrandr -xorg-libXdamage -xorg-libXfixes -xorg-libfontenc -xorg-xkbcomp -xorg-server-light -xorg-base-fonts -xorg-xf86-input-evdev -xorg-xf86-video-fbdev -xorg-xload -xorg-xclock -ttf-dejavu -giflib -tiff -libid3tag -libjpeg -libpng -imlib2 -hsetroot -xterm -fox -adie -pathfinder -shutterbug -calculator -links -slim -alsa-lib -libltdl -alsa-utils -mpg123 -glib -pango -cairo -openbox diff -r 15bddf06f52e -r abffc259e9cb flavors/pitft/rootfs/etc/X11/xorg.conf.d/99-calibration.conf --- a/flavors/pitft/rootfs/etc/X11/xorg.conf.d/99-calibration.conf Mon May 12 21:27:55 2014 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -Section "InputClass" - Identifier "calibration" - MatchProduct "stmpe-ts" - Option "Calibration" "3692 48 154 3892" - Option "SwapAxes" "1" -EndSection diff -r 15bddf06f52e -r abffc259e9cb flavors/pitft/rootfs/etc/init.d/local.sh --- a/flavors/pitft/rootfs/etc/init.d/local.sh Mon May 12 21:27:55 2014 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -#!/bin/sh -# -# /etc/init.d/local.sh: Local startup commands -# -# All commands here will be executed at boot time. -# - -echo "Setting up PiTFP screen..." -#modprobe fbtft_device debug=7 custom name=fb_ili9340 speed=16000000 \ -# rotate=90 gpios=dc:25 init=-1,0x01,-2,5,-1,0x28,-1,0xEF,0x03,0x80,0x02,-1,0xCF,0x00,0xC1,0x30,-1,0xED,0x64,0x03,0x12,0x81,-1,0xE8,0x85,0x00,0x78,-1,0xCB,0x39,0x2C,0x00,0x34,0x02,-1,0xF7,0x20,-1,0xEA,0x00,0x00,-1,0xC0,0x23,-1,0xC1,0x10,-1,0xC5,0x3e,0x28,-1,0xC7,0x86,-1,0x3A,0x55,-1,0xB1,0x00,0x18,-1,0xB6,0x08,0x82,0x27,-1,0xF2,0x00,-1,0x26,0x01,-1,0xE0,0x0F,0x31,0x2B,0x0C,0x0E,0x08,0x4E,0xF1,0x37,0x07,0x10,0x03,0x0E,0x09,0x00,-1,0xE1,0x00,0x0E,0x14,0x03,0x11,0x07,0x31,0xC1,0x48,0x08,0x0F,0x0C,0x31,0x36,0x0F,-1,0x11,-2,100,-1,0x29,-2,20,-3 -modprobe -v fbtft_device name=adafruitts rotate=90 -export FRAMEBUFFER=/dev/fb1 -startd slim diff -r 15bddf06f52e -r abffc259e9cb flavors/pitft/rootfs/etc/modprobe.d/pitft.conf --- a/flavors/pitft/rootfs/etc/modprobe.d/pitft.conf Mon May 12 21:27:55 2014 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -# PiTFT kernel module options - -options fbtft_device name=adafruitts rotate=90 diff -r 15bddf06f52e -r abffc259e9cb flavors/pitft/rootfs/etc/slim.conf --- a/flavors/pitft/rootfs/etc/slim.conf Mon May 12 21:27:55 2014 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,93 +0,0 @@ -# /etc/slim.conf: Slim LogIn Manger configuration file -# - -# Path, X server and arguments (if needed) -# Note: -xauth $authfile is automatically appended -default_path ./:/bin:/usr/bin:/usr/local/bin -default_xserver /usr/bin/Xorg -#xserver_arguments -dpi 75 - -# Commands for halt, login, etc. -halt_cmd /sbin/poweroff -reboot_cmd /sbin/reboot -console_cmd /usr/bin/xterm -C -fg white -bg black +sb -T "Console login" -e /bin/sh -l -c "exec /bin/login" -#suspend_cmd /usr/sbin/suspend - -# Full path to the xauth binary -xauth_path /usr/bin/xauth - -# Xauth file for server -authfile /run/slim.auth - -# Activate numlock when slim starts. Valid values: on|off -# numlock on - -# Hide the mouse cursor (note: does not work with some WMs). -# Valid values: true|false -hidecursor true - -# This command is executed after a succesful login. -# you can place the %session and %theme variables -# to handle launching of specific commands in .xinitrc -# depending of chosen session and slim theme -# -# NOTE: if your system does not have bash you need -# to adjust the command according to your preferred shell, -# i.e. for freebsd use: -# login_cmd exec /bin/sh - ~/.xinitrc %session -login_cmd exec /bin/sh -l ~/.xinitrc %session - -# Commands executed when starting and exiting a session. -# They can be used for registering a X11 session with -# sessreg. You can use the %user variable -# -# sessionstart_cmd some command -# sessionstop_cmd some command - -# Start in daemon mode. Valid values: yes | no -# Note that this can be overriden by the command line -# options "-d" and "-nodaemon" -# daemon yes - -# Available sessions (first one is the default). -# The current chosen session name is replaced in the login_cmd -# above, so your login command can handle different sessions. -# see the xinitrc.sample file shipped with slim sources -sessions enlightenment,openbox,jwmxs - -# Executed when pressing F11 (requires imagemagick) -#screenshot_cmd mtpaint -s /root/slim-shot.png - -# welcome message. Available variables: %host, %domain -welcome_msg Welcome to %host - -# Session message. Prepended to the session name when pressing F1 -# session_msg Session: - -# shutdown / reboot messages -shutdown_msg The system is going down... -reboot_msg The system is rebooting... - -# default user, leave blank or remove this line -# for avoid pre-loading the username. -default_user root - -# Focus the password field on start when default_user is set -# Set to "yes" to enable this feature -#focus_password no - -# Automatically login the default user (without entering -# the password. Set to "yes" to enable this feature -auto_login yes - - -# current theme, use comma separated list to specify a set to -# randomly choose from -current_theme rpi - -# Lock file -lockfile /run/slim.lock - -# Log file -logfile /var/log/slim.log - diff -r 15bddf06f52e -r abffc259e9cb flavors/pitft/rootfs/etc/slitaz/applications.conf --- a/flavors/pitft/rootfs/etc/slitaz/applications.conf Mon May 12 21:27:55 2014 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ -# SliTaz default applications configuration file. These apps can be -# started through wrappers: browser, editor and terminal. -# - -# File manager. -FILE_MANAGER="PathFinder" - -# Web browser. -BROWSER="links -g" - -# Text editor. -EDITOR="adie" - -# X terminal. -TERMINAL="xterm" - -# Window manager. -WINDOW_MANAGER="sts-session" diff -r 15bddf06f52e -r abffc259e9cb flavors/pitft/rootfs/etc/udev/rules.d/95-stmpe.rules --- a/flavors/pitft/rootfs/etc/udev/rules.d/95-stmpe.rules Mon May 12 21:27:55 2014 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -SUBSYSTEM=="input", ATTRS{name}=="stmpe-ts", ENV{DEVNAME}=="*event*", SYMLINK+="input/touchscreen" diff -r 15bddf06f52e -r abffc259e9cb rpi/pitft-setup --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rpi/pitft-setup Thu May 15 17:19:14 2014 +0200 @@ -0,0 +1,84 @@ +#!/bin/sh +# +# Setup Adafruit PiTFT on SliTaz Raspberry Pi +# +. /etc/slitaz/slitaz.conf + +linux="linux-pitft-3.10.32+-arm.tazpkg" +mirror="http://mirror.slitaz.org/arm/rpi/packages" +cache="/var/cache/tazpkg" + +module_conf="/etc/modprobe.d/pitft.conf" +calibration_conf="/etc/X11/xorg.conf.d/99-calibration.conf" +udev_rules="/etc/udev/rules.d/95-stmpe.rules" + +# Kernel +if [ ! -d "$PKGS_DB/installed/linux-pitft" ]; then + cd ${cache} + if [ ! -f "$linux" ]; then + echo "Downloading custom Linux kernel..." + busybox wget ${mirror}/${linux} + fi + spk-add ${linux} +fi + +# Modules +if [ ! -f "$module_conf" ]; then + echo "Creating: $module_conf" + cat > ${module_conf} << EOT +# PiTFT kernel module options +# +options fbtft_device name=adafruitts rotate=90 frequency=32000000 +options rpi_power_switch gpio_pin=23 mode=0 +EOT +fi +modprobe -v spi-bcm2708 +modprobe -v fbtft_device + +# Xorg calibration +if [ ! -f "$calibration_conf" ]; then + echo "Creating: $calibration_conf" + cat > ${calibration_conf} << EOT +Section "InputClass" + Identifier "calibration" + MatchProduct "stmpe-ts" + Option "Calibration" "3692 48 154 3892" + Option "SwapAxes" "1" +EndSection +EOT +fi + +# Udev +if [ ! -f "$udev_rules" ]; then + echo "Creating: $udev_rules" + cat > ${udev_rules} << EOT +SUBSYSTEM=="input", ATTRS{name}=="stmpe-ts", ENV{DEVNAME}=="*event*", SYMLINK+="input/touchscreen" +EOT +fi + +# Autologin and use PiTFT kernel +echo "Configuring autologin..." +sed -i s'/#auto_login.*/auto_login yes/' /etc/slim.conf +echo "Configuring bootloader..." +sed -i s'/kernel=.*/kernel=kernel-pitft.img/' /boot/config.txt + +# Start on boot +if ! grep -q 'FRAMEBUFFER' /etc/init.d/local.sh; then + echo "Enabling PiTFT at boot time..." + cat >> /etc/init.d/local.sh << EOT + +echo "Setting up PiTFT touchscreen..." +modprobe -v spi-bcm2708 +modprobe -v fbtft_device +#modprobe -v rpi_power_switch +export FRAMEBUFFER=/dev/fb1 +startd slim + +EOT +fi + +echo "----" +echo "PiTFT initiliazation finished: you can reboot" +echo "----" + +exit 0 diff -r 15bddf06f52e -r abffc259e9cb rpi/tazberry --- a/rpi/tazberry Mon May 12 21:27:55 2014 +0200 +++ b/rpi/tazberry Thu May 15 17:19:14 2014 +0200 @@ -368,7 +368,9 @@ --cancel-label "TazBerry" \ --menu "\nSetup or use a breakout board" ${height} ${width} 14 \ "camera" "$(gettext 'Configure your Pi to use a Camera')" \ -"piglow" "$(gettext 'Setup your Pi to use PiGlow')" 2>${tmp} +"piglow" "$(gettext 'Setup your Pi to use PiGlow')" \ +"raspicomm" "$(gettext 'Initialize RaspiComm board')" \ +"pitft" "$(gettext 'Setup PiTFT touchscreen')" 2>${tmp} # Handle options case "$?" in @@ -389,6 +391,11 @@ if [ "$anser" == "y" ]; then echo "Enter a value between: 5-255" && pyglow test fi ;; + raspicomm) + raspicomm init; read -t 4 ;; + pitft) + pitft-setup + echo -n "Press ENTER to continue..."; read ;; esac } diff -r 15bddf06f52e -r abffc259e9cb sat-rpi --- a/sat-rpi Mon May 12 21:27:55 2014 +0200 +++ b/sat-rpi Thu May 15 17:19:14 2014 +0200 @@ -175,7 +175,7 @@ fi # TazBerry, Piboot, Pileds, ... - for tool in tazberry piboot pileds raspicomm + for tool in tazberry piboot pileds raspicomm piface pitft-setup do echo -n "Copying utility: $tool" cp -f ${rpi}/${tool} ${rootfs}/usr/sbin @@ -241,8 +241,8 @@ cd ${kernel} export PATH=$PATH:/cross/${arch}/tools/bin export HOST_SYSTEM=${arch}-slitaz-linux-gnueabi - make mrproper && - make ARCH=arm bcmrpi_defconfig + #make mrproper && + #make ARCH=arm bcmrpi_defconfig if [ ! "$nopatch" ]; then echo "Patching SliTaz RPi Linux .config" patch -p0 -i ${data}/linux-rpi.patch || exit 1