3 ms·
> I couldn't do stage 2 on my laptop because that involves chrooting into the install and unfortunately my laptop isn't powerpc. For people doing similar proje
by jeroenhd 3y ago
> I couldn't do stage 2 on my laptop because that involves chrooting into the install and unfortunately my laptop isn't powerpc.
For people doing similar projects, you can use qemu in user mode to work around this. I believe the relevant Debian package is qemu-user-static. With it, you can execute binaries from foreign architectures as if they're native, with software translation doing all the hard work for you. Think Rosetta (not Rosetta2) but on Linux and supporting a wide variety of hardware.
Install the package, copy /usr/bin/qemu-<target architecture>-static to the /usr/bin folder in your chroot and you should be able to chroot into the foreign system!
I've used this to analyze some ARM binaries pulled from a router and it works surprisingly effective. Applications may fail because of the version inconsistencies between the daemons running on your OS and the old versions the chroot expects, but for basic tools it should Just Work, really.
- jovial_cavalier 3y agosystemd-nspawn is also worth looking into
- johndoe0815 3y agoHow would that work? The problem here is that chroot needs to run using a different CPU instruction set. qemu-user is exactly the right answer here. According to e.g. https://wiki.gentoo.org/wiki/Systemd-nspawn https://wiki.gentoo.org/wiki/Systemd-nspawn "no hardware emulation is taking place and unlike QEMU and Virtualbox non-native CPU instruction sets are not directly supported".
- dijit 3y agosystemd-nspawn is still using binfmt which is how Linux tries to read ELF files, and what you really want when executing other architectures is to teach binfmt about qemu. nspawn doesn't do anything additional here, but might be easier for most new sysadmins (sorry... "devops/platform/cloud engineers"). More info (from 2016 so it could be out of date): https://blog.oddbit.com/post/2016-02-07-systemd-nspawn-for-fun-and-wel/ https://blog.oddbit.com/post/2016-02-07-systemd-nspawn-for-f...
- jovial_cavalier 3y agocd into an OS image built for arm on your x86 dev machine, and type: `systemd-nspawn -D .` and it just works. At least it's never failed for me. I believe it pulls in some kind of binfmt/qemu shim to get these binaries working. Probably qemu under the hood, but this is about as plug-n-play as it gets.
- deleted 3y ago[deleted]