This document shows how to modify the iotbox image.
Requirements:
- a linux box (e.g Ubuntu, WSL doesn't work)
kpartx(sudo apt install kpartx -y)- https://nightly.odoo.com/master/iotbox/iotbox-latest.zip
First, the image needs to be unpacked to the 2 partitions.
Unzip the iotbox-latest.zip and run
sudo kpartx -v -a iotbox.imgSample output:
add map loop7p1 (254:2): 0 1048577 linear 7:7 8192
add map loop7p2 (254:3): 0 6799359 linear 7:7 1056769
Note down the loop's name. (In this case, its loop7)
The chroot-to-pi.sh allows us to chroot into the raspberry pi image. It requires some packages. Install them by running:
sudo apt install qemu qemu-user-static binfmt-support -yNow run the script like this:
chmod a+x chroot-to-pi.sh && \
sudo ./chroot-to-pi.sh /dev/mapper/<your loop name>and replace <your loop name> with your loop name, e.g loop7
Mount the 2 new mappers (e.g loop7p1 + 2, see the output of the command above):
mkdir boot && mkdir rootfs && \
sudo mount /dev/mapper/loop7p1 ./boot && \
sudo mount /dev/mapper/loop7p2 ./rootfsMake sure to replace loop7 with your loop's name.
Special thanks to @htruong for writing the chroot-to-pi.sh gist. Their gist can be found here: https://gist.github.com/htruong/7df502fb60268eeee5bca21ef3e436eb