leifliddy / macbook12-bluetooth-driver

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Does not compile on Debian with 5.10.0 kernel

HyperDew opened this issue · comments

Fails to compile on Debian with 5.10.0 kernel

Error log is as follows:

make -C /lib/modules/5.10.0-6-amd64/build M=/home/user/Downloads/macbook12-bluetooth-driver/build/bluetooth-5.10.0 modules
make[1]: Entering directory '/usr/src/linux-headers-5.10.0-6-amd64'
CC [M] /home/user/Downloads/macbook12-bluetooth-driver/build/bluetooth-5.10.0/hci_ldisc.o
/home/user/Downloads/macbook12-bluetooth-driver/build/bluetooth-5.10.0/hci_ldisc.c: In function ‘hci_uart_init’:
/home/user/Downloads/macbook12-bluetooth-driver/build/bluetooth-5.10.0/hci_ldisc.c:836:23: error: assignment to ‘ssize_t (*)(struct tty_struct *, struct file *, unsigned char , size_t, void **, long unsigned int)’ {aka ‘long int ()(struct tty_struct *, struct file *, unsigned char , long unsigned int, void **, long unsigned int)’} from incompatible pointer type ‘ssize_t ()(struct tty_struct *, struct file *, unsigned char , size_t)’ {aka ‘long int ()(struct tty_struct *, struct file *, unsigned char *, long unsigned int)’} [-Werror=incompatible-pointer-types]
836 | hci_uart_ldisc.read = hci_uart_tty_read;
| ^
cc1: some warnings being treated as errors
make[3]: *** [/usr/src/linux-headers-5.10.0-6-common/scripts/Makefile.build:284: /home/user/Downloads/macbook12-bluetooth-driver/build/bluetooth-5.10.0/hci_ldisc.o] Error 1
make[2]: *** [/usr/src/linux-headers-5.10.0-6-common/Makefile:1822: /home/user/Downloads/macbook12-bluetooth-driver/build/bluetooth-5.10.0] Error 2
make[1]: *** [/usr/src/linux-headers-5.10.0-6-common/Makefile:185: __sub-make] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.10.0-6-amd64'
make: *** [Makefile:19: all] Error 2
cp hci_uart.ko /lib/modules/5.10.0-6-amd64/updates
cp: cannot stat 'hci_uart.ko': No such file or directory
make: *** [Makefile:26: install] Error 1

contents of /lib/modules/5.10.0-6-amd64/updates
total 0

See if this fix works for you
#13 (comment)

commented

It works after I add this into the script before 'mv bluetooth $bluetooth_dir', thanks!

sed -i 's/size_t nr/size_t nt, void **cookie, unsigned long offset/' bluetooth/hci_ldisc.c

ok try this

run ./install.bluetooth.sh and after it fails...

cd build/bluetooth-5.10.0/ (or whatever the directory is called on your system)

and then run

sed -i 's/size_t nr/size_t nt, void **cookie, unsigned long offset/' hci_ldisc.c

**this change was introduced in kernel 5.11.3 and is not present in the 5.10.x kernel

then just run:

make
make install

I have no idea why Debian isn't using the actual source from kernel 5.10.0, as that hci_uart_tty_read function was changed in kernel 5.11.3. So yeah, I don't intend to modify this project to accommodate that.

commented

Oh, I got it.
This project is wonderful, that is because the Debian Bullseye applies the kernel 5.10.x and it is not stable version now.
I hope this should be fixed by Debian Community when the coming Bullseye releases or with kernel 5.10.52 applies.
Thanks for your help.

Sorry, I must have missed your previous comment.
Cool man, I'm glad it's working for you!

commented

Just change the third line:
kernel_version=$(uname -r | cut -d '-' -f1) #ie 5.2.8
to:
kernel_version='5.10.52'
or:
kernel_version=$(uname -v | cut -d ' ' -f4 | cut -d '-' -f1) #ie 5.2.8

It works, nice.

commented

May you make this into the main branch?

File: install.*.sh
Modify the 3rd line:
kernel_version=$(uname -r | cut -d '-' -f1) #ie 5.2.8
to:
kernel_version=$(uname -v | cut -d ' ' -f4 | cut -d '-' -f1) #ie 5.2.8