Mailing List Archive

is gentoo-mips right for me?
I was wondering if gentoo-mips is a right distribution/tool for me.

Here's the summary what I have and what I want to achieve.

I am interested in porting apps for wrt54 and similar hardware (they
have Broadcom CPUs). When I connect a 2 GB usb-stick to such a device
(i.e., to ASUS WL-500g Deluxe or to any other device listed on
http://wiki.openwrt.org/TableOfHardware), a small router could turn into
a really useful, rock-stable (no moving parts like hard-disk, fan etc.),
cheap, small, quiet, multi-purpose device (domain controller, print
server, web server etc.).

As compiling software on these devices directly isn't really a good
idea, at first I thought I'd just cross-compile the software.
However, very often, cross-compiling is not that easy (sometimes
involves lots of patching, which in my case turned out to be duplicating
someone's job).

So I searched the web a bit, and came to a conclusion:

I have to run gentoo-mips in qemu on my x86 hardware, compile/port apps
there, strip the binaries, and move them to these tiny routers.

Is my thinking correct?

Will such compiled software compiled on gentoo-mips run on
Broadcom-based routers?

Or maybe I just should give up this idea, as it's totally wrong from the
beginning?

I could check it myself, but as I failed to run the gentoo-mips livecd
in quemu, I'd like to know if I'm doing something reasonable before I
invest some time in running gentoo-mips on qemu.


--
Tomek
http://wpkg.org
WPKG - software management with Samba
--
gentoo-mips@gentoo.org mailing list
Re: is gentoo-mips right for me? [ In reply to ]
Tomasz Chmielewski wrote:
> I was wondering if gentoo-mips is a right distribution/tool for me.
>
> Here's the summary what I have and what I want to achieve.
>
> I am interested in porting apps for wrt54 and similar hardware (they
> have Broadcom CPUs). When I connect a 2 GB usb-stick to such a device
> (i.e., to ASUS WL-500g Deluxe or to any other device listed on
> http://wiki.openwrt.org/TableOfHardware), a small router could turn into
> a really useful, rock-stable (no moving parts like hard-disk, fan etc.),
> cheap, small, quiet, multi-purpose device (domain controller, print
> server, web server etc.).

A good idea...which is already facilitated by openwrt.


> As compiling software on these devices directly isn't really a good
> idea, at first I thought I'd just cross-compile the software.
> However, very often, cross-compiling is not that easy (sometimes
> involves lots of patching, which in my case turned out to be duplicating
> someone's job).

Duplicating...you mean like the work openwrt has already done?


> So I searched the web a bit, and came to a conclusion:
>
> I have to run gentoo-mips in qemu on my x86 hardware, compile/port apps
> there, strip the binaries, and move them to these tiny routers.
>
> Is my thinking correct?

Theoretically, our mipsel uclibc stages would let you do that, except
that apparently qemu for mips still has problems with userland programs.
That and I don't think qemu is particularly fast.


> Will such compiled software compiled on gentoo-mips run on
> Broadcom-based routers?

If you use the mipsel uclibc stages, and optimize for -march=mips32, sure.


> Or maybe I just should give up this idea, as it's totally wrong from the
> beginning?

This is really the smartest thing you have said thus far. Gentoo is
really not set up to run on these devices. It is far too heavy to
directly run on them (they don't have enough RAM, and typically not
enough disk space), and cross-compiling everything is a pain in the ass.
Folks behind distros like openwrt have already done a lot of hard work
porting apps and making them compile inside of their buildroot environment.


> I could check it myself, but as I failed to run the gentoo-mips livecd
> in quemu, I'd like to know if I'm doing something reasonable before I
> invest some time in running gentoo-mips on qemu.

The gentoo-mips livecd is definitely not what you want. The userland on
the cd and included kernels are only for big endian SGI hardware. It
has no chance of working on anything else. If I recall, qemu emulates a
little endian, MIPS 4kc cpu.

-Steve

--
gentoo-mips@gentoo.org mailing list
Re: is gentoo-mips right for me? [ In reply to ]
Stephen P. Becker schrieb:
> Tomasz Chmielewski wrote:
>
>> I was wondering if gentoo-mips is a right distribution/tool for me.
>>
>> Here's the summary what I have and what I want to achieve.
>>
>> I am interested in porting apps for wrt54 and similar hardware (they
>> have Broadcom CPUs). When I connect a 2 GB usb-stick to such a device
>> (i.e., to ASUS WL-500g Deluxe or to any other device listed on
>> http://wiki.openwrt.org/TableOfHardware), a small router could turn
>> into a really useful, rock-stable (no moving parts like hard-disk, fan
>> etc.), cheap, small, quiet, multi-purpose device (domain controller,
>> print server, web server etc.).
>
>
> A good idea...which is already facilitated by openwrt.

Indeed.
That's what I'm using on these routers.


>> As compiling software on these devices directly isn't really a good
>> idea, at first I thought I'd just cross-compile the software.
>> However, very often, cross-compiling is not that easy (sometimes
>> involves lots of patching, which in my case turned out to be
>> duplicating someone's job).
>
>
> Duplicating...you mean like the work openwrt has already done?

Either openwrt or gentoo-mips folks.
It seems to me that there is a chance that gentoo-mips will have more
apps ported than openwrt (which doesn't really have many applications
ported).


>> So I searched the web a bit, and came to a conclusion:
>>
>> I have to run gentoo-mips in qemu on my x86 hardware, compile/port
>> apps there, strip the binaries, and move them to these tiny routers.
>>
>> Is my thinking correct?
>
>
> Theoretically, our mipsel uclibc stages would let you do that, except
> that apparently qemu for mips still has problems with userland programs.

Have you read qemu 0.8.0 changelog? It was released a couple of days ago.

- MIPS and MIPSel User Linux emulation


> That and I don't think qemu is particularly fast.

Whatever slow it is, it will be faster than trying to compile anything
natively on these tiny routers :)


>> Will such compiled software compiled on gentoo-mips run on
>> Broadcom-based routers?
>
>
> If you use the mipsel uclibc stages, and optimize for -march=mips32, sure.

So, this means, that if I build a whole gentoo-mips under qemu - sounds
easy, doesn't it? :), with mipsel uclibc stages/-march=mips32, almost
each and every binary copied from such a system should run on these tiny
routers?

I'm quite new to other architectures than x86.


>> Or maybe I just should give up this idea, as it's totally wrong from
>> the beginning?
>
>
> This is really the smartest thing you have said thus far. Gentoo is
> really not set up to run on these devices. It is far too heavy to
> directly run on them (they don't have enough RAM, and typically not
> enough disk space), and cross-compiling everything is a pain in the ass.
> Folks behind distros like openwrt have already done a lot of hard work
> porting apps and making them compile inside of their buildroot environment.

I never intended to run gentoo on these tiny routers.

I just thought that compiling/porting software for openwrt/mips on
gentoo-mips would be easier than compiling software for mips on a x86
system (I'm really not a cross-compiling expert; and not everything is
ported to openwrt).


>> I could check it myself, but as I failed to run the gentoo-mips livecd
>> in quemu, I'd like to know if I'm doing something reasonable before I
>> invest some time in running gentoo-mips on qemu.
>
>
> The gentoo-mips livecd is definitely not what you want. The userland on
> the cd and included kernels are only for big endian SGI hardware. It
> has no chance of working on anything else. If I recall, qemu emulates a
> little endian, MIPS 4kc cpu.

Now I see why it didn't even start.


--
Tomek
http://wpkg.org
WPKG - software management with Samba
--
gentoo-mips@gentoo.org mailing list
Re: is gentoo-mips right for me? [ In reply to ]
Tomasz Chmielewski wrote:

>> Duplicating...you mean like the work openwrt has already done?
>
> Either openwrt or gentoo-mips folks.
> It seems to me that there is a chance that gentoo-mips will have more
> apps ported than openwrt (which doesn't really have many applications
> ported).

There's little "porting" to be honest. At most, porting simply entails
recompiling the target application so it links with the shared libs (or static,
if that's your preference) of the target architecture. Sometimes, porting
involves writing new code, as some apps are arch-specific and don't port easily
(ltrace, for example).

Gentoo simply facilitates easier porting in a sense because of the nature of the
distribution (source-based). If you discover an app needs a patch or a decent
re-write, it's easy to plug the patch into the ebuild to have it added before
the app is compiled. That said though, cross-compiling on Gentoo is still
somewhat incomplete. We've got mechanisms in-place that can theoretically allow
one to cross-compile an entire userland just about, but it's wholly untested and
there's little real documentation on how it all works yet. Really only for
people who have a solid grasp of the dark, voodoo-like nature of cross compiling.


>> Theoretically, our mipsel uclibc stages would let you do that, except
>> that apparently qemu for mips still has problems with userland programs.
>
> Have you read qemu 0.8.0 changelog? It was released a couple of days ago.
>
> - MIPS and MIPSel User Linux emulation

Qemu may allow running of userland programs, but it's still an emulator at
heart. It's buggy, slower than Windows Millennium on a P75, and only, as geoman
states, emulates a specific CPU. I don't doubt Qemu will get better over time,
but it's not an application we in the Gentoo/MIPS project will look at seriously
for a decent time to come.


>> That and I don't think qemu is particularly fast.
>
> Whatever slow it is, it will be faster than trying to compile anything
> natively on these tiny routers :)

Thou hath not tryeth to compileth glibc upon a RaQ2 of Cobalt, have thee? :)

Granted you can jack the RAM in a cobalt to a decent size for it to suck down
behemoths like glibc, assuming you got an emulator to work, the emulator would
likely be slower than a RaQ2, and probably slower than native compiles. The
only upside is being able to feed the emulated environment more RAM.


> So, this means, that if I build a whole gentoo-mips under qemu - sounds
> easy, doesn't it? :), with mipsel uclibc stages/-march=mips32, almost
> each and every binary copied from such a system should run on these tiny
> routers?

You've got the right idea on paper, but actual implementation will probably
reveal the difficulties involved. Not every app is going to port cleanly or
probably even operate properly.


> I'm quite new to other architectures than x86.

We generally discourage people who are new to non-x86 from venturing off into
experiments like this initially. The experiment can sometimes be overwhelming,
anf frustration eventually kills off any motivation to complete it. Our usual
suggestion is to get yourself a cheap SGI Box, like an Indy or an O2, play with
it for a few months and learn how MIPS works, then you'll have an idea of how
stuff works in comparison to their more inefficient x86 cousins. Other archs,
like Sparc, work well too as non-x86 playtoys. Then the original task can
sometimes be easier (but not always).



--Kumba

--
Gentoo/MIPS Team Lead
Gentoo Foundation Board of Trustees

"Such is oft the course of deeds that move the wheels of the world: small hands
do them because they must, while the eyes of the great are elsewhere." --Elrond
--
gentoo-mips@gentoo.org mailing list
Re: is gentoo-mips right for me? [ In reply to ]
Kumba wrote:
> Tomasz Chmielewski wrote:
>> Stephen P. Becker wrote:
>
>>> That and I don't think qemu is particularly fast.
>>
>> Whatever slow it is, it will be faster than trying to compile anything
>> natively on these tiny routers :)
>
> Thou hath not tryeth to compileth glibc upon a RaQ2 of Cobalt, have
> thee? :)
>
> Granted you can jack the RAM in a cobalt to a decent size for it to suck
> down behemoths like glibc, assuming you got an emulator to work, the
> emulator would likely be slower than a RaQ2, and probably slower than
> native compiles. The only upside is being able to feed the emulated
> environment more RAM.
>

Last I heard... QEMU was emulating a ~30MHz MIPS machine... on a modern
(>2GHz) x86 machine. Your router most likely has a clock speed in the
range of 100~200MHz; much faster than QEMU.

Others, like gxemul (which may be better suited to your needs) suffer
similar performance losses.

>> So, this means, that if I build a whole gentoo-mips under qemu -
>> sounds easy, doesn't it? :), with mipsel uclibc stages/-march=mips32,
>> almost each and every binary copied from such a system should run on
>> these tiny routers?
>
>
> We generally discourage people who are new to non-x86 from venturing off
> into experiments like this initially. The experiment can sometimes be
> overwhelming, anf frustration eventually kills off any motivation to
> complete it. Our usual suggestion is to get yourself a cheap SGI Box,
> like an Indy or an O2, play with it for a few months and learn how MIPS
> works, then you'll have an idea of how stuff works in comparison to
> their more inefficient x86 cousins. Other archs, like Sparc, work well
> too as non-x86 playtoys. Then the original task can sometimes be easier
> (but not always).

Better still... get a Cobalt machine if you can.

The Cobalt machines run a little-endian MIPS4 CPU, which, while they
can't run MIPS32 ISA binaries, they are at least the right endianness to
be able to build stuff natively for your router. And although they are
quite slow (generally 250MHz, and no secondary cache), they'll be a lot
faster than most emulators out there.

This, with a suitable µClibc-based chroot environment, should do quite
well for the task.

I still stand by what Kumba said ... start with something that is
officially well-supported (e.g. an SGI box, or a Qube2/RaQ2) to get
familiar with MIPS ... then work towards building for the router. :-)
--
Stuart Longland (aka Redhatter) .'''.
Gentoo Linux/MIPS Cobalt and Docs Developer '.'` :
. . . . . . . . . . . . . . . . . . . . . . .'.'
http://dev.gentoo.org/~redhatter :.'
Re: is gentoo-mips right for me? [ In reply to ]
I am new in this forum. I spent some days to find ltrace package for MIPS on the Internet and found only this web forum. Can anybody answer: does there ltrace for MIPS exist? and can I obtain it?
Thank you.
Ilya
--
View this message in context: http://www.nabble.com/is-gentoo-mips-right-for-me--t803970.html#a2438833
Sent from the gentoo-mips forum at Nabble.com.
Re: is gentoo-mips right for me? [ In reply to ]
ilya_y (sent by Nabble.com) wrote:
> I am new in this forum. I spent some days to find ltrace package for
> MIPS on the Internet and found only this web forum. Can anybody answer:
> does there ltrace for MIPS exist? and can I obtain it?
> Thank you.
> Ilya

That's a first. A message forums that watches our list and doubles as an
interface to it.

Anyways, your answer is, unfortunately, no. I've discovered the usefulness of
ltrace many a time on x86, but ltrace is one of those unique programs that needs
some porting before it can run on a new architecture. There's documentation
within the ltrace source explaining what information it needs to properly run on
a new architecture, but I've discovered that this documentation is not very
clear on how to properly obtain the information and put it to use within ltrace.

As such, ltrace will have to simply sit in the dust bin of time until someone
with the skill gets an inclination to port it to mips (and sparc, which could
also use it).


--Kumba

--
Gentoo/MIPS Team Lead
Gentoo Foundation Board of Trustees

"Such is oft the course of deeds that move the wheels of the world: small hands
do them because they must, while the eyes of the great are elsewhere." --Elrond
--
gentoo-mips@gentoo.org mailing list