From 1caf94daa29cf38f9181cecd967a80a5bea6492a Mon Sep 17 00:00:00 2001 From: Relintai Date: Thu, 22 Jul 2021 18:40:05 +0200 Subject: [PATCH] Added a small utility script and scripts to clone and install fbcp-ili. I preconfigured it for the adafruit pitft 2.2 for now. Eventually it will probably be generalized. --- .gitignore | 4 ++++ 01_small_utils.sh | 3 +++ 03_1_fbcp_ili_setup.sh | 29 ++++++++++++++++++++++++++++ 03_2_fbcp_build.sh | 17 ++++++++++++++++ 03_3_fbcp_install.sh | 11 +++++++++++ 03_4_fbcp_install_service.sh | 13 +++++++++++++ 04_setup_adafruit_pitft_22_config.sh | 22 +++++++++++++++++++++ files/fbcp.service | 11 +++++++++++ 8 files changed, 110 insertions(+) create mode 100755 01_small_utils.sh create mode 100755 03_1_fbcp_ili_setup.sh create mode 100755 03_2_fbcp_build.sh create mode 100755 03_3_fbcp_install.sh create mode 100755 03_4_fbcp_install_service.sh create mode 100755 04_setup_adafruit_pitft_22_config.sh create mode 100644 files/fbcp.service diff --git a/.gitignore b/.gitignore index e69de29..e65fe5e 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1,4 @@ + + +repos/* +repos/** diff --git a/01_small_utils.sh b/01_small_utils.sh new file mode 100755 index 0000000..f5f6369 --- /dev/null +++ b/01_small_utils.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +sudo apt install -y vim screen mc diff --git a/03_1_fbcp_ili_setup.sh b/03_1_fbcp_ili_setup.sh new file mode 100755 index 0000000..f794dde --- /dev/null +++ b/03_1_fbcp_ili_setup.sh @@ -0,0 +1,29 @@ +#!/bin/bash + + +if [ ! -d "repos" ]; then + mkdir repos +fi + +cd repos + +if [ ! -d "fbcp_ili" ]; then + git clone https://github.com/juj/fbcp-ili9341.git fbcp_ili + + #install dependencies + sudo apt install -y cmake +else + cd fbcp_ili + + git reset + git reset --hard + git pull origin master + git reset + git reset --hard + + cd .. +fi + +cd .. + + diff --git a/03_2_fbcp_build.sh b/03_2_fbcp_build.sh new file mode 100755 index 0000000..f875d84 --- /dev/null +++ b/03_2_fbcp_build.sh @@ -0,0 +1,17 @@ +#!/bin/bash + + +cd repos + +cd fbcp_ili + +if [ ! -d "build" ]; then + mkdir build +fi + +cd build + +cmake -DBACKLIGHT_CONTROL=1 -DSTATISTICS=0 -DADAFRUIT_ILI9341_PITFT=ON -DSPI_BUS_CLOCK_DIVISOR=10 .. +make + + diff --git a/03_3_fbcp_install.sh b/03_3_fbcp_install.sh new file mode 100755 index 0000000..3273c1a --- /dev/null +++ b/03_3_fbcp_install.sh @@ -0,0 +1,11 @@ +#!/bin/bash + + +cd repos +cd fbcp_ili +cd build + +sudo killall fbcp +sudo cp fbcp-ili9341 /usr/local/bin/fbcp + + diff --git a/03_4_fbcp_install_service.sh b/03_4_fbcp_install_service.sh new file mode 100755 index 0000000..40ed8c6 --- /dev/null +++ b/03_4_fbcp_install_service.sh @@ -0,0 +1,13 @@ +#!/bin/bash + + +if [ ! -f "/etc/systemd/system/fbcp.service" ]; then + sudo cp ./files/fbcp.service /etc/systemd/system/fbcp.service + + sudo systemctl enable fbcp +fi + +sudo killall fbcp +sudo systemctl start fbcp + + diff --git a/04_setup_adafruit_pitft_22_config.sh b/04_setup_adafruit_pitft_22_config.sh new file mode 100755 index 0000000..dcca9b2 --- /dev/null +++ b/04_setup_adafruit_pitft_22_config.sh @@ -0,0 +1,22 @@ + +cp /boot/config.txt /boot/config.txt.bak + +echo "" >> /boot/config.txt +echo "" >> /boot/config.txt + +echo "--- Added by pi_player start ---" >> /boot/config.txt + +echo "" >> /boot/config.txt +echo "" >> /boot/config.txt +echo "hdmi_group=2" >> /boot/config.txt +echo "hdmi_mode=87" >> /boot/config.txt +echo "hdmi_cvt=320 240 60 1 0 0 0" >> /boot/config.txt +echo "hdmi_force_hotplug=1" >> /boot/config.txt + + +echo "" >> /boot/config.txt +echo "" >> /boot/config.txt +echo "--- Added by pi_player end ---" >> /boot/config.txt + +echo "" >> /boot/config.txt + diff --git a/files/fbcp.service b/files/fbcp.service new file mode 100644 index 0000000..d6143dc --- /dev/null +++ b/files/fbcp.service @@ -0,0 +1,11 @@ +[Unit] +Description=Framebuffer copy utility for PiTFT +After=network.target + +[Service] +Type=simple +ExecStartPre=/bin/sleep 10 +ExecStart=/usr/local/bin/fbcp + +[Install] +WantedBy=multi-user.target