ltib总结


1. What is LTIB
    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项目是用于在不同目标平台下,开发和部署BSP的简单工具。使用该工具,用户能够为其目标平台开发符合GNU/Linux标准的映像。


2. What is required on your host before installing LTIB
    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


3. Install
    参见安装流程说明


4. Configuration
    Configuration of ltib is started by using one of the following commands:
    ./ltib                on the very first run for a CVS instance  首次运行时,自动进入配置界面
    ./ltib -m config      configure only                            只执行配置
    ./ltib --configure    configure and build                       执行配置和编译
    ./ltib -m distclean                                             此操作将彻底清除所有当前ltib工程文件


5. How can I re-configure the kernel under LTIB
    a.Select the option: [ ] Configure the kernel

    b.run:
        ./ltib -p kernel-2.6.11-pq3 -m prep

    c.build:
        ./ltib -p kernel-2.6.11-pq3 -m scbuild

    d.To copy the built kernel to the rootfs/boot directory (optional)
        ./ltib -p kernel-2.6.11-pq3 -m scdeploy

    e.If you change any source code in 'rpm/BUILD/linux-xxx/' you can capture your changes at the end by running:
        ./ltib -p kernel-2.6.11-pq3 -m patchmerge
      This will generate a patch of your changes and update the spec file.


6. Deployment
   (A) Ramdisk Image -> rootfs.ext2.gz.uboot
   (B) Kernel Image  -> rootfs/boot/uImage
   (C) DTB Image     -> rootfs/boot/mpc8306som.dtb
   (D) U-Boot Image  -> rootfs/boot/u-boot.bin


7. Command line options explained
    a. 显示帮助信息
       ./ltib --help

    b. 编译安装指定软件包
       ./ltib -p pkg

    c. 解压指定源码包
       -p pkg -m prep
       The sources will be found in rpm/BUILD/xxx

    d. 编译指定源码包(源码已解压缩)
       -p pkg -m scinstall

    e. 安装指定源码包
       -p pkg -m scdeploy

    f. 合并源码
       -p pkg -m patchmerge
       分析修改后的源码与修改前的源码包的差异,并生成 patch 补丁

    g. 显示当前编译安装的软件包
       ./ltib -m listpkgs
       ./ltib -m listpkgs | grep ' y '


8. 添加新软件到根文件系统  How can I add a completely new package to the root filesystem
    a. First clean your sources (remove any .o, .a, .so generated files) and then make a 'tarball'
       $make clean
       $tar zcvf xxx.tar.gz xxx

    b. Move this tarball to the LPP so ltib can find it.
       $mv xxx.tar.gz /opt/freescale/pkgs/
 
 然后要生成该文件的md5,不然步骤e会出错(解压包失败)

    c. Create a specfile using the existing template.
       $mkdir dist/lfs-5.1/xxx
       $cp dist/lfs-5.1/template/template.spec dist/lfs-5.1/xxx/xxx.spec

    d. Edit and fixup the template to reflect your package.
       Summary     put in a summary of what the package is/does
       Name        put in the name of the packge (usually from the tarball name)
       Version     put in the version (usually from the tarball/directory
       Release     start at 1 and rev each time you change the spec file
       License     e.g GPL/LGPL/BSD, look this up in the package's files
       Group       If this exists on an rpm based machine, copy from rpm -qi
                   If not, choose something from /usr/share/doc/rpm-/GROUPS
       %Build      often you'll need to add --host=$CFGHOST --build=%{_build} to the configure clause

 注:要把新包安装到根文件系统,必须修改xxx.spec文件
 %Install
 rm -rf $RPM_BUILD_ROOT
 make install prefix=%{_prefix} DESTDIR=$RPM_BUILD_ROOT/%{pfx}
 

    e. Unpack the new package sources
       $./ltib -m prep -p xxx

    f. Make any changes you need to the sources to get them to cross compile

    g. Build the new package with your changes
       $./ltib -m scbuild -p xxx

    h. Once the new package builds okay, check the install phase:
       $./ltib -m scinstall -p xxx

    i. Install the test package in the NFS root filesystem area (rootfs) and test
       $./ltib -m scdeploy -p xxx

    j. Once you're happy the package is running correctly, capture your changes.
       $./ltib -m patchmerge xxx

       Any changes you've made will be put into a patch file and copied to /opt/freescale/pkgs. In addition, the spec file will be updated to reference the new patch. You should check the patch and eliminate any bogus diffs.
       当有任何改动时,会自动创建 patch 补丁文件并复制到 /opt/freescale/pkgs 目录下,相应的 spec 文件也会更新。


9. 添加软件到配置界面  How do I introduce my new package to the config system
    a. Edit config/userspace/packages.lkc, this is in alphabetic order. Just after the 'PKG_SKELL' entry add:
       config PKG_STRACE
           bool "strace"

    b. Edit config/userspace/pkg_map. This is in build order. Put your package where it should go in the build order, and add an entry that ties the config key, to the directory containing the spec file for the package. For strace, I put this after gdb as shown:
       PKG_GDB             =   gdb
       PKG_STRACE          =   strace


10.启动服务  How to add a daemon to init
    a. 添加软件包(遵照第 8、9 两步)

    b. 编写启动脚本,可仿照已有的脚本进行修改。例如 etc/rc.d/init.d/named

    c. 在 config/userspace/sysconfig.lkc 添加配置入口
       config SYSCFG_START_NAMED
           depends PKG_NAMED
           bool "start named (nameserver)"
           default y

    d. 在 dist/lfs-5.1/sysconfig/sysconfig.spec 添加服务的入口
       if [ "$SYSCFG_START_NAMED" = "y" ]
       then
           named=named
       fi

    e. 在 dist/lfs-5.1/sysconfig/sysconfig.spec 文件的 all_services 行添加服务的名字

    e. 在 dist/lfs-5.1/sysconfig/sysconfig.spec 文件的 all_services_r 行添加服务的名字

    e. 在 dist/lfs-5.1/sysconfig/sysconfig.spec 文件的 cfg_services 行添加服务的名字

    e. 在 dist/lfs-5.1/sysconfig/sysconfig.spec 文件的 cfg_services_r 行添加服务的名字


11.在不创建软件包的情况下,直接将文件加入根文件系统
   Can I add files to the target root file system without creating a package
    a. 将文件放入 config/platform/mpc830xsom/merge 目录

    b. 将文件放入 merge 目录

    前者加入的文件,只针对 mpc830xsom 平台,后者则是全平台


**********************************************************************************************************************************************************************************************

 

LTIB 编译配置选项
 
根据说明文档,ltib 可以通过以下的命令配置:
 
* <verbatim># ./ltib</verbatim>          安装后第一次运行,采用默认配置
 
* <verbatim># ./ltib -m config</verbatim>  仅配置
 
* <verbatim># ./ltib --configure</verbatim> 配置和编译
 
执行./ltib是LTIB的默认配置,事实上可以通过./ltib –c 来配置编译选项。运行该命令,将出现一个蓝色的配置窗口,类似Linux中的menuconfig 命令效果。里面有很多的配置选项。以下将逐一进行介绍。
 
1.         Choose the target C library type  
该选项可对toolchain使用的C库进行配置。LTIB可支持glibc和uClibc两种C库
 
2.         Choose your toolchain 
该选项允许用户从一系列有效的toolchain中进行选择。该选择将改变CFLAGS。对每一个平台还可以包含一个用户可定制的toolchain。
 
3.         Bootloader  
该选项允许对bootloader的配置进行选择。
 
4.         Choose your Kernel   
该配置目录下的选项意义分别为:
 Kernel-选项允许用户从一系列有效的内核进行选择。
 Always rebuild the kernel-每次配置完成总是重新编译内核。
 Configure the kernel-LTIB编译内核前将进入Linux内核配置窗口。
 Include kernel headers-ltib将内核头文件编译进rootfs/usr/src/linux/include下。
 Leave the sources after building kernel-该选项将解压后的内核源码包保留下来。
 
5.         Package selection
 选择用户使用的工具包,在其中还可以选中对busybox的配置。
 
6.         Target System Configuration
 对网络和系统服务做基本的配置。
 
7.         Target Image Generation
 对生成的根文件系统进行配置。
 
8.         Load an Alternate Configuration File
 加载一个现有的配置文件。
 
9.         Save Configuration to an Alternate File
 当前配置另存为一个文件。
 
LITB 常用命令
 
如果想得到相关帮助,您可以在命令行输入:
 
# ./ltib  --help
 
接下来会提供LTIB的命令格式,以及所有的命令简要,一些命令在后面有详细的说明,均是参照官方的说明文档,鉴于命令内容繁多,只详细说明了前几个命令,如果需要其他命令的使用方法和说明,请查阅官方文档LtibFaq。
 
4.2.1 LTIB的命令格式
 
如下:

  ltib [-m <mode>] [options....]
 
举例:    ./ltib -m prep -p helloworld    //对helloworld文件包解压 输出目录为/../安装目录/ltib-mpc8313erdb-20070824/rpm/BUILD
 
下面给出LTIB的常用命令:
 --mode | m
     prep            //解开源码包并打补丁
     scbuild        //解开源码包、打补丁然后编译
     scinstall      //解开源码包、打补丁,编译后安装
     scdeploy      //运行一个scinstall命令并安装到rootfs下
     patchmerge  //生成并且合并一个补丁 (需要与-p <pkg>一起使用)
     clean          //清除并且反安装目标源码包
     distclean     //完全清除,移除相关的所有东西
     listpkgs      //列出源码包(按字母排序)
     release       //制作一个二进制发布iso镜像
     config        //使用--configure命令,仅做配置
     shell          //进入ltib命令行模式
 --pkg|p :       //仅操作指定源码包
 --configure|c :  //运行交互式配置
 --preconfig :    //配置文件来源
 --profile :     //profile文件。这个被用来选择用户空间源码包集合(例如
 
config/profiles/max.config)
 --rcfile|r :     //使用这个资源文件
 --batch|b :    //批处理模式,假定对所有的问题回答yes
 --force|f :    //强迫重新编译链接即使已经更新到最新
 --reinstall|e : //重新安装rpm包
 --nodeps|n :    //关闭安装和反安装依赖关系检查
 --conflicts|k :  //不强迫安装有文件冲突的rpm包
 --keepsrpms|s : //保留srpms 在编译链接之后 (缺省是删除的)
 --verbose|v :    //更多的输出
 --dry-run|d :    //只运行不打印 (仅输出echo消息)
 --continue|C :  //在源码包编译链接过程中出错也继续进行
 --version|V :    //打印应用程序版本并退出
 --noredir|N :    //不重定向到任何输出
 --deploy|D :    //运行部署脚本即使已经更新
 --dlonly :      //仅下载源码包
 --dltest :      //测试BSP的源码包是否有效
 --leavesrc|l :  //留下不解压的源码包 ( 仅在pkg模式下使用)
 --hostcf :    //重新配置编译链接安装主机支持的源码包集
 --help|h :    //使用帮助

 

**********************************************************************************************************************************************************************************************

1、用ltib设置配置选项后

注:生成的配置文件也会另存为 defconfig.dev(在config/platform/mpc830xsom/下)

如果要替换配置文件必须先删除defconfig.dev


2、用ltib配置内核配置后(加入配置文件名字为linux-2.6.34-mpc8306som-tdm.config)

注:生成的配置文件也会另存为 linux-2.6.34-mpc8306som-tdm.config.dev(在config/platform/mpc830xsom/下),如果要替换配置文件必须先删除linux-2.6.34-mpc8306som-tdm.config.dev文件


 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值