llewell
Posts: 10
Joined: Sun Mar 04, 2012 3:52 pm

Re: cross-compiling/developing for the Debian image

Sun Mar 04, 2012 4:05 pm

I have a Debian image for the RPi (debian6-17-02-2012) which I downloaded from Element 14 but I assume came from raspberrypi.org.  I do not have the device, but I do have the image running in qemu on a Debian wheezy system.

Is there any information on how this image was built?  What toolchain, what development system, what it scratchbox or codesourcery, etc.?

I want to know how to add other applications to the image.  For instance, I have downloaded SIP Media Loopback from Sourceforge, and I'd like to cross-compile it for the PI on this image.  I'm sure I'll have enough problems without reinventing the toolchain/environment used to build the OS it's running on.

User avatar
nick.mccloud
Posts: 804
Joined: Sat Feb 04, 2012 4:18 pm

Re: cross-compiling/developing for the Debian image

Sun Mar 04, 2012 4:49 pm

It has gcc on it, why not use that?

llewell
Posts: 10
Joined: Sun Mar 04, 2012 3:52 pm

Re: cross-compiling/developing for the Debian image

Sun Mar 04, 2012 7:16 pm

If that's the best way to do it, that's fine.  I'm really curious about how the thing is built, and I figure the more I know the less I have to worry about going down dead-ends caused by trying to reinvent the wheel.

User avatar
nick.mccloud
Posts: 804
Joined: Sat Feb 04, 2012 4:18 pm

Re: cross-compiling/developing for the Debian image

Sun Mar 04, 2012 7:38 pm

It's far too early in the life of Pi to say anything definitive!

llewell
Posts: 10
Joined: Sun Mar 04, 2012 3:52 pm

Re: cross-compiling/developing for the Debian image

Mon Mar 05, 2012 1:15 am

OK, that's kind of mysterious.  Well, I'm sure the answers are out there.

AlArenal
Posts: 141
Joined: Sun Feb 26, 2012 6:58 pm
Location: Germany
Contact: Website

Re: cross-compiling/developing for the Debian image

Mon Mar 05, 2012 8:22 am

Some things just have to settle in and that's probably not gonna happen until we're sitting in front of the actual RPi iron and get our feet wet. Questions will be more easy to answer if you can actually test what's going to happen.

plugwash
Forum Moderator
Forum Moderator
Posts: 3601
Joined: Wed Dec 28, 2011 11:45 pm

Re: cross-compiling/developing for the Debian image

Mon Mar 05, 2012 3:07 pm

I presume the image was put together from debian packages in the normal way using debootstrap either directly or through the debian installer.

As for building the packages official debian packages are always built natively on the target architecture (though on hardware with considerablly more ram than the Pi). The emdebian project offers tools for cross compiling but YMMV with using them to compile various software.

llewell
Posts: 10
Joined: Sun Mar 04, 2012 3:52 pm

Re: cross-compiling/developing for the Debian image

Mon Mar 05, 2012 3:14 pm

Do you mean more disk space?  How do you build on the device with more RAM when the RAM is built in to the chip?

As to the Debian image, I can't find grub or the kernel, for that matter.  They don't appear in any of the usual locations (but as I said, I haven't seen a Debian ARM build before).  I don't suppose anyone has published docs on how the RPi actually boots, have they?

User avatar
nick.mccloud
Posts: 804
Joined: Sat Feb 04, 2012 4:18 pm

Re: cross-compiling/developing for the Debian image

Mon Mar 05, 2012 3:49 pm

llewell said:


As to the Debian image, I can't find grub or the kernel, for that matter.  They don't appear in any of the usual locations (but as I said, I haven't seen a Debian ARM build before).  I don't suppose anyone has published docs on how the RPi actually boots, have they?


There are other threads on this but basically the GPU runs internal bootstrap code, reads settings from the first FAT partition on the card, initialises the ARM processor and feeds it a startup file. There is a kernel.img in the FAT partition.

Try various searches from the home page on the theme of 'gpu boot' and so forth.

plugwash
Forum Moderator
Forum Moderator
Posts: 3601
Joined: Wed Dec 28, 2011 11:45 pm

Re: cross-compiling/developing for the Debian image

Mon Mar 05, 2012 3:55 pm

Do you mean more disk space?

No I mean what I say though to build packages like webkit and libreoffice you DO need lots of disk IN ADDITION TO lots of ram.

How do you build on the device with more RAM when the RAM is built in to the chip?

Debian build their packages on boards that have the arm architecture but have far more ram than the Pi. You can find a list of debian armel buildds at https://buildd.debian.org/status/archit ... hp?a=armel (look for the line titled "Restrict on buildd:") and then look them up in the debian machines database at http://db.debian.org/machines.cgi if you are curious about exactly what machines they are using.

You will be able to build most stuff on the pi, it's just large C++ apps that are likely to be a problem.

As to the Debian image, I can't find grub or the kernel, for that matter.  They don't appear in any of the usual locations (but as I said, I haven't seen a Debian ARM build before).

Arm is a lot messier than PC architecture and boot details vary hugely by device.

I don't suppose anyone has published docs on how the RPi actually boots, have they?

How the pi boots has been discussed here at length but roughly speaking the GPU boots first and then loads the kernel. The GPU firmware, boot configuration, kernel and initrd are all loaded off a FAT partition at the beggining of the SD card.

Currently the Pi debian image will not be using a debian supplied kernel as debian do not yet (and may never) provide a kernel that supports the Pi. This is not an unusal situation for arm devices because there are so bloody many different ones out there.

llewell
Posts: 10
Joined: Sun Mar 04, 2012 3:52 pm

Re: cross-compiling/developing for the Debian image

Mon Mar 05, 2012 11:30 pm

Oh, so I only have to read a thousand posts or so.  No problem. 

I guess I have to think a little differently about the RPi.  It sounds like embedded Linux, with all of the limitations that implies, but it'll run just like a "real" computer if you don't want to poke around under the hood.  Good stuff.

Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: cross-compiling/developing for the Debian image

Tue Mar 06, 2012 12:28 am

Look for a thread with the title "config.txt" - it contains a lot of interesting info about how the Pi boots.

That is, before it veered off into a back-and-forth about how to keep kids from voiding their (and their friends) warranties...
And some folks need to stop being fanboys and see the forest behind the trees.

(One of the best lines I've seen on this board lately)

plugwash
Forum Moderator
Forum Moderator
Posts: 3601
Joined: Wed Dec 28, 2011 11:45 pm

Re: cross-compiling/developing for the Debian image

Tue Mar 06, 2012 12:39 am

llewell said:


I guess I have to think a little differently about the RPi.  It sounds like embedded Linux, with all of the limitations that implies


Not really the Pi has the ram and mass storage to run a proper linux disro like debian or fedora rather than a highly stripped down embeded distro like openwrt. It's just that arm boards like the Pi are far far less consistent in terms of boot processes and hardware structure than PCs are, they also tend to have a LOT less ram than modern PCs which makes natively building big C++ apps natively a PITA (even with 1 gigabyte of ram webkit and libreoffice builds grind in swap for days).

Cross compiling is an option but it brings problems of it's own. Most notablly the build system for the software you are building has to support it and it makes it impractical to run build time test suites.

Poking arround under the hood is encouraged on the arm side (the GPU side is closed unfortunately), you just have to get used to kernel and bootloader things varying far more between arm boards than they do between PCs.

Return to “General discussion”