- 论坛徽章:
- 0
|
Normal
0
7.8 磅
0
2
false
false
false
MicrosoftInternetExplorer4
st1\:*{behavior:url(#ieooui) }
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:普通表格;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Times New Roman";
mso-ansi-language:#0400;
mso-fareast-language:#0400;
mso-bidi-language:#0400;}
1.
Abstract
This document explains how to import a
foreign compiler to scratchbox.
2.
Introduction
. for compiling source code to marvle
platform,we must import the marvel compiler to our scrathbox,then I began this
work.
3.
import step
3.1
summary
for I donot want to pollute my previous scratchbox
environment,then I create a new environment named SDK_MARVEL,if you do not know
how please see doc——How to setup empty scratchbox.doc.
3.2
get
foreign compiler.
Extract the prebuilt toolchain to your COMPILER_DIR:eg.
/scratchbox/compilers/ arm-linux-4.1.1 .
The COMPILER_DIR should probably now have subdirectories like bin,your-arch-name and lib.
For the alien wrapper to work, you must have
Scratchbox version 1.0.3 or newer
(Apophis branch) and the compiler must work when invoked directly, eg.
/scratchbox/compilers/ arm-linux-4.1.1/bin/arm-linux-gcc –version
3.3
get the
sb-toolchain-extras
you should login
you to your object platform,eg,SDK_MARVEL for me,by invoke
/some/directory/scratchbox/login
sb-conf select SDK_MARVEL
then go
to a directory that you have write privilege,eg,/scratchbox/output,invoke:
darcs get
--set-scripts-executable
http://scratchbox.org/repos/1.0/sb-toolchain-extras
(here the time
decided by your network and your rp);
3.4
create
your configure file.
Ofcourse you can
write you own configure ,contains compiler related info and target platform
characteristic,but you can use a simple script to help you to do this.
Go to the
directory of you cool compiler ,eg /scratchbox/compiler/ arm-linux-4.1.1
Run
the helper script:
~/sb-toolchain-extras/confhelper/create_toolchain_conf.py >
~/sb-toolchain-extras/meta/alien-tc/arm-marvel.conf
(here ~ show that the sb-toolchain-extras is put to there)
You can edit
that to fit for you.
3.5
Build the
sb-toolchain-extras tools.
Go to the directory
of sb-toolchain-extras,then invoke :
make
CONFIG=meta/alien-tc/arm-marvel.conf -C meta/alien-tc
all-sums(the time decided by your
network and your rp)
make CONFIG=meta/alien-tc/yourconfig.conf -C
meta/alien-tc
(here
you can meet some errors just ignored it)
3.6
Run
sb-menu to setup compiler.
Run sb-menu —>setup->SDK_MARMEL->arm-linux-4.1.1,then
choose doctools,debian-etch,cputransp,perl,maemo3-tools,then choose a qemu,you
can choose the qemu-arm-0.8.2-sb2,then ignore the rootstrap then choose install
the files,after this,you can run gcc –v here you will see your new cool
compiler has been install in the scratchbox.
4.
test helloworld.
You can write a helloworld program to test the
gcc.the code can be like this:
int main(int argc,char **argv)
{
Printf(“Hello
cruel world\n”);
Return 0;
}
Run gcc helloworld.c –o helloworld
If you qemu support the new compiler ,you can run
the helloworld in the local machine,like this:
./helloworld
Or else you must copy your program to the object
platform
If you see
the output:
Hello cruel world
Then you succeed!
5.
reference
[1]. How to setup empty scratchbox.doc.
[2].
http://www.scratchbox.org/wiki/ForeignToolchains
[3]. http://www.scratchbox.org/wiki/Toolchains
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u2/67984/showart_2122871.html |
|