aaa801
Posts: 428
Joined: Mon Jun 04, 2012 9:06 pm
Location: Berkshire

Fast Compiling, Use your current pc to compile directly EASY

Thu Jun 14, 2012 8:36 pm

This allows you to actualy run the system from the sdcard, so you dont have to worry about cross compiling anymore :O

sdc refers to the / partition of the sd card which you can find with this
sudo fdisk -l

look for the disk that looks like this

Disk /dev/sdc: 2013 MB, 2013265920 bytes
62 heads, 62 sectors/track, 1022 cylinders, total 3932160 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0007133b

Device Boot Start End Blocks Id System
/dev/sdc1 * 2048 258047 128000 c W95 FAT32 (LBA)
/dev/sdc2 258048 3899391 1820672 83 Linux

that's your sdcard
then mount the correct parition (the one with the linux fs in it)


sudo su
apt-get install kpartx qemu binfmt-support qemu-user qemu-user-static

Once those are installed

mount /dev/sdc /mnt
cp /usr/bin/qemu-arm-static /mnt/usr/bin
mount -o bind /dev /mnt/dev
mount -o bind /proc /mnt/proc
mount -o bind /sys /mnt/sys
chroot /mnt

To exit the chroot type exit

Enjoy the speeded up development

Credits to arianvp for a shorter way to mount the sdcard

bredman
Posts: 1415
Joined: Tue Jan 17, 2012 2:38 pm

Re: Fast Compiling, Use your current pc to compile directly

Thu Jun 14, 2012 9:28 pm

This instruction is completely unintelligible. It is definitely not suitable for the beginner's part of the forum. A beginner might type these commands into a Raspberry Pi.

What is the purpose?

What type of computer should the commands be run on? I assume a Linux PC, not a Raspberry Pi.

How would this type of mounting help to compile ARM software on a standard PC? qemu is mentioned once, but is not used anywhere else in the instructions.

aaa801
Posts: 428
Joined: Mon Jun 04, 2012 9:06 pm
Location: Berkshire

Re: Fast Compiling, Use your current pc to compile directly

Thu Jun 14, 2012 9:58 pm

bredman wrote:This instruction is completely unintelligible. It is definitely not suitable for the beginner's part of the forum. A beginner might type these commands into a Raspberry Pi.

What is the purpose?

What type of computer should the commands be run on? I assume a Linux PC, not a Raspberry Pi.

How would this type of mounting help to compile ARM software on a standard PC? qemu is mentioned once, but is not used anywhere else in the instructions.
please read up on the primary function of chroot

bredman
Posts: 1415
Joined: Tue Jan 17, 2012 2:38 pm

Re: Fast Compiling, Use your current pc to compile directly

Fri Jun 15, 2012 8:07 am

These questions are not for you, I already understand how your solution works.

I was suggesting these are important things that should be explained to the reader.

This is the sort of thing that gives Linux a bad name. Writing an instruction takes time and effort to explain the context and the reason and the method. Writing a list of commands is the easy part.

hjongste
Posts: 19
Joined: Sun Jan 01, 2012 5:53 am

Re: Fast Compiling, Use your current pc to compile directly

Fri Jun 15, 2012 9:18 am

I absolutely agree with bredman. I am no novice to Linux but I still remember how daunting these long command line instructions were. A typical example of someone who understands code but is incompetent in transferring the knowledge to other people. He probably writes code without comments and is proud of it. This is exactly what is preventing Linux to make a breakthrough with a larger audience.

arianvp
Posts: 2
Joined: Thu Jun 14, 2012 8:32 pm

Re: Fast Compiling, Use your current pc to compile directly

Fri Jun 15, 2012 9:36 am

I'm sorry for the non-beginnerish feel of this guide. I came up with this method together with aaa801, but I will be writing a comprehensive, good to understand, noob-friendly edition this afternoon. Hopefully that will be a help to you all ^^

andyl
Posts: 265
Joined: Tue Jan 10, 2012 11:05 am

Re: Fast Compiling, Use your current pc to compile directly

Fri Jun 15, 2012 9:57 am

hjongste wrote:I absolutely agree with bredman. I am no novice to Linux but I still remember how daunting these long command line instructions were. A typical example of someone who understands code but is incompetent in transferring the knowledge to other people. He probably writes code without comments and is proud of it. This is exactly what is preventing Linux to make a breakthrough with a larger audience.
Actually it is quite possible to write good quality understandable code without comments. But I do agree with you. This isn't suitable for beginners at all, and I would like to see a lot more commentary for those intermediate users who might be tempted.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 25458
Joined: Sat Jul 30, 2011 7:41 pm

Re: Fast Compiling, Use your current pc to compile directly

Fri Jun 15, 2012 10:21 am

andyl wrote: Actually it is quite possible to write good quality understandable code without comments. But I do agree with you. This isn't suitable for beginners at all, and I would like to see a lot more commentary for those intermediate users who might be tempted.
Gotta disagree with that first sentence. The only code that would be clearly and quickly understandable without comments would be so simple as to be almost worthless. I speak from 30 years of software development, and cannot count the number of times where allegedly 'simple' code needed some time to decipher. Usually code I wrote! Time that could have been saved with a one or two line comment.

Agree with the rest. I'm not even sure what the OP posts was trying to do! Had to read the text and title a couple of times - think its something to do with cross compiling. And I know what I'm doing. Entirely unsuitable for a beginners forum, so going to move it to programming.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
“I own the world’s worst thesaurus. Not only is it awful, it’s awful."

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 25458
Joined: Sat Jul 30, 2011 7:41 pm

Re: Fast Compiling, Use your current pc to compile directly

Fri Jun 15, 2012 10:25 am

Sorry, just realised its already in programming. Cannot find a more suitable place to put it, so leaving as is. But to the OP - please add a LOT more information to the post, at the moment is pretty much useless.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
“I own the world’s worst thesaurus. Not only is it awful, it’s awful."

antiloquax
Posts: 406
Joined: Sun Nov 20, 2011 11:37 am
Contact: Website

Re: Fast Compiling, Use your current pc to compile directly

Fri Jun 15, 2012 11:24 am

So this is different from running a virtual Pi in qemu using something that begins:

Code: Select all

qemu-system-arm ...
I used qemu to compile some stuff before I got my Pi. I'll try this approach as well. Interesting.

By the way, I have overclocked my Pi and when I tried to run the qemu using the filesystem (post-overclock), qemu crashed.
I'm guessing that there's a way to avoid this. If anyone knows, I'd be interested. The same card runs fine on the RPi itself :)

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

Re: Fast Compiling, Use your current pc to compile directly

Fri Jun 15, 2012 12:10 pm

jamesh wrote:The only code that would be clearly and quickly understandable without comments would be so simple as to be almost worthless.
Having spent three hours last night running use cases for a JavaScript compiler against someone's undocumented regexes I heartily support the above.

If you ain't got a comment line to code line ratio nearing 1:2 then your code is probably unmaintainable to anyone else.

andyl
Posts: 265
Joined: Tue Jan 10, 2012 11:05 am

Re: Fast Compiling, Use your current pc to compile directly

Fri Jun 15, 2012 1:03 pm

jamesh wrote:
andyl wrote: Actually it is quite possible to write good quality understandable code without comments. But I do agree with you. This isn't suitable for beginners at all, and I would like to see a lot more commentary for those intermediate users who might be tempted.
Gotta disagree with that first sentence. The only code that would be clearly and quickly understandable without comments would be so simple as to be almost worthless. I speak from 30 years of software development,
So do I, speak from 30 years of experience.

One of the problems with comments and code are that you can't trust the comments. Many times code has been changed (maybe because business requirements have changed) but the comments haven't. Sometimes the code has never matched the comments. So you need to be able to read and understand the code anyway. Another issue is that people put in too many (and one is too many) bloody useless comments. It is no good adding a comment "increment i" for a line which says i++.

Ways in which to reduce commenting to way below the ratio expressed by Nick.

Meaningful names for variables and functions.
Use of named constants and not magic numbers.
Keep the amount of functionality in a method or function to the absolute minimum. Refactor until they are small enough to understand.
Always use good unit test suites to test all the public interface of all your classes.
Get the level of abstraction - your code design - right.
Use a revision control system and use meaningful commit messages.

Also I do not eschew all documentation. Just that most of my documentation is at a higher level of design abstraction than the actual code.

Also of course I have described the ideal. Short comments describing the why, maybe a quick ref to an algorithm and why it was chosen, seem perfectly reasonable as that is often not captured by the code. Commenting the what is redundant IMO.

aaa801
Posts: 428
Joined: Mon Jun 04, 2012 9:06 pm
Location: Berkshire

Re: Fast Compiling, Use your current pc to compile directly

Fri Jun 15, 2012 2:04 pm

More understandable version coming soon to a forum near you.

Should be up by tonight.

arianvp
Posts: 2
Joined: Thu Jun 14, 2012 8:32 pm

Re: Fast Compiling, Use your current pc to compile directly

Fri Jun 15, 2012 2:35 pm

Okay, we rewrote this to make it more user-friendly, but we couldn't edit this post for some reason... so we created a new topic here : http://www.raspberrypi.org/phpBB3/viewt ... =31&t=8478


Mods, please lock this one ^^

Return to “General programming discussion”