Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Support for Linux binfmt #176

Open
christianhujer opened this issue Nov 19, 2022 · 2 comments
Open

Feature Request: Support for Linux binfmt #176

christianhujer opened this issue Nov 19, 2022 · 2 comments

Comments

@christianhujer
Copy link

It would be great to see packaged support for Linux binfmt.
Using Linux binfmt, Amiga OS binaries could be directly run from a Linux shell using their name.

I managed to quickly get this running on Ubuntu 22.04 using these files:

File /usr/share/binfms/amiga-vamos:

package amiga-vamos
interpreter /home/christian.hujer/.local/bin/vamos
magic \x00\x00\x03\xf3

(The path in the file obviously would have to be set correctly by make install-binfmt or whatever would be used.)

Then I ran sudo update-binfmts --import amiga-vamos and sudo service binfmt-support force-reload.
And voilà, I could run an Amiga-OS binary by making it executable chmod +x hello and then running it using ./hello.

@cnvogelg
Copy link
Owner

Nice one! I like the approach...
Unfortunately, I don't see a way on how to support this automatically on the myriad of Linux variants out there...

However, a readme keeping this information would be really helpful... I'll extend the manual...

@riker77
Copy link

riker77 commented Jan 22, 2023

I just set this up myself in Gentoo, where both OpenRC and systemd init-systems use the same format[2] for configuring new binary formats.

/etc/binfmt.d/amiga_hunk.conf
:AmigaHUNK:M::\x00\x00\x03\xf3::/path/to/amitools/bin/vamos:

The config file will be picked up by /etc/init.d/binfmt or systemd's systemd-binfmt.service if you (re)start the service. You can also manually add it by issuing[2] the following command - this only works, if the binfmt_misc pseudo-filesystem has already been mounted.
cat /etc/binfmt.d/amiga_hunk.conf >/proc/sys/fs/binfmt_misc/register

[1] https://www.kernel.org/doc/html/latest/admin-guide/binfmt-misc.html
[2] https://manpages.debian.org/testing/systemd/binfmt.d.5.en.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants