LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (https://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   Cross-Compiling using Scratchbox. (https://www.linuxquestions.org/questions/linux-kernel-70/cross-compiling-using-scratchbox-507661/)

Mejia 12-05-2006 11:27 AM

Cross-Compiling using Scratchbox.
 
Hello,

I'm compiling for ARM architecture, I'm using the Scratchbox Tools(no much experience actually),

I'm following the instructions from Scratchbox webpage:

"" First we need a small piece of software to compile. "Hello World" will do fine:

#include <stdio.h>

int main(void) {
printf("Hello World!\n");

return 0;
}


Then let us compile the "Hello World" natively for X86 to see it works and to see some information about the binary produced. We assume you wrote the "Hello World" to a file named 'hello.c'. Now in the same directory where you have the 'hello.c' execute a command:

> gcc -Wall -o hello hello.c

It should not output anything and then you should have a 'hello' binary that you can run to get output of "Hello World!".

> ./hello
Hello World!

Now for running a 'file' command to see some information about the 'hello' binary:

> file hello
hello: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for
GNU/Linux 2.2.0, dynamically linked (uses shared libs), not stripped
""


My question is: what can I do to change the GNU/Linux version of the "hello" file compiled. For instance: change the version from GNU/Linux 2.2.0 to GNU/Linux 2.6.18.

Your help is very appreciated.
Thanks in advance.

unSpawn 12-06-2006 05:21 AM

change the version from GNU/Linux 2.2.0 to GNU/Linux 2.6.18
Are you sure the "2.2.0" denotes the kernel version? I think its another specification.

Mejia 12-06-2006 09:06 AM

My Distro is Fedora and my kernel is 2.6.18, and my concern is: why the Scratchbox is compiling for GNU/Linux 2.2.0 while my Kernel is 2.6.18, then I don't think the "2.2.0" denotes the kernel version, my first guess is that I can fix this problem by patching the Scratchbox or by changing some headers, but I don't know how...

Thanks in advance !

unSpawn 12-06-2006 10:13 AM

If you run "cc -dumpmachine | grep -i arm", does your toolchain's cc return "arm(-something)"?

Mejia 12-06-2006 11:14 AM

First thanks for your help !

The following is a more real example of what is happening in my workstation when I login to the Scratchbox:

=============================
[sbox-temporal: /] > ls
bin floppy lib opt srv tools.tar
boot home lmbench-2.5 proc sys usr
cdrom host_usr login_target.sh root targets var
dev inetutils-1.4.2 media sbin tmp
etc initrd mnt scratchbox tools
[sbox-temporal: /] > cd usr
[sbox-temporal: /usr] > ls
bin include lib sbin
[sbox-temporal: /usr] > cd bin
[sbox-temporal: /usr/bin] > ls
catchsegv gencat getent locale mtrace rpcinfo zdump
cc getconf ldd localedef rpcgen tzselect
[sbox-temporal: /usr/bin] > file locale
locale: ELF 32-bit LSB executable, ARM, version 1 (ARM), for GNU/Linux 2.4.3, dynamically linked (uses shared libs), not stripped
[sbox-temporal: /usr/bin] > cc -dumpmachine | grep -i arm
arm-unknown-linux-gnu

[sbox-temporal: /usr/bin] >

===============================

Notes:
1. Using Fedora 5
2. with Kernel 2.6.18
3. with gcc-4.0.1 & glibc-2.3.2
4. with binutils-2.16.1


All times are GMT -5. The time now is 06:58 PM.