I am thinking about working on arm64 support and testing the results on qemu-arm.
Cool.
What files do I need to change or look at when doing this?
Is it as simple as adding the extra arch parameters in this file?
Don’t edit files in .d folders generally. Add your own. See Whonix
source code introduction. You can also use …/buildconfig.d to get away
from any conflicts.
But in this case you don’t even need that. --arch amd64 or similar is
enough.
You’ve added all architectures to the repo source lists so could it be simple as specifying one of them for debootsrap to download?
TBB isn’t available for anything but i386 and amd64 from TPO. Otherwise
maybe not much missing. Try.
Not relevant at the moment until I finish testing x86-64. Does the requirements for build machine kernel architecture apply here too? How would the instructions posted in your comment affect what I am trying to do here?
The other build seems to be churning along without problems and is pulling packages from stretch. At the moment the build script would not be able to support building images with a kernel archtiecture different from what the build machine is running so its certain this won’t work.
However debootstrap can do this if the build script supports passing the “–foreign” option.
At the moment the build script would not be able to support building images with a kernel archtiecture different from what the build machine is running so its certain this won’t work.
The build script is a lot less magic than you think. Grep the code for i386, i686 and amd64. There is nothing that makes it platform specific In essence, it combines Debian packages in commands in useful ways. Everything script does could also be done manually. So there is no inherent limitation. If there is a limitation, it would be one of for example [grml-]debootstrap. Not one of the build script.
However debootstrap can do this if the build script supports passing the “–foreign” option.
In case you don’t know, you are not supposed to create the full line for
invocation of debootstrap. grml-debootstrap passes most parameters just
fine. Search the build log for debootstrap. You only need to add any
extra arguments for cross platform building.
–foreign is required for crossbuilding and --second-stage-target= for debootstrap to be able to successfully build on non native hardware past stage 2 and as non root.
I’m thinking when doing crossbuilds a new folder with the intended arch name should be created. I don’t know if that directory should be in the Whonix source one or created outside.
The best option would be to just support a normal build script with --arch on an emulated Debian qemu-arm environment.
EDIT:
After trying that I ran into several problems mainly the extreme slowness of emulation and lack of a video device support.
The only practical way is to generate an image on an arm64 hardware when available with minimal changes to the build script by adding --arch arm64. Crossbuilding won’t be a problem then.
This should be left to the builder- getting a Debian jessie based arm64 environment. Bare metal or emulated. The build script can’t do this for the user. Because the emulated arm64 would need a bootable operating system also - a Debian jessie based arm64. Back to root one. There are to my knowledge no downloadable, gpg verifiable, official Debian raw images.
We would feed it the Whonix packages at the last part of step 6
We can’t wretch that all into a single command. At least not without
major refactoring. And it will probably not be needed. Please read all
files from the build-steps.d in lexical order file by file, from top to
bottom, line by line. No need to understand all at once, but then you’ll
see.
As I understand that Debian wiki page, it seems after qemu-debootstrap
did its job, one can just run commands within the chroot normally
without further required changes.
Therefore, given the proper build variables and command line parameters,
as detailed in my last post, the build should just work normally.
The current script stays the same except it downloads bootstrapping packages with the foreign option then the next step involves qemudebootsrap that can do syscall emualtion with qemu-static or a full system emulation with qemu-system-arm which takes it from there.
The latter is best for high level package compatibility.
These steps create a rootfs successfully however a kernel needs to be built/downloaded possibly with APT and I have an idea on what to do next but I don’t know how. Next step is to grab the linux arm64 package while chrooted and then fire up full system qemu emulation to verify the results.
I think forget about it. Creating a bootable raw image is non-trivial.
That’s what grml-debootstrap is for. Starting from debootstrap is like
reinventing grml-debootstrap. Rather than doing this, contribute the
missing feature to grml-debootstrap or image-bootstrap.
grml-debootstrap or package compiling is easy when doing same architecture builds but crossbuilds and crosscompiling are where things get complicated. The qemu-arm compilation step is unecessary in this guide and the packaged version is good enough.