FREESCALE-SDK Linux porting a Build environment script host-prepare.sh analysis

Source: Internet
Author: User
Tags yocto

Next, use your own extra-curricular rest time to perform Linux porting and analysis based on the PowerPC architecture Freescale-sdk. The main reference is the official document Freescale Linux SDK start_here.html, the first to build the compilation environment script host-prepare.sh analysis. Before porting the system, you need to build a compilation environment, install the necessary packages, and prepare for the post-compilation system. Many people see the script headache, the following is my analysis process, the analysis of bad places can leave a message, discussed together.

I. Build the compilation environment script analysis./scripts/host-prepare.sh

[Email protected]:~/sdk/qoriq-sdk-v1.4-20130625-yocto$./scripts/host-prepare.sh-h
Usage:./scripts/host-prepare.sh [-h] [-f]
-h:display Help
-f:force Install all needed host pkgs, running non-interactively
Analyze./scripts/host-prepare.sh script, enter command./scripts/host-prepare.sh-h, display Help information.
Script_dir= ' Readlink-f $ (dirname $) ' #获取当前脚本所在目录
Usage_message () { #帮助子函数, enter-H or-? When the function is called to run
echo "Usage: $ [h] [-f]
-h:display Help
-f:force Install all needed host pkgs, running non-interactively
"
} #getopts Options Variable
While getopts "FH" Host_prepare_flag #每次执行循环, getopts checks the next command-line argument and determines if it is legitimate. Check whether the parameter starts with a--followed by a letter contained in option
Do #如果是, the matching option letter exists in the specified variable variable, and returns the exit status 0;
Case $host _prepare_flag in #如果-The letters that follow are not included in the options and are deposited in a variable? and returns the exit status 0;
f) force_update= ' true '; #如果命令行中已经没有参数, or the next parameter does not start with--Returns an exit status of not 0.
;;
?) Usage_message;exit 1;
;;
Esac
Done
# Check Host distribution #检查客服机系统类型, there are/etc/lsb-release files, open the show Distrib_id=ubuntu distrib_release=10.04
If [-r/etc/lsb-release] && grep ubuntu/etc/lsb-release >/dev/null 2>&1#1表示stdout标准输出, the system default value is 1,>/dev/null equivalent to 1>/dev/null
Then #2表示stderr标准错误
# ubuntu-based System
. /etc/lsb-release
distro= "Ubuntu"
Release=${distrib_release}
Hostpkg= "Apt-get"
elif [-r/etc/debian_version]
Then
# debian-based
distro= "Debian"
Release= ' Cat/etc/debian_version '
Hostpkg= "Apt-get"
......
echo "Verifying sudo permission to execute $hostpkg command."#输出Verifying sudo permission to execute apt-get command.
User= ' WhoAmI ' | | True #这里包括下面几句都是关于root权限判断的, analyze??? later
......
Case ' $distro ' in #根据上面系统判断得出 $distro = "Ubuntu", so execute the script script= "$SCRIPT _dir/host-prepare-ubuntu-mint-debian.sh";
' Ubuntu ' | ' Mint ' | ' Debian ')
script= "$SCRIPT _dir/host-prepare-ubuntu-mint-debian.sh";
;;
' Redhat ' | ' CentOS ' | ' Fedora ')
script= "$SCRIPT _dir/host-prepare-rhel-centos-fedora.sh";
;;
' SUSE ' | ' OpenSUSE ')
script= "$SCRIPT _dir/host-prepare-suse.sh";
;;
Esac
#紧接着上面分析 $SCRIPT _dir/host-prepare-ubuntu-mint-debian.sh, of which $script_dir=~/sdk/qoriq-sdk-v1.4-20130625-yocto/ Scripts
if test $force _update; Then update_flag= '-y--force-yes '; fi#force_update = ' true ' Assignment update_flag= '-y--force-yes '
pkgs= "sed wget subversion git-core coreutils \
Unzip texi2html texinfo libsdl1.2-dev docbook-utils fop gawk \
Python-pysqlite2 diffstat make gcc build-essential xsltproc \
g++ desktop-file-utils chrpath Libgl1-mesa-dev libglu1-mesa-dev \
autoconf automake groff libtool xterm libxml-parser-perl \
"
# pkgs required for FSL use
pkgs= "$PKGS vim-common xz-utils CVS Tofrodos libstring-crc32-perl"
pkgs= "$PKGS Patch Libbonobo2-common Libncurses5-dev"
If ["' uname-m '" = "x86_64"]; Then
pkgs= "$PKGS ia32-libs Lib32ncurses5-dev"
Fi #对PKGS赋值需要安装的包
echo "Now we" re going to install all the other development packages needed to build Yocto, please wait "
sudo apt-get $UPDATE _flag install $PKGS #搭建编译环境, install the necessary packages
At this point, the necessary packages have been installed to build a good environment for the post-system normal compilation.

FREESCALE-SDK Linux porting a Build environment script host-prepare.sh analysis

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.