Jump to content
IGNORED

Removers Library - a.out Binary Emulation Dropped From Linux Kernel


BitJag

Recommended Posts

4 hours ago, Zerosquare said:

By the way, have you tried pinging SebRmv on his e-mail address?

I haven't yet.  The last few times I have emailed him (last email was in May), I didn't get a response.  Thought I might be bugging him too much with my coding problems, so I decided to focus on other things in the meantime.

 

I will shoot an email off to him today though.  Just to let him know about this thread and brief overview what is going on.  I was also going to post the open_console() function bug on the rmvlib git repo in case that is where the source of that bug is, and hopefully he will get a notification for that.

 

Also, where should I post possible bugs in rmac/rln?  Here or is there a bug tracker somewhere?  I don't see an obvious place on Shamus's site where I originally git clone these two programs from. 

 

I'm thinking that rmac is not compiling code correctly for the mod tracker routines.  I need to do a few more tests, and get some simpler example code together to try as an example for a bug report and to help pinpoint the problem.  All I know is that my old tool chain with mac/aln I don't get a program crash when the mod tracker begins playing music, but when I build the same code with the new tool chain rmac/rln it seems to crash at the point where the mod tracker starts playing.  If I comment out the code that starts the tracker routine, and build with rmac/rln again, there is no crash.

Link to comment
Share on other sites

Looking forward to trying this out. I have been wanting to install removers library for some time. I got sidetracked with RaptorAPI instead.

I need to upgrade from Debian 8 (Jessie) to Debian 10 (Buster) before I can install vinvent riviere's gcc-m68k-cross-tools because of dependencies.

I have made a start and upgraded to Debian 9 (Stretch) so far.

I can make RMAC and RLN with the change, though.

The 'install_rmvlib.sh' script works fine in Debian once adjustments are made for adding vinvent riviere's package. There is a web page that describes how to install the packages on Debian. It is a little different from Ubuntu. That's when I got to needing dependencies that require Debian 10 (Buster).

Link to comment
Share on other sites

Thanks Zerosquare!

 

41 minutes ago, joeyaage said:

Looking forward to trying this out. I have been wanting to install removers library for some time. I got sidetracked with RaptorAPI instead.

I need to upgrade from Debian 8 (Jessie) to Debian 10 (Buster) before I can install vinvent riviere's gcc-m68k-cross-tools because of dependencies.

I have made a start and upgraded to Debian 9 (Stretch) so far.

I can make RMAC and RLN with the change, though.

The 'install_rmvlib.sh' script works fine in Debian once adjustments are made for adding vinvent riviere's package. There is a web page that describes how to install the packages on Debian. It is a little different from Ubuntu. That's when I got to needing dependencies that require Debian 10 (Buster).

Good to hear.  You may need to set the JAGPATH environment variable yourself after running the script, adjust the the paths in Makefile.config to be absolute.  With exact paths that point to the library objects, header files, and necessary bin files. 

Link to comment
Share on other sites

15 hours ago, joeyaage said:

Looking forward to trying this out. I have been wanting to install removers library for some time. I got sidetracked with RaptorAPI instead.

I need to upgrade from Debian 8 (Jessie) to Debian 10 (Buster) before I can install vinvent riviere's gcc-m68k-cross-tools because of dependencies.

I have made a start and upgraded to Debian 9 (Stretch) so far.

I can make RMAC and RLN with the change, though.

The 'install_rmvlib.sh' script works fine in Debian once adjustments are made for adding vinvent riviere's package. There is a web page that describes how to install the packages on Debian. It is a little different from Ubuntu. That's when I got to needing dependencies that require Debian 10 (Buster).

You really don't need to upgrade your linux distro just to have a m68k gcc. A few years ago I made a script that builds gccs 4.6.4 to even the most recent ones (9.x) regardless of your linux distro. Of course the script targets ELF binaries but it really doesn't matter since Jaguar binaries are built to be absolute position without any headers.

 

That script has grown to be long and complex because we (me and DML) wanted to also build C++ support and libraries in order to be able to build TOS binaries. Most of that complexity will go away if you remove these goals (i.e. just gcc with C support and a bare bones libc). If anyone is interested I could attempt to chop the script down. On a modern PC running a linux vm and 4 simulated CPU cores the build time should be around 15 to 20 minutes so it's not that bad.

  • Like 1
Link to comment
Share on other sites

I have been reading up and discovered that a.out executable binaries are not being deprecated from the linux kernel until version 5.1

I believe that the very latest ubuntu version now can go up to kernel version 5.3 which is unfortunate.

However the Debian distro which is the one I have used starting in the 90's is up to version 10 (released in July 2019) and uses kernel version 4.9.

This gives Debian users at least 2 years before a.out is no longer usable (lucky me).

Anyway, thank you for the early warning.

 

I still have not installed vincent riviere's gcc-m68k-cross-compiler yet because of needing dependencies from Debian 10 (I am now on Debian 9),

However I have found some versions from a page at https://tho-otto.de/crossmint.php which I may be able to make use of (further reading is neccessary) or there are probably older versions of vincent riviere's packages that I can use.

  • Like 1
Link to comment
Share on other sites

  • 3 months later...
5 hours ago, SebRmv said:

On archlinux, you can install the following package to add support for old a.out format.

 

https://aur.archlinux.org/packages/ia32_aout-dkms/

Thanks for maintaining this module Seb.   To be honest I haven't done much exploring outside of the *buntu linux sphere since I started using Linux a decade ago.  I may need to see test the Arch Linux waters sometime soon.  I only have a surface understanding of building the Linux kernel, but I assume can add this source for the module into a kernel build for any flavor of Linux?

 

The tool chain with rmac and rln that we have been able to cobble together in this thread, with the exception of not being able to use open_console() function in the Remover's library, seems to be working well.  Also, I still develop on a system with the my older tool chain, with a.out support in an older Linux kernel. So, I am currently using both the old and new tool chains to develop the same project.  I just have to swap a Makefile for some slightly different paths.  Probably not the wisest way to approach development, but it is currently working for me.  Ultimately, I am incredibly thankful for all the help I have received from everyone on this forum, I wouldn't be doing any of this without that help.  Being able to do any development for the Jag on any of my day to day workstations feels like a small miracle every time I think about it.

 

I also have an updated script for the rmac/rln tool chain.  Some of the workarounds mentioned in this thread seem to have been implemented into the sources for rmac/rln over the last few months.  I will work on getting that uploaded for those who are interested.

Link to comment
Share on other sites

Maybe. I guess it fails when linking with rln, right? So you could try jlinker to see what happens (you need to install ocaml compiler to build jlinker, this is available on ubuntu). I am interested to hear if it works. And if it does not, please report me the error...

  • Like 1
Link to comment
Share on other sites

1 minute ago, SebRmv said:

Maybe. I guess it fails when linking with rln, right? So you could try jlinker to see what happens (you need to install ocaml compiler to build jlinker, this is available on ubuntu). I am interested to hear if it works. And if it does not, please report me the error...

If I remember right, its been a few months since I last tried.  I will let you know the outcome soon.

 

I just got somewhat familiar with ocaml this morning trying to get your Jag Image Converter built, so it shouldn't be too much for me to get jlinker built.

Link to comment
Share on other sites

53 minutes ago, SebRmv said:

Yes, jlinker is much easier to build than the image converter as it has no dependencies at all :)

So, I am struggling to get jlinker to build.  I have installed every package available in the ubuntu repositories I can find for ocaml and I get the following error.  And its the same error if I run just make, or ocamlbuild linker.native.

 

File "linker.ml", line 150, characters 86-100:
Error: Unbound module Stdlib
Command exited with code 2.
Compilation unsuccessful after building 28 targets (0 cached) in 00:00:00.

 

Since its not finding Stdlib, I assume it has to do with how ocaml is installed through the repositories or a version issue.

 

My version of ocaml is 4.05.0 .

 

 

 

Link to comment
Share on other sites

4 minutes ago, SebRmv said:

You need a more recent version of ocaml. I believe 4.08 is OK (Pervasives has been deprecated and replaced by Stdlib)

Or you can just revert the commit https://github.com/sbriais/jlinker/commit/2da16f5822d9e00cb38f883eb356718d8c76b339

 

Just installed a more recent version, and I got jlinker built.

 

Here is what I get if I just adjust the make file to jlinker.  I am not sure what to make of it, because I am not seeing any option in the makefiles that would refer to "read_long".  I have attached the program and makefiles below.

 

I will keep investigating, but thought I would post this in case there is something obvious I am missing.

 

m68k-atari-mint-gcc -mc68000 -Wall -fomit-frame-pointer -O2 -msoft-float -funroll-loops -I/home/lachoneus/Jaguar/lib/
include -c main.c
/home/lachoneus/Jaguar/src/jlinker/jlinker.native -a 4000 x x -rq -v -v -v -w -y /home/lachoneus/Jaguar/lib/lib -e -o
main.cof crt0.o main.o    display.o interrupt.o rmvlib.a jlibc.a libgcc.a  
File crt0.o found: /home/lachoneus/Jaguar/lib/lib/crt0.o
File main.o found: main.o
File display.o found: /home/lachoneus/Jaguar/lib/lib/display.o
File interrupt.o found: /home/lachoneus/Jaguar/lib/lib/interrupt.o
File rmvlib.a found: /home/lachoneus/Jaguar/lib/lib/rmvlib.a
File jlibc.a found: /home/lachoneus/Jaguar/lib/lib/jlibc.a
File libgcc.a found: /home/lachoneus/Jaguar/lib/lib/libgcc.a
Invalid_argument("read_long")
make: *** [Makefile.example:10: main.cof] Error 1


 

jlinker_custom_console_build_error.zip

Link to comment
Share on other sites

That's interesting. How did you build gcc? Could you send me the file libgcc.a

(or even better all the files 

crt0.o main.o display.o interrupt.o rmvlib.a jlibc.a libgcc.a

) ?

The exception is raised by jlinker. It tries to read 4 bytes at an illegal place (see https://github.com/sbriais/jlinker/blob/master/bytesExt.ml)

Edited by SebRmv
Link to comment
Share on other sites

3 hours ago, SebRmv said:

I patched jlinker and this seems to work now. Could you give a try to the latest version available on github?

Works like a charm.  Both the console example, and my game Crescent Memories.  Thank you for taking the time to work this out Seb, I will let you know if I run into anything else with jlinker once I get some time behind it.  It will be incredibly useful to have quick access to a console for on screen debugging again.

 

@ggn I don't know if you have been following this, but does the bug that Seb mentions in the above post apply to rln as well?

Link to comment
Share on other sites

Okay, first issue.  I have been creating an example program before I upload the tool chain build install script I am working on, and I want this example program to have a little bit of the basics for a simple game (sprites, music, ect...)  And I ran into a problem when trying to play a mod file.  Below is my explanation and minor exploration of the problem.  I have attached an archive for debugging.


Included in this archive are two build environments.  A jlinker environment and the rln environment.  The only difference between each tool chain is the linker used.

 

Both environments "successfully" build the same example program located in /Jaguar/example_programs/generic_example in each build environment.  Again, the code and data for the example is the same between each tool chain, the only difference is the linker being used.  This example plays a mod file with the Remover's Library.

 

When the example program is built with the rln toolchain, the cof file builds successfully, loads successfully in virtualjaguar, and plays the song.  When the example program is built with the jlinker tool chain, the cof file builds successfully, but crashes in virtualjaguar.

 

To make sure that this isn't a coding error, I also built this example program with my "old" toolchain (madmac,aln), and the example builds and runs successfully.

 

Where I believe the problem is is in the alterations to the following files in the Remover's Library.  These changes allow rmac to successfully build these specific assembler files in the Remover's library.  These changes are applied to both the rln and jlinker tool chain, again the only difference between these two tool chains is the linker being used.

 

/Jaguar/src/rmvlib/sound/sound.s (about line 122)

    padding_nop    (D_RAM+$20-*)
    
changed to:

    pc1=*
    padding_nop    (D_RAM+$20-pc1)
    
/Jaguar/src/rmvlib/sound/paula.s (about line 67)

    padding_nop    (D_RAM+$10-*)
    
changed to:
    
    pc1=*
    padding_nop    (D_RAM+$10-pc1)
    
I am assuming the issue is here, but I don't know for sure.  It seems like jlinker is having an issue with this alteration to the Remover's Library's source files.  Or, rmac needs adjustments made to itself to make these adjustments to the Remover's Library unnecessary.

 

There are build logs for all tools in both tool chains in /Jaguar/src/build_logs/.  And there is a build log for each copy of the example program for each tool chain in /Jaguar/example_programs/generic_example.

Before I finish up, here is a reminder of a few other changes needed to get rmac to build itself, and a few more adjustments to rmvlib source files that were implemented in previous posts in this thread.  I am including these in case they also have an effect on the jlinker build of the example program.

 

/Jaguar/src/rmvlib/display/display.s (about line 150)

    padding_nop    (G_RAM+$10-*)
    
changed to:

    pc1=*
    padding_nop    (G_RAM+$10-pc1)

 

/Jaguar/src/rmvlib/display/display.s (about line 169)

    padding_nop    (G_RAM+$40-*)
    
changed to:

    pc2=*
    padding_nop    (G_RAM+$40-pc2)

 

/Jaguar/src/rmac/expr.c (about line 467)    
    *a_attr = cursect | DEFINED;
    
changed to:

    *a_attr = DEFINED;

 

Thanks again for any help, and let me know if you need me to test anything or provide any more files for debugging purposes.
 

rln_jlinker_sound_bug.zip

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...