Multi(Embeded)Cpu scratchbox ga^y a^'n tu+o+.ng to^'t, nhu+ng ba'c na`o muo^'n 
thu+? Scratchbox cho MO^.T embeded CPU (vi' du. nhu+ cho arm) thi` ne^n ddo.c 
hu+o+'ng da^~n ca`i dda(.t theo no^'i ke^'t ma.ng sau, cho ma'y Linux cu?a 
minh` (chi? ca^`n khoa?n 522 MB). DDu+`ng que^n do.c nhu+~ng hu+o+'ng da^~n 
(pdf hay html) cu?a scratchbox.org.:

"http://www.scratchbox.org/documentation/user/scratchbox-1.0/html/tutorial.html";
 
2.1. Installing the Scratchbox

The current stable release of Scratchbox is 1.0.1. You can get the needed 
packages from. The following packages are needed from the download page: 
scratchbox-core, scratchbox-libs and scratchbox-toolchain-arm-glibc. All of 
those packages are provided as binary tar.gz, deb and rpm form. In this article 
we use .tar.gz files. The Scratchbox installation we are going to use takes 
about 522 mb of hard disk space and it will install under '/scratchbox/'. You 
will also need some extra space to work in. If you don't have enough space on 
your root partition then you can create a symbolic link to some other partition 
before continuing, e.g.:

> mkdir /work/scratchbox
> ln -s /work/scratchbox /scratchbox

Scratchbox needs to be installed as root:

> cd /tmp/
> wget http://www.scratchbox.org/download/files/sbox-releases/
1.0/tarball/scratchbox-core-1.0.1-i386.tar.gz
> wget http://www.scratchbox.org/download/files/sbox-releases/
1.0/tarball/scratchbox-libs-1.0.1-i386.tar.gz
> wget http://www.scratchbox.org/download/files/sbox-releases/
1.0/tarball/scratchbox-toolchain-arm-gcc3.3-glibc2.3-1.0.1-i386.tar.gz
> tar -xzf scratchbox-core-1.0.1-i386.tar.gz -C /
> tar -xzf scratchbox-libs-1.0.1-i386.tar.gz -C /
> tar -xzf scratchbox-toolchain-arm-gcc3.3-glibc2.3-1.0.1-i386.tar.gz 
-C /
> /scratchbox/run_me_first.sh

'run_me_first.sh' asks you some questions, just use defaults. After this we 
need to add user for Scratchbox. User must be some user that you have in your 
system. Do NOT add root user! e.g.:

> /scratchbox/sbin/sbox_adduser vmankine

Scratcbox installation document [3] chapter number two helps you in installing 
the packages if you want to use for example .deb packages.

2.2. Down to business

Let us first use the old fashioned way of cross-compiling and use the 
Scratchbox tools from the host system like any other tools. 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;
}

First 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

Any of this does not yet have anything to do with Scratchbox or cross-compiling 
for that matter. For cross-compiling we need to use the cross-compiler provided 
in the Scratchbox packages. Run command:

> /scratchbox/compilers/arm-gcc-3.3.4-glibc-2.3.2/bin/arm-linux-gcc 
-Wall -o arm-hello hello.c

Running that command should not give you any output but now you should have an 
'arm-hello' binary. You cannot run that as it is for ARM architecture and you 
are on a X86 machine. Anyhow we can run the 'file' command to see that it 
really is an ARM binary:

> file arm-hello
arm-hello: ELF 32-bit LSB executable, ARM, version 1 (ARM), for 
GNU/Linux 2.0.0, dynamically linked (uses shared libs), not stripped

Now we have cross-compiled our first application! If you have your IPAQ or 
equivalent ARM device running Linux you can of course try the application on 
that one. Just transfer the 'arm-hello' to IPAQ with e.g. scp and run it there 
normally..."

Good luck!
----------------------------------------
> From: [EMAIL PROTECTED]
> To: vietlug-users@lists.sourceforge.net
> Subject: Re: [Vietlug] ScratchBoxMultiCpu
> Date: Mon, 1 May 2006 13:24:27 +0200
> 
> On Monday 01 May 2006 11:24, maikhai wrote:
> 
> > Boot tu HDD chi vao den Text mode, ngang cho XF86Config duoc nap, no thu
> > vesa khong duoc, chuyen qua thu mot driver khac, cung khong duoc, sau do la
> > dau prompt nhay ra. Tu cho nay co the chay cac lenh, goi mc duoc.
> > XF86Config copy cua xfld (cung giong Knoppix) nhung van khong vao Graphics
> > duoc khong biet tai loi o cho nao?
> làm sao biết cụ copy sang hdd như thế nào chứ ? Nếu chỉ có 1,3Gb  thì không 
> ổn 
> đâu !
> 
> -------------------------------------------------------
> VietLUG-users mailing list
> VietLUG-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/vietlug-users

_________________________________________________________________
Enter the Windows Live Mail beta sweepstakes
http://www.imagine-msn.com/minisites/sweepstakes/mail/register.aspx

Trả lời cho