Please help me, I am tired of being confused and not being able to do anything. I have a Bluetooth 5.0 Adapter, Tp-link UB500.
This device is not supported on the latest kernel yet. I found out that I can build a patched btusb
kernel module and add it to my currently running kernel. BUT I am just dumbfounded at this point, I CANNOT get the module to build correctly, everytime something just goes wrong.
I am running 5.14.10-1-MANJARO kernel. I followed this tutorial from the manjaro forums. I also got the patch needed from here.
Here is what I added to the 0900-btusb.patch
file :
Fix Drivers for TPLink-UB500
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -433,6 +433,10 @@ static const struct usb_device_id blacklist_table[] = {
{ USB_DEVICE(0x0bda, 0xb009), .driver_info = BTUSB_REALTEK },
{ USB_DEVICE(0x2ff8, 0xb011), .driver_info = BTUSB_REALTEK },
+ /* Additional Realtek 8761B Bluetooth devices */
+ { USB_DEVICE(0x2357, 0x0604), .driver_info = BTUSB_REALTEK |
+ BTUSB_WIDEBAND_SPEECH },
+
/* Additional Realtek 8761BU Bluetooth devices */
{ USB_DEVICE(0x0b05, 0x190e), .driver_info = BTUSB_REALTEK |
BTUSB_WIDEBAND_SPEECH },
Then I followed the tutorial as followed, adjusted the PKGBUILD
, here is my exact PKGBUILD file contents :-
# Maintainer: Philip Müller <philm[at]manjaro[dot]org>
# Maintainer: Bernhard Landauer <bernhard@manjaro.org>
# Arch credits:
# Tobias Powalowski <tpowa@archlinux.org>
# Thomas Baechler <thomas@archlinux.org>
pkgbase=linux514
pkgname=('linux514' 'linux514-headers')
_kernelname=-MANJARO
_basekernel=5.14
_basever=514
pkgver=5.14.17
pkgrel=1
arch=('x86_64')
url="https://www.kernel.org/"
license=('GPL2')
makedepends=('bc'
'docbook-xsl'
'libelf'
'pahole'
'git'
'inetutils'
'kmod'
'xmlto'
'cpio'
'perl'
'tar'
'xz')
options=('!strip')
source=("https://www.kernel.org/pub/linux/kernel/v5.x/linux-${_basekernel}.tar.xz"
"https://www.kernel.org/pub/linux/kernel/v5.x/patch-${pkgver}.xz"
# the main kernel config files
'config' 'config.anbox'
# ARCH Patches
'0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-CLONE_NEWUSER.patch'
'0002-HID-quirks-Add-Apple-Magic-Trackpad-2-to-hid_have_special_driver-list.patch'
# Temp Fixes
# MANJARO Patches
'0101-i2c-nuvoton-nc677x-hwmon-driver.patch'
'0102-iomap-iomap_bmap-should-accept-unwritten-maps.patch'
'0103-futex.patch'
'0104-revert-xhci-Add-support-for-Renesas-controller-with-memory.patch'
'0107-quirk-kernel-org-bug-210681-firmware_rome_error.patch'
# Lenovo + AMD
'0302-lenovo-wmi2.patch'
# other patches
# Bootsplash
'0401-revert-fbcon-remove-now-unusued-softback_lines-cursor-argument.patch'
'0402-revert-fbcon-remove-no-op-fbcon_set_origin.patch'
'0403-revert-fbcon-remove-soft-scrollback-code.patch'
'0501-bootsplash.patch'
'0502-bootsplash.patch'
'0503-bootsplash.patch'
'0504-bootsplash.patch'
'0505-bootsplash.patch'
'0506-bootsplash.patch'
'0507-bootsplash.patch'
'0508-bootsplash.patch'
'0509-bootsplash.patch'
'0510-bootsplash.patch'
'0511-bootsplash.patch'
'0512-bootsplash.patch'
'0513-bootsplash.gitpatch'
'0900-btusb.patch')
sha256sums=('7e068b5e0d26a62b10e5320b25dce57588cbbc6f781c090442138c9c9c3271b2'
'bfe913fd04c78f544e6a416e3a0952066635548cb155412f62ba4d82769637ff'
'5e18e915aa406ad1548c2cdf0a1485657bf582c5aff64076882b9572af65673e'
'fc896e5b00fad732d937bfb7b0db41922ecdb3a488bc1c1b91b201e028eed866'
'986f8d802f37b72a54256f0ab84da83cb229388d58c0b6750f7c770818a18421'
'df5843818f1571841e1a8bdbe38d7f853d841f38de46d6a6a5765de089495578'
'7823d7488f42bc4ed7dfae6d1014dbde679d8b862c9a3697a39ba0dae5918978'
'95745075edd597caa92b369cfbcd11a04c9e3c88c0c987c70114924e1e01df5c'
'cbf1ca0b95b2156e408fb5a9520dde1e5fd342586407e1e0dcccd9a526c79e53'
'22f259620bfb89ffb4e65fcc810d8d796d0c3714a31dc6378122ed8cc1645bdd'
'5e804e1f241ce542f3f0e83d274ede6aa4b0539e510fb9376f8106e8732ce69b'
'1d58ef2991c625f6f0eb33b4cb8303932f53f1c4694e42bae24c9cd36d2ad013'
'2b11905b63b05b25807dd64757c779da74dd4c37e36d3f7a46485b1ee5a9d326'
'94a8538251ad148f1025cc3de446ce64f73dc32b01815426fb159c722e8fa5bc'
'1f18c5c10a3c63e41ecd05ad34cd9f6653ba96e9f1049ce2b7bb6da2578ae710'
'59202940d4f12bad23c194a530edc900e066866c9945e39748484a6545af96de'
'e096b127a5208f56d368d2cb938933454d7200d70c86b763aa22c38e0ddb8717'
'8c1c880f2caa9c7ae43281a35410203887ea8eae750fe8d360d0c8bf80fcc6e0'
'1144d51e5eb980fceeec16004f3645ed04a60fac9e0c7cf88a15c5c1e7a4b89e'
'dd4b69def2efacf4a6c442202ad5cb93d492c03886d7c61de87696e5a83e2846'
'028b07f0c954f70ca37237b62e04103e81f7c658bb8bd65d7d3c2ace301297dc'
'a0c548c5703d25ae34b57931f1162de8b18937e676e5791a0f039922090881e7'
'8dbb5ab3cb99e48d97d4e2f2e3df5d0de66f3721b4f7fd94a708089f53245c77'
'a7aefeacf22c600fafd9e040a985a913643095db7272c296b77a0a651c6a140a'
'e9f22cbb542591087d2d66dc6dc912b1434330ba3cd13d2df741d869a2c31e89'
'27471eee564ca3149dd271b0817719b5565a9594dc4d884fe3dc51a5f03832bc'
'60e295601e4fb33d9bf65f198c54c7eb07c0d1e91e2ad1e0dd6cd6e142cb266d'
'035ea4b2a7621054f4560471f45336b981538a40172d8f17285910d4e0e0b3ef'
'0fea73217cff815544072466a465f4775c422082981c8e3f6078650c766cd87d')
prepare() {
cd "linux-${_basekernel}"
# add upstream patch
msg "add upstream patch"
patch -p1 -i "../patch-${pkgver}"
local src
for src in "${source[@]}"; do
src="${src%%::*}"
src="${src##*/}"
[[ $src = *.patch ]] || continue
msg2 "Applying patch: $src..."
patch -Np1 < "../$src"
done
msg2 "0513-bootsplash"
git apply -p1 < "../0513-bootsplash.gitpatch"
msg2 "add config.anbox to config"
cat "../config" > ./.config
cat "../config.anbox" >> ./.config
if [ "${_kernelname}" != "" ]; then
sed -i "s|CONFIG_LOCALVERSION=.*|CONFIG_LOCALVERSION=\"${_kernelname}\"|g" ./.config
sed -i "s|CONFIG_LOCALVERSION_AUTO=.*|CONFIG_LOCALVERSION_AUTO=n|" ./.config
fi
msg "set extraversion to pkgrel"
sed -ri "s|^(EXTRAVERSION =).*|\1 -${pkgrel}|" Makefile
# set patchlevel to 14
#sed -ri "s|^(PATCHLEVEL =).*|\1 14|" Makefile
msg "don't run depmod on 'make install'"
# We'll do this ourselves in packaging
sed -i '2iexit 0' scripts/depmod.sh
msg "get kernel version"
make prepare
msg "rewrite configuration"
yes "" | make config >/dev/null
}
build() {
cd "linux-${_basekernel}"
msg "build"
make ${MAKEFLAGS} LOCALVERSION= bzImage modules
}
package_linux514() {
pkgdesc="The ${pkgbase/linux/Linux} kernel and modules"
depends=('coreutils' 'linux-firmware' 'kmod' 'mkinitcpio>=27')
optdepends=('crda: to set the correct wireless channels of your country')
provides=("linux=${pkgver}" VIRTUALBOX-GUEST-MODULES WIREGUARD-MODULE)
cd "linux-${_basekernel}"
# get kernel version
_kernver="$(make LOCALVERSION= kernelrelease)"
mkdir -p "${pkgdir}"/{boot,usr/lib/modules}
make LOCALVERSION= INSTALL_MOD_PATH="${pkgdir}/usr" INSTALL_MOD_STRIP=1 modules_install
# systemd expects to find the kernel here to allow hibernation
# https://github.com/systemd/systemd/commit/edda44605f06a41fb86b7ab8128dcf99161d2344
cp arch/x86/boot/bzImage "${pkgdir}/usr/lib/modules/${_kernver}/vmlinuz"
# Used by mkinitcpio to name the kernel
echo "${pkgbase}" | install -Dm644 /dev/stdin "${pkgdir}/usr/lib/modules/${_kernver}/pkgbase"
echo "${_basekernel}-${CARCH}" | install -Dm644 /dev/stdin "${pkgdir}/usr/lib/modules/${_kernver}/kernelbase"
# add kernel version
echo "${pkgver}-${pkgrel}-MANJARO x64" > "${pkgdir}/boot/${pkgbase}-${CARCH}.kver"
# make room for external modules
local _extramodules="extramodules-${_basekernel}${_kernelname:--MANJARO}"
ln -s "../${_extramodules}" "${pkgdir}/usr/lib/modules/${_kernver}/extramodules"
# add real version for building modules and running depmod from hook
echo "${_kernver}" |
install -Dm644 /dev/stdin "${pkgdir}/usr/lib/modules/${_extramodules}/version"
# remove build and source links
rm "${pkgdir}"/usr/lib/modules/${_kernver}/{source,build}
# now we call depmod...
depmod -b "${pkgdir}/usr" -F System.map "${_kernver}"
}
package_linux514-headers() {
pkgdesc="Header files and scripts for building modules for ${pkgbase/linux/Linux} kernel"
depends=('gawk' 'python' 'libelf' 'pahole')
provides=("linux-headers=$pkgver")
cd "linux-${_basekernel}"
local _builddir="${pkgdir}/usr/lib/modules/${_kernver}/build"
install -Dt "${_builddir}" -m644 Makefile .config Module.symvers
install -Dt "${_builddir}/kernel" -m644 kernel/Makefile
install -Dt "${_builddir}" -m644 vmlinux
mkdir "${_builddir}/.tmp_versions"
cp -t "${_builddir}" -a include scripts
install -Dt "${_builddir}/arch/x86" -m644 "arch/x86/Makefile"
install -Dt "${_builddir}/arch/x86/kernel" -m644 "arch/x86/kernel/asm-offsets.s"
cp -t "${_builddir}/arch/x86" -a "arch/x86/include"
install -Dt "${_builddir}/drivers/md" -m644 drivers/md/*.h
install -Dt "${_builddir}/net/mac80211" -m644 net/mac80211/*.h
# https://bugs.archlinux.org/task/13146
install -Dt "${_builddir}/drivers/media/i2c" -m644 drivers/media/i2c/msp3400-driver.h
# https://bugs.archlinux.org/task/20402
install -Dt "${_builddir}/drivers/media/usb/dvb-usb" -m644 drivers/media/usb/dvb-usb/*.h
install -Dt "${_builddir}/drivers/media/dvb-frontends" -m644 drivers/media/dvb-frontends/*.h
install -Dt "${_builddir}/drivers/media/tuners" -m644 drivers/media/tuners/*.h
# https://bugs.archlinux.org/task/71392
install -Dt "${_builddir}/drivers/iio/common/hid-sensors" -m644 drivers/iio/common/hid-sensors/*.h
# add xfs and shmem for aufs building
mkdir -p "${_builddir}"/{fs/xfs,mm}
# copy in Kconfig files
find . -name Kconfig\* -exec install -Dm644 {} "${_builddir}/{}" \;
# add objtool for external module building and enabled VALIDATION_STACK option
install -Dt "${_builddir}/tools/objtool" tools/objtool/objtool
# remove unneeded architectures
local _arch
for _arch in "${_builddir}"/arch/*/; do
[[ ${_arch} == */x86/ ]] && continue
rm -r "${_arch}"
done
# remove documentation files
rm -r "${_builddir}/Documentation"
# strip scripts directory
local file
while read -rd '' file; do
case "$(file -bi "$file")" in
application/x-sharedlib\;*) # Libraries (.so)
strip $STRIP_SHARED "$file" ;;
application/x-archive\;*) # Libraries (.a)
strip $STRIP_STATIC "$file" ;;
application/x-executable\;*) # Binaries
strip $STRIP_BINARIES "$file" ;;
application/x-pie-executable\;*) # Relocatable binaries
strip $STRIP_SHARED "$file" ;;
esac
done < <(find "${_builddir}" -type f -perm -u+x ! -name vmlinux -print0 2>/dev/null)
strip $STRIP_STATIC "${_builddir}/vmlinux"
# remove unwanted files
find ${_builddir} -name '*.orig' -delete
}
Then I go ahead and run makepkg --nobuild
, it run fine with the last couple of lines being :-
==> rewrite configuration
==> Sources are ready.
Then I run this command : srcDir=src/5.14.10-1-MANJARO
Where I have replaced the kernel version with my currently running kernel, and the command runs fine.
Then I run this command : ln -s /usr/lib/modules/5.14.10-1-MANJARO/build/Module.symvers "$srcDir/"
It runs fine, I then run : zcat /proc/config.gz > "$srcDir/.config"
It returns error permission denied
even when running with sudo.
I am currently stuck at this stage, what should I do ? Sorry for such a long post, this is my first time doing something like this, I am very new to linux, please someone help me figure this out. I will keep this post updated as I progress further.