pinnerite
2023-08-16 17:56:15 UTC
You will know that every time a new Kernel is installed, the old kernel
media modules must be destroyed while booted into the old kernel.
Then after rebooting into the new kernel, new modules must be compiled.
It is a pain in the proverbial a..e.
So I developed a script to automate the process. Read the instructions
at the top if you plan to use it. There is no guarantee that it is
perfect but I have tested it but on;ly on Mint 21.1
Here it is:
#!/bin/bash
#
sname="Install Open Source TBS drivers (tbs_osrcupdate-07).sh"
# --------------------------------------------------------------------
# This script automates the process of installing dtivers for TBS TV cards
# such as TS-6280, TBS-6281 etc, particularly following a kernel update.
# It is a two-pass process. Start it while running the original kernel.
# Following a reboot into the new kernel, run it again.
#
# Created by Alan Secker 2023, based on an open source script provided by
# TBS. It has only been tested in Linux Mint 21.1 but should run on any
# Linux system provided the kernel hearders or sources for the new kernel
# have been downloaded and installed.
#
# No warranties are given. Run it at your own risk.
# =================================================
# Before running this script:
#
# 1) Create a directory TBS-TV in your home directory
# 2) Move this script to ~/TBS-TV.
# 3) Make this script executable by running "chmod+x tbs_oscrupdate.sh"
# from a terminal prompt ($) without the quotes.
# 4) If not already installed, from a terminal, run sudo apt install git
#
#----------------------------------------------------------------------
mkdir -p /home/$USER/tmp
passflag=/home/$USER/tmp/tbs.txt
## function disp {
disp() {
echo "$1"
read -p " Press Enter to continue"
# read -rsn1
}
echo ""
echo "$sname"
echo ""
# If the passflag file exists, we have rebooted, if not continue with
# First Pass.
if ! [ -f "$passflag" ]; then
#
# First Pass
# ----------
echo " Ensure the running kernel is the OLD kernel"
echo " Here is alist of all the installed kernels"
echo
dpkg --list | grep linux-image
echo
echo " You must be running the old kernel."
echo " Compare with the running kernel."
echo
uname -mrs
echo
read -p " Press Enter to continue"
echo
echo "If it is not the old kernel, press R to reboot but remember"
echo "to hold down the shift key as the system comes up in order to"
echo "get into GRUB. Once there select the second option to arrive"
echo "at the list of kernels. Select the previous kernel"
echo " or ENTER to continue"
echo
read -r -n 1 nkey
# Note the ^^ case modification operator
if [ "${nkey^^}" = "R" ]; then
sudo /sbin/shutdown -r now
fi
# Create a flag file to confirm we are in the correct kernel.
echo " " > "$passflag"
echo
echo "OK it is the old kernel we are going to delete modules"
echo "from the old kernel"
echo
#"Check for /home/$USER/Programs/tbstv
#
if cd /opt
then
disp "About to delete /opt/media and /opt/media_build and contents"
sudo rm -Rf /opt/media
sudo rm -Rf /opt/media_build
echo
disp " About to delete old driver modules"
echo
sudo rm -rf /lib/modules/"$(uname -r)"/kernel/drivers/media
# else
fi
# Reboot into new kernel
echo
echo ""
disp " Reboot into new kernel prior to second pass"
echo
reboot
else
# Second Pass - after reboot
# --------------------------
disp "Delete passflag"
rm "$passflag"
cd /opt
disp "After deleting $passflag, download TBS open source driver"
# read -p "Press Space-Bar to continue"
disp "git clone https://github.com/tbsdtv/media_build.git"
sudo git clone https://github.com/tbsdtv/media_build.git
disp "git clone --depth=1 https://github.com/tbsdtv/linux_media.git -b latest ./media"
sudo git clone --depth=1 https://github.com/tbsdtv/linux_media.git -b latest ./media
disp "Now change to /opt/media_build"
echo
# cd media_build
cd media_build || { echo "media_build not found"; exit 1; }
echo
disp "Next run make dir DIR=../media"
echo
sudo make dir DIR=../media
disp "Next run make allyesconfig"
echo
sudo make allyesconfig
sudo sed -i -r 's/(^CONFIG.*_RC.*=)./\1n/g' v4l/.config
sudo sed -i -r 's/(^CONFIG.*_IR.*=)./\1n/g' v4l/.config
echo
disp "About to run make -j4"
echo
if ! sudo make -j4
then
echo
echo "make failed"
read -p " Press Enter to continue"
exit
else
disp "make succeeded"
echo
sudo make install
echo
disp "make install succeeded"
echo
disp "Download and install Firmware"
sudo wget http://www.tbsdtv.com/download/document/linux/tbs-tuner-firmwares_v1.0.tar.bz2
sudo tar jxvf tbs-tuner-firmwares_v1.0.tar.bz2 -C /lib/firmware/
fi
# reboot
fi
media modules must be destroyed while booted into the old kernel.
Then after rebooting into the new kernel, new modules must be compiled.
It is a pain in the proverbial a..e.
So I developed a script to automate the process. Read the instructions
at the top if you plan to use it. There is no guarantee that it is
perfect but I have tested it but on;ly on Mint 21.1
Here it is:
#!/bin/bash
#
sname="Install Open Source TBS drivers (tbs_osrcupdate-07).sh"
# --------------------------------------------------------------------
# This script automates the process of installing dtivers for TBS TV cards
# such as TS-6280, TBS-6281 etc, particularly following a kernel update.
# It is a two-pass process. Start it while running the original kernel.
# Following a reboot into the new kernel, run it again.
#
# Created by Alan Secker 2023, based on an open source script provided by
# TBS. It has only been tested in Linux Mint 21.1 but should run on any
# Linux system provided the kernel hearders or sources for the new kernel
# have been downloaded and installed.
#
# No warranties are given. Run it at your own risk.
# =================================================
# Before running this script:
#
# 1) Create a directory TBS-TV in your home directory
# 2) Move this script to ~/TBS-TV.
# 3) Make this script executable by running "chmod+x tbs_oscrupdate.sh"
# from a terminal prompt ($) without the quotes.
# 4) If not already installed, from a terminal, run sudo apt install git
#
#----------------------------------------------------------------------
mkdir -p /home/$USER/tmp
passflag=/home/$USER/tmp/tbs.txt
## function disp {
disp() {
echo "$1"
read -p " Press Enter to continue"
# read -rsn1
}
echo ""
echo "$sname"
echo ""
# If the passflag file exists, we have rebooted, if not continue with
# First Pass.
if ! [ -f "$passflag" ]; then
#
# First Pass
# ----------
echo " Ensure the running kernel is the OLD kernel"
echo " Here is alist of all the installed kernels"
echo
dpkg --list | grep linux-image
echo
echo " You must be running the old kernel."
echo " Compare with the running kernel."
echo
uname -mrs
echo
read -p " Press Enter to continue"
echo
echo "If it is not the old kernel, press R to reboot but remember"
echo "to hold down the shift key as the system comes up in order to"
echo "get into GRUB. Once there select the second option to arrive"
echo "at the list of kernels. Select the previous kernel"
echo " or ENTER to continue"
echo
read -r -n 1 nkey
# Note the ^^ case modification operator
if [ "${nkey^^}" = "R" ]; then
sudo /sbin/shutdown -r now
fi
# Create a flag file to confirm we are in the correct kernel.
echo " " > "$passflag"
echo
echo "OK it is the old kernel we are going to delete modules"
echo "from the old kernel"
echo
#"Check for /home/$USER/Programs/tbstv
#
if cd /opt
then
disp "About to delete /opt/media and /opt/media_build and contents"
sudo rm -Rf /opt/media
sudo rm -Rf /opt/media_build
echo
disp " About to delete old driver modules"
echo
sudo rm -rf /lib/modules/"$(uname -r)"/kernel/drivers/media
# else
fi
# Reboot into new kernel
echo
echo ""
disp " Reboot into new kernel prior to second pass"
echo
reboot
else
# Second Pass - after reboot
# --------------------------
disp "Delete passflag"
rm "$passflag"
cd /opt
disp "After deleting $passflag, download TBS open source driver"
# read -p "Press Space-Bar to continue"
disp "git clone https://github.com/tbsdtv/media_build.git"
sudo git clone https://github.com/tbsdtv/media_build.git
disp "git clone --depth=1 https://github.com/tbsdtv/linux_media.git -b latest ./media"
sudo git clone --depth=1 https://github.com/tbsdtv/linux_media.git -b latest ./media
disp "Now change to /opt/media_build"
echo
# cd media_build
cd media_build || { echo "media_build not found"; exit 1; }
echo
disp "Next run make dir DIR=../media"
echo
sudo make dir DIR=../media
disp "Next run make allyesconfig"
echo
sudo make allyesconfig
sudo sed -i -r 's/(^CONFIG.*_RC.*=)./\1n/g' v4l/.config
sudo sed -i -r 's/(^CONFIG.*_IR.*=)./\1n/g' v4l/.config
echo
disp "About to run make -j4"
echo
if ! sudo make -j4
then
echo
echo "make failed"
read -p " Press Enter to continue"
exit
else
disp "make succeeded"
echo
sudo make install
echo
disp "make install succeeded"
echo
disp "Download and install Firmware"
sudo wget http://www.tbsdtv.com/download/document/linux/tbs-tuner-firmwares_v1.0.tar.bz2
sudo tar jxvf tbs-tuner-firmwares_v1.0.tar.bz2 -C /lib/firmware/
fi
# reboot
fi
--
Linux Mint 21.1 kernel version 5.15.0-79-generic Cinnamon 5.6.8
AMD Phenom II x4 955 CPU 16Gb Dram 2TB Barracuda
Linux Mint 21.1 kernel version 5.15.0-79-generic Cinnamon 5.6.8
AMD Phenom II x4 955 CPU 16Gb Dram 2TB Barracuda