zoukankan      html  css  js  c++  java
  • PetaLinux使用bitbake提前下载所有软件包

     

    PetaLinux环境下,也可以使用Yocto/openembedded的bitbake。Xilinx ug1144有详细说明。
    为了方便,我编写了以下脚本,导入bitbake需要的环境。将下列脚本保存为sh文件,使用source导入,之后就能使用bitbake。脚本的第一个输入参数是PetaLinux版本号,比如2019.2。如果source时没有提供版本号,而系统有环境变量XILINX_VERSION,脚本就使用XILINX_VERSION作为PetaLinux版本号。如果source时没有提供PetaLinux版本号,系统也没有定义XILINX_VERSION,则缺省使用2019.2作为PetaLinux版本号。

    #!/bin/bash
    # hankf@xilinx.com
    
    echo -e "
    Begin to run script: $0"
    echo "";
    
    # $1: the first argument could be Xilinx Petalinux version.
    
    if [ "$1" = "" ]; then
    
        if [ "$XILINX_VERSION" = "" ]; then
            XILINX_VERSION=2019.2
        fi
    else
        XILINX_VERSION=$1
    fi
    
    echo "Use Xilinx version: $XILINX_VERSION"
    export XILINX_VERSION
    
    # Xilinx UG1144
    # Accessing BitBake in a Project
    # 1. Run petalinux-config or petalinux-config --oldconfig or petalinux-config --silentconfig at least once after creating the project, so that the required environment is setup.
    # 2. Source the PetaLinux tools script:
    # source /opt/Xilinx/peta/$XILINX_VERSION/settings.sh
    # 3. Source the Yocto e-SDK:
    
    source /opt/Xilinx/peta/$XILINX_VERSION/components/yocto/source/aarch64/environment-setup-aarch64-xilinx-linux
    
    source /opt/Xilinx/peta/$XILINX_VERSION/components/yocto/source/aarch64/layers/core/oe-init-build-env
    
    export PATH=/opt/Xilinx/peta/$XILINX_VERSION/tools/hsm/bin:$PATH
    
    export BB_ENV_EXTRAWHITE="$BB_ENV_EXTRAWHITE PETALINUX"
    
    # it will enter directory "build"
    
    # To test if the BitBake is available, run:
    # bitbake strace
    

    在petalinux工程的目录,使用source执行上述脚本后,会进入build目录。这时可以执行各种bitbake命令,比如执行"bitbake strace"。

    为了以后编译PetaLinux编译方便,或者为了创建离线编译环境,可以通过bitbake命令提前下载编译所需要的所有软件包。Yocto 2.5使用命令“bitbake --runall=fetch”, 之前的版本使用命令“bitbake -c fetchall”。 根据 Yocto Project Mega-Manual 的31章,OpenEmbedded提供了一下target系统image的例子。下面是其中一些image的描述。

    core-image-base: A console-only image that fully supports the target device hardware.
    
    core-image-clutter: An image with support for the Open GL-based toolkit Clutter, which enables development of rich and animated graphical user interfaces.
    
    core-image-minimal: A small image just capable of allowing a device to boot.
    
    core-image-rt: A core-image-minimal image plus a real-time test suite and tools appropriate for real-time use.
    
    core-image-sato: An image with Sato support, a mobile environment and visual style that works well with mobile devices. The image supports X11 with a Sato theme and applications such as a terminal, editor, file manager, media player, and so forth.
    

    对于core-image-sato,使用命令“bitbake core-image-sato --runall=fetch”可以下载编译core-image-sato所需要的所有软件包。

    hankf:~/zcu106_bsp_peta/build$
    hankf:~/zcu106_bsp_peta/build$ bitbake core-image-sato --runall fetch
    Loading cache: 100% |###########################################################################| Time: 0:00:01
    Loaded 3980 entries from dependency cache.
    Parsing recipes: 100% |#########################################################################| Time: 0:00:09
    Parsing of 2894 .bb files complete (2893 cached, 1 parsed). 3981 targets, 164 skipped, 0 masked, 0 errors.
    NOTE: Resolving any missing task queue dependencies
    Initialising tasks: 100% |######################################################################| Time: 0:00:07
    NOTE: Executing RunQueue Tasks
    NOTE: Tasks Summary: Attempted 484 tasks of which 3 didn't need to be rerun and all succeeded.
    

    Xilinx petalinux工程使用的配置名称是petalinux-user-image,使用命令“bitbake petalinux-user-image --runall=fetch”可以下载编译petalinux-user-image所需要的所有软件包。

    hankf:~/zcu106_bsp_peta/build$ bitbake petalinux-user-image --runall=fetch
    Loading cache: 100% |############################################| Time: 0:00:00
    Loaded 3980 entries from dependency cache.
    Parsing recipes: 100% |##########################################| Time: 0:00:03
    Parsing of 2894 .bb files complete (2893 cached, 1 parsed). 3981 targets, 164 skipped, 0 masked, 0 errors.
    NOTE: Resolving any missing task queue dependencies
    Initialising tasks: 100% |#######################################| Time: 0:00:01
    NOTE: Executing RunQueue Tasks
    NOTE: Tasks Summary: Attempted 252 tasks of which 252 didn't need to be rerun and all succeeded.
    

    之后,可以在build/downloads目录下可以看到大量的.tar.gz文件。把这些.tar.gz文件,拷贝到一个目录,然后设置工程使用本地下载的文件。具体设置,可以参考 整合Xilinx PetaLinux工程编译和Open Source U- Boot/Linux编译.

  • 相关阅读:
    Expression Web 3 安装问题
    按钮重置问题引发的思考 JQuery & Ajax
    将相同值的行内容进行合并操作Sql2005
    SmartDraw 2010 破解成功
    JQuery CheckBoxList
    JQuery this 和 $(this) 的区别
    Asp.net 随记 Part4 (7190 )
    项目发布错误的解决方法
    JSON In Code
    JQuery QA
  • 原文地址:https://www.cnblogs.com/hankfu/p/12605367.html
Copyright © 2011-2022 走看看