Summary of issues encountered in the cross-compilation environment of installing Imx6linux systems under Ubuntu

Source: Internet
Author: User
Tags glob

  This period of time has been busy with the embedded project, you can say from the embedded novice a little bit of the introduction, about the embedded and IMX6 Core Board development has a little understanding, especially for the building of the board environment. Hardware development, build the environment, is a very large amount of engineering, is also a very important step, the environment can not be put on the next step. Of course, this premise is to have a certain understanding of the hardware used in the project. For the embedded development, the project to now, from a what do not understand to now can discuss with you v4l2,framebuffer, discuss the video development of Linux, although still rookie level, but this month really let oneself mastered a knowledge.

On the development of embedded, there are a lot of tutorials and steps on the Internet, presumably is to follow the following steps: Determine the requirements, according to the requirements of hardware selection, determine hardware and familiar with hardware, set up the development environment, software, online debugging, the link between the hardware, the final formation of prototypes, cutting systems, sub-assembly. Every step here is important, and you cannot overlook any one step. The following summarizes some of the problems encountered in building the development environment. Different hardware has different requirements, cross-compilation environment is not the same.

To build a development environment under Linux, you must be aware of the environment configuration of your Linux system.

First, the environment configuration1.1. What is Shell

Shell: Also known as Shell, is "provide user interface" software, usually refers to the command line interface of the parser, in the operating system, provides access to the kernel services provided by the program.

Shell: Because of the outer interface between the operating system (kernel) and the user interface, the shell is usually divided into two categories: command line and graphical interface. The shell layer provides a command-line interface (CLI), while the graphics shell provides a graphical user interface (GUI).

Bash is a built-in shell program that is subordinate to the shell of the command line. Simply put, the shell provides an interface that allows the user to enter commands, receive user commands, and then invoke the appropriate application, equivalent to a DOS command.

1.2 Establishment of the environment

  After the user logs on to the system, a built-in bash program is launched to read the configuration scripts for the startup files that define the default environment shared by all users. For the non-user requirements, the operating system environment variables will be repaired to meet user needs, bash read the system's default environment variables, will be automatically read stored in the home directory used to define the personal environment of the startup files, establish the required environment.

1.3 What is in the startup file

There are two types of shell sessions: the login shell and the Non-login shell session.

Login Shell's Startup file:

/etc/profile: Global configuration script for all users

~./bash_profile: Personal boot file that can be expanded into a global configuration script

~/.bash_login:

~/.profile

Non-login Shell: Read startup file

/ETC/BASH.BASHRC: Global configuration script for all users

~/.BASHRC: The user's personal boot file, which is then integrated into the parent-class process environment. Where the parent class process is usually a login shell.

Eg:  . bash_profile:#. bash_profile# Cget the aliases and Functionsif [-f  ~/.BASHRC]; then             .   ~/.bashrcfi#  User specific enviroment and startup  Programspath = $PATH: $HOME/binexport  PATH       

# The start line is the comment line, the shell does not read; This code is called the IF compound command

If the file "~/.BASHRC" exists, then read the "~/.BASHRC" file

Path= $PATH: $HOME/bin: Adds $home/bin to the tail of the PATH value.

The export command tells the shell to use the contents of the path variable for the shell's child process.

1.4 Modifying the environment

  The above is the location and content of the system boot file, you can customize the individual environment by modifying the system startup file. Changes to the environment variables or additions to the path directory need to be done in the. bash_profile file, depending on the version, such as Ubuntu using the./profile file. Other modifications should be in the. bashrc file to modify the tool: Vim

The text editor is divided into two categories: the graphical interface and text-based Ubuntu, which are commonly used in text-based vim

Networked installation: sudo apt-get vim

Uninstall: Rm-rf vim

Open File: Vim file name (be sure to enter the current path)

Modify FILE: A--Enter insert mode

Exit File: Esc +: + (W,q, Wq, q! , wq! such as

Printenv: Print some or all of the environmental information

Set: Setting Shell options

Export: Exporting your environment to a program that you want to run later

Alias: Create an alias for the command

Source: File path/filename

second, cross-compiling

  In the development process of embedded system, the target platform of running program usually has limited storage space and computing ability, such as the common arm platform: static storage space: 16~32MB, CPU frequency: 100mhz~500mhz Therefore, it is impossible to natively compile on arm platform, Because the General compiler toolchain (compilation tool chain) requires a lot of storage space, and requires a strong CPU computing power. We can compile executable programs for other platforms on a host platform (such as a PC) that has strong CPU power and sufficient storage controls. The PC is rich in resources and can easily integrate the development environment and debugging tools.

  Because of the different architecture of the PC and the embedded system environment, the program that can run on the PC cannot run on the target arm board, so the embedded development must be cross-compiled so that the PC can generate code that can be executed in arm class. The main task of compiling is to translate the program into machine code that the CPU that runs the program can recognize. in this case, a cross-compilation chain is used. To cross-compile, you need to install the cross-compilation tool chain on the host platform, then compile our source code with this cross-compilation toolchain, and eventually generate code that can run on the target platform.

  what is a compile toolchain: The compiler tool chain can be easily understood as a compilation toolset: compilers, assemblers, linker, C standard libraries. The compiler is responsible for converting the source code into binary machine code (or assembly code), such as GCC, assembler and linker, etc. are responsible for the construction of executable files, like Binutils, Chinese as binary toolset, C standard library is a universal machine code library for linker, like GLIBC.

Approximate process:

Install LTIB and compile the BSP

    1. Compiling QT 4.8.5
    2. Installing QT 4.8.5
    3. and configure the cross-compilation of arm
    4. Cross-compilation of arm
Iii. Summary of the issues

Some of the problems encountered in environmental configuration summary or knowledge grooming:

3.1. Introduction to make command

  In the development of a system, it is generally divided into a system of several modules, which improves the maintainability of the system, but because of the inevitable correlation between the various modules, so when a module changes, other modules may be more. To do this, a make command is specifically provided in the Linux system to automatically maintain the target file.

Pros: Only update modified files (in Linux, a file is created or updated with a last modified time, the Make command is the last modification time to determine whether the file is modified), and the unmodified file is ignored, and the make command will not miss a need to update the file.

  Dependency determination: The make command certainly does not know these dependencies, and requires programmers to write these dependencies to a file called Makefile. The makefile file contains some goals, usually the target is the file name, for each goal, provides a set of commands to achieve this goal, and the target has a dependency on the other target or file name.

3.2, can not find the zlib

Here is a little bit of the tool involved.

The Ltib (Linux target Image Builder) project is a simple tool for developing and deploying BSP (Board support Packages) using different target platforms. Using this tool, users can develop an image that conforms to the Gnu/linux standard for their target platform.

The BSP (Board support packages) is a board-level supporting package that is a layer between the motherboard hardware and the operating system, and should be part of the operating system, primarily to support the operating system and enable it to run better on the hardware board.

Problem Description:

Run./ltib–m config it went wrong.

Prompt does not install zlib, in fact, the system has been installed, is also the latest version.

Workaround:

Zlib is a library for data compression, in-Program data compression, decompression of their own programs and files

Add path, open Directory/ltib/bin/ltibutils.pm file, search for zlib part code;

Zlib-= Sub {My @f = (glob ('/usr/lib/libz.so* '),

Glob ('/lib/libz.so* '),

Glob ('/lib64/libz.so* '), +

Glob ('/lib/i386-linux-gnu/libz.so* '),

glob ('/usr/lib/i386-linux-gnu/libz.so* '),

Glob ('/usr/lib32/libz.so* '),

Glob ('/usr/lib/x86_64-linux-gnu/libz.so* ')); @f > 1? 1:0},

The Glob () function returns the file name or directory that matches the specified pattern.

Bold that line error, add in before you can run.

3.3,./ltibError

Problem Description:

You don ' t has a working TeX binary installed, but the Texi2dvi script

Can ' t proceed without it. If you want the

Install some kind of Tex, for example Tex Live Debian packages. You can do

That with the This command:

Apt-get Install Texlive

MAKE[2]: * * * [flex.pdf] Error 1

MAKE[2]: Leaving directory '/opt/freescale/ltib/usr/src/rpm/build/flex-2.5.37/doc '

MAKE[1]: * * * [install-recursive] Error 1

MAKE[1]: Leaving directory '/opt/freescale/ltib/usr/src/rpm/build/flex-2.5.37 '

Make: * * * [install] Error 2

Error:bad exit status from/home/cody/i.mx6/ltib/tmp/rpm-tmp.99407 (%install)

RPM Build Errors:

Bad exit status from/home/cody/i.mx6/ltib/tmp/rpm-tmp.99407 (%install)

Build time for flex:27 seconds

Failed Building Flex

Died at./ltib Line 1392.

Traceback

main::build_host_rpms:1392

main::host_checks:1447

main:554

Solution:

sudo apt-get install Texinfo
sudo apt-get install texlive

Reason:

Tex is a typesetting system

Texlive is a Tex package that contains an editor, a compiler, and a reader.

Texinfo software relies on bash, which contains programs that read, write, and convert Info documents to provide system documentation

3.4.The file directory could not be found

Problem Description:

Bash:command not found

Because the path variable is set, which causes the default path of the system to be overwritten, sudo, LS, chmod and other commands are not available at this time.

Solution:

1,/usr/bin/sudo Vi/etc/profile (because you can't find sudo, you have to write the full path, and other commands need to write the full path if the hint is not found)

2. Save after adding the following content at the end

Export path= $PATH:/sbin:/usr/bin:/usr/sbin

/sbin generally refers to the super-user instructions, mainly placed some system management of the necessary programs;

/usr/bin is a running script for some of the software you install at a later stage;

/usr/sbin put some user-installed system management prerequisite programs;

Consider whether the $path in root already contains these environment variables.

You can view PATH, if: path= $PATH: $HOME/bin need to be added as follows:

Path= $PATH: $HOME/bin:/sbin:/usr/bin:/usr/sbin

3. Restart the system or perform the following command to take effect

Source/etc/profile

The above thanks Xiao shes is sister's finishing and sharing, which let us all learn a little more things. Later decided to record the contents of the weekly meeting, share and summarize.

Summary of issues encountered in the cross-compilation environment of installing Imx6linux systems under Ubuntu

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.