分类: LINUX
2010-05-24 20:37:06
最近开始研究M2277EVB Board,下面我们先来学习一下其开发环境的建立过程:
freescale公司为编译ColdFire Linux目标镜像提供了LITB工具包:
The LTIB (Linux Target Image Builder) project is a simple tool that can be used to develop and deploy BSPs (Board Support Packages) for various target platforms. Using this tool a user will be able to develop a GNU/Linux image for their target platform.
上面是官方解释。实际上,ltib是一系列脚本和管理方法的集合。开发者可以将源代码或开源软件包配置,编译,部署和压缩,成为可以烧写到flash上的bootloader,kernel和root file system映像。而这一切作都是通过./ltib命令加选项加参数实现的。
1) Installing the BSP
首先,将LITB的镜像文件M52277EVB_LTIB.iso复制到/home/wzg/目录下
$ su - root // 切换身份到root用户,需要root用户密码
# mkdir /mnt/cdrom //创建/mnt/cdrom目录
# mount -o loop /home/wzg/M52277EVB_LTIB.iso /mnt/cdrom //挂载镜像文件
# su - wzg //切换到普通用户(LTIB只允许在普通用户下安装)
$ cd /mnt/cdrom
$ ./install
2)Running LTIB
安装完成之后,会出现如下提示:
Installation complete, your ltib installation has been placed in
/home/wzg/ltib-m5227xevb-20080311, to complete the installation:
cd /home/wzg/ltib-m5227xevb-20080311
./ltib
按照如上提示,执行如下操作:
$ cd /home/wzg/ltib-m5227xevb-20080311 //切换到安装路径下
$ ./ltib
The first time LTIB runs on your machine a number of host packages are built and installed that
support LTIB. This may take a few minutes.
安装的时候 可能会出现如下提示:
I ran the command: sudo -S -l which returned:
We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.
Password:
This means you don't have sudo permission to execute rpm commands as root
without a password. This is needed for this build script to operate correctly.
To configure this, as root using the command "/usr/sbin/visudo",
and add the following line in the User privilege section:
wzg ALL = NOPASSWD: /bin/rpm, /opt/freescale/ltib/usr/bin/rpm
Started: Mon May 24 16:32:21 2010
Ended: Mon May 24 16:32:28 2010
Elapsed: 7 seconds
Build Failed
这是由于安装ltib需要是普通用户身份,但部分命令要超级用户权限才行,所以需要执行visudo增加用户liuby的权限,如下操作
# su
# /usr/sbin/visudo // 此命令相对于vi打开了一个权限设置文件
// 按i进入输入模式,在最后一行添加如下一行内容
wzg ALL = NOPASSWD: /bin/rpm, /opt/freescale/ltib/usr/bin/rpm
// 按ESC进入命令行模式,按:wq保存退出
# exit // 退出root,回到普通用户身份wzg
$ cd /home/wzg/ltib-m5227xevb-20080311 //切换到安装路径下
$ ./ltib
等待相当长的一定时间会出现:Build Succeeded
安装完成!