cnvogelg / amitools

Various tools for using AmigaOS programs on other platforms
258 stars 72 forks source link

Not really an issue - Rather HOW TO use binfmt_misc to allow execution of Amiga binaries using Vamos from AmiTools on Linux :D #209

Open aiobofh opened 2 months ago

aiobofh commented 2 months ago

So... I just wanted to give you guys a small tip on how to make it super simple and convenient to run Amiga executables on any Linux-machine with binfmt_misc capabilities. Just like any Amiga executable was a native ELF or script with a shebang. Super ergonimic.

This will allow probably allow you to add a Workbench-installation C-folder to your path and do Amiga-scripting (to some degree) at your normal shell terminal in your Linux machine :D basically :D.

Prerequisit: You will need a ~/.vamosrc correctly configured for an AmigaDOS/Workbench installation somewhere on your file system. You can also have a .vamosrc in your "current dir" if you're cross-compiling, or e.g. using SAS/C or DevPac to build Amiga executables using Vamos as well... then you just start your program like so: ./my_program like it was any other ELF executable.

One-shot (lost at reboot)

The following will register a binfmt_misc executable type for Amiga binaries, that will start using Vamos.

echo ":Amiga:M::\x00\x00\x03\xf3::$(which vamos):" | sudo tee /proc/sys/fs/binfmt_misc/register

To unregister it again just do the following:

echo -1 | sudo tee /proc/sys/fs/binfmt_misc/Amiga

Permanent configuration

First figure out where your system finds vamoses absolute path using which vamos

For example this could be /usr/sbin/vamos

As root or using sudo or run0 edit /etc/binfmt.d/Amiga.conf and add the following line to it:

`:Amiga:M::\x00\x00\x03\xf3::/path/you/got/from/which/vamos:

And then restart systemd-binfmt.service using:

systemctl restart systemd-binfmt.service

So... Do with it what you like - and. Sorry for posting this in the issues :D

Hugs! /AiO