Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Raspberry Pi cross compiler + distcc on an i7 -- solved
View unanswered posts
View posts from last 24 hours

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
1clue
Veteran
Veteran


Joined: 05 Feb 2006
Posts: 1377

PostPosted: Thu Jul 17, 2014 11:16 pm    Post subject: Raspberry Pi cross compiler + distcc on an i7 -- solved Reply with quote

Hi,

Just bought 3 Raspberry Pi B+ boards, and some extra attachments. They're not here yet.

So I anticipate a kernel compile almost immediately (one is a stratum 1 ntp server based on gps) and probably one of them I'm going to try Gentoo on.

I also anticipate that compiling anything on this thing is going to be painful, so I started looking at distcc and I have questions. This is my first time trying to cross compile anything.

So the questions:

  1. Is there an accurate way to make a virtual Raspberry Pi using QEMU on an i7?
  2. Is there an accurate way to make a whole operating system from the i7, burn it to the sdhc card and put it on the pi?


Things I'm looking at but not finished with:
http://wiki.gentoo.org/wiki/Raspberry_Pi_Cross_building
http://wiki.gentoo.org/wiki/Distcc/Cross-Compiling

Thanks.


Last edited by 1clue on Thu Jul 31, 2014 6:08 pm; edited 2 times in total
Back to top
View user's profile Send private message
russK
Apprentice
Apprentice


Joined: 27 Jun 2006
Posts: 224

PostPosted: Fri Jul 18, 2014 2:39 am    Post subject: Re: Raspberry Pi cross compiler into a VM? Reply with quote

1clue wrote:

  1. Is there an accurate way to make a virtual Raspberry Pi using QEMU on an i7?
  2. Is there an accurate way to make a whole operating system from the i7, burn it to the sdhc card and put it on the pi?



You can pretty much put an arm stage3 on the pi without having to build it on the i7.

Also, you can run an arm install in qemu-static-user as shown here:
http://wiki.gentoo.org/wiki/Crossdev_qemu-static-user-chroot

I did that about a year or so ago without using the debian package. I've been trying to recreate it again without the debian package because I'm a gentoo fanatic, but I may be about to raise the white flag and follow the latest wiki instructions.

From what I recall, the qemu arm install isn't exactly like the raspberry pi but it's close enough to emerge packages. I believe the qemu-user process is basically single threaded however, so even with -j7 or whatever in your MAKEOPTS, it goes much slower that one would hope.

Quote:
Things I'm looking at but not finished with:
http://wiki.gentoo.org/wiki/Raspberry_Pi_Cross_building
http://wiki.gentoo.org/wiki/Distcc/Cross-Compiling

That also works and I think it might actually work better that the qemu-static-user. But don't quote me on that. I suspect using crossdev on the i7 to build binpkg packages and set up a binhost might be the best solution. I hope to pursue this as well, because I will be putting a pi in a fixture that I won't want to disassemble to pull the SD card for updates.
Back to top
View user's profile Send private message
1clue
Veteran
Veteran


Joined: 05 Feb 2006
Posts: 1377

PostPosted: Fri Jul 18, 2014 3:55 am    Post subject: Reply with quote

OK this is good news.

I already have the i7 set up for it unless I missed something, will find out when I get the boards.

I might also try the VM thing.

Thanks.
Back to top
View user's profile Send private message
XavierMiller
Moderator
Moderator


Joined: 23 Jul 2004
Posts: 5533
Location: ~Brussels - Belgique

PostPosted: Fri Jul 18, 2014 7:03 am    Post subject: Reply with quote

Hello,

The qemu-static stuff is much slower than the raspberry pi. I prefer to use distcc.
_________________
Xavier Miller
(FR) Merci de respecter les règles du forum.
http://www.xaviermiller.be
Back to top
View user's profile Send private message
1clue
Veteran
Veteran


Joined: 05 Feb 2006
Posts: 1377

PostPosted: Fri Jul 18, 2014 4:02 pm    Post subject: Reply with quote

OK, so in order to build a boot image, I pretty much need the pi right? I don't know how to emerge to an alternate location for a different platform.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 31991
Location: 56N 3W

PostPosted: Fri Jul 18, 2014 7:28 pm    Post subject: Reply with quote

cross distcc is the way to go for a Pi.

A few things will cross compile cleanly, some like python and perl never will without extensive build system patching.

On your helper system(s) install crossdev and use it to build a cross toolchain for the Pi.
Also install distcc to listen for crys for help from the Pi.
Check out your cross compiler by trying to emerge @system into an empty Arm root filesystem.

Do a normal stage3 install on the Pi but add distcc as soon as you can.

Run emerge in pump mode to distribute as much as possible.

Its all well documented on the Wiki.

1clue,

How are you doing the time server?
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
1clue
Veteran
Veteran


Joined: 05 Feb 2006
Posts: 1377

PostPosted: Sat Jul 19, 2014 1:16 am    Post subject: Reply with quote

Some of this depends on when stuff shows up. According to the estimated time of delivery, the rpi's should show up Monday, but most of my other stuff shows up later.

This means I might get a Gentoo image first. I'll undoubtedly make sure they all work using one of the n00bs images, just to be sure, but then I'll try a Gentoo install.

IMO the time server is easiest, and there are lots of examples for rpi stratum 1 time server. There's one with good detail about kernel changes (pps support required) and I might try to do a Gentoo image with pps support.

I think that the time server is easiest. There's a GPS from adafruit I ordered, unfortunately it's about the last thing to show up by estimated time of delivery. But I might try to get that image first since it's the smallest install. Then copy that image as a first, and then duplicate it for the others.

I think I'll set up the NTP server as a normal peer first, then when I get the GPS I'll make the config change once I get the GPS drivers in there and working. Then it's done.

The second thing is a book reader. My parents are both 80. They don't see very well anymore, and reading has always been a big part of their lives. They have this book reader monstrosity, it's a 24-inch LCD with a zoom and a focus and an X-Y table that supports the book. USD $1600 to buy it. Medicare loaned it to them, and I think this is outrageous. There seems to be no minimal device for this, and the one they have has features that don't even make sense, just to jack the price up.

They have a 50" big screen TV. They have HDMI in, and the rpi has HDMI out. I'm taking a camera module and will come up with some sort of arm to adjust the rpi and camera to see the book correctly, and they can move the book on the table rather than using an X-Y table. My estimated cost the basic machine is around USD $100, instead of $1600. There are lots of pages on book scanners, I'm probably going to implement some of that too. The price tag will inevitably go up.

My original intent was only to make a projector, no data capture. That said, a lot of what they read is stuff they keep around for records, and it would be nice to store it electronically. Going further, it would be neat to store not only the image but also the text, and maybe even provide an audio output so they don't have to read anything.

I'm obviously doing a bunch of reading right now, but it would be nice to do some of this in a Gentoo sort of way.
Back to top
View user's profile Send private message
1clue
Veteran
Veteran


Joined: 05 Feb 2006
Posts: 1377

PostPosted: Sat Jul 19, 2014 1:33 am    Post subject: Reply with quote

I just changed the subject to something more appropriate now that I have more information.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 31991
Location: 56N 3W

PostPosted: Sat Jul 19, 2014 8:11 am    Post subject: Reply with quote

1clue,

If you have camera pixels to spare, It might be easier to fix the book and camera, so the camera sees the whole open text, then do zoom, and pan (in X any Y) controlled by a joystick, to show the text of interest. That just leaves page turning.

The hard bit is that the Pi does not nave any analogue inputs to read the joystick.
Still, Apple cracked that in the APPLE ][. A 557 timer is your friend.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
1clue
Veteran
Veteran


Joined: 05 Feb 2006
Posts: 1377

PostPosted: Sat Jul 19, 2014 4:41 pm    Post subject: Reply with quote

Details of the reader will wait until I have something that works.

I wonder, can I format the card with gpt partition table?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 31991
Location: 56N 3W

PostPosted: Sat Jul 19, 2014 5:22 pm    Post subject: Reply with quote

1clue,

Not really. The GPU on the Pi does the boot loading, so you need a real DOS Partition table with a FAT Partition so it can find the files to load at boot.

Maybe you could hand craft a hybrid format.

One oc the first signs of an inadequate PSU por the Pi is that it trashes the filesystem on the memory card.
I tend to use a USB spinney or root over NFS. That way the FLASH card is only used for booting
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
1clue
Veteran
Veteran


Joined: 05 Feb 2006
Posts: 1377

PostPosted: Sun Jul 20, 2014 3:19 am    Post subject: Reply with quote

Is a computer supply 5v line adequate?

All they had at the rpi place was a cheapo 1.1a usb supply. I know the specs say it can go up to 2a.

Maybe using an nfs mount isn't a bad idea, but for my ntp server I was hoping for a simpler setup.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 31991
Location: 56N 3W

PostPosted: Sun Jul 20, 2014 11:05 am    Post subject: Reply with quote

1clue,

In my experience, its not the PSU itself, it a oombination of the PSU and size of the wire to the micro USB.
A computer USB port regulated to 500mA will not work for memory card writes.

A mobile phone charger, with the phone data cable is OK too.
The same charger with an Amazon Basics USB to micro USB cable fails.
An RS components 1.2A PSU works.

This is tested with Pi Bs with 256MB and 512MB RAM.

Just to top it off, I hosted Pappys Seeds on a Pi powered from a USB port on an HP Microserver using one af these Amazon Basics USB to micro USB cables that failed above, with no issues. The root filesystem was on NFS with /boot and the seeds on the flash card. There was no keyboard or mouse connected.

Most of the power in a Pi goes to erasing/writing the FLASH, hence its very picky about FLASH cards

I don't have a B+, with four USB ports to test and I've not tested micro flash cards either.

The weak point is the 5v to 3.3v regulator on the Pi. If you use the expansion header to provide 3.3v You won't have any issues.
Maybe this has been fixed on the B+ ?
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
1clue
Veteran
Veteran


Joined: 05 Feb 2006
Posts: 1377

PostPosted: Sun Jul 20, 2014 3:34 pm    Post subject: Reply with quote

I saw 4 USB ports, lower power consumption and everything else the same except layout, and that decided it for me.

Since I have several rpi's I wonder if a roll-your-own supply might be in order. Maybe also wire in a different connector, I wonder if one of the many pins could be used for power for both the 3.3v you mentioned and 5v as well?

Thanks.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 31991
Location: 56N 3W

PostPosted: Sun Jul 20, 2014 6:35 pm    Post subject: Reply with quote

1clue,


The schematic for the original Pi is on the web. The B+ is probably there too.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
1clue
Veteran
Veteran


Joined: 05 Feb 2006
Posts: 1377

PostPosted: Wed Jul 23, 2014 2:23 am    Post subject: Reply with quote

I have my boards and all my extras.

The camera works, the only thing I don't have set up is the gps module because as yet I can't find my soldering pen.

I haven't tried Gentoo yet, wanting to make sure everything works first.

Also somewhat unsure about how to go about Gentoo and still get a single partition.

Frankly these USB or SD cards are a bit of a mystery to me too, I've tried burning 5 of them and came back with 2 unusable, permanently broken sticks. One of them got smoking hot every time I plugged it in, and failed in a few days. The other had a permanently smaller size and failed a few months later.

Theoretically I should be able to dd if=/path/to/disk.img of=/dev/sdd bs=4M and have it go right? Just like a hard disk? Or should I do it partition by partition?

My card is SDXC 16g, class 10. Don't really want to kill it.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 31991
Location: 56N 3W

PostPosted: Wed Jul 23, 2014 5:12 pm    Post subject: Reply with quote

1clue,

There are very few class 10 cards work it a Pi. Higher speeds demand higher power.

You need at least two partitions, if you will put Gentoo on the SD Card
A FAT /boot partition and a / that supports symlinks. (FAT does not)

For /boot, I put the sdcard in my PC card reader and use cp.

For / I try to use a USB spinny or root over NFS. cp -a will work too.
dd is a bad choice as it will write all the free space on the SDcard.
SDCards aro also slow to write.

If you are going to try a class 10 card, don't be surprised if the write trashes the filesystem.
Only /boot must be on tho SDcard. After that, its up to you.

Check things out with Raspian
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
1clue
Veteran
Veteran


Joined: 05 Feb 2006
Posts: 1377

PostPosted: Wed Jul 23, 2014 6:53 pm    Post subject: Reply with quote

OK I didn't know about the class 10 cards not working. Crud, that's all I even buy. I guess I gotta go get a few crappy ones.

At least now I know why nothing I built myself works. :(

For two of these at least, I need to have everything on the card. So I'm going that route first.

I see you repeated some stuff, sorry about that.
Back to top
View user's profile Send private message
1clue
Veteran
Veteran


Joined: 05 Feb 2006
Posts: 1377

PostPosted: Wed Jul 23, 2014 9:13 pm    Post subject: Reply with quote

OK so just because I'm a little dense sometimes, here's an approach for the pi:


  1. Get some cheap SD cards of various sizes.
  2. Download Gentoo ARM installer.
  3. Put it on an SD card, we're calling this one the installer card. (If not dd then what? It's all I ever used for this sort of thing)
  4. Put the installer card in the sd card slot.
  5. Put another sd card (called 'sda') into a USB card reader
  6. Put the card reader into a USB slot. Or should I put it in a powered hub, and that into the slot?
  7. Add a keyboard and monitor
  8. Boot
  9. Turn on sshd & root password
  10. Connect from my workstation.
  11. Normal install
  12. Get distcc asap.
  13. Configure to hit my i7 with distccd
  14. And after that, I guess everything's normal?


Is there a way to tell emerge that you'd rather have EVERYTHING done on a remote node with distcc, not do any of it on the board?

Thanks.
Back to top
View user's profile Send private message
1clue
Veteran
Veteran


Joined: 05 Feb 2006
Posts: 1377

PostPosted: Thu Jul 24, 2014 5:37 am    Post subject: Reply with quote

Found this, looks promising:

http://chymeric.eu/blog/2014/05/21/gentoo-for-the-raspberry-pi/
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 31991
Location: 56N 3W

PostPosted: Thu Jul 24, 2014 3:59 pm    Post subject: Reply with quote

1clue,

Its much easier that that.

Put Raspian on a SDcard using your PC
This makes your partitions and just works. Move the SDCard to the Pi and boot it.

It will have three partitions and offer to grow the root partition to fill the card - don't let it.

When you get control, make a partition for Gentoo. Get an ARMv6-hardfp stage3 and do a conventional stage3 install.
Use the Raspian kernel, in boot/ and copy its /lib/modules/* to Gentoo.

Edit the file in /boot so it uses the Gentoo partition for root.

Building the kernel is hard. You need a specially patched RPi source tree so leave it until Gentoo is running
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
XavierMiller
Moderator
Moderator


Joined: 23 Jul 2004
Posts: 5533
Location: ~Brussels - Belgique

PostPosted: Thu Jul 24, 2014 7:25 pm    Post subject: Reply with quote

For the sources, there is sys-kernel/raspberrypi-kernel ; I prefer git sources : https://github.com/raspberrypi/linux/tree/rpi-3.15.y
I compile them on my i5 with that script (you need raspberrypi-mkimage on the cross-compiling machine):
Code:
make ARCH=arm menuconfig
make ARCH=arm -j5
make ARCH=arm INSTALL_MOD_PATH=../out modules_install
imagetool-uncompressed.py --force arch/arm/boot/Image ../out/boot/kernel.img


This will install modules and kernel.img on the out folder along the linux folder ; get them and put them on the raspi.
_________________
Xavier Miller
(FR) Merci de respecter les règles du forum.
http://www.xaviermiller.be
Back to top
View user's profile Send private message
1clue
Veteran
Veteran


Joined: 05 Feb 2006
Posts: 1377

PostPosted: Thu Jul 24, 2014 8:26 pm    Post subject: Reply with quote

Will do.

For at least two of these, I need to have / on the stick. Is 8g enough or should I go with 16? Looking at my relatively minimal i7 gentoo box (which will be distccd here) I'm thinking 16g.

But one will be just ntpd and gps software, so I'm not sure exactly what I need here.

I think I'm going with 16g sticks for both, they're only a couple bucks different. I just need to get cheap ones this time.

Thanks.
Back to top
View user's profile Send private message
XavierMiller
Moderator
Moderator


Joined: 23 Jul 2004
Posts: 5533
Location: ~Brussels - Belgique

PostPosted: Thu Jul 24, 2014 8:46 pm    Post subject: Reply with quote

8 is OK (mine has < 2 Go with a headless NAS + print + scan server), 16 will be comfortable.
_________________
Xavier Miller
(FR) Merci de respecter les règles du forum.
http://www.xaviermiller.be
Back to top
View user's profile Send private message
1clue
Veteran
Veteran


Joined: 05 Feb 2006
Posts: 1377

PostPosted: Thu Jul 31, 2014 7:33 am    Post subject: Reply with quote

Finally got around to finishing my Gentoo install!

This is just first boot, I need to do the kernel next.

It's been sitting patiently for awhile, but I've been fiddling with it when I get a few minutes.

Thanks for all the help, will leave this open in case I need help yet.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum