GUIDE: How to mount the .img file and change the kernel

Hi

So i’am in the state where i have to compile my own kernel to get wifi but after this is done i still play around quite a bit so when i have to reimage the sdcard because something broke i have to do this all over again.

As it takes about 3 hours or so it is a lot of work.
Of course i could just copy the kernel to another PC and then reinstall it into the new image.

Yes this is possible but i still need to boot one time with ethernet to do this.

Solution: Change the kernel inside the img you will write to the SDcard.

Problem: The Kernel is not accessible in the sdcard only the rootfs is

How to do it:

losetup -P /dev/loop0 69.img
mkdir /mnt/vf2-boot
mount /dev/loop0p2 /mnt/vf2-boot
→ Change kernel, make sure the name is the same!
umount /mnt/vf2-boot
losetup -d /dev/loop0

Flash to SD
Profit :slight_smile:

4 Likes