Skip to content

Instantly share code, notes, and snippets.

@ukn
Forked from Stono/99-install-facetime-camera.sh
Last active December 19, 2024 17:50
Show Gist options
  • Save ukn/a2f85e3420ae7d0f64db2274a9bc106b to your computer and use it in GitHub Desktop.
Save ukn/a2f85e3420ae7d0f64db2274a9bc106b to your computer and use it in GitHub Desktop.
Install the kernal module required for the facetimehd camera to work on Linux
#!/bin/bash
set -e
export CONFIG_MODULE_SIG=n
export CONFIG_MODULE_SIG_ALL=n
# For current kernel
export KERNELRELEASE=$(cat /proc/version | awk '{print $3}')
temp_dir=$(mktemp -d)
echo "Installing FacetimeHD camera for $KERNELRELEASE"
cd $temp_dir
git clone https://github.com/patjak/facetimehd-firmware.git
git clone https://github.com/patjak/bcwc_pcie.git
cd $temp_dir/facetimehd-firmware
pwd
make
make install
cd $temp_dir/bcwc_pcie
pwd
make
make install
rm -rf $temp_dir
if [ ! -d "/etc/modules-load.d" ]; then
mkdir -p "/etc/modules-load.d"
fi
cat > "/etc/modules-load.d/facetimehd.conf" << EOL
videobuf2-core
videobuf2_v4l2
videobuf2-dma-sg
facetimehd
EOL
# Workaround for depmod being skipped above with error:
# Warning: modules_install: missing 'System.map' file. Skipping depmod
echo "Generate modules.dep and map files"
sudo depmod
echo "Adding kernel modules"
sudo modprobe -r bdc_pci
sudo modprobe facetimehd
echo "Install complete"
@ukn
Copy link
Author

ukn commented Jan 16, 2023

No rule to make target 'modules'.

I don't use this setup any more but have you tried searching the web for this error?
Check if you have kernel headers installed that match the current kernel version.

@Memnoc
Copy link

Memnoc commented Jan 6, 2024

I have sort of gathered all I could find on this topic and the gist itself into another repo with some more info. I hope this can be useful to someone struggling with this.
I had a particular rough time making this work on Debian 12, and then this script helped.
Hope this helps!

P.S. sometimes Cheese is picky with the drivers - test on google meet to see if the fix the worked, then tackle Cheese separately.

@BenjaminNassW
Copy link

I had 'make' error because i didnt have curl installed,
now i thought it installed correctly but cheese wont load the camera and neither will google meet, here is the termina:

sudo ./99-install-facetime-camera.sh
Installing FacetimeHD camera for 6.1.0-22-amd64
Cloning into 'facetimehd-firmware'...
remote: Enumerating objects: 902, done.
remote: Counting objects: 100% (17/17), done.
remote: Compressing objects: 100% (12/12), done.
remote: Total 902 (delta 6), reused 14 (delta 5), pack-reused 885
Receiving objects: 100% (902/902), 301.25 KiB | 1.19 MiB/s, done.
Resolving deltas: 100% (591/591), done.
Cloning into 'bcwc_pcie'...
remote: Enumerating objects: 1169, done.
remote: Counting objects: 100% (86/86), done.
remote: Compressing objects: 100% (44/44), done.
remote: Total 1169 (delta 52), reused 63 (delta 42), pack-reused 1083
Receiving objects: 100% (1169/1169), 421.23 KiB | 1.21 MiB/s, done.
Resolving deltas: 100% (779/779), done.
/tmp/tmp.4UWrdtSMYi/facetimehd-firmware

Checking dependencies for driver download...
/usr/bin/curl
/usr/bin/xzcat
/usr/bin/cpio

Downloading the driver, please wait...

Found matching hash from OS X, El Capitan 10.11.5
==> Extracting firmware...
--> Decompressing the firmware using gzip...
--> Deleting temporary files...
--> Extracted firmware version 1.43.0

Copying firmware into '//usr/lib/firmware/facetimehd'
/tmp/tmp.4UWrdtSMYi/bcwc_pcie
make -C /lib/modules/6.1.0-22-amd64/build M=/tmp/tmp.4UWrdtSMYi/bcwc_pcie modules
make[1]: Entering directory '/usr/src/linux-headers-6.1.0-22-amd64'
CC [M] /tmp/tmp.4UWrdtSMYi/bcwc_pcie/fthd_ddr.o
CC [M] /tmp/tmp.4UWrdtSMYi/bcwc_pcie/fthd_hw.o
CC [M] /tmp/tmp.4UWrdtSMYi/bcwc_pcie/fthd_drv.o
CC [M] /tmp/tmp.4UWrdtSMYi/bcwc_pcie/fthd_ringbuf.o
CC [M] /tmp/tmp.4UWrdtSMYi/bcwc_pcie/fthd_isp.o
CC [M] /tmp/tmp.4UWrdtSMYi/bcwc_pcie/fthd_v4l2.o
CC [M] /tmp/tmp.4UWrdtSMYi/bcwc_pcie/fthd_buffer.o
CC [M] /tmp/tmp.4UWrdtSMYi/bcwc_pcie/fthd_debugfs.o
LD [M] /tmp/tmp.4UWrdtSMYi/bcwc_pcie/facetimehd.o
MODPOST /tmp/tmp.4UWrdtSMYi/bcwc_pcie/Module.symvers
CC [M] /tmp/tmp.4UWrdtSMYi/bcwc_pcie/facetimehd.mod.o
LD [M] /tmp/tmp.4UWrdtSMYi/bcwc_pcie/facetimehd.ko
BTF [M] /tmp/tmp.4UWrdtSMYi/bcwc_pcie/facetimehd.ko
Skipping BTF generation for /tmp/tmp.4UWrdtSMYi/bcwc_pcie/facetimehd.ko due to unavailability of vmlinux
make[1]: Leaving directory '/usr/src/linux-headers-6.1.0-22-amd64'
make -C /lib/modules/6.1.0-22-amd64/build M=/tmp/tmp.4UWrdtSMYi/bcwc_pcie modules_install
make[1]: Entering directory '/usr/src/linux-headers-6.1.0-22-amd64'
INSTALL /lib/modules/6.1.0-22-amd64/extra/facetimehd.ko
DEPMOD /lib/modules/6.1.0-22-amd64
Warning: modules_install: missing 'System.map' file. Skipping depmod.
make[1]: Leaving directory '/usr/src/linux-headers-6.1.0-22-amd64'
Generate modules.dep and map files
Adding kernel modules
modprobe: FATAL: Module bdc_pci not found.

@zigarojec
Copy link

You guys are perfect. Works on my MacBook Pro Retina Early 2015, Debian 12 KDE Plasma.

@risugop
Copy link

risugop commented Aug 31, 2024

for some reason im getting this error

Installing FacetimeHD camera for 6.1.0-23-amd64
Clonando en 'facetimehd-firmware'...
remote: Enumerating objects: 902, done.
remote: Counting objects: 100% (17/17), done.
remote: Compressing objects: 100% (12/12), done.
remote: Total 902 (delta 6), reused 14 (delta 5), pack-reused 885 (from 1)
Recibiendo objetos: 100% (902/902), 301.25 KiB | 1.53 MiB/s, listo.
Resolviendo deltas: 100% (591/591), listo.
Clonando en 'bcwc_pcie'...
remote: Enumerating objects: 1169, done.
remote: Counting objects: 100% (86/86), done.
remote: Compressing objects: 100% (44/44), done.
remote: Total 1169 (delta 52), reused 63 (delta 42), pack-reused 1083 (from 1)
Recibiendo objetos: 100% (1169/1169), 421.23 KiB | 1.66 MiB/s, listo.
Resolviendo deltas: 100% (779/779), listo.
/tmp/tmp.gVcNmYfViw/facetimehd-firmware

Checking dependencies for driver download...
/usr/bin/curl
/usr/bin/xzcat
/usr/bin/cpio

Downloading the driver, please wait...

Found matching hash from OS X, El Capitan 10.11.5
==> Extracting firmware...
--> Decompressing the firmware using gzip...
--> Deleting temporary files...
--> Extracted firmware version 1.43.0

Copying firmware into '//usr/lib/firmware/facetimehd'
/tmp/tmp.gVcNmYfViw/bcwc_pcie
make -C /lib/modules/6.1.0-23-amd64/build M=/tmp/tmp.gVcNmYfViw/bcwc_pcie modules
make[1]: *** /lib/modules/6.1.0-23-amd64/build: No existe el fichero o el directorio. Alto.
make: *** [Makefile:12: all] Error 2

if anybody asks, i am using debian 12 with kde plasma

@lovrenco
Copy link

lovrenco commented Sep 8, 2024

Hello, I have latest Ubuntu 24.04.1 and when script runs I get this error. Can you help, please:

Copying firmware into '//usr/lib/firmware/facetimehd'
/tmp/tmp.UFC9QVUmI1/bcwc_pcie
make -C /lib/modules/6.8.0-41-generic/build M=/tmp/tmp.UFC9QVUmI1/bcwc_pcie modules
make[1]: Entering directory '/usr/src/linux-headers-6.8.0-41-generic'
warning: the compiler differs from the one used to build the kernel
The kernel was built by: x86_64-linux-gnu-gcc-13 (Ubuntu 13.2.0-23ubuntu4) 13.2.0
You are using: gcc-13 (Ubuntu 13.2.0-23ubuntu4) 13.2.0
CC [M] /tmp/tmp.UFC9QVUmI1/bcwc_pcie/fthd_ddr.o
CC [M] /tmp/tmp.UFC9QVUmI1/bcwc_pcie/fthd_hw.o
CC [M] /tmp/tmp.UFC9QVUmI1/bcwc_pcie/fthd_drv.o
CC [M] /tmp/tmp.UFC9QVUmI1/bcwc_pcie/fthd_ringbuf.o
CC [M] /tmp/tmp.UFC9QVUmI1/bcwc_pcie/fthd_isp.o
CC [M] /tmp/tmp.UFC9QVUmI1/bcwc_pcie/fthd_v4l2.o
CC [M] /tmp/tmp.UFC9QVUmI1/bcwc_pcie/fthd_buffer.o
CC [M] /tmp/tmp.UFC9QVUmI1/bcwc_pcie/fthd_debugfs.o
LD [M] /tmp/tmp.UFC9QVUmI1/bcwc_pcie/facetimehd.o
MODPOST /tmp/tmp.UFC9QVUmI1/bcwc_pcie/Module.symvers
CC [M] /tmp/tmp.UFC9QVUmI1/bcwc_pcie/facetimehd.mod.o
LD [M] /tmp/tmp.UFC9QVUmI1/bcwc_pcie/facetimehd.ko
BTF [M] /tmp/tmp.UFC9QVUmI1/bcwc_pcie/facetimehd.ko
make[1]: Leaving directory '/usr/src/linux-headers-6.8.0-41-generic'
make -C /lib/modules/6.8.0-41-generic/build M=/tmp/tmp.UFC9QVUmI1/bcwc_pcie modules_install
make[1]: Entering directory '/usr/src/linux-headers-6.8.0-41-generic'
INSTALL /lib/modules/6.8.0-41-generic/updates/facetimehd.ko
SIGN /lib/modules/6.8.0-41-generic/updates/facetimehd.ko
DEPMOD /lib/modules/6.8.0-41-generic
Warning: modules_install: missing 'System.map' file. Skipping depmod.
make[1]: Leaving directory '/usr/src/linux-headers-6.8.0-41-generic'
Generate modules.dep and map files
Adding kernel modules
modprobe: FATAL: Module bdc_pci not found.
lovrenco@MacBuntu:~/Documents$

@ca4ti
Copy link

ca4ti commented Nov 23, 2024

lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 24.10
Release: 24.10
Codename: oracular

apt-get install pahole

ln -sf /boot/System.map-$(uname -r) /usr/src/linux-headers-$(uname -r)/System.map

ln -sf /usr/lib/modules/$(uname -r)/vmlinux.xz /boot/

install this version : https://gist.github.com/petrstepanov/73e1eeaeca8b56bf4bca2a367f18fe95

@ca4ti
Copy link

ca4ti commented Dec 19, 2024

git clone https://github.com/patjak/bcwc_pcie.git
cd bcwc_pcie

mkdir /usr/src/facetimehd-0.1
cp -Rf ./* /usr/src/facetimehd-0.1
dkms add -m facetimehd -v 0.1
dkms build -m facetimehd -v 0.1
dkms install -m facetimehd -v 0.1 --force
modprobe facetimehd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment