The establishment of an embedded Linux development environment based on "Hua Qing vision learning manual"

Source: Internet
Author: User

Establish an embedded Linux development environment

 

[Lab content]

Use the crosstool-0.43.tar.gz script toolkit to create your own cross compiler. This compiler can compile the u-boot-1.3.1, linux-2.6.22.6 kernel.

 

[Lab environment]

1. ubuntu8.10 release

2. linux-2.6.22.6 Kernel

3. fs2410 Platform

[Experiment steps]

Crosstool is a script program developed by Dan Keel, an American who can automatically compile different matching versions of GCC and glibc and perform tests.

: H t p: // kegel.com/crosstool/crosstool-0.43.tar.gz

 

(1) tool Installation

Make sure that the following toolkit is installed in your system: Bison, flex, Build-essential.

Installation Method: 1.
Sudo apt-Get install xxx

Sudo apt-Get install bison flex build-essential patch libncurses5-dev

 

2. sudp dpkg-I XXX. Deb

Common software packages include:

Bison_13a2.3.dfsg-4build1_i386.deb

Build-essential_11.4_i386.deb

Flex_2.5.33-10build1_i386.deb

Libncurses5-dev_5.6 + 20071124-1ubuntu2_i386.deb

M4_1.4.8-1build1_i386.deb (first installed)

Patch_2.5.9-5_i386.deb

Note: All of the preceding operations are performed under normal users.

 

(2) GCC version downgrade

Ubunut8.10 default GCC 4.3.2, this version of the syntax requirements are high, it is not recommended to choose, select gcc-4.1, while retaining gcc4.3.2.

There are two ways to install gcc-4.1:

1. sudo apt-Get install gcc-4.1

2. Use sudo dpkg-I XXX. Deb
Install the following packages:

Gcc-4.1_4.1.2-23ubuntu3_i386.deb

Gcc-4.1-base_4.1.2-23ubuntu3_i386.deb

Cpp-4.1_4.1.2-23ubuntu3_i386.deb

 

After installation, You need to modify the GCC software link:

Sudo RM/usr/bin/GCC
(Delete GCC, which is a soft link file of gcc4.3.2)

Sudo ln-S/usr/bin/gcc-4.1
(Create a soft link from GCC to the gcc-4.1)

 

(3) modify the sh version

If you run LS-La/bin/sh
If the link is Dash, run the following command:

Sudo dpkg-reconfigure dash

Select No to delete dash.

 

(4) We need to create two directories: crosstool and downloads.

Crosstool is the directory for storing the tool chain, and downloads is the directory for storing the source code package required for compiling crosstool.

Mkdir/home/boat_man/downloads

CP gcc-3.4.5.tar.gz glibc-2.3.6.tar.gz linux-2.6.22.6.tar.gz crosstool-0.43.tar.gz binutils-2.15.tar.gz glibc-linuxthreads-2.3.3.tar.gz linux-libc-headers-2.6.12.0.tar.bz2/home/boat_man/downloads

If downloads does not have these source code packages, crosstool will download the packages by itself during compilation, but the download takes a long time. Therefore, we need to download these packages in advance and put them under downloads.

 

(5) decompress the crosstool package and enter its directory to view important script files.

CD/home/boat_man/downloads

Tar xzvf crosstool-0.43.tar.gz

CD crosstool-0.43

There are many supported. Sh scripts and. dat configuration files in this directory. We choose demo-arm-softfloat.sh that supports soft floating point operations
.

 

(6) Modify demo-arm-softfloat.sh

Vim demo-arm-softfoat.h.

Modify the following two sentences:

Tarballs_dir = $ home/downloads

Result_top =/opt/crosstool

Is:

Tarballs_dir =/home/boat_man/dowloads (directory where your source code is stored)

Result_top =/home/boat_man/crosstool (directory of the tool chain to be generated)

 

(7) Modify gcc-3.4.5-glibc-2.3.6.dat

The modified content is as follows:

Binutils_dir = binutils-2.15

Gcc_dir = gcc-3.4.5

Glibc_dir = glibc-2.3.6

Linux_dir = linux-2.6.22.6

Linux_sanitized_header_dir = linux-libc-headers-2.6.12.0

Glibcthreads_filename = glibc-linuxthreads-2.3.6

Note: The version of the source code package is required.
The source code version in downloads is the same.

 

(8)./demo-arm-softfloat.sh

Execute this script and compile it on my machine for about half an hour.

 

(9) Modify Environment Variables

Sudo Vim/etc/bash. bashrc

Add the following statement at the end of the file:

Path = $ path:/home/boat_man/crosstool/gcc3.4.5-glibc-2.3.6/ARM-softfloat-Linux-GNU/bin:

Export path

 

(10) Reopen a terminal

Arm-softfloat-Linux-GNU-gcc-V

If the last line shows GCC version 3.4.5
It indicates that your cross-tool chain has been successfully built.

 

(11) Restore GCC and sh

Sudo RM/usr/bin/GCC

Sudo ln-S/usr/bin/gcc-4.3/usr/bin/GCC


Sudo dpkg-reconfigure dash

Select Yes to reinstall dash.


OK, our cross-compilation tool arm-softfloat-Linux-GNU-gcc
That's all!

 

 

 

 

 

 

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.