remusmp / rpi-rt-kernel

56 stars 34 forks source link

Consider using kpartx #7

Open dberlin opened 2 years ago

dberlin commented 2 years ago

You currently manually calculate the loop partition offsets, etc. This is very fragile, and actually breaks for no obvious reason on some of my machines

kpartx is a tool (installable by apt in dockerfile) that is meant to do this for you.

If you run kpartx -a -v {RASPBIOS}.img in your build.sh, it will create /dev/mapper/loop0p1 (boot) and /dev/mapper/loop0p2 (root), which you can mount without any flags/issues at all. It will take care of figuring out the partitions by actually reading the partition table out of the image, rather than guessing offsets.