Unable to see updated kernel code on Android

Hello, I have been having issues with updating Android kernel code.

What I did was adding printk and pr_info lines inside the kernel, recompiled, and flashed the new image into the board.

My AOSP directory is ~/aosp and hikey-kernel is ~/aosp/hikey-kernel.
This is the commands that I put to recompile and flash the board;

~/aosp/hikey-linaro$ make olddefconfig ARCH=arm64
~/aosp/hikey-linaro$ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-android- -j24
~/aosp/hikey-linaro$ cp arch/arm64/boot/dts/hisilicon/hi6220-hikey.dtb arch/arm64/boot/dts/hisilicon/hi6220-hikey.dtb-4.9
~/aosp/hikey-linaro$ cp arch/arm64/boot/Image-dtb arch/arm64/boot/Image-dtb-4.9
~/aosp/hikey-linaro$ mv arch/arm64/boot/dts/hisilicon/hi6220-hikey.dtb-4.9 …/device/linaro/hikey-kernel
~/aosp/hikey-linaro$ mv arch/arm64/boot/Image-dtb-4.9 …/device/linaro/hikey-kernel
~/aosp$ make bootimage -j24

I used the first command instead of make ARCH=arm64 hikey_defconfig, because I have updated configurations of device drivers.

One thing, that I am not sure if I have done correctly is making bootimage part.
Main reason why I ran them inside kernel directory is that when I try to run the last command ‘make bootimage -j24’, I get the message below.

Also, I’ve seen some other discussions (I don’t remember correctly where I’ve seen them) saying that you should run the make bootimage command on Android directory. So, that is what I did.

Please let me know what I can do to make this work and see my own messages through dmesg on picocom.
Thank you in advance!

make olddefconfig updates your current .config with a newer kernel version (add/del/set config flags).
You need to ensure that oldconfig is applied on the hikey defconfig:
$ make ARCH=arm64 hikey_defconfig
$ make ARCH=arm64 olddefconfig

Once you have built the kernel/dtb binaries, you copy them into the aosp hikey/kernel dir.
Then you need to regenerate the android boot partition which can be achieved with make bootimage.
This command is performed from aosp root dir after having configured your environment:
$ cd _aosp_
$ source ./build/envsetup.sh
$ lunch hikey-userdebug
$ make bootimage

This worked for me :slight_smile:

Thank you so much!!