Kernel compilation


I want to build the kvim3 kernel separately (not inside AOSP). When I use make uImage the generated uImage is different from one that is built on: out/target/product/kvim3/obj/KERNEL_OBJ/arch/boot/uImage

When I make boot file using:

out/host/linux-x86/bin/mkbootimg --second out/target/product/kvim3/kvim3.dtb --kernel out/target/product/kvim3/uImage --base 0x0 --cmdline "androidboot.dtbo_idx=0 --cmdline "root=/dev/mmcblk0p18" buildvariant=userdebug" --os_version 9 --os_patch_level 2018-08-05 --kernel_offset 0x1080000 --header_version 1 --output out/target/product/kvim3/boot.img

And flash this file using:
fastboot flash boot boot.img

The board does not load.

1- Why the generated uImage is different from the one generated by “make bootimage” in AOSP?
(diff arch/arm/boot/uImage …/out/target/product/kvim3/obj/KERNEL_OBJ/arch/arm/boot/uImage:
Binary files arch/arm/boot/uImage and …/out/target/product/kvim3/obj/KERNEL_OBJ/arch/arm/boot/uImage differ) While .config are same.

2- What is the reason that generated boot.img does not work?


@Terry @goenjoy @jasonl Please help to check.

I will verify your question later

I appreciate if you could help me with my question. I want to compile kernel and work with gpu frequency, but there is problem in both. For compiling kernel I explainsed the problem and for changing gpu frequency there is no dir containing gpu governors. Even I cannot find gpu governor config at compile time.


@Ehsan How you build the kvim3 kernel separately ? What changes have you made?

you can try to use above command to build in device/khadas/kvim3/

make ARCH=arm CROSS_COMPILE=/opt/toolchains/gcc-linaro-6.3.1-2017.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- uImage

I built kernel with this method. My question is why generated uImage file is different when kernel is built inside AOSP with this source code?

Also when I build by this way and generate boot.img flashing this boot does not work.

AOSP ,you mean android 11?

just now ,i use the above command to build ,and flash boot.img ,it can work

1 Like

AOSP in khadas github, master branch.
You exactly use mention command in common dir? Would you please check if generated uImage is different from one that is generate by make bootimage in aosp by diff command?

And how you make boot.img by generated uImage?

I appreciate if you could help me by this questions.


make ARCH=arm CROSS_COMPILE=/opt/toolchains/gcc-linaro-6.3.1-2017.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- uImage

out/host/linux-x86/bin/mkbootimg --second out/target/product/kvim3/obj/KERNEL_OBJ/arch/arm/boot/dts/amlogic/kvim3.dtb --kernel common/arch/arm/boot/uImage --base 0x0 --cmdline “androidboot.dtbo_idx=0 --cmdline “root=/dev/mmcblk0p18” buildvariant=userdebug” --os_version 9 --os_patch_level 2018-08-05 --kernel_offset 0x1080000 --header_version 1 --output out/target/product/kvim3/boot.img

I used the same. but before make uImage .config file is required. Do you produce it using the following command?
make ARCH=arm CROSS_COMPILE=/opt/toolchains/gcc-linaro-6.3.1-2017.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- kvim_a32_defconfig

I use the same commands!

Do you use the following repo?
repo init -u -b khadas-vims-pie

Would you please check the following command if produced uImage and the one that is generated with make bootimage are different?

diff common/arch/arm/boot/uImage out/target/product/kvim3/obj/KERNEL_OBJ/arch/arm/boot/uImage

yes ,the repo and command is same ,and the uImage is also ok