LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Solaris / OpenSolaris (https://www.linuxquestions.org/questions/solaris-opensolaris-20/)
-   -   Compiling Linux on Solaris (https://www.linuxquestions.org/questions/solaris-opensolaris-20/compiling-linux-on-solaris-729673/)

mintzyuval 05-31-2009 11:36 AM

Compiling Linux on Solaris
 
Hey,

I'll try to explain my problem in short:

I need to compile a Linux (exact version not too important, using the latest stable branch) binary for the sparc (OpenSparc) architecture. The thing is:

1. I don't have a decent cross compilier from AMD64 -> Sparc that can create the image on a given AMD64 computer (I've tried, the toolchain created an erroneous binary file).

2. The only Sparc-Machine in my disposal has Solaris installed on it.

So, when I try to compile linux on the Solaris machine I get several errors, all regarding either defines that don't exist (relocation defines for ARM and MIPS in elf.h header), or are linux specific (for example strsep/asprintf).
Although all the errors I've encountered so far are superficial problems that I can correct, I fear I'll encounter many more errors along the way, some of them harder-to-fix than those.

Did anyone already managed such a feat (compiling linux on a solaris machine)? if so, could he give me some tips on how he managed it?

Thanks,
Mintz Yuval

Mr-Bisquit 06-01-2009 04:12 AM

Have you tried compiling in a VM for the target architecture?

Maybe use a FreeBSD tool? I know it sounds silly buty I am assuming that the compatibility works both ways.

knudfl 06-01-2009 06:09 AM

Some suggestions :
EDIT-EDIT : Set up a VM like Mr-Bisquit said.
Install "Debian for Sparc" in the VM.

Or install "Debian for Sparc" on a spare harddisk on
the Sparc computer.

Both options will make it easy to compile your application.

Debian for Sparc
http://cdimage.debian.org/debian-cd/5.0.1/sparc/iso-cd/
.....

jlliagre 06-01-2009 06:55 AM

These are good guesses, unfortunately as far as I know, unless you have an UltraSPARC T CPU and then could experiment with Linux LDOMs ( http://www.sun.com/servers/coolthreads/ldoms/index.jsp ), there are no virtual machines on top of the SPARC CPU that would support a Linux installation. Virtual-Box is x86/x64 only.

knudfl 06-01-2009 07:19 AM

Sorry, my mistake.

Qemu + Sun xVM Server are mentioned here
http://en.wikipedia.org/wiki/Compari...rtual_machines

.....

jlliagre 06-01-2009 08:11 AM

Sun xVM server uses Xen which is x86 only too.

Qemu might work as it is reported to support SPARC in 32 bit mode. http://www.nongnu.org/qemu/status.html

mintzyuval 06-02-2009 04:30 AM

Quote:

Originally Posted by jlliagre (Post 3558895)
Sun xVM server uses Xen which is x86 only too.

Qemu might work as it is reported to support SPARC in 32 bit mode. http://www.nongnu.org/qemu/status.html

Well, I need this linux in order to use it with Sun's SAM simulation for the OpenSparc T2 machine - and correct me if I'm wrong here, but that's a 64-bit machine, so 32-bit architecture isn't good enough for me.

Thanks,
Mintz Yuval

jlliagre 06-02-2009 07:27 PM

Userland 32 bit binaries run on 64 bit but I'm confused by your reply.

If you want to build a Linux binary in order to run it on a SPARC simulator, that means you already have a Linux OS running on it, do you ?

Then why won't you compile that binary on that environment ?

Or are you trying to port the lx brand on Sparc ?

mintzyuval 06-03-2009 02:29 AM

Quote:

Originally Posted by jlliagre (Post 3560907)
Userland 32 bit binaries run on 64 bit but I'm confused by your reply.

If you want to build a Linux binary in order to run it on a SPARC simulator, that means you already have a Linux OS running on it, do you ?

Then why won't you compile that binary on that environment ?

Or are you trying to port the lx brand on Sparc ?


I'll try to make things clearer - SAM runs on an AMD64 with solaris installed on it (SAM wouldn't normally compile and run on a system running Linux OS).
The linux I want to compile is for usage as a guest OS in the simulation - but I don't have a running Linux OS at this point.

Thanks,
Mintz Yuval

jlliagre 06-03-2009 03:34 AM

So you want to compile the whole linux kernel and Gnu userland, not a single linux binary and boot that kernel on SAM ?

That's quite ambitious. I would suggest to use a real SPARC machine for the builds. You'll probably find some cheap ones on ebay or similar.

mintzyuval 06-04-2009 02:48 AM

Thanks everybody - I managed to finish the changes in the linux code in order to allow it to compile without its gnu-specific functionality and linux-specific definition on a Sparc Architecture (regarding last reply, I stated I already have a Sparc machine in my disposal, only with solaris on it).
Hope it will go well...
If not, I'll install a distribution of linux on a different partition, and compile the code there.

Thanks,
Mintz Yuval


All times are GMT -5. The time now is 11:09 PM.