Add armv6 support to lang/ocaml

Issue #8 resolved
Andy Ray created an issue

Hi,

I've been working on OCaml 4.01.0 FreeBSD armv6 support (specifically on the raspberry pi but with other targets in mind as well).

I have a small patch to enable native code compilation here; https://github.com/andrewray/mirage-fpga/releases

At the moment I am basically running from source using OPAM but it would be really nice to roll this support into ports, if possible.

Please let me know if you are interested in this and if there is anything I can do to help.

Cheers, Andy

Comments (18)

  1. Michael Grünewald repo owner

    Hi Andy!

    It would be great to support armv6, unfortunately I do not have access to such an architecture and will then be unable to test it by myself.

    I suggest that you:

    1. Clone the repository ports-bsd
    2. Start a branch ocaml-4.01.0-armv6 off master
    3. Add your patch in that branch.

    once you are done, I will take a look at your patch, test it on amd64 and on RedPorts. Once we arrive at something satisfying, we will submit a patch.

    I will also open a PR for this.

    Cheers, Michael

  2. Andy Ray reporter

    Great stuff. I will see what I can pull together in the next couple of days.

    I'm a newbie with FreeBSD (but enjoying the experience!) so I may have a stupid question or two incoming...!

    Cheers, Andy

  3. Michael Grünewald repo owner

    Hi Andy,

    so welcome to FreeBSD! If you did not already, you really should subscribe to questions@, this mailing list is the primary source of information about our OS. If you are interesting by porting, maybe you should consider subscribing to ports@ as well and could have a look at the Porter's Handbook — while I do not think you need to read it for this patch, it is worth mentioning this excellent documentation.

    We have now have a PR and I suggest that we continue discussion about this topic there, so that it is easily accessible to other FreeBSD users.

    Cheers! Michael

    P.S.: Do not forget to clone the repository in bitbucket, so that we can esaily share our work!

    P.P.S.: Feel free to ask any question you like!

  4. Andy Ray reporter

    I have a plan....I've use 'make makepatch' and got a couple of new patches for arm.S and arch/arm.ml. This is fine with the small caveat that the filenames do not seem to follow the convention you use (using '__' for directory separators).

    I now need to make a couple of small changes to the configure script. This seems to be changed in two places during patching - first 'files/patch-configure' is run, then the Makefile target 'post-patch'.

    In order to make my change I am assuming I need to apply 'files/patch-configure', make my changes then generate a new patch which is then to be processed by 'post-patch'?

    I will then be able to start trying things out on my board - the only other possible change might be to the 'as' flags passed to the configure script in the makefile depending on what value ${ASFLAGS} takes.

  5. Michael Grünewald repo owner

    Your plan seems fine, but there is a small difficulty bound to the post-patch script: we do not want to have these automatic modifications in patch produced by make makepatch.

    Modifications done by post-patch have two goals:

    1. Genericize the compiler used, i.e. do not hardcode gcc
    2. Edit installation routines to support staging.

    I would suggest to rename the post-patch target to post-patch-disabled while you a re cooking your patch, you can still try to build in this setting. When you are ready to test your build, rename post-patch-disabled to post-patch and make clean install.

    Have fun! :)

  6. Andy Ray reporter

    Thanks. I managed much the same with some manual patching.

    I have a working build and a few other questions. I will send a pull request shortly and do a write up on the PR you opened.

  7. Andy Ray reporter

    That's great. A short delay will give me a chance to test the port in anger as well and I will report back if I find any problems (all looking good so far though).

  8. Michael Grünewald repo owner

    Support native code compilation on armv6 (raspberry pi)

    • asmrun/arm.S - select appropriate asm configuration for armv6 softfp under freebsd

    • asmcomp/arch.ml - map freebsd to use EABI

    • configure - detect arm--freebsd* as an appropriate platform for native code compilation and set arch/machine/system appropriately

    • Makefile - set correct options for assembly. map armv6 to back to arm so the correct back end is compiled by ocaml

    Closes #8

    → <<cset 6c749249c96d>>

  9. Michael Grünewald repo owner

    I prepared a fix for #9 and bundled it together with your fix #8, the resulting branch is called ocaml-4.01.0,3.

    As John changed the port, I had to rebase your fix against the new state of the port. It would be very nice if you could test the tip of ocaml-4.01.0,3 to be sure that I rebased correctly.

    Did you try your fix in anger as well?

  10. Andy Ray reporter

    I am away on holiday for a week so won't be able to test this until next Friday or so.

    Been doing a load of compiling with the port and it seems to be working fine.

  11. Michael Grünewald repo owner

    HI Andy! I hope your holiday was great! Once you find time for your tests, we can submit a patch for arm support.

    Cheers, Michael

  12. Andy Ray reporter

    Thanks for the prod...been a busy few weeks!

    I will do a big recompile of everything from the kernel through ocaml and on to the latest opam and a large application. It will take a few days so hopefully I should be able to report the results by the end of the week.

    Cheers, Andy

  13. Andy Ray reporter

    Sorry for the long delay in getting this properly tested.

    Everything is now rebuilt and working great from your ocaml-4.01.0,3 branch.

    Cheers, Andy

  14. Log in to comment