构建scratchbox环境步骤

在Ubuntu9.04系统上构建scratchbox环境步骤:

1.添加软件源到apt包管理器
编辑/etc/apt/sources.list 最后面增加下面一行:
deb http://scratchbox.org/debian/ stable main

2.更新软件源
sudo apt-get update

3.安装软件包
sudo apt-get install scratchbox-core scratchbox-libs scratchbox-devkit-cputransp scratchbox-devkit-debian
sudo apt-get install scratchbox-devkit-perl scratchbox-toolchain-cs2007q3-glibc2.5-arm7

 

如果使用uclibc,可以安装下面的包:

scratchbox-toolchain-arm-gcc4.1-uclibc20061004

 



4.禁止Ubuntu8.04以后的vdso功能
编辑/etc/sysctl.conf, 最后面增加下面两行:
vm.vdso_enabled = 0
vm.mmap_min_addr = 4096

使结果生效,运行

sudo sysctl -p

为了长期生效,编辑/etc/rc.local,在最后一行(exit 0)前面, 增加:sysctl -p


5.增加用户到scratchbox
假设你的登录用户名是your_user
sudo /scratchbox/sbin/sbox_adduser your_user

6.添加用户到sbox组中
编辑/etc/group文件,下面一行:
sbox:x:1001:
改为:
sbox:x:1001:your_name

 

7.退出当前用户,用your_user重新登陆,确认your_user用户已经在sbox组里面,运行

groups

可以看到最后的组名:sbox

8.进入scratchbox环境,运行:

/scrathbox/login

 

 

9.配置编译目标

退出scratchbox环境,在terminal中运: sb-menu

出现交互式配置菜单,选择:
setup -> new --> 输入target名字:arm-dev
选择编译器: cs2007q3-glibc2.5-arm7
选择cputransp:
选择:Done
选择:qemu-arm-cvs-m
Do you wish extract a rootstrap on the target ? --> no
Do you wish install files to the target ? --> no
Do you wish to select the target --> yes
此时sb-menu会退出。

重新运行:

sb-menu

出现交互式配置菜单,选择:
install
选择目标平台:arm-dev --> OK
选择要安装的文件(空格反选),默认选择 --> ok
exit

 

(记住:如果使用sb-menu来创建多个项目时,需要退出scratchbox环境进行操作)

 

详细参考:

http://www.scratchbox.org/documentation/docbook/0.9.8/installdoc.html

 

10.拷贝/scratchbox/packages/hello.c 到/scratchbox/users/your_name/home/your_name/

 

11.编译,生成 hello 可执行程序,运行:

> gcc hello.c -o hello

 

测试文件类型,确认程序是arm平台可执行的,运行:

> file hello

可以看到文件的运行平台为 ARM

 

运行hello程序

>./hello

可以在终端看到输出结果:hello world!

 

12. 编译hello-world工程

将packages目录下的hello-world.tar.gz 拷贝到/scratchbox/users/your_name/home/your_name

解压,运行:

>tar xzvf hello-world.tar.gz

>cd hello-workd

>./autogen.sh

>make

>file hello

运行可执行文件查看:

>./hello

 

13. 卸载scratchbox

首先需要退出scratchbox环境,然后运行:

/scratchbox/sbin/sbox_ctl stop

 

sudo rm /scratchbox -R

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值