Chinaunix首页 | 论坛 | 博客
  • 博客访问: 382894
  • 博文数量: 43
  • 博客积分: 1493
  • 博客等级: 上尉
  • 技术积分: 660
  • 用 户 组: 普通用户
  • 注册时间: 2008-05-01 10:57
文章分类

全部博文(43)

文章存档

2015年(1)

2013年(1)

2011年(6)

2010年(13)

2009年(13)

2008年(9)

分类: 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-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

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-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.

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-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.

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].

 

阅读(1241) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~