C2 开发环境搭建 README 概要翻译

来源:互联网 发布:linux socket udp 编辑:程序博客网 时间:2024/06/05 08:54
========================
C2 Microsystems PVR SDK 0.10                          //c2公司
========================


Contents:                                        //简介
A. Overview                                      //概述
B. Prerequisites                                 //前提条件
C. Getting Started                                    //开始
  I. Unpacking the release                            //发行版本
  II. Setting up the host tools - Compiler + friends  //建立友好的编译环境
  III. Linux - building the source package            //linux 建立源代码包
  IV. Linux - building the binary package             //linux 建立二进制
D. Running the minimal system                   //运行最小的系统
  I. Basics                                           //基本的
  II. Networking                                      //网络
  III. u-boot software                                //U-BOOT
E. The media software                           //媒体框架
  I. Media Framework                                  //媒体框架
  II. Qtopia                                          //QT
  III. PVR application                                //PVR应用
  IV. Enable 2D Graphics acclerator                   //2D动画   
  V. c2box application                                //C2盒子应用
F. Documentation                                //文献
G. Extras: fusepod, oprofile, perl, snoopy, strace, hdd  //额外的 


-----------
A. Overview
-----------


This release includes the following:
  - host development toolchain (ie. gcc and friends, source and binaries)
  - kernel (source and binary)        //kernel的源文件于二进制码
  - u-boot (source and binary)
  - Qtopia Opensource 4.6.1 release (source)
  - C2 Media Framework (source and binary)
  - C2 Application (source and demo)
  - Extras: fusepod, oprofile, perl, snoopy, strace, hdd


-----------------
B. Prerequisites  //硬件必备条件
-----------------


  - Host running Linux 2.6 (recommend Fedora Core 8 or higher full install)
  - 1.6G bytes available disk space (SDK only) + 1G work space. These
    need to be on Linux ext2 or ext3 filesystems as we rely on soft links.
  - root access via sudo 
  - SD card reader/writer
  - Serial port connection 


------------------
C. Getting Started
------------------


  I. The sdk-0.10 release is packaged as a compressed tar archives:    //SDK-0.10的发布是tar以压缩包的形式发布


    c2-jazz2-sdk-0.10-3L-devtools-bin.tar.gz [host development toolchain binary package]
    c2-jazz2-sdk-0.10-3L-devtools-src.tar.gz [host development toolchain source package]
    c2-jazz2-sdk-0.10-3L-qt-4.6.1-src.tar.gz [qtopia source package]
    c2-jazz2-sdk-0.10-3L-u-boot-bin.tar.gz [u-boot binary package]
    c2-jazz2-sdk-0.10-3L-u-boot-src.tar.gz [u-boot source package]
    c2-jazz2-sdk-0.10-3L-c2_goodies-src.tar.gz [Extras source package]
    c2-jazz2-sdk-0.10-3L-c2_goodies-bin.tar.gz [Extras binary package]
    c2-jazz2-sdk-0.10-3L-kernel-bin.tar.gz [kernel binary package]
    c2-jazz2-sdk-0.10-3L-kernel-nand-bin.tar.gz [kernel binary for nand flash package]
    c2-jazz2-sdk-0.10-3L-kernel-src.tar.gz [kernel source package]
    c2-jazz2-sdk-0.10-3L-sw_media-bin.tar.gz [media framework binary packagen]
    c2-jazz2-sdk-0.10-3L-sw_c2apps-src.tar.gz [C2 application source package]
    c2-jazz2-sdk-0.10-3L-demo-bin.tar.gz [C2 application demo package]
    c2-jazz2-sdk-0.10-3L-docs.tar.gz [sdk documentation]


    $(ID) is your chip ID.    $(ID)是你的片上ID


    1. For convenience, set the environment variable ARCHIVES to the           //为了方便,设置环境变量地址为你保存的那些变量地址
       directory where you have saved these archives. Commands throughout      //
       this README will refer to this directory as $ARCHIVES


       % export ARCHIVES=/some/path/to/these/archives


    2. Create an empty directory for building the sdk.                         //为编译SDK创建一个空的地址
       Tailor the directory name below to adapt to your system.                //修改地址名,来适应你的系统


       % mkdir /some/path/to/c2-jazz2-sdk-0.10
       % cd /some/path/to/c2-jazz2-sdk-0.10


    3. For convenience, set the environment variable SDK to this directory.    //为了方便,设置环境变量地址为SDK的地址
       Commands throughout this README will refer to this directory as $SDK    //命令通过这个readme,指向SDK的地址


       % export SDK=/some/path/to/c2-jazz2-sdk-0.10


  II. Setting up the host development toolchain - Compiler + friends       //安装主机环境工具


    The development tools are suppled in both binary and source form. The  //环境工具的源代码与二进制码都提供了,A操作是运行二进制码
    most efficient way of getting your application running is to use the   //安装工具,如果你想的话,也可以按B操作来安装工具
    binary release in Step A below, but the source release is also part 
    of this release, and if desired, you can build the development tools 
    using Step B. below.


    A. Using the binary release:  -----                                     //用二进制码文件


       1. Extract the host development toolchain binary package as follows: //获得主机环境工具二进制包


          % cd $SDK
          % tar xzvmf $ARCHIVES/c2-jazz2-sdk-0.10-3L-devtools-bin.tar.gz


          This will create the directory tree $SDK/c2/                      //这样会创建SDK/C2/的目录


       2. Add $SDK/c2/daily/bin to your PATH (bash syntax in example below) //添加SDK/C2/daily/bin到你的路径


          % export PATH=$SDK/c2/daily/bin:$PATH


          You may want to add this to your login script (eg. ~/.bashrc)     //你需要增加这些东西到你的登录帐号脚本下


    B. Using the source release:                                            //用源码包的形式发布


       1. Extract the host development toolchain source package as follows: //获得源码二进制包


          % cd $SDK
          % tar xzvmf $ARCHIVES/c2-jazz2-sdk-0.10-3L-devtools-src.tar.gz    //


          This will create the directory $SDK/devtools which itself contains //这样会包含SDK/sevtools这个地址
          a number of scripts and a subdirectory tarballs with numerous      //这个地址自己会包含文件体系的编号,
          source tar archives.                                               //和众多源代码目录的源代码档案。


      2. Build the tools using the $SDK/devtools/buildtools.sh script.      //编辑这些工具用$SDK/devtools/buildtools.sh脚本


         The new tools will be built in ./c2/$DATE                          //这些新工具要编译在./c2/$DATE


         You may modify this location by changing the following variables   //你需要通过在buildtools.sh中修改下述变量来修改地址
         in the buildtools.sh script (the only restriction is that these    //唯一的约束就是那些地址被作为软连接放在硬盘相同的分区
         locations are on the same disk partition as soft links are used).


            WORK_DIR=$TOP_DIR/tools-build  # directory for building sources //编译源码的地址
            C2_DIR=$TOP_DIR/c2/$DATE       # binaries will go here          //二进制码将会放在这里


         Then  


          % cd $SDK/devtools
          % ./buildtools.sh 


          The build output will be logged to a file, which is exported    //编译输出将会记录到一个文件中,  通过
          to the file indicated by the line "Build output logged to XYZ", //“Build output logged to XYZ”也可以输出的文件示意
          <XYZ> is variable and can be viewed from another process using: //XYZ是一个变量用另一个方法也可以显示:tail -f XYZ


          % tail -f XYZ


       3. When the build completes, add the resulting tools to your PATH. //当编译完成,增加最终的工具到你的路径
          This is similar to the binary package, but the PATH here is     //这类似于二进制包,但是,这里的路径来源于buildtools.sh
          derived from the C2_DIR variable in buildtools.sh.              //的C2_DIR变量


          % export PATH=$C2_DIR/bin:$PATH


          You may want to add this to your login script (eg. ~/.bashrc)   //你会想要增加这个(......)到米的帐号描述文件下


  III. Linux - building the source package            //linux- 创建源代码包


    1. Extract the kernel source release as follows:  //通过以下的内核源码发布来获得


       % cd $SDK
       % tar xzvmf $ARCHIVES/c2-jazz2-sdk-0.10-3L-kernel-src.tar.gz 


       This will create the directory tree $SDK/sw/   //这将会创建一个目录树 $SDK/sw/


    2. Build a kernel                                 //创建内核
 
       Note: PATH should already include the development toolchain (from //路径已经包括了创建的工具链(在II章2步)
             section II step 2). If not then set it using the following  //如果不再设置他用bash命令
             bash command 'export PATH=$SDK/c2/daily/bin:$PATH'. Other   //export PATH=$SDK/c2/daily/bin:$PATH
             shells may require different syntax.                        //其他shell可能需要不同的语法


       % cd $SDK/sw/kernel/linux-2.6
       % cp arch/c2/configs/c2_jazz2_defconfig ./.config
       % make oldconfig
       % cd ../
       % make initramfs_gen.txt
       % make linux-2.6/vmlinux.bin


    3. Build the SD card. You will need the SD card device name of your  //创建内存卡,你需要主机中SD卡设备的名字
       host (/dev/sdd in the example below).


       % cd $SDK/sw/kernel
       % make SD=/dev/sdd sdcard  # change /dev/sdd to your SD card device


       NOTE: sudo is used for this step, so you will be likely prompted  //注意: 在这步用used,所以,你将会有可能被提示输入你的密码
             for your password.


       This will create the following filesystems on the SD card (where  //这将会创建下面的文件系统
       /dev/sdd is replaced with the SD card device you specified), copy // /dev/sdd会被你指定的SD卡设备替代
       the kernel to /dev/sdd1, and install the base file system on      //拷贝内核到/dev/sdd1,安装基本文件系统到/dev/sdd5
       /dev/sdd5.


       /dev/sdd1      vfat    label=sdboot
       /dev/sdd5      ext2    label=sdroot
       /dev/sdd6      ext3    label=sdhome
       /dev/sdd7      ext2    label=sdtmp


       NOTE: If your SD card has already been built successfully, there //如果你的SD卡已经安装成功,这里将会有4个文件系统()
       will be 4 file systems (sdroot, kernel, home, tmp) and you can   //你可以跳过 make sdcard这步,
       skip the step 'make sdcard' and simply install new system software//直接用接下在的命令安装新的系统软件
       using the following command


       % cd $SDK/sw/kernel
       % make SD=/dev/sdd LINUX_DIR=linux-2.6 install 
                                  # optional, used for updating SD cards
                                  # that already have the filesystems 
                                  # created by a prior 'make sdcard'


       OPTIONAL:
       You can add the following lines to your /etc/fstab to make 
       use of the SD card on you development host simpler. Commands
       throughout this document dont do this, but they could. The
       mount points would also need to be created.


       /dev/sdd1    /mnt/kernel    vfat    noauto,user,rw 0 0
       /dev/sdd5    /mnt/sdroot    ext2    noauto,user,rw 0 0
       /dev/sdd6    /mnt/home      ext3    noauto,user,rw 0 0
       /dev/sdd7    /mnt/tmp       ext2    noauto,user,rw 0 0


       Once the SD card has been created (using the make command above)
       subsequent mounting of a filesystem would be done by using:


           mount /mnt/kernel (or sdroot or home or tmp] 


       
  IV. Linux - building the binary package                        //用二进制码包创建


    NOTE: This step may be skipped if you have already built the //如果你已经创建了KEINEL源代码包,
          kernel source package (described in Step III above).   //那么这步就可以跳过去了(上一步是用源代码包创建)


    1. Extract the kernel binary release as follows:             //通过下面的步骤来获得内核二进制文件


       % cd $SDK
       % tar xzvmf $ARCHIVES/c2-jazz2-sdk-0.10-3L-kernel-bin.tar.gz 


       This will create the directory tree $SDK/prebuilt/sw/     //这将会创建目录树:$SDK/prebuilt/sw/


    2. Building a kernel     //创建一个内核


       Note: PATH should already include the development toolchain (from  //PATH路径已经包括了创建的工具链
             section II step 2). If not then set it using the following   
             bash command 'export PATH=$SDK/c2/daily/bin:$PATH'. Other
             shells may require different syntax.


       % cd $SDK/prebuilt/sw/kernel
       % make initramfs_gen.txt
       % touch linux-2.6/vmlinux.bin
       % make SD=/dev/sdd sdcard # change /dev/sdd to your SD card device


       NOTE: sudo is used for this step, so you will likely be prompted   //在这步中会用sudo,你很可能会被要求输入你的密码
             for your password.


       This make will create the following filesystems on the SD card 
       (where /dev/sdd is replaced with the SD card device you specified),
       copy the kernel to /dev/sdd1, and install the base file system on
       /dev/sdd5.


       /dev/sdd1      vfat    label=sdboot
       /dev/sdd5      ext2    label=sdroot
       /dev/sdd6      ext3    label=sdhome
       /dev/sdd7      ext2    label=sdtmp


-----------------------------
D. Running the minimal system                   //运行最小系统
-----------------------------


 I. Basics.


   1. Connect the serial port of the cc427 to the host Linux system using//用串口连接cc427到linux主机中,用DB9接口
      a straight through serial DB9 extension cable.  You will need to   //你需要知道串口设备的名字
      know the serial port device name.


   2. The host PC uses a terminal program to communicate with the cc427. //主机电脑用一个中断于CC427相连来编程
      On the Linux host we use minicom(1) as a terminal emulator, and    //在linux主机中,我们用COM1作为终端方针,
      on Windows we use HyperTerminal. Within the terminal program, set  //在windows中,我们用........,在中断编程,设置串口参数:
      the following serial configuration:
        Baud rate: 115200
        Data bits: 8
        Parity: none
        Stop Bits: 1
        Flow control: none


   3. With the SD card inserted, press the power reset button.  //插入SD卡,按下电源复位按钮


      You should see messages similiar to the following on the Linux //我们会看到类似于下面的消息,在linux主机控制台中
      host minicom console:


        U-Boot 1.3.0 (Sep 24 2009 - 15:42:12)


        Board: CC427(CPU 400 MHz, Memory 400 MHz, UART 100 MHz, SDIO 50 MHz)
        CHIPID: CC1200
        FLASH: M25P80 0x400KB@45(Fix to 10)MHz
        DRAM:  256 MB
        I2C:   ready
        SD/MMC:SD card detected, id:3-SD01G-1c6093 size:992000KiB
        In:    serial
        Out:   serial
        Err:   serial
        Hit any key to stop autoboot:  0


      This is followed by a stream of boot messages, ending with:


        Please press Enter to activate this console.


     Press Enter, then


        ~ #


     The system is now up and ready!    //系统起来,准备好了


     If you got this far, steps 4 and 5 can be skipped. They are intended 如果 你到这里顺利的话,4。5步就可以条过去了
     for systems which need the boot prom to be [re]configured.


   4. Depending on how the boot prom is configured on your target board
      it may boot into a prom monitor prompt at power on and reset. 
      If so, you can list files on the /dev/sdd1 partition using 'sdls',
      or you can load the kernel into memory using 'sdload vmlinux.bin'. 
      To execute the loaded kernel type 'go'.  Here's a synopsis:




        U-Boot 1.3.0 (Sep 24 2009 - 15:42:12)


        Board: CC427(CPU 400 MHz, Memory 400 MHz, UART 100 MHz, SDIO 50 MHz)
        CHIPID: CC1200
        FLASH: M25P80 0x400KB@45(Fix to 10)MHz
        DRAM:  256 MB
        I2C:   ready
        SD/MMC:SD card detected, id:3-SD01G-1c6093 size:992000KiB
        In:    serial
        Out:   serial
        Err:   serial
        Hit any key to stop autoboot:  0 


        CC427> ls


             5271602   vmlinux.bin


           1 file(s), 0 dir(s)


        CC427> sdload vmlinux.bin
        Loading file:vmlinux.bin to address:0xa0000000
        reading vmlinux.bin


        5271602 bytes read
        CC427> go


      See the file README in the u-boot release for further details. 
      ( section II below has more on u-boot)


      There is also prom monitor information via the 'help' command.


        CC427> help


   5. The prom monitor command options can be listed using 'printenv'.
      They also be changed using the 'setenv args' command followed by 
      the 'saveenv' command.


        CC427> printenv
        CC427> setenv bootargs <value>
        CC427> saveenv


      The default <value> is specified by the kernel.
      (grep CONFIG_CMDLINE $SDK/sw/kernel/linux-2.6/.config)


      Press the power reset button to restart the boot using these 
      options.


      Example: Setting ntsc video format
      ----------------------------------


        CC427> setenv bootargs mem=256m,128m debug \
                      console=uart,mmio,0xb0224000,115200n8 \
                      video=c2fb:cpst,ntsc,60,fbcm:16M
        CC427> saveenv
      Press the power reset button to restart the boot using these 
      options.


      Example: Setting 720p video format
      ----------------------------------


        CC427> setenv bootargs mem=256m,128m debug \
                      console=uart,mmio,0xb0224000,115200n8 \
                      video=c2fb:cpnt,720p,60,fbcm:16M
        CC427> saveenv


       Example: Setting network MAC Address
      ----------------------------------
 
        CC427> setenv macaddr XX:XX:XX:XX:XX:XX
        CC427> saveenv
 
      Press the power reset button to restart the boot using these
      options.
      


      NOTE: The continuation mark ('\') in the example command lines 
            above is for documentation only and should be removed, type
            the entire command on 1 line.


  6.  When the kernel booting is complete press <Enter> to start the 
      busybox shell.  The standard Linux shell, Bash(1) is included in 
      the root file system.  If you want to run it type 'bash' on the 
      command line.  Busybox is a single executable that contains many 
      Linux command line utilities.  There are two versions of busybox, 
      one statically-linked version in the initial ram file 
      system, /bin/busybox, and a more complete, dynamically-linked 
      version in the sdcard root filesystem, /sdroot/bin/busybox.  If 
      you type either command you will see a list of subcommands.  There 
      are two versions mainly because it is possible to remove the sdcard 
      from a running system so files can be transferred.  Two shell 
      scripts are included for this purpose.  From a running system, 
      type '. /bin/sdunplug' before removing the SD card, and 'sdplug' 
      once it has been reinserted.  SD unplug assumes that there are no 
      running programs that were started from the SD card, such as bash 
      or lircd.


  II. Networking - Usb-to-ethernet adapters 


     Networking can be started using the 'netstart' script from the 
     command line.


     Supported USB-to-ethernet adapters:
       - TRENDnet TU-ET100C 
       - Netgear FA120
       - others TBD


     FIXME add class of network drivers/devices supported


     The default system behavior is to detect the device and get an ip 
     address via dhcp.


        1.  busybox runs as init via a link:


              /init -> /bin/busybox


        2. init executes the script /etc/init.d/rcS
        3. rcS runs /etc/init.d/rc.local
        4. rc.local runs /sdroot/sbin/netstart:


           #!/bin/sh


           ifconfig eth0 0.0.0.0
           hostname debug-01
           /sdroot/bin/busybox udhcpc -n --script=/sdroot/sbin/udhcpc.script
           cp /sdroot/etc/passwd /etc/passwd


        5. Once an ipaddress is received from  a dhcp server on your 
           network, the udhcpc.script runs.


     If you don't have a dhcp server, you can edit netstart to program a
     fixed ip address:


       #!/bin/sh
       # ip address
       ifconfig eth0 10.0.0.2
       # dns server
       echo 10.0.0.1 > /etc/resolv.conf


     The root file system is a ramfs, so changes there are not saved.      //根文件系统是ramfs格式的,所以不能保存
     Any changes that need to be non-volatile need to be made to files     //任何改变如果想要保存,需要做成文件/shroot
     in /sdroot and copied to their respective rootfs (/) versions by      //和复制到他们各自的根目录 / 下,通过
     either the network scripts or by rc.demo.  The last thing that        //网络脚本,或者rc.demo文件
     rc.local does is look for /sdroot/etc/init.d/rc.demo and execute      //最后一件事情是rc.local能寻找...目录,如果可以的话,还能执行他
     it if it can.  Any system customizations can be made in this script.  //任何系统定制能用这个脚本制作
     /sdroot is mounted read-only by default and must be remounted at      // /sdroot默认被只读挂载,并且必须在写运行,或者修改运行的时候重新挂载
     runtime to be written or modified:


       # mount -o remount,rw /sdroot


     Make sure you sync(1) your changes:


       # sync


     In summary, our default behavior is dhcp.  If it's not working,      //总结来说,我们默认的运行时dhcp,如果他不运行了,
     there is something wrong with the adapter, wiring, network or dhcp   //则适配器、网线、网络、或者dhcp服务器有问题了
     server.


  III. U-boot                                        //U-BOOT


    The u-boot package is used to modify the bootloader which controls     //U-BOOT包用来更改bootloader,bootloader是控制内存速度,cpu频率的
    memory speed, cpu frequency. To use the binary release, follow steps 1.//想用二进制包,跟着第一步
    To build the source release, follow steps 2 and 3:                     //想用源文件包,跟着第二三步


    1. Use the delivered binaries.                                         //用释放的二进制


    The binary release can be unpackaged by using the following commands:  //二进制包可以用接下来的命令解压缩


       % cd $SDK
       % tar xvzmf $ARCHIVES/c2-jazz2-sdk-0.10-3L-u-boot-bin.tar.gz


    This will create the files u-boot-*.rom along with the files README.C2. //这样可以创建文件u-boot-*.rom  along with (在...以外)
    See these README.C2 files for more information.                         //看README.C2文件能发现更多的信息


    2. [Optional] Unpack the source tar archive                             //解压源代码压缩包


          % cd $SDK
          % tar xvzmf $ARCHIVES/c2-jazz2-sdk-0.10-3L-u-boot-src.tar.gz


       This will create the directory tree $SDK/sw/prom/u-boot-1.3.0/       //这样能创建地址树 $SDK/sw/prom/u-boot-1.3.0/


    3. [Optional] Build the u-boot                        //编译u-boot


      Creat compiling environment of bootloader           //为bootloader创建编译环境


         % cd $SDK/sw/prom/u-boot-1.3.0


      See README.C2 for the supported configurations.     //读README.C2里面的配置支持


      Build the loader for CC427 board with CC1200 chip with //为用CC1200芯片的CC427板创建引导
      MPU 400MHz & MEM 400Mhz:
         % make jazz2evb_config
         % make boot -j1  MPUCLK=355 MEMCLK=400 DDR_DEVICE=MT47H64M16-25E SINGLE_MC


     The u-boot binary is created in $SDK/sw/prom/u-boot-1.3.0/u-boot.rom //u-boot的二进制文件被创建到$SDK/sw/prom/u-boot-1.3.0/u-boot.rom这个目录中
 


---------------------
E. The media software                    //媒体软件
---------------------


  I. Media Framework                     //媒体框架


    The C2 Media Framework is delivered in binary form.  //C2媒体框架以二进制码发表


    1. Extract the binary release and use it.            //获取二进制码,并用它


       % mkdir -p $SDK/sw_media
       % cd $SDK/sw_media
       % tar xvzmf $ARCHIVES/c2-jazz2-sdk-0.10-3L-sw_media-bin.tar.gz 


       This will create the directory tree $SDK/sw_media/TARGET_LINUX_C2_TANGO_RELEASE/  //这样将会创建目录树......


    2. Install the sw_media libraries and binaries                     //安装sw_media库和二进制码


       To run sample media applications, you will need to copy the     //运行媒体示例请求,你需要将请求拷贝到SD卡/home partition
       applications to the SD card in the /home partition, the example //目录中,这个例子属于第一次创建地址 /home/gest
       below first creates the directory /home/guest.


       % cd $SDK/sw_media/TARGET_LINUX_C2_TANGO_RELEASE
       % export SDHOME=/dev/sdd6 # change to match your SD card device
       % sudo mount -t ext3 $SDHOME /mnt 
       % sudo mkdir -p /mnt/guest
       % sudo cp bin/FbPlayer /mnt/guest
       % sudo cp bin/Mojo /mnt/guest
       % sudo cp bin/FbRecorder /mnt/guest
       % sudo umount /mnt


    3. Run a sample application: FbPlayer         //运行一个简单的应用Fbplayer


       FbPlayer is a sample media player application which can be run  //FbPlayer是一个简单的播放器应用,可以用.
       using the command './FbPlayer -n movie.avi'. Copy the avi file  // ./FbPlayer -n movie.avi 来运行
       to ramdisk before playing it for best results, you can also 
       playback streams from sata harddisk or other media, ie: 
          'cp sw-lb.avi /sw-lb.avi ; ./FbPlayer -n /sw-lb.avi'
       
       Note: The -n switch means there is no gui. type h when running  //:-n表示没有GUI, h表示运行时得到操作
             to get options.


  II. Qtopia                      //QT


    The Qtopia opensource 4.6.1 release is delivered in both source and //QT开源版4.6.4以源文件与二进制两种方式发布
    binary form. To build the source release, follow steps 1 and 2:     //编译源文件,用第1步于第2步


    NOTE: Starting with SDK-1.3, qtopia on the C2 platform has a        //从SDK-1.3开始,基于C2平台的QT已经开始依赖SW_media包
          dependency on the sw_media package. The sw_media header files //sw_media头文件和库必须已经安装到系统中,才能编译QT源文件
          and libraries must be already installed on your system in
          order to build the qtopia source package. 


    Building the C2 qtopia source package                      //编译C2 QT源代码包
         c2-jazz2-sdk-0.10-3L-qt-4.6.1-src.tar.gz :


    1. Extract the qtopia opensource release to a working directory, e.g. //获取QT开源文件到一个工作目录中
       The one created to build the kernel above will do just fine.       //???
      
       % cd $SDK
       % tar xvzmf $ARCHIVES/c2-jazz2-sdk-0.10-3L-qt-4.6.1-src.tar.gz


       This will create the directory tree                                //创建一个目录树
             $SDK/sw/Qt/qt-embedded-linux-opensource-src-4.6.1


    2. Building qtopia is done by running the configure script, which is  //通过运行配置脚本来编译QT,这个配置脚本一会就会制作
       followed by making.  Use ./configure --help to see all             //用 ./configure --help 来查看所有的配置信息
       configure options. See the INSTALL script section 3. Building for  //看安装脚本部分3,编译额外的信息
       additional info. 
       
       Note: The reference of the sw_media headers (-I) and libraries (-L)//sw_media头文件和库的编译参考,在配置行下面
             in the configure line below should match where these exist   //那些存在你的系统中
             on your system.


       % export C2_DEVTOOLS_PATH=$SDK/c2/sw
       % export QT_CFLAGS_DIRECTFB=-I$C2_DEVTOOLS_PATH/include/directfb
       % export QT_LIBS_DIRECTFB="-L$C2_DEVTOOLS_PATH/lib -ldirectfb -ldirect -lfusion"
       % export QTHOME=/c2/local/Trolltech/QtopiaCore-4.6.1-generic
       % cd $SDK/sw/Qt/qt-everywhere-opensource-src-4.6.1
       % ./configure -embedded c2 \
          -little-endian \
          -qt-kbd-linuxinput \
          -qt-libpng \
          -release \
          -opensource \
          -prefix $QTHOME \
          -depths 8,16,32 \
          -confirm-license \
          -plugin-gfx-directfb \
          -dbus \
          -I$SDK/sw/root/usr/include/dbus-1.0/ \
          -L$SDK/sw/root/usr/lib/ \
          -ldbus-1 \
          -largefile \
          -webkit \
          -openssl-linked \
          -xmlpatterns \
          -exceptions
       NOTES: 1. The file README.C2 in this directory is specific    //1,文件README C2在这个地址是特殊的用法,来配置,
                 instructions to configure for using with a Lilliput          //为了用于 利利普 的触摸屏
                 touchscreen, which is not included as part of this       //它不包括这个SDK的一部分
                 SDK. Please disregard this file if you are not using      //如果你不用 (...) 的触摸屏的话,可以忽视这个文件
                 this Lilliput touchscreen.


              2. Qtopia Core is by default built/installed into       //qt内核是通过默认编译安装(。。。地址)得来的
                  /usr/local/Trolltech/QtopiaCore-4.6.1 but this is  //但是可以用(。。。)命令来改变
                  changed by using the -prefix arg to the configure 
                  command above. 


                  The value of $QTHOME in the commands above is used by //命令中的 $QTHOME是用于 run.sh描述文件描述之上,
                  the run.sh script described below in the section       //PVR application,描述文件之下
                  'PVR application'. If you choose another value for    //如果你选择令一个值作为前缀-prefix
                  -prefix, you will also need to modify this script to    //你也需要修改文件描述
                  run filemanager.


       % make
       % make install


       The resulting libraries and binaries will be installed in local  //产生的库与二进制文件将会被安装在在配置文件中
       which is defined by -prefix in configure. If using configuration //通过前缀定义的当地目录中, 如果用于配置文件之上,
       above, the path will is                                            //这个路径应该是……
       /c2/local/Trolltech/QtopiaCore-4.6.1-generic




  III. PVR application                                                       //PVR的应用
          
    1. Set up an example PVR application, filemanager //设置一个PVR应用示例,


       Unpack the source tar archive                               //解压源代码压缩文件
              
         % cd $SDK
         % tar xvzmf $ARCHIVES/c2-jazz2-sdk-0.10-3L-sw_c2apps-src.tar.gz
            
       This will create the directory tree $SDK/sw_c2apps/              //这样将会创建一个目录树$SDK/sw_c2apps


       Note: PATH should already include the development toolchain (from //路径已经包括开发工具链 (在II章的2节)
             section II step 2). If not then set it using the following  //如果没有,则用bash命令'export PATH=$SDK/c2/daily/bin:$PATH' 创建
             bash command 'export PATH=$SDK/c2/daily/bin:$PATH'. Other   //不同的shell会需要不同的命令语法
             shells may require different syntax.


       Make sure you have already compiled sw_media and qtopia as        //确定你已经编译好了前面提及的sw_media和QT
       mentioned above. Then follow these steps to compile and run the   //接下来的那些步骤就是编译和运行文件管理器
       filemanager


       a. compile pvr demo                             //编译pvr demo
          
        Modify PATH variable to use the correct qmake. Example,          //更改PATH用于正确的qmake 例如:......
           export PATH=/c2/local/Trolltech/QtopiaCore-4.6.1-generic/bin:$PATH


        The platform selection is controlled by the SW_MEDIA_PATH,       //平台的选择通过SW_MEDIA_PATH、BUILD_TARGET、TARGET_ARCH、BUILD variables来控制
        BUILD_TARGET, TARGET_ARCH, BUILD variables. Add these values     //当执行的时候添加这些值
        when making. Example,         //例如


          % cd $SDK/sw_c2apps
          % BUILD_TARGET=TARGET_LINUX_C2 TARGET_ARCH=TANGO \
                BUILD=RELEASE SW_MEDIA_PATH=$SDK/sw_media \
                make install


         After this step, a work directory will be generated in          //这步以后,一个工作目录在$SDK/sw_c2apps/work中生成了
              $SDK/sw_c2apps/work


         NOTE:                                                           //注意:
            If you have moved sw_media to other path, the INCLUDEPATH    //如果你移动sw_media到其他路径中,
            and LIBS in filemanager.pro need to be modified to refer to  //filemanager.pro中的INCLUDEPATH和LIBS需要修改关联到新的路径
            the new paths.


            If you have installed qtopia in some other path than suggested //如果你已经安装QT到其他的路径,而不是建议的路径
            above, the PATH should export to refer to the new paths.       //PATH需要关联到其它的路径


       b. install the filemanager build                    //安装filemanager编译


          Copy work directory to the SD card.                                  //拷贝工作目录到SD卡中


          % export SDHOME=/dev/sdd6      # change to match your SD card device //改变到匹配你的SD卡设备
                                         # home partition (device number 6)    //home目录的划分(设备号 6)
          % sudo mount -t ext3 $SDHOME /mnt
          % sudo cp -a $SDK/sw_c2apps/work /mnt/


          By default, the application will use remote controller as the        //默认的,这个应用会用偏僻的控制作为输入设备
          input device. You can also use a usb keyboard as alternative         //你也可以选择用USB键盘通过改变in /mnt/work/run.sh
          by modifying the two lines below in /mnt/work/run.sh                 //文件下面的两行


             #export QWS_KEYBOARD=LIRC:/dev/lircd
             export QWS_KEYBOARD=USB:/dev/usbkbd


          % sudo sync
          % sudo umount /mnt


      c. run filemanager                               //运行filemanager


          On the CC427, run application from SD card.  //在CC427板上,从SD卡中运行应用


          % cd /home/work
          % ./run.sh


    2. [Optional] Run example using the delivered binaries          //[可选的] 运行例子用传递二进制码


      a. Extract the application demo binary release as follows:    //从下面获取二进制文件demo应用


          % cd $SDK
          % tar xvzmf $ARCHIVES/c2-jazz2-sdk-0.10-3L-demo-bin.tar.gz


       This will create the directory tree $SDK/work/               //这样将会创建地址树 $SDK/work/


      b. Install work directory                  //安装工作目录


          % cd $SDK
          % export SDHOME=/dev/sdd6        # change to match your SD card device  //改变地址来匹配你的SD卡设备
                                           # home partition (device number 6)
          % sudo mount -t ext3 $SDHOME /mnt
          % sudo cp -r $SDK/work /mnt
          % sudo sync
          % sudo umount /mnt


      c. run filemanager                              //运行文件管理


          On the CC427, run application from SD card. //在CC427板子上,从SD卡运行文件


          % cd /home/work
          % ./run.sh


    3. [Optional] Customize codec component           //[可选的] 定做(裁剪)代码成分


      The codec is delivered using plugins mechanism in         //定制代码用c2-jazz2-sdk-0.10-3L-sw_media-bin.tar.gz包中的结构插件裁剪
      c2-jazz2-sdk-0.10-3L-sw_media-bin.tar.gz, they also can   //他们(插件)也能在c2-jazz2-sdk-0.10-3L-demo-bin.tar.gz发现
      be found in c2-jazz2-sdk-0.10-3L-demo-bin.tar.gz. You can //
      customize them through add or delete binary of plugins.   //你能定制他们通过插件增减或减少二进制码..


      The work directory of plugins is /home/work/plugins in SD card, the      //插件的工作地址是在SD卡中的/home/work/plugins
      binary locate in $SDK/sw_media/TARGET_LINUX_C2_TANGO_RELEASE/lib/plugins.//插件的二进制位于$SDK/sw_media/TARGET_LINUX_C2_TANGO_RELEASE/lib/plugins
      Adding binary of needed codec to work directory or deleting them         //???
      from work directory will finish customization.


  IV. Enable 2D Graphics acclerator                                   //使能2D绘图


    1. In U-boot shell, set bootargs:                                 //在u-boot shell中,设置boot参数
      iCC427> set bootargs mem=512m,256m,32m debug console=uart,mmio,0xb0224000,115200n8 video=c2fb:cpnt,720p,60,fbcm:16M
      (here, the 32m is resolved for graphics hardware. It can be 
      18m, 20m also, but 32m is recommended.)                                                 
                                                                            
    2, Unpack the c2-jazz2-sdk-0.10-3L-gfx_2d-bin.tar.gz             //解压c2-jazz2-sdk-0.10-3L-gfx_2d-bin.tar.gz
        % tar -zvxf c2-jazz2-sdk-0.10-3L-gfx_2d-bin.tar.gz                   
                                                                            
    3, run setup_gfx.sh                                              //运行setup_gfx.sh
        % sh setup_gfx.sh                                                   
                                                                            
    4, setup the run environment:                                    //设置运行环境
        % export FRAMEBUFFER=/dev/osd1                                      
        % echo bg-color=00000000>/.directfbrc                               
        % echo hardware>>/.directfbrc                                       
        % echo no-vt>>/.directfbrc                                          
        % echo no-cursor>>/.directfbrc                                      
        % echo pixelformat=ARGB>>/.directfbrc                               
        % echo dont-catch=2>>/.directfbrc                                   
                                                                            
    5, insmod the driver                                             //挂载设备
      % insmod /lib/modules/galcore.ko  


  V. c2box application             //c2盒子应用
          
    1. Set up an example c2box application, filemanager                 //建立一个C2box应用的例子,文件管理


       Unpack the source tar archive                                    //解压被压缩源文件
              
         % cd $SDK 
         % tar xvzmf $ARCHIVES/c2-jazz2-sdk-0.10-3L-sw_c2apps-src.tar.gz
         
    2.Set environment variable,enable c2box application                 //设置环境变量,使能c2box应用
        
        % export ENABLE_NEW_APP=TRUE
            
       This will create the directory tree $SDK/sw_c2apps/              //这样会创建目录树 $SDK/sw_c2apps/


       Note: PATH should already include the development toolchain (from //注意 PATH可能已经包含开发工具链(从II章第二步中)
             section II step 2). If not then set it using the following //如果没有,用export PATH=$SDK/c2/daily/bin:$PATH来设置它
             bash command 'export PATH=$SDK/c2/daily/bin:$PATH'. Other  //不同的shell命令可能不同
             shells may require different syntax.


       Make sure you have already compiled sw_media and qtopia as       //确定你已经编译好前面提及的 sw_media和QT
       mentioned above. Then follow these steps to compile and run the  //接下来几步是编译和运行filemanager
       filemanager


       a. compile c2box demo                     //编译c2box demo
          
        Modify PATH variable to use the correct qmake. Example,      //更改PATH路径,用于正确的qmake 例如
           export PATH=/c2/local/Trolltech/QtopiaCore-4.6.1-generic/bin:$PATH


        The platform selection is controlled by the SW_MEDIA_PATH,   //平台选择通过SW_MEDIA_PATH,BUILD_TARGET,TARGET_ARCH,BUILD variables 
        BUILD_TARGET, TARGET_ARCH, BUILD variables. Add these values //当编译的时候增加这些值
        when making. Example,


          % cd $SDK/sw_c2apps
          % BUILD_TARGET=TARGET_LINUX_C2 TARGET_ARCH=TANGO \
                BUILD=RELEASE SW_MEDIA_PATH=$SDK/sw_media \
                make install


         After this step, a work directory will be generated in      //这步以后,一个$SDK/sw_c2apps/work工作目录将会产生
              $SDK/sw_c2apps/work


         NOTE:
            If you have moved sw_media to other path, the INCLUDEPATH   //注意:如果你移动sw_media到其他路径,
            and LIBS in filemanager.pro need to be modified to refer to // ......需要更新到新的路径
            the new paths.


            If you have installed qtopia in some other path than suggested //如果你已经安装QT到新的路径,而不是建议的路径
            above, the PATH should export to refer to the new paths.       // PATH应该输出到新的路径


       b. install the filemanager build                                 //安装filemanager编译
--------------------
F. Run in NAND flash      //在NAND flash中运行
--------------------
  
  I. MTD devices


    On C2 development platform, a 256MB NAND flash is equipped. System and //在C2开发平台,配置了256M NAND flash 系统和应用会运行在NAND flash上
    application can be ran in the NAND flash.


    NAND flash is rendered as MTD deivces. User can manage NAND flash      //NAND flash会被转化为磁盘设备,用户要通过磁盘设备来管理NAND flash
    through MTD device. MTD partitions are board dependent. The partition  //磁盘分割有板子依赖
    table is defined in arch/c2/c2-boards/c2-evb/c2_evb_platform.c. You    //分割表在arch/c2/c2-boards/c2-evb/c2_evb_platform.c中定义
    can modify it basing on the flash chip size of your board. The default //你可以根据你板子上的flash芯片大小来定制它,默认的磁盘分割是……
    partitions is
        dev:  address    size   name
        mtd0: 00000000 01000000 "boot"
        mtd1: 01000000 01000000 "setting"
        mtd2: 02000000 02000000 "rootfs"
        mtd3: 04000000 0BE00000 "home"
        mtd4: 0FE00000 00200000 "storage"


  II. The minimal system                    //最小的系统


    1. Build


       Note: PATH should already include the development toolchain (from //注意:PATH已经包含在开发工具链中了(从第II章2步中,)
             section II step 2). If not then set it using the following  //如果没有
             bash command 'export PATH=$SDK/c2/daily/bin:$PATH'. Other
             shells may require different syntax.


       Extract the kernel source release as follows:                     //获得kernel源代码文件


         % cd $SDK
         % tar xzvmf $ARCHIVES/c2-jazz2-sdk-0.10-3L-kernel-src.tar.gz


       Compile kernel by using the following commands:                   //通过下面的命令编译源代码


         % cd $SDK/sw/kernel
         % make -f configs/jazz2-pvr-nand/pvr-nand.mk


       This will create the kernel and rootfs images at                  //这将会在...与...目录中创建kernel与rootfs镜像
       $SDK/sw/kernel/linux-2.6/zvmlinux.bin and $SDK/sw/kernel/rootfs.image.


    2. [Optional] using the delivered binaries                               //[可选的]用二进制码方式


       Extract the kernel binary release for NAND flash as follows:          //从NAND flash中获得kernel二进制码文件


         % cd $SDK
         % tar xzvmf $ARCHIVES/c2-jazz2-sdk-0.10-3L-kernel-nand-bin.tar.gz


       This will create the kernel and rootfs images at                      //这将会在...与...地址中创建kernel与rootfs镜像
       $SDK/sw/kernel/linux-2.6/zvmlinux.bin and $SDK/sw/kernel/rootfs.image.//


    3. Burn image                                     //烧录镜像


       Press the power reset button, and enter U-boot. we need burn images //按下电源复位按钮,进入u-boot,我们需要烧录镜像
       into NAND flash basing on MTD partition table by U-boot.            //通过u-boot进入磁盘分区表


       When you use nandflash for first time, an advice is used to erase   //如果你第一次用nandflash,建议用u-boot擦出整个flash
       whole flash by U-boot.


         CC427> nand device 0 
         CC427> nand erase


       Firstly, you need load images from network through tftp. Set up   //第一,你需要通过网络用tftp加载镜像
       tftp server and copy rootfs.image and zvmlinux.bin to tftp boot   //设置tftp服务器,拷贝rootfs.image和zvmlinux.bin到开发工作组的tftp引导地址
       directory on the development workstation. On the target platform, //在目标平台,通过u-boot设置IP地址
       set IP address by U-boot.


         CC427> set serverip 'workstation IP' 
         CC427> set ipaddr 'platform IP'
         CC427> saveenv  


       Then load images and burn them.                    //然后加载镜像,烧录它


         CC427> nand device 0 
         CC427> nand erase 0x0 0x600000
         CC427> mw.b 0xa2000000 0xff 0x600000 
         CC427> tftp 0xa2000000 zvmlinux.bin 
         CC427> nand write 0xa2000000 0x0 0x600000 
         CC427> nand erase 0x2000000 0x2000000
         CC427> mw.b 0xa2000000 0xff 0x2000000
         CC427> tftp 0xa2000000 rootfs.image 
         CC427> nand write.yaffs 0xa2000000 0x2000000 0x1e00000 


       Set up and boot the Linux system:                   //设置和引导linux 系统


         CC427> nand device 0 
         CC427> nand read 0xa0000000 0x0 0x600000 
         CC427> go


  III. Install application      //安装应用


      Boot the minimal system, then copy C2 application demo package to //引导最小应用,然后通过网络拷贝C2应用demo包到平台下的root地址下面
      root directory of platform through network, and Extract it.       //然后获取它


        % cd /home
        % tar zxtf /c2-jazz2-sdk-0.10-3L-demo-bin.tar.gz








       Building hdd libraries:


          cd $SDK/c2_goodies/hdd
          ./sdk-build-hdd.sh



说明:C2平台应用开发只需要安装3部分

1,交叉编译工具,用二进制代码压缩包安装

2,C2的QT库,用第一步安装的交叉编译工具编译源代码包安装

3,SW_MEDIA,C2自带播放器解码包,用二进制代码包安装



//翻译:patrick   日期:2011-10-3
//备注:仅仅是概要翻译,英汉对照看,自用。
原创粉丝点击