Import marvel compiler to scratchbox

来源:互联网 发布:软件外包公司联系 编辑:程序博客网 时间:2024/04/28 17:21

<!-- /* Font Definitions */ @font-face{font-family:Courier;panose-1:2 7 4 9 2 2 5 2 4 4;mso-font-charset:0;mso-generic-font-family:modern;mso-font-format:other;mso-font-pitch:fixed;mso-font-signature:3 0 0 0 1 0;}@font-face{font-family:宋体;panose-1:2 1 6 0 3 1 1 1 1 1;mso-font-alt:SimSun;mso-font-charset:134;mso-generic-font-family:auto;mso-font-pitch:variable;mso-font-signature:3 135135232 16 0 262145 0;}@font-face{font-family:"/@宋体";panose-1:2 1 6 0 3 1 1 1 1 1;mso-font-charset:134;mso-generic-font-family:auto;mso-font-pitch:variable;mso-font-signature:3 135135232 16 0 262145 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal{mso-style-parent:"";margin:0cm;margin-bottom:.0001pt;line-height:12.0pt;mso-pagination:none;text-autospace:none;font-size:10.0pt;font-family:"Times New Roman";mso-fareast-font-family:宋体;mso-fareast-language:EN-US;}h1{mso-style-next:正文;margin-top:6.0pt;margin-right:0cm;margin-bottom:3.0pt;margin-left:36.0pt;text-indent:-36.0pt;line-height:12.0pt;mso-pagination:none;page-break-after:avoid;mso-outline-level:1;mso-list:l0 level1 lfo1;text-autospace:none;font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:Arial;mso-bidi-font-family:"Times New Roman";mso-font-kerning:0pt;mso-fareast-language:EN-US;}h2{mso-style-parent:"标题 1";mso-style-next:正文;margin-top:6.0pt;margin-right:0cm;margin-bottom:3.0pt;margin-left:36.0pt;text-indent:-36.0pt;line-height:12.0pt;mso-pagination:none;page-break-after:avoid;mso-outline-level:2;mso-list:l0 level2 lfo1;text-autospace:none;font-size:10.0pt;font-family:Arial;mso-bidi-font-family:"Times New Roman";mso-fareast-language:EN-US;}h3{mso-style-parent:"标题 1";mso-style-next:正文;margin-top:6.0pt;margin-right:0cm;margin-bottom:3.0pt;margin-left:57.3pt;text-indent:-36.0pt;line-height:12.0pt;mso-pagination:none;page-break-after:avoid;mso-outline-level:3;mso-list:l0 level3 lfo1;text-autospace:none;font-size:10.0pt;font-family:Arial;mso-bidi-font-family:"Times New Roman";mso-fareast-language:EN-US;font-weight:normal;font-style:italic;}h4{mso-style-parent:"标题 1";mso-style-next:正文;margin-top:6.0pt;margin-right:0cm;margin-bottom:3.0pt;margin-left:36.0pt;text-indent:-36.0pt;line-height:12.0pt;mso-pagination:none;page-break-after:avoid;mso-outline-level:4;mso-list:l0 level4 lfo1;text-autospace:none;font-size:10.0pt;font-family:Arial;mso-bidi-font-family:"Times New Roman";mso-fareast-language:EN-US;font-weight:normal;}h5{mso-style-next:正文;margin-top:12.0pt;margin-right:0cm;margin-bottom:3.0pt;margin-left:144.0pt;text-indent:0cm;line-height:12.0pt;mso-pagination:none;mso-outline-level:5;mso-list:l0 level5 lfo1;text-autospace:none;font-size:11.0pt;font-family:"Times New Roman";mso-fareast-language:EN-US;font-weight:normal;}h6{mso-style-next:正文;margin-top:12.0pt;margin-right:0cm;margin-bottom:3.0pt;margin-left:144.0pt;text-indent:0cm;line-height:12.0pt;mso-pagination:none;mso-outline-level:6;mso-list:l0 level6 lfo1;text-autospace:none;font-size:11.0pt;font-family:"Times New Roman";mso-fareast-language:EN-US;font-weight:normal;font-style:italic;}p.MsoHeading7, li.MsoHeading7, div.MsoHeading7{mso-style-next:正文;margin-top:12.0pt;margin-right:0cm;margin-bottom:3.0pt;margin-left:144.0pt;text-indent:0cm;line-height:12.0pt;mso-pagination:none;mso-outline-level:7;mso-list:l0 level7 lfo1;text-autospace:none;font-size:10.0pt;font-family:"Times New Roman";mso-fareast-font-family:宋体;mso-fareast-language:EN-US;}p.MsoHeading8, li.MsoHeading8, div.MsoHeading8{mso-style-next:正文;margin-top:12.0pt;margin-right:0cm;margin-bottom:3.0pt;margin-left:144.0pt;text-indent:0cm;line-height:12.0pt;mso-pagination:none;mso-outline-level:8;mso-list:l0 level8 lfo1;text-autospace:none;font-size:10.0pt;font-family:"Times New Roman";mso-fareast-font-family:宋体;mso-fareast-language:EN-US;font-style:italic;}p.MsoHeading9, li.MsoHeading9, div.MsoHeading9{mso-style-next:正文;margin-top:12.0pt;margin-right:0cm;margin-bottom:3.0pt;margin-left:144.0pt;text-indent:0cm;line-height:12.0pt;mso-pagination:none;mso-outline-level:9;mso-list:l0 level9 lfo1;text-autospace:none;font-size:9.0pt;font-family:"Times New Roman";mso-fareast-font-family:宋体;mso-fareast-language:EN-US;font-weight:bold;font-style:italic;}p.MsoBodyTextIndent, li.MsoBodyTextIndent, div.MsoBodyTextIndent{margin-top:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:13.5pt;margin-bottom:.0001pt;mso-pagination:none;text-autospace:none;font-size:10.0pt;font-family:"Times New Roman";mso-fareast-font-family:宋体;mso-font-kerning:14.0pt;mso-fareast-language:EN-US;}a:link, span.MsoHyperlink{color:blue;text-decoration:underline;text-underline:single;}a:visited, span.MsoHyperlinkFollowed{color:purple;text-decoration:underline;text-underline:single;}tt{mso-ansi-font-size:12.0pt;mso-bidi-font-size:12.0pt;font-family:宋体;mso-ascii-font-family:宋体;mso-fareast-font-family:宋体;mso-hansi-font-family:宋体;mso-bidi-font-family:宋体;} /* Page Definitions */ @page{mso-page-border-surround-header:no;mso-page-border-surround-footer:no;}@page Section1{size:612.0pt 792.0pt;margin:72.0pt 90.0pt 72.0pt 90.0pt;mso-header-margin:36.0pt;mso-footer-margin:36.0pt;mso-paper-source:0;}div.Section1{page:Section1;} /* List Definitions */ @list l0{mso-list-id:-5;mso-list-template-ids:-1;}@list l0:level1{mso-level-style-link:"标题 1";mso-level-tab-stop:none;mso-level-number-position:left;mso-level-legacy:yes;mso-level-legacy-indent:36.0pt;mso-level-legacy-space:7.2pt;text-indent:-36.0pt;}@list l0:level2{mso-level-style-link:"标题 2";mso-level-text:"%1/.%2";mso-level-tab-stop:none;mso-level-number-position:left;mso-level-legacy:yes;mso-level-legacy-indent:36.0pt;mso-level-legacy-space:7.2pt;margin-left:36.0pt;text-indent:-36.0pt;}@list l0:level3{mso-level-style-link:"标题 3";mso-level-text:"%1/.%2/.%3";mso-level-tab-stop:none;mso-level-number-position:left;mso-level-legacy:yes;mso-level-legacy-indent:36.0pt;mso-level-legacy-space:7.2pt;margin-left:57.3pt;text-indent:-36.0pt;}@list l0:level4{mso-level-style-link:"标题 4";mso-level-text:"%1/.%2/.%3/.%4";mso-level-tab-stop:none;mso-level-number-position:left;mso-level-legacy:yes;mso-level-legacy-indent:36.0pt;mso-level-legacy-space:7.2pt;margin-left:36.0pt;text-indent:-36.0pt;}@list l0:level5{mso-level-style-link:"标题 5";mso-level-text:"%1/.%2/.%3/.%4/.%5";mso-level-tab-stop:none;mso-level-number-position:left;mso-level-legacy:yes;mso-level-legacy-indent:0cm;mso-level-legacy-space:7.2pt;margin-left:0cm;text-indent:0cm;}@list l0:level6{mso-level-style-link:"标题 6";mso-level-text:"%1/.%2/.%3/.%4/.%5/.%6";mso-level-tab-stop:none;mso-level-number-position:left;mso-level-legacy:yes;mso-level-legacy-indent:0cm;mso-level-legacy-space:7.2pt;margin-left:0cm;text-indent:0cm;}@list l0:level7{mso-level-style-link:"标题 7";mso-level-text:"%1/.%2/.%3/.%4/.%5/.%6/.%7";mso-level-tab-stop:none;mso-level-number-position:left;mso-level-legacy:yes;mso-level-legacy-indent:0cm;mso-level-legacy-space:7.2pt;margin-left:0cm;text-indent:0cm;}@list l0:level8{mso-level-style-link:"标题 8";mso-level-text:"%1/.%2/.%3/.%4/.%5/.%6/.%7/.%8";mso-level-tab-stop:none;mso-level-number-position:left;mso-level-legacy:yes;mso-level-legacy-indent:0cm;mso-level-legacy-space:7.2pt;margin-left:0cm;text-indent:0cm;}@list l0:level9{mso-level-style-link:"标题 9";mso-level-text:"%1/.%2/.%3/.%4/.%5/.%6/.%7/.%8/.%9";mso-level-tab-stop:none;mso-level-number-position:left;mso-level-legacy:yes;mso-level-legacy-indent:0cm;mso-level-legacy-space:7.2pt;margin-left:0cm;text-indent:0cm;}ol{margin-bottom:0cm;}ul{margin-bottom:0cm;}-->

1.              Abstract

This document explains how to import aforeign compiler to scratchbox.

2.              Introduction

.      for compiling source code to marvleplatform,we must import the marvel compiler to our scrathbox,then I began thiswork.

3.              import step

3.1       summary

for I donot want to pollute my previous scratchboxenvironment,then I create a new environment named SDK_MARVEL,if you do not knowhow please see doc——How to setup empty scratchbox.doc.

3.2       getforeign 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 haveScratchbox 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 thesb-toolchain-extras

you should loginyou to your object platform,eg,SDK_MARVEL for me,by invoke

/some/directory/scratchbox/login

sb-conf select SDK_MARVEL

       then goto 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 timedecided by your network and your rp);

 

3.4       createyour configure file.

Ofcourse you canwrite you own configure ,contains compiler related info and target platformcharacteristic,but you can use a simple script to help you to do this.

Go to thedirectory of you cool compiler ,eg /scratchbox/compiler/ arm-linux-4.1.1

Runthe 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 editthat to fit for you.

3.5       Build thesb-toolchain-extras tools.

Go to the directoryof sb-toolchain-extras,then invoke :

makeCONFIG=meta/alien-tc/arm-marvel.conf -C meta/alien-tc

all-sums(the time decided by yournetwork and your rp)

make CONFIG=meta/alien-tc/yourconfig.conf -Cmeta/alien-tc

 (hereyou can meet some errors just ignored it)

 

 

3.6       Runsb-menu to setup compiler.

Run sb-menu >setup->SDK_MARMEL->arm-linux-4.1.1,thenchoose doctools,debian-etch,cputransp,perl,maemo3-tools,then choose a qemu,youcan choose the qemu-arm-0.8.2-sb2,then ignore the rootstrap then choose installthe files,after this,you can run gcc –v here you will see your new coolcompiler has been install in the scratchbox.

 

4.              test helloworld.

You can write a helloworld program to test thegcc.the code can be like this:

int main(int argc,char **argv)

{

  Printf(“Hellocruel world/n”);

  Return 0;

}

Run gcc helloworld.c –o helloworld

If you qemu support the new compiler ,you can runthe helloworld in the local machine,like this:

./helloworld

Or else you must copy your program to the objectplatform

If you  seethe 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