LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-11-2012, 05:07 PM   #1
naf546
LQ Newbie
 
Registered: Aug 2012
Posts: 11

Rep: Reputation: Disabled
How are distrubutions rebuilt for different CPU architectures?


Hey there , Nathan here.
I was currently looking at how developers currently go about rebuilding whole distrobutions to be able to run on different architectures?

Take Debian for example. the debian community supports powerpc , mips etc...

Is every package recompiled for each CPU platform individually? or do they have a massive script they edit and execute to build the different OS's?
I'm asking as it seems to me a little bit unintuitive both ways.

Thanks for your time.

Nathan.
 
Old 08-12-2012, 05:11 AM   #2
heinblöd
Member
 
Registered: May 2004
Location: France
Distribution: Slackware Gentoo
Posts: 186

Rep: Reputation: 31
look at this :
http://landley.net/writing/docs/cross-compiling.html for basics
and this for a live coverage :
http://www.armedslack.org/
https://twitter.com/drmozes
 
1 members found this post helpful.
Old 08-12-2012, 08:35 AM   #3
naf546
LQ Newbie
 
Registered: Aug 2012
Posts: 11

Original Poster
Rep: Reputation: Disabled
Thanks for your reply, but i don't see it helping me in any particular way.

I understand the basic's of cross compiling. I was looking at how to build 300> packages for a different architecture.
I wound't imagine you would have to do it manually - I however could be wrong...

The 'Introduction to cross compiling' is, however a good read.
 
Old 08-12-2012, 09:17 AM   #4
whizje
Member
 
Registered: Sep 2008
Location: The Netherlands
Distribution: Slackware64 current
Posts: 594

Rep: Reputation: 141Reputation: 141
Every package is recompiled for each CPU platform.
How else could it be done.
 
Old 08-12-2012, 10:29 AM   #5
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
Aside from the complications associated with cross compiling, it isn't so much different from a native build. Of course, sometimes those complications can be significant. I think a lot of the original development gets done by hardware vendors who want Linux to run on their products; especially any custom hardware drivers, bootloaders, and application-specific code. Cross building kernels is relatively painless.
--- rod.
 
Old 08-12-2012, 01:00 PM   #6
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,784

Rep: Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083
See Autobuilder network.
 
Old 08-12-2012, 01:46 PM   #7
heinblöd
Member
 
Registered: May 2004
Location: France
Distribution: Slackware Gentoo
Posts: 186

Rep: Reputation: 31
Well actually the first time you will compile every single package for a new arch .
Maybe later, if the base has been set up, you can use buildscripts like SlackBuilds in Slackware to have some degree of automatisation.
But actually I don't think there is much more one can do than look at each package, sort out it's dependancies, sort out the build order for your toolchain and build one by one.

A good example may be Linux from scratch, which describes the process and even has some automatisation sub-projects, but they all need to be adjusted for every major change in the sources or important packages (like xorg or gcc)

The link to http://www.armedslack.org/ I put in because you can follow the process where someone has or is porting a distro to a new architecture.

The autobuilder network is a example for automatisation been set up for a distro, but it also needs manual work, if a build fails.

Another example for this is the Opensuse OBS : http://www.open-build-service.org/

Last edited by heinblöd; 08-12-2012 at 01:52 PM.
 
Old 08-12-2012, 06:00 PM   #8
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,673
Blog Entries: 4

Rep: Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945
Cross-compiling is both commonplace and painless. The output of any compiler is "object code." It doesn't have to be "object code for the architecture that is running the compiler at the time."

For instance, a portable device might not be a very good platform for running the compiler that generates object code for that device. But it does not need to be.

Perhaps more commonly: your sexy multi-core latest-greatest Intel chip might be tasked with generating object files for a "vanilla 386." (Very rapidly...)
 
Old 08-12-2012, 06:23 PM   #9
jefro
Moderator
 
Registered: Mar 2008
Posts: 22,001

Rep: Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629
You have to do a lot more in most cases than simple compile from sources. Different arches may have any number of less or more components and even as simple as how it reads a number is important. Having the source code is good for a very skilled developer to start with but they have to have a very detailed knowledge of the hardware to create an OS for that device.
 
Old 08-12-2012, 06:50 PM   #10
naf546
LQ Newbie
 
Registered: Aug 2012
Posts: 11

Original Poster
Rep: Reputation: Disabled
Thanks for your replies.
I think I understand alot better now.

So rebuilding a Distro isn't something to be undertaken by a lonewolf like myself?
It sounds like it takes alot of effort to rebuild something by the likes of fedora or ubuntu for different architectures.

I currently followed the LFS book , but after spending 6 weeks on it, restarting the project 8-9 times, I eventually grew tired of it.

I'm actually trying as my first C++ project to build my own distro from Tinycore and build my own Windows Manager.
Wish me luck! Hopefully I will get something at the end of it, rather then a mangled ball of C++ code
 
Old 08-12-2012, 06:58 PM   #11
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680

Rep: Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373
Quote:
Originally Posted by jefro View Post
You have to do a lot more in most cases than simple compile from sources. Different arches may have any number of less or more components and even as simple as how it reads a number is important. Having the source code is good for a very skilled developer to start with but they have to have a very detailed knowledge of the hardware to create an OS for that device.
I thought whomever creates the compiler is the one dealing with the endedness and instruction set? Surely source code is source code and once the compiler is ported (non-trivial, of course)?
 
Old 08-12-2012, 09:55 PM   #12
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,673
Blog Entries: 4

Rep: Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945
Quote:
So rebuilding a Distro isn't something to be undertaken by a lonewolf like myself?
It sounds like it takes a lot of effort to rebuild something by the likes of fedora or ubuntu for different architectures.
Indeed, that is what the distro managers do for all of us, and it is in fact an expert undertaking.

Quote:
I currently followed the LFS book , but after spending 6 weeks on it, restarting the project 8-9 times, I eventually grew tired of it.
As did I. Then, I discovered Gentoo, which is also a source-code based distro, albeit of a very different form and purpose. LFS (= Linux From Scratch) is in my opinion primarily an educational exercise, and as such I consider it to be a priceless exercise that every Linux geek should go through more than once.

Quote:
I'm actually trying as my first C++ project to build my own distro from Tinycore and build my own Windows Manager.
Wish me luck! Hopefully I will get something at the end of it, rather then a mangled ball of C++ code
A noble undertaking, and please do advise us of your progress. "Good luck!" It's perfectly reasonable to regard whatever you come up with as "a mangled ball," partly because every programmer looks upon his work more-or-less that way. Still, it will be well worth doing and we do look forward to it. As should you.
 
Old 08-12-2012, 09:58 PM   #13
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
Quote:
Originally Posted by 273 View Post
I thought whomever creates the compiler is the one dealing with the endedness and instruction set? Surely source code is source code and once the compiler is ported (non-trivial, of course)?
Source code isn't always portable. There are many many ways to build hardware dependencies into code, and many different ways of running a compiler. In ARM CPU's alone, there are a plethora of combinations of features: endian-ness, ABIs, floating point support, memory management support, ARM versions, etc.
Throw in dependencies on standard C libraries, kernel versions, compiler versions (newer generally means stricter; what compiled on older compilers often won't on newer compilers), and the sheer volume of code, and you're bound to have problems. Just building a cross toolchain is an exercise not for the faint of heart.
Nope, it isn't easy.
Quote:
Originally Posted by naf546
I'm actually trying as my first C++ project to build my own distro from Tinycore
I did that about a year ago. I was amazed how much work it was, even though someone else had done all the heavy lifting. I had previously looked long and hard at many other distros, as well as at the possibility of rolling my own from scratch. I have no doubt whatsoever that TinyCore (actually the now defunct & GUI-less Microcore) was the best choice.

--- rod.

Last edited by theNbomr; 08-13-2012 at 08:53 AM. Reason: typos fixed
 
Old 08-12-2012, 10:41 PM   #14
vharishankar
Senior Member
 
Registered: Dec 2003
Distribution: Debian
Posts: 3,178
Blog Entries: 4

Rep: Reputation: 138Reputation: 138
deleted.

Last edited by vharishankar; 11-02-2012 at 12:44 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Where can those with low bandwidth go to get new distrubutions? antares4141 Linux - Newbie 10 09-22-2009 09:53 AM
package-Linux Distrubutions darwins Linux - Distributions 3 12-20-2008 08:13 PM
Dual Boot Two Linux Distrubutions aquatux Linux - General 12 01-24-2007 06:15 AM
CPU architectures bobbens Linux - Hardware 2 02-09-2005 09:52 AM
fixing linux distrubutions? chunlee Linux - General 1 12-12-2004 07:37 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration