Cross compiling R13B04 for MIPS CPU running linux works

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Cross compiling R13B04 for MIPS CPU running linux works

Matthias Lang
Hi,

R13B04 has brand-new support for cross-compiling. Big thanks to
Rickard Green for tackling that ugly job.

Compiling R13B for a MIPS-32 big endian CPU running linux worked first
try (!), all I did was make an erl-xcomp file with three lines changed
from the template:

 erl_xcomp_build=guess
 erl_xcomp_host=mips-linux
 CFLAGS=-Os

Questions:

  1. Do you want the erl-xcomp file I made?

     On one hand: I don't know of anyone else running Erlang on that
     CPU (an Au1000, which runs the control system on Corelatus' GTH
     hardware).

     On the other hand: the next person with a weird target would probably
     be happy to see that they're not setting off into "only OTP have
     done this" territory.

  2. On targets where disk space is precious, it's nice if the .beams
     are compressed. On earlier releases, I did that that by including
     +compressed in ERL_COMPILE_FLAGS (by patching the makefile).

     Is there a better way to do that now?

     I had a quick look, couldn't find one, thought I'd ask before
     I invent my own method, possibly putting the .beams in an archive
     while I'm at it.

Matt

________________________________________________________________
erlang-questions (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Cross compiling R13B04 for MIPS CPU running linux works

Rickard Green-2
2010/3/1 Matthias Lang <[hidden email]>:

> Hi,
>
> R13B04 has brand-new support for cross-compiling. Big thanks to
> Rickard Green for tackling that ugly job.
>
> Compiling R13B for a MIPS-32 big endian CPU running linux worked first
> try (!), all I did was make an erl-xcomp file with three lines changed
> from the template:
>
>  erl_xcomp_build=guess
>  erl_xcomp_host=mips-linux
>  CFLAGS=-Os
>

Always nice to hear that it works.

> Questions:
>
>  1. Do you want the erl-xcomp file I made?
>
>     On one hand: I don't know of anyone else running Erlang on that
>     CPU (an Au1000, which runs the control system on Corelatus' GTH
>     hardware).
>
>     On the other hand: the next person with a weird target would probably
>     be happy to see that they're not setting off into "only OTP have
>     done this" territory.
>

Yes, please. I think it's good with example configurations that people
can have a look at when creating their own configurations.

>  2. On targets where disk space is precious, it's nice if the .beams
>     are compressed. On earlier releases, I did that that by including
>     +compressed in ERL_COMPILE_FLAGS (by patching the makefile).
>
>     Is there a better way to do that now?
>
>     I had a quick look, couldn't find one, thought I'd ask before
>     I invent my own method, possibly putting the .beams in an archive
>     while I'm at it.
>


I haven't looked at this, but this is of course interesting for small
embedded systems.

I had a look in beam_lib and it seems that the strip_release/1
function also compresses the result, so invoking the following after
building the system should get you a slim system:
  $ERL_TOP/bootstrap/bin/erl -noshell -noinput -eval
"beam_lib:strip_release(\"$ERL_TOP\"),init:stop()"

This will however remove the debug info too, which perhaps isn't what
you wanted. I think it would be nice to be able to add the +compressed
flag without having to patch the makefiles, so I'll try to have a look
at it before R14.

Regards,
Rickard

> Matt
>
>
________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:[hidden email]
>
>

________________________________________________________________
erlang-questions (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Cross compiling R13B04 for MIPS CPU running linux works

Steve Vinoski-2
On Tue, Mar 2, 2010 at 4:54 PM, Rickard Green <[hidden email]> wrote:

>
> I had a look in beam_lib and it seems that the strip_release/1
> function also compresses the result, so invoking the following after
> building the system should get you a slim system:
>  $ERL_TOP/bootstrap/bin/erl -noshell -noinput -eval
> "beam_lib:strip_release(\"$ERL_TOP\"),init:stop()"
>

This is exactly what I do for my embedded cross-builds and it works great.

--steve
Reply | Threaded
Open this post in threaded view
|

Re: Cross compiling R13B04 for MIPS CPU running linux works

Håkan Mattsson-2
In reply to this post by Matthias Lang
On Mon, Mar 1, 2010 at 3:49 PM, Matthias Lang <[hidden email]> wrote:

>  2. On targets where disk space is precious, it's nice if the .beams
>     are compressed. On earlier releases, I did that that by including
>     +compressed in ERL_COMPILE_FLAGS (by patching the makefile).
>
>     Is there a better way to do that now?
>
>     I had a quick look, couldn't find one, thought I'd ask before
>     I invent my own method, possibly putting the .beams in an archive
>     while I'm at it.

If you are using reltool to create your target system, you can configure it
to create the archive files for you. It can also compress (any type of) files
put in archives as well as strip debug info from beam files.

/Håkan

________________________________________________________________
erlang-questions (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:[hidden email]