New Member
Posts: 22
Registered: ‎04-18-2014
Kudos: 23

How to (re)build EdgeOS packages?

Hi,

I've just got my first EdgeOS device and I'm very impressed. I've been a long-time user of OpenWRT and I deviated briefly into MikroTik but found that OpenWRT lacked acceleration capability and MikroTik was so closed it was impossible to acheive the things I needed.

So the EdgeRouter devices look like the perfect answer!  I have an IPsec tunnel running at virtually no CPU impact that was bringing both the MikroTik and OpenWRT devices to their knees! Superb!

BUT ... in the course of getting it to do what I need I found that I needed to recompile dnsmasq, as I need version 2.64 or later so that it has ipset support (I'll post a separate message on that topic.)

It was difficult to find any clear instructions on how to build the package, I found some stuff around accel-ppp which helped, but it's not perfect.

I have installed the emdebian cross compiler, I have (eventually) figured out the xapt can help you get your dependencies sorted out, however when I actually try to build the package it tried to use 'gcc' (which is for x86) and pkg-config which looks at the x86 system and not the mips dependencies.

The pkg-config stuff I can work around by installing in both environments, but the gcc stuff required editing the rules file to force the mips compiler.

The end result is that it all worked ok, but I don't think I'm going about it in the right way.

Is there a concise description of how we should go about setting up a system for cross-compiling and then an example of compiling one of the base packages for EdgeOS? (for non debian experts!)

Thanks,

Lee.

Highlighted
Member
Posts: 276
Registered: ‎11-16-2013
Kudos: 104
Solutions: 15

Re: How to (re)build EdgeOS packages?

Last time, i've just created qemu virtual mashine with mips64 arch, installed debian squeze on it, and build packages using debhelper Man Happy

It's creepy but doesn't require to learn xapt and other things that could blow your mind Man Happy

Previous Employee
Posts: 13,551
Registered: ‎06-10-2011
Kudos: 5474
Solutions: 1656
Contributions: 2

Re: How to (re)build EdgeOS packages?

Yeah I just took a quick look at the dnsmasq build scripts (Makefile etc.) and looks like they weren't written with cross-compile in mind. So probably what you did was necessary to get it to build correctly. If you could post the changes you made that may be helpful too (e.g., if we need to update to a newer version with squeeze) Icon Smile Thanks!

New Member
Posts: 22
Registered: ‎04-18-2014
Kudos: 23

Re: How to (re)build EdgeOS packages?

Ok, I've had a go at fixing this properly ... but I'm no debian expert and I've not done this before so this could be completely wrong.

Basically I copied a section from another debian/rules file that seems to properly set the CC variable, then use that instead of hardcoded "gcc".

I also added some code to set PKG_CONFIG_PATH.

It seems to work ok.

Can I please make a request for a later version of dnsmasq in the next release? I need a version with ipset support, which I think means 2.66 or later. I'm experimenting with 2.69 (the latest) and it seems to drop in with no other issues.

With the ipset version of dnsmasq it's possible to build address groups based on the results of domain name lookups ... this enables qos/routing/firewalling by domain name. For me, I use this to route specific traffic over IPsec so that it appears to come from another geo, but I'm sure there are lots of uses. I've added cli options and scripts to support it ... I'll post shortly once I've finished tidying up. 

Regards,

Lee.

 

13a14,26
> DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
> DEB_HOST_GNU_TYPE  := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
> DEB_HOST_ARCH      := $(shell dpkg-architecture -qDEB_HOST_ARCH)
> DEB_HOST_ARCH_OS   := $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
> ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
>         CROSS=CC=$(DEB_HOST_GNU_TYPE)-gcc
>         CC=$(DEB_HOST_GNU_TYPE)-gcc
>         export PKG_CONFIG_PATH=/usr/$(DEB_HOST_GNU_TYPE)/lib/pkgconfig
> else
>         CROSS=CC=gcc
>         CC=gcc
> endif
>
118c131
<       make $(TARGET) PREFIX=/usr DESTDIR=`pwd`/debian/base CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" COPTS="$(COPTS)" CC=gcc
---
>       make $(TARGET) PREFIX=/usr DESTDIR=`pwd`/debian/base CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" COPTS="$(COPTS)" CC="$(CC)"
158c171
<       make -C contrib/wrt PREFIX=/usr DESTDIR=`pwd`/debian/utils CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" COPTS="$(COPTS)" CC=gcc
---
>       make -C contrib/wrt PREFIX=/usr DESTDIR=`pwd`/debian/utils CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" COPTS="$(COPTS)" CC="$(CC)"

Previous Employee
Posts: 13,551
Registered: ‎06-10-2011
Kudos: 5474
Solutions: 1656
Contributions: 2

Re: How to (re)build EdgeOS packages?

Yeah it would certainly be good to have a newer version. The issue is that currently we're using the Debian wheezy binary package directly, which is 2.62. Debian jessie has 2.69 but the binary package is not compatible (requires newer libc etc.). So at the moment, to move to newer version means we'd need to import the source code and start building the binary package on our own, which would be extra maintenance work and we will need to see if that is feasible based on resources availability etc. The changes you provided would be useful if we do go that route though, so thanks for the contributions!