分类: LINUX
2009-12-16 14:47:20
This document explains how to import a
foreign compiler to scratchbox.
. for compiling source code to marvle
platform,we must import the marvel compiler to our scrathbox,then I began this
work.
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.
Extract the prebuilt toolchain to your COMPILER_DIR:eg.
/scratchbox/compilers/ arm-linux-
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
/scratchbox/compilers/ arm-linux-
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
(here the time
decided by your network and your rp);
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-
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.
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)
Run sb-menu —>setup->SDK_MARMEL->arm-linux-
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!
[1]. How to setup empty scratchbox.doc.
[2].
[3].