Hi, thanks for your reply.One way is to run raspberry OS image inside chroot (or docker) via qemu user emulation - for docker see e.g. https://github.com/multiarch/qemu-user-static , same thing can be done without docker by simply installing qemu-user-static extracting raspberry image into folder and using chroot. This is a bit slower but still much faster on recent PC than running on the Zero 2W and you still run the exact native arm compiler in same environment as on the device (so it is not even real cross-compilation). If you don't prefer docker desktop for windows that can integrate into WSL2, even the normal linux docker installation runs fine in WSL when systemd is enabled in /etc/wsl.conf (or you start docker daemon manually)
EDIT: and BTW check also this https://github.com/lukechilds/dockerpi
EDIT2: the dockerpi is pretty slow
found also this script https://gist.github.com/htruong/0271d84 ... 126a5ad716
also in gist comments there is a link to grow the image, that worked for me to add some space to the image
this version of chroot script works for meCode:
#!/bin/bashif [ `id -u` -ne 0 ] then echo Please run this script as root or using sudo! exitfiIMG=2024-07-04-raspios-bookworm-arm64-lite.imgIMGDIR=raspbianLOOP=$(losetup -Pf ${IMG} --show)mkdir -p $IMGDIRmount -o rw ${LOOP}p2 $IMGDIRmount -o rw ${LOOP}p1 $IMGDIR/boot# mount bindsmount --bind /dev $IMGDIR/devmount --bind /sys $IMGDIR/sysmount --bind /proc $IMGDIR/procmount --bind /dev/pts $IMGDIR/dev/pts# ld.so.preload fix[ -f $IMGDIR/etc/ld.so.preload ] && sed -i 's/^/#/g' $IMGDIR/etc/ld.so.preload# hostname fixgrep -q $(hostname) $IMGDIR/etc/hosts || echo "127.0.1.1 $(hostname)" >> $IMGDIR/etc/hosts# copy qemu binarycp /usr/bin/qemu-arm-static $IMGDIR/usr/bin/# chroot chroot $IMGDIR su - pifstrim -v $IMGDIR # trim unused space on loop device# revert ld.so.preload fix# sed -i 's/^#//g' $IMGDIR/etc/ld.so.preloadumount $IMGDIR/{dev/pts,proc,sys,dev,boot,}losetup -d $LOOPdu -sh $IMG
The links you provided and the scripts look like what I want, I can't get it to work though. I did have a 'container' up and running with the instructions from the link you provided, but the size wasn't big enough so I attempted to do-over with the size changes and now everything is broken. I ran your script and I get:
Code:
chroot: failed to run command ‘su’: Input/output errorraspbian: 461 MiB (483422208 bytes) trimmed2.2G 2024-07-04-raspios-bookworm-arm64-lite.img
Do you have any idea what could be causing this? I did have some issues with the parted command, /dev/loop0 didn't exist or something so I was using loop3/4/5/6... etc. No idea.
Statistics: Posted by Zalosath — Fri Jul 26, 2024 3:40 pm