Update only kernel

I’m trying to modify a driver for kernel and I’m looking for a faster way to test it. is there any way to update only kernel with easy installer?
or if there is any other ways please mention it.
I’m using yocto to build my image.

apalis iMX8QM 4GB
Ixora motherboard
bsp 5.7

You can modify easy installer’s JSON file to update kernel only

Along with the kernel file, the kernel modules may also need to be updated. On the device, you can also replace the kernel file in /boot folder and make sure to flash the file by sync command.

Hi Alex,
thank you for your respond, can you please inform me with more details? I removed rootfs and bootloader partitions from json file, keeping just boot partition and then I updated my image using easy installer but it wasn’t successful and bootloader can’t find kernel.

Hey ramin_rad,

a fast approach to only update the kernel image is to use the following process. This is only a summary of the steps:

  1. Update the kernel and recompile it using bitbake, e.g. “bitbake linux-toradex” on your development machine
  2. Copy the updated Image.gz from build/temp/deploy/image/<IMAGE_NAME>/Image.gz to your device e.g. via ssh
    On your target device:
  3. Mount the boot partition " mount /dev/mmcblk0p1 /boot"
  4. Move the Image.gz to /boot and renaming it, “mv /Image.gz /boot/Image1.gz”
  5. Unzip the Image.gz “gunzip Image1.gz”
  6. This should result in a file called /boot/Image1

Reboot your device and enter the uboot console. Here you can switch to the new kernel image.
7. load mmc 0:1 ${kernal_addr_r} /boot/Image1
8. setenv boot_file “Image1”
9. setenv kernel_image “Image1”
10. boot

Now your system starts with your new image. I think you can improve the process by using a oneliner for the scp-command and the stuff to execute on your target.

scp Image.gz root@<target_ip>:~ && ssh root@<target_ip> "mount /dev/mmcblk0p1 /boot ; cd /boot; rm -Rf Image1.gz Image1; mv ~/Image.gz /boot/Image1.gz; gunzip Image1.gz; reboot"

We are using this approach for a faster kernel-replacement and driver development. One benefit is that in case of a kernel panic, you can always use the original /boot/Image.gz because you use Image1.gz/Image1 for your developed kernel.

Hope this helps.
Best regards

Hi Andi,

thank you for your response, it’s a great solution :slight_smile: and it worked for me.
but I’m going to add some little details:

  • it’s not necessary to compile whole image, “bitbake virtual/kernel” would be enough.
  • no need to mount partition because it’s already mounted.
  • reboot command may not work due to incomplete PATH so it’s better to use /sbin/reboot

my final oneliner command:

scp Image.gz root@${ip}:~ && ssh root@${ip} "cd /boot; rm -Rf Image1.gz Image1; mv ~/Image.gz /boot/Image1.gz; gunzip Image1.gz; /sbin/reboot"

  • on u-boot console “load” command didn’t work for me but setting boot_file and kernel_image to Image1 was enough for system to understand to load kernel from Image1

Best Regards,