How to configure the kernal and install it?

96boards

#1

Hi,

I have been struggling with configuring and installing a new kernel in dragonboard 820c running in debian.

I do not have a UART debugger connected.

I am trying to build the kernal in target board (820c) (not cross compiling in host)

I wanted to

  1. enable CONFIG_TRACING ,CONFIG_CONTEXT_SWITCH_TRACER as well as CONFIG_TRACEPOINTS in the kernal configuration and install the new kernal.
  2. Build my custom kernel module for profiling application, it needs CONFIG_TRACEPOINTS to be defined
    I follow
    https://www.96boards.org/documentation/consumer/dragonboard820c/build/linux-kernel.md.html
    which tells me how to build the kernel from source.

I did “make defconfig distro.config” and then make menuconfig to enable the TRACING option.
Everything went fine, I could check whether these are enabled in .config.

I built the kernel using "make -j $PROCS Image.gz dtbs KERNELRELEASE=4.14.0-qcomlt-${ARCH}
".
Created boot image using the instructions in


I used root argument as
export cmdline=“root=/dev/disk/by-partlabel/rootfs rw rootwait console=ttyMSM0,115200n8”
.
Everything went fine and I could create boot image,

“I do not have the UART debugger”

How can I install the boot.img which is got created in my target board?

I tried using “sudo dd if=boot.img of=/dev/disk/by-partlabel/boot”

But when I reboot my board it does not detect the mouse and keyboard connected to the USB port. So I do not know whether it is using the new kernel. Could someone please point out the mistake that I did?

(I wanted the board to boot up with the new kernel, so that I can build my custom ko module for my profiling applications. )

(I could build my kernal in host and could install it using fastboot method, but in that case I was missing linux hearders, Even if I install linux headers, using apt-get install, I wonder whether It contains CONFIG_TRACEPOINTS defined, that is the reason why I decided to build my kernel from source in the target and build my ko module using that source )

Your replies will be really helpful.

Thanks.


#2

Did you build and install the modules as well (make modules_install)?

I don’t understand this point, if you build your kernel, you already have linux headers in your source tree.


#3

Thanks Loic.

No. I did " make -j $PROCS Image.gz dtbs KERNELRELEASE=4.14.0-qcomlt-${ARCH}" only not make modules_install.

After installing the kernal using fastboot, from host machine (USB). The /usr/src folder was empty.


#4

If you’re using the released kernel, you can retrieve Linux headers via apt:

apt-get install linux-headers-$(uname -r)

#5

Thanks Loic.

When I was trying to enter fastboot, surprisingly the board got booted from my new kernel which I just built.
Mouse and keyboard are detected and working.
But the /boot folder is not updated and contains the previous entries (image,system map and initrd.img of previous build)

Also the sd card is not detected (As expected for 4.14 build). I hope I can use ssh to transfer data to the board.

Will this contain the configuration changes that I made to the kernel, for eg: will the CONFIG_TRACEPOINTS be defined?


#6

If I understand well, you want to build a custom kernel and an out-of-tree module. You can build both of them on your host computer (I assume x86_64) or directly on the target (dragonboard), the last solution can be longer to build a full kernel.

I understand you want to build your out-of-tree module directly on the target. For that you will need to have the same kernel sources that have been used to build the running kernel, or at least the headers package (containing headers, config…). A first solution could be to copy modified Linux source tree from your host to the target and then use it to generate your module. An other solution is to generate the linux-headers package with e.g. make deb-pkg which will create a linux-headers-*.deb package installable on your target with dpkg.


#7

Thanks, I could manage to make the kernel module form the kernel source in the target.

But I had to make the module using ARCH=arm where as I have built the kernel using ARCH=arm64 (Eventhough I was building directly in target, I used it).

But when I use ARCH=arm64 to build my driver, it says " struct stackframe does not contain element sp. Because my kernel source tries to access element sp of structure stackframe under the #ifdef arm .
This preprocessor definition comes form /arch/arm/Makefile. I wonder, how this arm is defined even if I used ARCH=arm64. Also the element sp is defined for arm not for arm64 (/arch/arm/include/asm/stacktrace.h and /arch/arm64/include/asm/stacktrace.h ).

So I build my kernel module using ARCH=arm in the target and the module got inserted. I hope that it will work fine.

Thanks Loic for the prompt and informative replies.