NXP

手把手教你搭建powerpc(P2020)的ltib编译环境

2019-07-12 13:49发布

最近工作涉及一些要搭建基于PowerPC架构的CPU(P2020)的编译环境,谨以此文总结记录一下ltib(Linux Target Image Builder)编译环境的搭建过程,基本上freescale官网也有,只是做一个总结。

本文主要介绍使用CentOS6.6系统搭建ltib环境,并通过ltib命令行简单编译内核和最小文件系统,最终生成一个image,可烧写到powerpc p2020板子上运行。

freescale官网:http://www.nxp.com/
准备工作:
1) freescale官网下载Linux BSP for P2020 RDB (REV 20101101) ISO  -- P1020_P2020RDB_20101101_ltib.iso
2) CentOS官网下载CentOS6.6 ISO  -- CentOS-6.6-x86_64-minimal.iso

步骤:
1. 安装centos6系统

2. 创建新用户myuser, 使用ltib脚本时不允许使用root用户
[root@centos6 ~]# useradd myuser
[root@centos6 ~]# passwd myuser

3. 安装telnet-server, 用于远程登陆
[root@centos6 ~]# yum install telnet-server
[root@centos6 ~]# vim /etc/xinetd.d/telnet                 //设置disable=no
[root@centos6 ~]# service xinetd restart
[root@centos6 ~]# vim /etc/sysconfig/iptables              // 添加对端口23开放
[root@centos6 ~]# service iptables restart

4. 添加sudo for myuser, 
[root@centos6 ~]# vim /etc/sudoers
myuser    ALL=(ALL)       ALL
myuser    ALL=(ALL)       NOPASSWD: /bin/rpm,/opt/freescale/ltib/usr/bin/rpm

5. 安装ltib环境需要的依赖包 [root@centos6 ~]# yum install -y perl glibc glibc-headers glibc-devel binutils
libstdc++ libstdc++-devel gcc gcc-c++ sudo zlib zlib-devel rpm
rpm-build patch wget ncurses ncurses-devel m4 bison flex texinfo
gettext autoconf libtool glib2-devel lzo-devel intltool libuuid-devel
tcl perl-ExtUtils-MakeMaker ld-linux.so.2

package version comment perl >= 5.6.1 to run the ltib script glibc >= 2.2.x to build/run host packages glibc-headers >= 2.2.x to build/run host packages glibc-devel >= 2.2.x to build/run host packages binutils >= 2.11.93 to build host packages libstdc++ any? to build rpm-fs host package libstdc++-devel any? to build rpm-fs host package gcc >= 2.96 to build host packages gcc-c++ >= 2.26 to build rpm-fs host package sudo any to run the 'rpm install' phase on each package zlib any to build rpm-fs and mtd-utils host packages zlib-devel any to build rpm-fs and mtd-utils host packages rpm any to build initial rpm-fs host package rpm-build any to build initial rpm-fs host package patch any used by rpm wget any to download packages/patches on demand ncurses >= 5.1 to build lkc (config language) host package ncurses-devel >= 5.1 to build lkc (config language) host package m4 any? may be needed by bison bison any to build lkc (config language) host package flex any Not required we install:for host lkc texinfo any to build genext2fs host package (requires ncurses-deve gettext any genext2fs target package autoconf >= 2.54 Not required we install: automake target package libtool >= 1.4.2 Not required we install: libusb target package glib2-devel any? Needed if you want to build glib2
6. 使用root用户挂载P1020_P2020RDB_20101101_ltib.iso, 并使用myuser用户安装BSP编译环境
[root@centos6 ~]# su root
[root@centos6 ~]# mount -o loop P1020_P2020RDB_20101101_ltib.iso /mnt
[root@centos6 ~]# su myuser
[myuser@centos6 ~]$ cd /opt/myuser/
[myuser@centos6 ~]$ /mnt/install

安装完成后,会在当前路径下生成一个以ltib前缀的路径, 进入到当前ltib路径,第一次需要执行 [myuser@centos6 ltib]$ ./ltib 随后会生成以下路径,会安装交叉编译环境; /opt/freescale/pkgs           存放编译的软件所有源码包