0

I want to compile ejabberd for this router: Broadcom BCM4708A0, 2xARM Cortex A9, asuswrt-merlin 380.58_0.

I know I should create my own toolchain where all libs and environment should match router.

How can I do this? I found nothing in buildroot manual and google.

J. Yellow
  • 75
  • 1
  • 1
  • 6
  • Well, that ejabberd should be running within the OS that is already on the router, right? – Marcus Müller May 21 '16 at 18:20
  • Hence, you should use the SDK that was probably generated in the same step as that OS image was. – Marcus Müller May 21 '16 at 18:21
  • If you want to roll your own OS, well, then get reading. That's not going to be a project for a rainy afternoon. – Marcus Müller May 21 '16 at 18:21
  • If such an SDK is not available, sometimes static linking can also work. For that you just need a Compiler toolchain that roughly matches the target. – Frank Meerkötter May 22 '16 at 05:08
  • @MarcusMüller , yes ejabberd should be running within the OS that is already on the router, and there is no SDK. – J. Yellow May 22 '16 at 09:05
  • @FrankMeerkötter , that is my main question: how to create such toolchain. Should I copy router filesystem somewhere or anything else? – J. Yellow May 22 '16 at 09:09
  • @J.Yellow: you won't be able to build an SDK just by the files that are present on the router. You will have to find something like a BSP (board support package) that matches your router (or something sufficiently similar), and build an SDK with that using your favourite embedded toolchain (which seems to be buildroot, but there's so many more). – Marcus Müller May 22 '16 at 09:21
  • @J.Yellow: also, if the router uses GPL code (it does if it runs Linux, at least for the kernel), you have a **right** to get all the files needed to build your binary (kernel). Now, you mentioned in half a word that your router uses Asuswrt – which means you can pretty surely assume that it's easy to get the system the Asuswrt people used to create their image. – Marcus Müller May 22 '16 at 09:24

1 Answers1

1

You mentioned in half a sentence you're already running Asuswrt on that router – so follow the instructions on https://github.com/RMerl/asuswrt-merlin/wiki

They definitely have automated scripts to generate/get the right SDKs, and you should stay within the confines of the build system used for the asuswrt image as far as possible.

If done right, you add ejabberd to your asuswrt image build process as a patch; from there on, you can just build new, fully functional filesystem images that you can just "flash" like any other firmware image.

A word on your choice of software: ejabberd is an impressive piece of software, but it's also not really easy on your RAM. Running it on your router might or might not work. What really worries me: Unless someone else has done this before you, you will need an Erlang compiler to target your router – which might really make this project far more involved than you currently think. I've checked the openWRT project, and no-one there seems to have brought ejabberd to their router firmware ecosystem, and if I had a guess, that's not because it's unpopular (ejabberd is probably the most important XMPP server), but it's because it's pretty hard to do and router hardware might not be the optimal platform to run it on.

OpenWRT has a package for prosody with extensive documentation on how to use it. You should probably base your work off that.

Marcus Müller
  • 34,677
  • 4
  • 53
  • 94