Support for the Surface Cameras under Linux.
Device | Front Camera | Rear Camera |
---|---|---|
Surface Go | IMX135 | OV2740 |
Surface Go 2 | IMX135 | OV2740 |
Surface Laptop | OV5693 | OV8865 |
- Rear Cameras have upstream drivers and need to be connected to the bridge.
- (Prep) Install the required packages for compiling the kernel:
sudo apt install build-essential binutils-dev libncurses5-dev libssl-dev ccache bison flex libelf-dev
- Clone the surface-cameras repo:
git clone https://github.com/jakeday/surface-cameras.git ~/surface-cameras
- Clone the mainline stable kernel repo:
git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git ~/linux-stable
- Go into the linux-stable directory:
cd ~/linux-stable
- Checkout the version of the kernel you wish to target (replacing with your target version):
git checkout v5.y.z
- Apply the kernel patches from the surface-cameras repo:
for i in ~/surface-cameras/patches/[VERSION]/*.patch; do patch -p1 < $i; done
- Use config for kernel series (may need to manually change for your distro):
cp ~/surface-cameras/configs/[VERSION]/config .config
- Compile the kernel and headers (for ubuntu, refer to the build guide for your distro):
make -j `getconf _NPROCESSORS_ONLN` deb-pkg LOCALVERSION=-linux-surface
- Install the headers, kernel and libc-dev:
sudo dpkg -i ../linux-headers-[VERSION].deb ../linux-image-[VERSION].deb ../linux-libc-dev-[VERSION].deb
- (Prep) Install the required packages for patching the dsdt:
sudo apt install acpica-tools
- Create a working directory:
mkdir ~/surface-dsdt
- Go into the working directory:
cd ~/surface-dsdt
- Dump your current ACPI:
sudo acpidump > acpidump.out
- Extract the ACPI parts:
acpixtract acpidump.out
- Disassemble the DSDT:
iasl -d DSDT.dat
- Patch the DSDT:
patch -p1 < ~/surface-cameras/patches/dsdt/[DEVICE_FILE].patch
- Build the patched DSDT:
iasl -tc DSDT.dsl
- Make a CPIO Archive to boot with patched DSDT
mkdir -p kernel/firmware/acpi
cp DSDT.aml kernel/firmware/acpi
find kernel | cpio -H newc --create > acpi_override
sudo cp acpi_override /boot
- Configure your bootloader to load the CPIO archive, normally by updating your grub config to add the path to the new acpi override.
kitakar5525
jhand2
drjscally