Freescale-sdk linux port a build compiling environment script host-prepare.sh Analysis

Source: Internet
Author: User
Tags yocto

Freescale-sdk linux port a build compiling environment script host-prepare.sh Analysis

Next we will use our out-of-class break time to port and analyze linux based on the PowerPC architecture freescale-sdk. Refer to the official documentation freescale linux sdk START_HERE.html, first of all to build the compiling environment script host-prepare.sh analysis. Before porting the system, you need to build a compilation environment, install necessary packages, and prepare for the later compilation system. Many people have a headache when they see the script. The following is my analysis process. If the analysis is poor, leave a message and discuss it together.

1. Build compiling environment script analysis./scripts/host-prepare.sh

Freescale @ freescale-sdk :~ /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 the./scripts/host-prepare.sh script and enter the command./scripts/host-prepare.sh-h to display help information.
SCRIPT_DIR = 'readlink-f $ (dirname $0) '# obtain the directory where the current script is located.
Usage_message () {# Help subfunction, input-h or -? Call this function to run
Echo "Usage: $0 [-h] [-f]
-H: display help
-F: force install all needed host pkgs, running non-interactively
"
} # Getopts options variable
While getopts "fh" host_prepare_flag # Each time a loop is executed, getopts checks the next command line parameter and determines whether it is legal. Check whether the parameter starts with-, followed by a letter contained in option
Do # If yes, the matching option letter will exist in the specified variable, and return the exit status 0;
Case $ host_prepare_flag in # If the letter after-is not included in options, ?, And return the exit status 0;
F) force_update = 'true'; # If no parameter exists in the command line, or the next parameter does not start with "-", an exit status other than "0" is returned.
;;
?) Usage_message; exit 1;
;;
Esac
Done
# Check host distribution # check the system type of the customer service machine. The/etc/lsb-release file exists. open the file to display DISTRIB_ID = Ubuntu DISTRIB_RELEASE = 10.04.
If [-r/etc/lsb-release] & grep Ubuntu/etc/lsb-release>/dev/null 2> & 1 #1 indicates stdout standard output, the default value is 1.>/dev/null is equivalent to 1>/dev/null.
Then #2 indicates stderr standard error
# 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." # output Verifying sudo permission to execute apt-get command.
User = 'whoam' | true # The following statements are about root permission judgment, which will be analyzed later ???
......
Case "$ distro" in # according to the above system judgment to get $ distro = "Ubuntu", so execute script = "$ SCRIPT_DIR/host-prepare-ubuntu-mint-debian.sh ";
'Ubuntu '| 'mint' | 'debian ')
Script = "$ SCRIPT_DIR/host-prepare-ubuntu-mint-debian.sh ";
;;
'Redhat' | 'cento' | 'ora ora ')
Script = "$ SCRIPT_DIR/host-prepare-rhel-centos-fedora.sh ";
;;
'Suse' | 'opensuse ')
Script = "$ SCRIPT_DIR/host-prepare-suse.sh ";
;;
Esac
# Followed by the above analysis $ SCRIPT_DIR/host-prepare-ubuntu-mint-debian.sh, where $ SCRIPT_DIR = ~ /Sdks/QorIQ-SDK-V1.4-20130625-yocto/scripts
If test $ force_update; then UPDATE_FLAG = '-y -- force-Yes'; fi # force_update = 'true' value: 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 unzip tproc \
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 # package to be installed when assigning values to PKGS
Echo "Now we're re going to install all the other development packages needed to build Yocto, please wait"
Sudo apt-get $ UPDATE_FLAG install $ PKGS # Build the compiling environment and install necessary packages
Now, necessary packages have been installed to build the environment for normal system compilation.

Related Article

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.