How to disable camera sensors in dtsi in Kernel


#1

I have a Dragon board 410C with Debian Kernel in it. I am trying to disable the sensor in Dtsi file. How to Do it?..I am not able to locate this file in Kernel. Please let me know the procedure to do this.


96Boards MIPI adapter
#2

Your are looking for arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi, there are camera sensors defined (ov5645) but disabled by default. If you mean removing the whole camera subsystem then you can just change the camss status field:

&camss {
status = “disabled”;

You can do the same with the camera control interface (CCI) node as well.


#3

With current installed Kernel which is running , I am not able to find arch/arm64 folder. Is there any way to surf that path?.. system is configured with ov5640 camera and its running and video is out. I am new to this system and exploring one by one, so please don’t mistake if I ask non-sense questions.


#4

No problem, there are no stupid questions, is there any reason why you want to disable camera other than exploring the system/board ?

Actually this path is located in the Linux kernel source tree, not at runtime on your board. To keep it simple, your system is composed of a bootloader, a kernel (Linux) for hardware abstraction, a file system (rootfs, containing standard files and applications) and a device-tree which is a data structure describing the hardware (resources, hierarchy, addresses, GPIOs…). If you want to disable the camera device/subsystem, you basically need to modify and rebuild the device-tree (at least).

You can have more information at:


#5

Thanks for responding. We want to attach a different imager and configure the device tree structure for it. Before that I want to explore on current system, so as to get handson experience on it. I downloaded Kernel source code by giving command:

apt-get source linux-source

This was the replica of the Kernel source running on hardware, however I could not locate only .dtsi file inside arch/arm64 folder.

Document link you provided has the details on how to get Kernel source , editing .dtsi files and rebuild Kernel?.


#6

I assume you have a x86-64 Linux computer and already have debian running on your target(dragonboard). The following steps should allow you to replace the kernel by a custom one:

Prepare Toolchain environment

In order to (cross-)compile software for your target (armv8/aarch64) you need some building tools, you can find toolchains at https://www.linaro.org/downloads/. If you build your software on a Intel(x86) 64-bit computer (host) for your dragonboard (target) you need to use the gcc-xxxx-x86_64_aarch64-linux-gnu toolchain.

$ wget -q0- https://releases.linaro.org/components/toolchain/binaries/latest/aarch64-linux-gnu/gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu.tar.xz ~/Downloads/
$ tar -xf gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu.tar.xz
$ export ARCH=arm64
$ export CROSS_COMPILE=pwd/gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-

Download Linux source code

You can retrieve Dragonboard Linux source from the following Linaro git repository: git://git.linaro.org/landing-teams/working/qualcomm/kernel.git, the current branch to use is origin/release/qcomlt-4.14.
$ git clone git://git.linaro.org/landing-teams/working/qualcomm/kernel.git -b origin/release/qcomlt-4.14

Apply changes on kernel or device-tree.

Build Linux Kernel (and device-tree)

$ cd kernel
$ make defconfig
$ make -j 4

Create new boot image

We are going to use abootimg tool, install it.

Copy your kernel and dtb(device-tree) into a boot directory
$ mkdir boot
$ cp arch/arm64/boot/Image boot/
$ cp arch/arm64/boot/dts/qcom/apq8016-sbc.dtb boot/
$ cd boot

Zip the kernel and append the DTB.
$ gzip -c Image > Image.gz
$ cat Image.gz apq8016-sbc.dtb > Image.gz+dtb

abootimg tool requests a ramdisk image, but we actually does not use it, create a dummy one:
$ echo "notaninitrd" > initrd.img

Generate the boot image.
$ abootimg --create boot.img -k Image.gz+dtb -r initrd.img -c "pagesize=2048" -c "kerneladdr=0x80008000" -c "ramdiskaddr=0x82000000" -c "cmdline=root=/dev/mmcblk0p10 rootwait rw console=ttyMSM0,115200n8"

Flash

Replace the boot partition with your own, reboot with S4 pressed and flash:
$ fastboot flash boot boot.img
You can now reboot on your new kernel/dtb…

Install new Modules

I’s very likely you have to update Linux modules as well, which are not part of the bootimage but usually on the root file system (lib/modules). When you change/upgrade your kernel with a different one, kernel modules are no more compatible and need to be updated as well.

On your dragonboard, you can check kernel version with:
$ uname -r
4.14.0-00063-gd4bc7bd-dirty

Go back to the kernel directory and install modules
$ cd ../
$ make modules_install INSTALL_MOD_PATH=./boot

You should now have a boot/lib/modules/4.14.0-000xxxx directory containing all modules and aligned with your kernel version, you need to copy this in your dragonboard /lib/modules/ dir. You can use network (scp) or usb/sdcard support for the transfer.