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

Source: Internet
Author: User
Tags prepare yocto

Next, use your own extra-curricular rest time to perform Linux porting and analysis based on the PowerPC architecture Freescale-sdk. Main references Official document Freescale Linux SDK start_here.html, first to build the compilation environment script host-prepare.sh analysis. Before porting the system. Need to build a compilation environment. Install the necessary packages. Prepare for the post-compilation system.

Very many people see the script on the headache, the following is my analysis process, the analysis of bad places can be in the following 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 execute
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 parameter and infers whether it is legitimate.

Check whether the reference is preceded by--followed by a letter included 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 following letters are not included in the options and are deposited in the variable. and returns the exit status 0;
f) force_update= ' true '; #假设命令行中已经没有參数, or the next parameter does not start with a. Returns a non-0 exit status.
;;
?) 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权限推断的. Later analysis??

?
......
Case ' $distro ' in #依据上面系统推断得出 $distro = "Ubuntu", so run 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, among them $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
So far. The necessary packages have been installed to build a good environment for the later system to compile properly.

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.