slitaz-arm rev 187

Add support for PiTFT via a a small script
author Christophe Lincoln <pankso@slitaz.org>
date Thu May 15 17:19:14 2014 +0200 (2014-05-15)
parents 15bddf06f52e
children ad488d58318b
files flavors/pitft/README flavors/pitft/flavor.conf flavors/pitft/packages.list flavors/pitft/rootfs/etc/X11/xorg.conf.d/99-calibration.conf flavors/pitft/rootfs/etc/init.d/local.sh flavors/pitft/rootfs/etc/modprobe.d/pitft.conf flavors/pitft/rootfs/etc/slim.conf flavors/pitft/rootfs/etc/slitaz/applications.conf flavors/pitft/rootfs/etc/udev/rules.d/95-stmpe.rules rpi/pitft-setup rpi/tazberry sat-rpi
line diff
     1.1 --- a/flavors/pitft/README	Mon May 12 21:27:55 2014 +0200
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,21 +0,0 @@
     1.4 -SliTaz PiTFT Touchscreen
     1.5 -------------------------
     1.6 -
     1.7 -SliTaz runs nicely on PiTFT! Here is a custom flavor to get started.
     1.8 -Cross compiling the fbtft kernel driver is done with:
     1.9 -
    1.10 -# sat-rpi cook-linux --clean --gconfig --fbtft 
    1.11 -
    1.12 -Then enable video drivers you want, close the config and it will build.
    1.13 -The default X session is powered by sts.
    1.14 -
    1.15 -
    1.16 -Adafruit Fork of FBTFT for use with Adafruit TS shield
    1.17 -------------------------------------------------------
    1.18 -https://github.com/adafruit/adafruit-rpi-fbtft/
    1.19 -
    1.20 -
    1.21 -Adafruit guides
    1.22 ----------------
    1.23 -https://learn.adafruit.com/adafruit-pitft-28-inch-resistive-touchscreen-display-raspberry-pi
    1.24 -
     2.1 --- a/flavors/pitft/flavor.conf	Mon May 12 21:27:55 2014 +0200
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,8 +0,0 @@
     2.4 -# SliTaz ARM Flavor configuration file.
     2.5 -#
     2.6 -
     2.7 -FLAVOR="pitft"
     2.8 -VERSION="20140410"
     2.9 -MAINTAINER="pankso@slitaz.org"
    2.10 -SHORT_DESC="SliTaz Raspberry PiTFT (tiny touchscreen)"
    2.11 -WEB_SITE="http://arm.slitaz.org/rpi"
     3.1 --- a/flavors/pitft/packages.list	Mon May 12 21:27:55 2014 +0200
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,107 +0,0 @@
     3.4 -busybox
     3.5 -gcc-lib-base
     3.6 -gettext-base
     3.7 -glibc-base
     3.8 -kbd-base
     3.9 -slitaz-base-files
    3.10 -slitaz-boot-scripts
    3.11 -slitaz-configs-base
    3.12 -slitaz-tools
    3.13 -slitaz-icon
    3.14 -slitaz-polar-cursors
    3.15 -spk
    3.16 -tazirc
    3.17 -util-linux-blkid
    3.18 -util-linux-uuid
    3.19 -ncurses-common
    3.20 -ncurses
    3.21 -ncursesw
    3.22 -libcomerr
    3.23 -e2fsprogs
    3.24 -dialog
    3.25 -zlib
    3.26 -dropbear
    3.27 -joe
    3.28 -nano
    3.29 -lynx
    3.30 -clex
    3.31 -wireless_tools
    3.32 -wpa_supplicant
    3.33 -libssl
    3.34 -libcrypto
    3.35 -libgcrypt
    3.36 -libgpg-error
    3.37 -libnl
    3.38 -dosfstools
    3.39 -udev
    3.40 -kmod
    3.41 -liblzma
    3.42 -bzip2
    3.43 -usbids
    3.44 -bzlib
    3.45 -freetype
    3.46 -libxcb
    3.47 -attr
    3.48 -expat
    3.49 -libxml2
    3.50 -acl
    3.51 -fontconfig
    3.52 -jpeg
    3.53 -pixman
    3.54 -xorg-libX11
    3.55 -xorg-libXft
    3.56 -xorg-libXrender
    3.57 -xorg-libXpm
    3.58 -xorg-libXext
    3.59 -xorg-libXmu
    3.60 -xorg-libXau
    3.61 -xorg-libXdmcp
    3.62 -xorg-libXt
    3.63 -xorg-libXinerama
    3.64 -xorg-libXcomposite
    3.65 -xorg-libXv
    3.66 -xorg-libxkbfile
    3.67 -xorg-libXaw
    3.68 -xorg-libXaw
    3.69 -xorg-libSM
    3.70 -xorg-libICE
    3.71 -xorg-xkeyboard-config
    3.72 -xorg-libpciaccess
    3.73 -xorg-libXxf86vm
    3.74 -xorg-libXfont
    3.75 -xorg-libXcursor
    3.76 -xorg-libXrandr
    3.77 -xorg-libXdamage
    3.78 -xorg-libXfixes
    3.79 -xorg-libfontenc
    3.80 -xorg-xkbcomp
    3.81 -xorg-server-light
    3.82 -xorg-base-fonts
    3.83 -xorg-xf86-input-evdev
    3.84 -xorg-xf86-video-fbdev
    3.85 -xorg-xload
    3.86 -xorg-xclock
    3.87 -ttf-dejavu
    3.88 -giflib
    3.89 -tiff
    3.90 -libid3tag
    3.91 -libjpeg
    3.92 -libpng
    3.93 -imlib2
    3.94 -hsetroot
    3.95 -xterm
    3.96 -fox
    3.97 -adie
    3.98 -pathfinder
    3.99 -shutterbug
   3.100 -calculator
   3.101 -links
   3.102 -slim
   3.103 -alsa-lib
   3.104 -libltdl
   3.105 -alsa-utils
   3.106 -mpg123
   3.107 -glib
   3.108 -pango
   3.109 -cairo
   3.110 -openbox
     4.1 --- a/flavors/pitft/rootfs/etc/X11/xorg.conf.d/99-calibration.conf	Mon May 12 21:27:55 2014 +0200
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,6 +0,0 @@
     4.4 -Section "InputClass"
     4.5 -	Identifier		"calibration"
     4.6 -	MatchProduct	"stmpe-ts"
     4.7 -	Option			"Calibration"	"3692 48 154 3892"
     4.8 -	Option			"SwapAxes" "1"
     4.9 -EndSection
     5.1 --- a/flavors/pitft/rootfs/etc/init.d/local.sh	Mon May 12 21:27:55 2014 +0200
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,13 +0,0 @@
     5.4 -#!/bin/sh
     5.5 -#
     5.6 -# /etc/init.d/local.sh: Local startup commands
     5.7 -#
     5.8 -# All commands here will be executed at boot time.
     5.9 -#
    5.10 -
    5.11 -echo "Setting up PiTFP screen..."
    5.12 -#modprobe fbtft_device debug=7 custom name=fb_ili9340 speed=16000000 \
    5.13 -#	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
    5.14 -modprobe -v fbtft_device name=adafruitts rotate=90
    5.15 -export FRAMEBUFFER=/dev/fb1
    5.16 -startd slim
     6.1 --- a/flavors/pitft/rootfs/etc/modprobe.d/pitft.conf	Mon May 12 21:27:55 2014 +0200
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,3 +0,0 @@
     6.4 -# PiTFT kernel module options
     6.5 -
     6.6 -options fbtft_device name=adafruitts rotate=90
     7.1 --- a/flavors/pitft/rootfs/etc/slim.conf	Mon May 12 21:27:55 2014 +0200
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,93 +0,0 @@
     7.4 -# /etc/slim.conf: Slim LogIn Manger configuration file
     7.5 -#
     7.6 -
     7.7 -# Path, X server and arguments (if needed)
     7.8 -# Note: -xauth $authfile is automatically appended
     7.9 -default_path        ./:/bin:/usr/bin:/usr/local/bin
    7.10 -default_xserver      /usr/bin/Xorg
    7.11 -#xserver_arguments   -dpi 75
    7.12 -
    7.13 -# Commands for halt, login, etc.
    7.14 -halt_cmd            /sbin/poweroff
    7.15 -reboot_cmd          /sbin/reboot
    7.16 -console_cmd         /usr/bin/xterm -C -fg white -bg black +sb -T "Console login" -e /bin/sh -l -c "exec /bin/login"
    7.17 -#suspend_cmd        /usr/sbin/suspend
    7.18 -
    7.19 -# Full path to the xauth binary
    7.20 -xauth_path         /usr/bin/xauth 
    7.21 -
    7.22 -# Xauth file for server
    7.23 -authfile           /run/slim.auth
    7.24 -
    7.25 -# Activate numlock when slim starts. Valid values: on|off
    7.26 -# numlock             on
    7.27 -
    7.28 -# Hide the mouse cursor (note: does not work with some WMs).
    7.29 -# Valid values: true|false
    7.30 -hidecursor          true
    7.31 -
    7.32 -# This command is executed after a succesful login.
    7.33 -# you can place the %session and %theme variables
    7.34 -# to handle launching of specific commands in .xinitrc
    7.35 -# depending of chosen session and slim theme
    7.36 -#
    7.37 -# NOTE: if your system does not have bash you need
    7.38 -# to adjust the command according to your preferred shell,
    7.39 -# i.e. for freebsd use:
    7.40 -# login_cmd           exec /bin/sh - ~/.xinitrc %session
    7.41 -login_cmd           exec /bin/sh -l ~/.xinitrc %session
    7.42 -
    7.43 -# Commands executed when starting and exiting a session.
    7.44 -# They can be used for registering a X11 session with
    7.45 -# sessreg. You can use the %user variable
    7.46 -#
    7.47 -# sessionstart_cmd	some command
    7.48 -# sessionstop_cmd	some command
    7.49 -
    7.50 -# Start in daemon mode. Valid values: yes | no
    7.51 -# Note that this can be overriden by the command line
    7.52 -# options "-d" and "-nodaemon"
    7.53 -# daemon	yes
    7.54 -
    7.55 -# Available sessions (first one is the default).
    7.56 -# The current chosen session name is replaced in the login_cmd
    7.57 -# above, so your login command can handle different sessions.
    7.58 -# see the xinitrc.sample file shipped with slim sources
    7.59 -sessions            enlightenment,openbox,jwmxs
    7.60 -
    7.61 -# Executed when pressing F11 (requires imagemagick)
    7.62 -#screenshot_cmd      mtpaint -s /root/slim-shot.png
    7.63 -
    7.64 -# welcome message. Available variables: %host, %domain
    7.65 -welcome_msg         Welcome to %host
    7.66 -
    7.67 -# Session message. Prepended to the session name when pressing F1
    7.68 -# session_msg         Session: 
    7.69 -
    7.70 -# shutdown / reboot messages
    7.71 -shutdown_msg       The system is going down...
    7.72 -reboot_msg         The system is rebooting...
    7.73 -
    7.74 -# default user, leave blank or remove this line
    7.75 -# for avoid pre-loading the username.
    7.76 -default_user        root
    7.77 -
    7.78 -# Focus the password field on start when default_user is set
    7.79 -# Set to "yes" to enable this feature
    7.80 -#focus_password      no
    7.81 -
    7.82 -# Automatically login the default user (without entering
    7.83 -# the password. Set to "yes" to enable this feature
    7.84 -auto_login          yes
    7.85 -
    7.86 -
    7.87 -# current theme, use comma separated list to specify a set to 
    7.88 -# randomly choose from
    7.89 -current_theme       rpi
    7.90 -
    7.91 -# Lock file
    7.92 -lockfile            /run/slim.lock
    7.93 -
    7.94 -# Log file
    7.95 -logfile             /var/log/slim.log
    7.96 -
     8.1 --- a/flavors/pitft/rootfs/etc/slitaz/applications.conf	Mon May 12 21:27:55 2014 +0200
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,18 +0,0 @@
     8.4 -# SliTaz default applications configuration file. These apps can be
     8.5 -# started through wrappers: browser, editor and terminal.
     8.6 -#
     8.7 -
     8.8 -# File manager.
     8.9 -FILE_MANAGER="PathFinder"
    8.10 -
    8.11 -# Web browser.
    8.12 -BROWSER="links -g"
    8.13 -
    8.14 -# Text editor.
    8.15 -EDITOR="adie"
    8.16 -
    8.17 -# X terminal.
    8.18 -TERMINAL="xterm"
    8.19 -
    8.20 -# Window manager.
    8.21 -WINDOW_MANAGER="sts-session"
     9.1 --- a/flavors/pitft/rootfs/etc/udev/rules.d/95-stmpe.rules	Mon May 12 21:27:55 2014 +0200
     9.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.3 @@ -1,1 +0,0 @@
     9.4 -SUBSYSTEM=="input", ATTRS{name}=="stmpe-ts", ENV{DEVNAME}=="*event*", SYMLINK+="input/touchscreen" 
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/rpi/pitft-setup	Thu May 15 17:19:14 2014 +0200
    10.3 @@ -0,0 +1,84 @@
    10.4 +#!/bin/sh
    10.5 +#
    10.6 +# Setup Adafruit PiTFT on SliTaz Raspberry Pi
    10.7 +#
    10.8 +. /etc/slitaz/slitaz.conf
    10.9 +
   10.10 +linux="linux-pitft-3.10.32+-arm.tazpkg"
   10.11 +mirror="http://mirror.slitaz.org/arm/rpi/packages"
   10.12 +cache="/var/cache/tazpkg"
   10.13 +
   10.14 +module_conf="/etc/modprobe.d/pitft.conf"
   10.15 +calibration_conf="/etc/X11/xorg.conf.d/99-calibration.conf"
   10.16 +udev_rules="/etc/udev/rules.d/95-stmpe.rules"
   10.17 +
   10.18 +# Kernel
   10.19 +if [ ! -d "$PKGS_DB/installed/linux-pitft" ]; then
   10.20 +	cd ${cache}
   10.21 +	if [ ! -f "$linux" ]; then
   10.22 +		echo "Downloading custom Linux kernel..."
   10.23 +		busybox wget ${mirror}/${linux}
   10.24 +	fi
   10.25 +	spk-add ${linux}
   10.26 +fi
   10.27 +
   10.28 +# Modules
   10.29 +if [ ! -f "$module_conf" ]; then
   10.30 +	echo "Creating: $module_conf"
   10.31 +	cat > ${module_conf} << EOT
   10.32 +# PiTFT kernel module options
   10.33 +#
   10.34 +options fbtft_device name=adafruitts rotate=90 frequency=32000000
   10.35 +options rpi_power_switch gpio_pin=23 mode=0
   10.36 +EOT
   10.37 +fi
   10.38 +modprobe -v spi-bcm2708
   10.39 +modprobe -v fbtft_device
   10.40 +
   10.41 +# Xorg calibration
   10.42 +if [ ! -f "$calibration_conf" ]; then
   10.43 +	echo "Creating: $calibration_conf"
   10.44 +	cat > ${calibration_conf} << EOT
   10.45 +Section "InputClass"
   10.46 +	Identifier		"calibration"
   10.47 +	MatchProduct	"stmpe-ts"
   10.48 +	Option			"Calibration"	"3692 48 154 3892"
   10.49 +	Option			"SwapAxes" "1"
   10.50 +EndSection
   10.51 +EOT
   10.52 +fi
   10.53 +
   10.54 +# Udev
   10.55 +if [ ! -f "$udev_rules" ]; then
   10.56 +	echo "Creating: $udev_rules"
   10.57 +	cat > ${udev_rules} << EOT
   10.58 +SUBSYSTEM=="input", ATTRS{name}=="stmpe-ts", ENV{DEVNAME}=="*event*", SYMLINK+="input/touchscreen"
   10.59 +EOT
   10.60 +fi
   10.61 +
   10.62 +# Autologin and use PiTFT kernel
   10.63 +echo "Configuring autologin..."
   10.64 +sed -i s'/#auto_login.*/auto_login    yes/' /etc/slim.conf
   10.65 +echo "Configuring bootloader..."
   10.66 +sed -i s'/kernel=.*/kernel=kernel-pitft.img/' /boot/config.txt
   10.67 +
   10.68 +# Start on boot
   10.69 +if ! grep -q 'FRAMEBUFFER' /etc/init.d/local.sh; then
   10.70 +	echo "Enabling PiTFT at boot time..."
   10.71 +	cat >> /etc/init.d/local.sh << EOT
   10.72 +
   10.73 +echo "Setting up PiTFT touchscreen..."
   10.74 +modprobe -v spi-bcm2708
   10.75 +modprobe -v fbtft_device
   10.76 +#modprobe -v rpi_power_switch
   10.77 +export FRAMEBUFFER=/dev/fb1
   10.78 +startd slim
   10.79 +
   10.80 +EOT
   10.81 +fi
   10.82 +
   10.83 +echo "----"
   10.84 +echo "PiTFT initiliazation finished: you can reboot"
   10.85 +echo "----"
   10.86 +
   10.87 +exit 0
    11.1 --- a/rpi/tazberry	Mon May 12 21:27:55 2014 +0200
    11.2 +++ b/rpi/tazberry	Thu May 15 17:19:14 2014 +0200
    11.3 @@ -368,7 +368,9 @@
    11.4  		--cancel-label "TazBerry" \
    11.5  		--menu "\nSetup or use a breakout board" ${height} ${width} 14 \
    11.6  "camera"         "$(gettext 'Configure your Pi to use a Camera')" \
    11.7 -"piglow"         "$(gettext 'Setup your Pi to use PiGlow')" 2>${tmp}
    11.8 +"piglow"         "$(gettext 'Setup your Pi to use PiGlow')" \
    11.9 +"raspicomm"      "$(gettext 'Initialize RaspiComm board')" \
   11.10 +"pitft"          "$(gettext 'Setup PiTFT touchscreen')" 2>${tmp}
   11.11  	
   11.12  	# Handle options
   11.13  	case "$?" in
   11.14 @@ -389,6 +391,11 @@
   11.15  			if [ "$anser" == "y" ]; then 
   11.16  				echo "Enter a value between: 5-255" && pyglow test
   11.17  			fi ;;
   11.18 +		raspicomm)
   11.19 +			raspicomm init; read -t 4 ;;
   11.20 +		pitft)
   11.21 +			pitft-setup
   11.22 +			echo -n "Press ENTER to continue..."; read ;;	
   11.23  	esac
   11.24  }
   11.25  
    12.1 --- a/sat-rpi	Mon May 12 21:27:55 2014 +0200
    12.2 +++ b/sat-rpi	Thu May 15 17:19:14 2014 +0200
    12.3 @@ -175,7 +175,7 @@
    12.4  		fi
    12.5  		
    12.6  		# TazBerry, Piboot, Pileds, ...
    12.7 -		for tool in tazberry piboot pileds raspicomm
    12.8 +		for tool in tazberry piboot pileds raspicomm piface pitft-setup
    12.9  		do
   12.10  			echo -n "Copying utility: $tool"
   12.11  			cp -f ${rpi}/${tool} ${rootfs}/usr/sbin
   12.12 @@ -241,8 +241,8 @@
   12.13  			cd ${kernel}
   12.14  			export PATH=$PATH:/cross/${arch}/tools/bin
   12.15  			export HOST_SYSTEM=${arch}-slitaz-linux-gnueabi
   12.16 -			make mrproper &&
   12.17 -			make ARCH=arm bcmrpi_defconfig
   12.18 +			#make mrproper &&
   12.19 +			#make ARCH=arm bcmrpi_defconfig
   12.20  			if [ ! "$nopatch" ]; then
   12.21  				echo "Patching SliTaz RPi Linux .config"
   12.22  				patch -p0 -i ${data}/linux-rpi.patch || exit 1