patjak / facetimehd

Reverse engineered Linux driver for the FacetimeHD (Broadcom 1570) PCIe webcam
GNU General Public License v2.0
1.35k stars 160 forks source link

Ubuntu 21.10 Crash #256

Open GMAzrael opened 2 years ago

GMAzrael commented 2 years ago

Upgraded from 21.04 to 21.10 with PopOS and it crashed on the firmware loading. https://gist.github.com/GMAzrael/ba85549089489bddbd992889a0804d50

usernamefoo commented 2 years ago

Can confirm with a new install of PopOS 21.10 beta2 on a 2015 macbook pro. This module seems to not like linux 5.15.

GMAzrael commented 2 years ago

@patjak any luck investigating this one?

patjak commented 2 years ago

It seems the Apple ACPI is doing something wrong. Did you also update to the latest firmware version in MacOS (normal MacOs updates) or just PopOS?

GMAzrael commented 2 years ago

Didnt do any updates to MacOS for some time. My 2012 MBP wouldn't get Monterey. I didn't think my camera got a firmware update in some time.

I only updated PopOS

sylqvq commented 2 years ago

I'm not 100% sure if this contributes, but considering that building fails on my Pop 21.10 install (MBA 7,1), I could only assume?

make -C /lib/modules/5.15.8-76051508-generic/build M=/home/syl/bcwc_pcie modules
make[1]: Entering directory '/usr/src/linux-headers-5.15.8-76051508-generic'
  CC [M]  /home/syl/bcwc_pcie/fthd_ddr.o
  CC [M]  /home/syl/bcwc_pcie/fthd_hw.o
  CC [M]  /home/syl/bcwc_pcie/fthd_drv.o
  CC [M]  /home/syl/bcwc_pcie/fthd_ringbuf.o
  CC [M]  /home/syl/bcwc_pcie/fthd_isp.o
  CC [M]  /home/syl/bcwc_pcie/fthd_v4l2.o
  CC [M]  /home/syl/bcwc_pcie/fthd_buffer.o
  CC [M]  /home/syl/bcwc_pcie/fthd_debugfs.o
  LD [M]  /home/syl/bcwc_pcie/facetimehd.o
  MODPOST /home/syl/bcwc_pcie/Module.symvers
  CC [M]  /home/syl/bcwc_pcie/facetimehd.mod.o
  LD [M]  /home/syl/bcwc_pcie/facetimehd.ko
  BTF [M] /home/syl/bcwc_pcie/facetimehd.ko
Skipping BTF generation for /home/syl/bcwc_pcie/facetimehd.ko due to unavailability of vmlinux
make[1]: Leaving directory '/usr/src/linux-headers-5.15.8-76051508-generic'

Building on this exact laptop had been previously flawless; even on latest Apple firmware. This could be a separate issue, and if it is, please correct me, because I'm not very knowledgeable in terms of Linux.

ivanperez-keera commented 2 years ago

I get the same Skipping BTF generation for /home/syl/bcwc_pcie/facetimehd.ko due to unavailability of vmlinux notice. Could this be the reason?

sylqvq commented 2 years ago

I did do a little research a good while back when I still used my MacBook, and all I could find is other DKMS modules failing to install because of an updated kernel. There's no "one size fits all" solution for this error in particular; every result I found had a different solution for their issue mentioned.

satmandu commented 2 years ago

For those who end up here, you might need an updated pahole (version 1.23) to handle reading the new BTF tags for that kernel. (But I was able to get this facetimehd module to build just fine for the ubuntu mainline 5.17.1 kernel from https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.17.1/ for what it is worth.)

Updating pahole from the dwarves package can be a PITA though due to constantly moving targets of the btf header files in the linux kernel and the libbtf packages which the dwarves package in turn targets to build pahole.

I eventually just downloaded the pahole sources and installed from those to solve the issue.

The message I sent the debian pahole maintainer about this:

Any chance you would consider putting pahole 1.23 into testing/sid from https://git.kernel.org/pub/scm/devel/pahole/pahole.git ?

pahole 1.23 solves an issue with building the 5.17-rc1 kernel when ends with this error:

  LD      .tmp_vmlinux.kallsyms1
  KSYMS   .tmp_vmlinux.kallsyms1.S
  AS      .tmp_vmlinux.kallsyms1.S
  LD      .tmp_vmlinux.kallsyms2
  KSYMS   .tmp_vmlinux.kallsyms2.S
  AS      .tmp_vmlinux.kallsyms2.S
  LD      vmlinux
  BTFIDS  vmlinux
FAILED: load BTF from vmlinux: No such file or directory
make[2]: *** [/home/kernel/COD/linux/Makefile:1161: vmlinux] Error 255
make[2]: *** Deleting file 'vmlinux'
make[2]: Leaving directory '/home/kernel/COD/linux/debian/build/build-generic'
make[1]: *** [Makefile:219: __sub-make] Error 2
make[1]: Leaving directory '/home/kernel/COD/linux'
make: *** [debian/rules.d/[2-binary-arch.mk:53](http://2-binary-arch.mk:53/): /home/kernel/COD/linux/debian/stamps/stamp-build-generic] Error 2
dpkg-buildpackage: error: debian/rules build subprocess returned exit status 2

Issue can be seen here: https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.17-rc1/amd64/log
satmandu commented 2 years ago

I was able to build a dkms package which worked just fine in 22.04 with kernel 5.17.1.

First install the 5.1.7.1 kernel from here: https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.17.1/ Then build and install the dkms package and the firmware files:

# Install required apps: 
sudo apt install debhelper git unrar
# get source
git clone https://github.com/patjak/bcwc_pcie.git
cd bcwc_pcie/
sudo mkdir /usr/src/facetimehd-0.1
sudo cp -r * /usr/src/facetimehd-0.1/
sudo dkms add -m facetimehd -v 0.1
sudo dkms mkdsc -m facetimehd -v 0.1 --source-only
sudo dkms mkdeb -m facetimehd -v 0.1 --source-only
# Now install the deb package in /var/lib/dkms/facetimehd/0.1/deb
sudo dpkg -i /var/lib/dkms/facetimehd/0.1/deb/*.deb
cd /tmp
curl -OLf https://download.info.apple.com/Mac_OS_X/031-30890-20150812-ea191174-4130-11e5-a125-930911ba098f/bootcamp5.1.5769.zip
unzip bootcamp5.1.5769.zip
cd BootCamp/Drivers/Apple/
unrar x AppleCamera64.exe
dd bs=1 skip=1663920 count=33060 if=AppleCamera.sys of=9112_01XX.dat
dd bs=1 skip=1644880 count=19040 if=AppleCamera.sys of=1771_01XX.dat
dd bs=1 skip=1606800 count=19040 if=AppleCamera.sys of=1871_01XX.dat
dd bs=1 skip=1625840 count=19040 if=AppleCamera.sys of=1874_01XX.dat
sudo cp *.dat /lib/firmware/facetimehd/
# and then reboot
ivanperez-keera commented 2 years ago

Do you need that specific kernel? Could it work with: 5.13.0-40-generic?

ivanperez-keera commented 2 years ago

I am getting:

$ sudo dkms mkdsc -m facetimehd -v 0.1 --source-only
Error! DKMS tree does not contain: facetimehd-0.1
Build cannot continue without the proper tree.
ivanperez-keera commented 2 years ago

I was just able to install it with:

# make
# make install

Using checkinstall did not work for me. It created a deb without the kernel module (i.e., *.ko file).

I'd prefer to automate this process. Is there a chance that we could have 1) a PPA for this module? and 2) a way for the module to be re-compiled when we install a new kernel?

satmandu commented 2 years ago

Try

git clone https://github.com/patjak/bcwc_pcie.git
cd bcwc_pcie/
sudo mkdir /usr/src/facetimehd-0.1
sudo cp -r * /usr/src/facetimehd-0.1/
sudo dkms add -m facetimehd -v 0.1
sudo dkms mkdsc -m facetimehd -v 0.1 --source-only
sudo dkms mkdeb -m facetimehd -v 0.1 --source-only
networkdude2k commented 1 year ago

I realize this thread is a few months old. I am currently trying to run the dkms mkdsc and the dkms mkdeb steps. It appears that the mkdsc and mkdeb actions have been removed from dkms on Ubuntu 22.10. I confess to being somewhat of a noob when it comes to compiling drivers. All the steps have run smoothly up to now, and I have just kind of hit a wall. Any help would be much appreciated. When I run apt to install dkms it gives me:

networkdude@MacBookPro:~$ sudo apt install dkms [sudo] password for networkdude: Reading package lists... Done Building dependency tree... Done Reading state information... Done dkms is already the newest version (3.0.6-2ubuntu2). 0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.

When I run dkms alone to view the options, I get this (note that mkdsc & mkdeb are missing): Usage: /usr/sbin/dkms [action] [options] [action] = { add | remove | build | install | uninstall | match | autoinstall | mktarball | ldtarball | status } [options] = [-m module] [-v module-version] [-k kernel-version] [-a arch] [-c dkms.conf-location] [-q] [--force] [--force-version-override] [--all] [--templatekernel=kernel] [--directive='cli-directive=cli-value'] [--config=kernel-.config-location] [--archive=tarball-location] [--kernelsourcedir=source-location] [--binaries-only] [--source-only] [--verbose] [--no-depmod] [--modprobe-on-install] [-j number] [--version]

Ubuntu 22.10 on a 2017 MacBook Pro 15" (14,3), kernel version 5.19.0-26-generic.

jorge-vitrubio commented 11 months ago

I am getting:

$ sudo dkms mkdsc -m facetimehd -v 0.1 --source-only
Error! DKMS tree does not contain: facetimehd-0.1
Build cannot continue without the proper tree.

the howto has to be updated, it seem dkms in verson 3.x has dropped support for distro specific packagin

https://github.com/dell/dkms/commit/68b083eaa3f71c166adfece8e4f760e0cdf96185

so this man does not work any more in debian stable, testing and unstable

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1009179

lbtbs commented 10 months ago

Try

git clone https://github.com/patjak/bcwc_pcie.git
cd bcwc_pcie/
sudo mkdir /usr/src/facetimehd-0.1
sudo cp -r * /usr/src/facetimehd-0.1/
sudo dkms add -m facetimehd -v 0.1
sudo dkms mkdsc -m facetimehd -v 0.1 --source-only
sudo dkms mkdeb -m facetimehd -v 0.1 --source-only

I tried and got this error:

sudo dkms mkdsc -m facetimehd -v 0.1 --source-only Error! Unknown action specified: "" Usage: /usr/sbin/dkms [action] [options] [action] = { add | remove | build | install | uninstall | match | autoinstall | mktarball | ldtarball | status } [options] = [-m module] [-v module-version] [-k kernel-version] [-a arch] [-c dkms.conf-location] [-q] [--force] [--force-version-override] [--all] [--templatekernel=kernel] [--directive='cli-directive=cli-value'] [--config=kernel-.config-location] [--archive=tarball-location] [--kernelsourcedir=source-location] [--binaries-only] [--source-only] [--verbose] [--no-depmod] [--modprobe-on-install] [-j number] [--version]

bagong commented 10 months ago

I can confirm this last one, but I doubt it matters... Unfortunately this repo has been renamed and only half refactored, so working through it is quite confusing... The driver works however, right. It's quite something to run a 2014 wrbcam with a 6.5 kernel (Ubuntu 23.10)

CaptainMorgan12 commented 7 months ago

I have Ubuntu 23 and Kernel 6.5 so is there a chance it works? The facetimehd camera is in my thunderbolt display not the macbook pro.

ryosuketc commented 4 months ago

By any chance has anyone ever worked this out? I thought about downgrading dkms to 2.x (maybe 2.8.4-3: https://tracker.debian.org/pkg/dkms) but it's not found. The Kernel is 6.8.0-31-generic on Ubuntu 24.04 LTS.

$ apt list dkms -a
Listing... Done
dkms/noble 3.0.11-1ubuntu13 all

I am getting:

$ sudo dkms mkdsc -m facetimehd -v 0.1 --source-only
Error! DKMS tree does not contain: facetimehd-0.1
Build cannot continue without the proper tree.

the howto has to be updated, it seem dkms in verson 3.x has dropped support for distro specific packagin

dell/dkms@68b083e

so this man does not work any more in debian stable, testing and unstable

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1009179