Skip to content

Commit

Permalink
updated manual patch script for ubuntu 24 support
Browse files Browse the repository at this point in the history
  • Loading branch information
Arun-Prasad-V committed Sep 9, 2024
1 parent 7a2e26a commit c091cf7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
5 changes: 3 additions & 2 deletions scripts/patch-realsense-ubuntu-lts-hwe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ source ./scripts/patch-utils-hwe.sh
LINUX_BRANCH=${LINUX_BRANCH:-$(uname -r)}

# Get the required tools and headers to build the kernel
sudo apt-get install linux-headers-generic linux-headers-$LINUX_BRANCH build-essential git bc -y
sudo apt-get install linux-headers-$LINUX_BRANCH build-essential git bc -y
#Packages to build the patched modules
require_package libusb-1.0-0-dev
require_package libssl-dev
Expand Down Expand Up @@ -137,7 +137,7 @@ if [ $rebuild_ko -eq 0 ];
then
#Search the repository for the tag that matches the mmaj.min.patch-build of Ubuntu kernel
kernel_full_num=$(echo $LINUX_BRANCH | cut -d '-' -f 1,2)
if [ "${ubuntu_codename}" != "jammy" ];
if [[ "${ubuntu_codename}" != "jammy" && "${ubuntu_codename}" != "noble" ]];
then
kernel_git_tag=$(git ls-remote --tags origin | grep "${kernel_full_num}\." | grep '[^^{}]$' | tail -n 1 | awk -F/ '{print $NF}')
else
Expand Down Expand Up @@ -330,6 +330,7 @@ fi
# As a precausion start with unloading the core uvcvideo:
try_unload_module uvcvideo
try_unload_module videobuf2_v4l2
[ ${k_maj_min} -ge 608 ] && try_unload_module videobuf2_memops
[ ${k_maj_min} -ge 500 ] && try_unload_module videobuf2_common
[ ${k_maj_min} -ge 605 ] && try_unload_module uvc
try_unload_module videodev
Expand Down
17 changes: 13 additions & 4 deletions scripts/patch-utils-hwe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ function choose_kernel_branch {
;;
esac
else
echo -e "\e[31mUnsupported distribution $2, kernel version $1 . The patches are maintained for Ubuntu 16/18/20/22/24 LTS\e[0m" >&2
echo -e "\e[31mUnsupported distribution $2, kernel version $1 . The patches are maintained for Ubuntu 20/22/24 LTS\e[0m" >&2
exit 1
fi
}
Expand Down Expand Up @@ -232,7 +232,10 @@ function try_module_insert {
fi

# backup the existing module (if available) for recovery
if [ -f ${tgt_ko} ];
if [ -f ${tgt_ko}.zst ];
then
sudo cp ${tgt_ko}.zst ${tgt_ko}.zst.bckup
elif [ -f ${tgt_ko} ];
then
sudo cp ${tgt_ko} ${tgt_ko}.bckup
else
Expand All @@ -254,15 +257,21 @@ function try_module_insert {
echo -e "\e[31mVerify that the current kernel version is aligned to the patched module version\e[0m"
if [ ${backup_available} -ne 0 ];
then
sudo cp ${tgt_ko}.bckup ${tgt_ko}
if [ -f ${tgt_ko}.zst.bckup ];
then
sudo cp ${tgt_ko}.zst.bckup ${tgt_ko}.zst
else
sudo cp ${tgt_ko}.bckup ${tgt_ko}
fi
sudo modprobe ${module_name}
printf "\e[34mThe original \e[33m %s \e[34m module was reloaded\n\e[0m" ${module_name}
fi
exit 1
else
# Everything went OK, delete backup
printf "\e[32m succeeded\e[0m"
sudo rm ${tgt_ko}.bckup
sudo rm -f ${tgt_ko}.zst.bckup
sudo rm -f ${tgt_ko}.bckup
fi

# Reload all dependent modules recursively
Expand Down

0 comments on commit c091cf7

Please sign in to comment.