(5) Start compiling. The compilation process mainly consists of 6 steps;
a. Generation of kernel header files
b. Generation of Binary utilties
c. Generation of Glibc header files
d. Generation of first-stage gcc
e. Generation of glibc library files
f. Generation of complete compilation tools
Note: The first-stage gcc generation is mainly used to generate glibc library files.
1. Generate kernel header files
$root@host:/home/arm/kernel# tar xvjf linux-2.6.22.tar.bz2
$root@host:/home/arm/kernel# cd linux-2.6.22
$root@host:/home/arm/kernel/linux-2.6.22#
make ARCH=arm CROSS_COMPILE=arm-linux- menuconfig
Among them, menuconfig specifies the configuration interface. Other available options include config (full character interface) and xconfig (graphical interface under xwindow). Ubuntu needs to install tk8.4 to support xconfig. In addition, you need to uninstall mawk and install gawk. (mawk has a bug)
The linux2.6 kernel provides support for s3c2410. Select the s3c2410 series in system. After configuration, exit and save.
$root@host:/home/arm/kernel/linux-2.6.22# cd include
$root@host:/home/arm/kernel/linux-2.6.22/include# cd linux
$root@host:/home/arm/kernel/linux-2.6.22/include/linux# ls version.h autoconf.h
version.h autoconf.h
These two files will be used in the following compilation. If not, exit to the internal directory and make version.h.
Create the following link:
$root@host:/home/arm/kernel/linux-2.6.22/include# ln –s asm-arm asm
$root@host:/home/arm/kernel/linux-2.6.22/include# ln -s asm/arch-s3c2410 asm/arch
Copy the kernel header file to the final installation directory:
$root@host:/home/arm/kernel/linux-2.6.22/include# mkdir –p ${TARGET_PREFIX}/include
cp –r asm- ${TARGET_PREFIX}/include
$root@host:/home/arm/kernel/linux-2.6.22/include#
cp –r linux ${TARGET_PREFIX}/include $root@host:/home/arm/kernel/linux-2.6.22/include# cp –d asm ${TARGET_PREFIX}/includeThus
the kernel header files are created.
2. Create Binary utilities:
binutils is a collection of binary tools, among which as, ar and ld are commonly used.
$root@host:/home/arm/kernel/include# cd ${PRJROOT}/build-tools
$root@host:/home/arm/build-tools# tar xvjf binutils-2.18.tar.bz2
$root@host:/home/arm/build-tools# cd build-binutils
$root@host:/home/arm/build-tools/build-binutils#
patch –Np1 –i /
home/arm/build-tools /patch/binutils-2.18* $root@host:/home/arm/build-tools/build-binutils#
../binutils-2.18/configure --target=${TARGET} –prefix=${PREFIX}
$root@host:/home/arm/build-tools/build-binutils# make
$root@host:/home/arm/build-tools/build-binutils# make install 1. At the same
time, some files starting with arm-linux should be generated under ${PREFIX}/bin.
$root@host:/home/arm/build-tools/build-binutils# ls ${PREFIX}/bin .
3. Generate glibc header files:
$root@host:/home/arm/build-tools/build-binutils# cd ..
$root@host:/home/arm/build-tools/# tar xvjf glibc-2.6.1.tar.bz2
$root@host:/home/arm/build-tools/#
tar xvzf glibc-2.6.1.tar.gz --directory ./glibc-2.6.1/
$root@host:/home/arm/build-tools/# cd glibc-2.6.1
$root@host:/home/arm/build-tools/glibc-2.6.1# mv glibc-ports-2.6.1 ports –vApply
the patch:
$root@host:/home/arm/build-tools/glibc-2.6.1#
patch –Np1 –i /home/arm/build-tools/patch/glibc-2.6.1-*patch
$root@host:/home/arm/build-tools/glibc-2.6.1# cd ..
$root@host:/home/arm/build-tools/# cd build-glibc-headersHere
you need to add support for the NPTL thread library:
$root@host:/home/arm/build-tools/build-glibc-headers#
echo “libc_cv_forced_unwind=yes”>>config.cache
echo “libc_cv_c_cleanup=yes”>>config.cache
echo “libc_cv_arm_tls=yes”>>config.cacheNote
: If “cannot compute long double size” appears during compilation, add:
echo "ac_cv_sizeof_long_double=12">>config.cache
$root@host:/home/arm/build-tools/build-glibc-headers#
../glibc-2.6.1/configure --host=${TARGET} --prefix=”/usr” --enable-add-ons
--with-headers=${TARGET_PREFIX}/include --cache-file=config.cache
$root@host:/ home/arm/build-tools/build-glibc-headers#
make cross-compiling=yes install_root=${TARGET_PREFIX} prefix=””
install-headers
$root@host:/home/arm/build-tools/build-glibc-headers#
mkdir –p ${TARGET_PREFIX}/include/gnu
$root@host:/home/arm/build-tools/build-glibc-headers#
touch ${TARGET_PREFIX}/include/gnu/stubs.h
Note: If an error occurs during compilation that the header file cannot be found, you can use the touch command to create an empty file in the corresponding directory according to the file name in the error prompt. Generally, the compilation can be successful.
Keywords:3c2410 linux2.6.22 port
Reference address:Linux2.6.22 porting based on 3c2410 (2)
a.
b.
c.
d.
e.
f. Generation
1. Generate kernel header files
$root@host:/home/arm/kernel# tar xvjf linux-2.6.22.tar.bz2
$root@host:/home/arm/kernel# cd linux-2.6.22
$root@host:/home/arm/kernel/linux-2.6.22#
make ARCH=arm CROSS_COMPILE=arm-linux- menuconfig
Among them, menuconfig specifies the configuration interface. Other available options include config (full character interface) and xconfig (graphical interface under xwindow). Ubuntu needs to install tk8.4 to support xconfig. In addition, you need to uninstall mawk and install gawk. (mawk has a bug)
The linux2.6 kernel provides support for s3c2410. Select the s3c2410 series in system. After configuration, exit and save.
$root@host:/home/arm/kernel/linux-2.6.22# cd include
$root@host:/home/arm/kernel/linux-2.6.22/include# cd linux
$root@host:/home/arm/kernel/linux-2.6.22/include/linux# ls version.h autoconf.h
version.h autoconf.h
These two files will be used in the following compilation. If not, exit to the internal directory and make version.h.
Create the following link:
$root@host:/home/arm/kernel/linux-2.6.22/include# ln –s asm-arm asm
$root@host:/home/arm/kernel/linux-2.6.22/include# ln -s asm/arch-s3c2410 asm/arch
Copy the kernel header file to the final installation directory:
$root@host:/home/arm/kernel/linux-2.6.22/include# mkdir –p ${TARGET_PREFIX}/include
$root@host:/home/arm/kernel/linux-2.6.22/include# cp –rd asm-arm ${TARGET_PREFIX}/include
$root@host:/home/arm/kernel/linux-2.6.22/include#cp –r asm- ${TARGET_PREFIX}/include
$root@host:/home/arm/kernel/linux-2.6.22/include#
cp –r linux ${TARGET_PREFIX}/include $root@host:/home/arm/kernel/linux-2.6.22/include# cp –d asm ${TARGET_PREFIX}/includeThus
the kernel header files are created.
2. Create Binary utilities:
binutils is a collection of binary tools, among which as, ar and ld are commonly used.
$root@host:/home/arm/kernel/include# cd ${PRJROOT}/build-tools
$root@host:/home/arm/build-tools# tar xvjf binutils-2.18.tar.bz2
$root@host:/home/arm/build-tools# cd build-binutils
$root@host:/home/arm/build-tools/build-binutils#
patch –Np1 –i /
home/arm/build-tools /patch/binutils-2.18* $root@host:/home/arm/build-tools/build-binutils#
../binutils-2.18/configure --target=${TARGET} –prefix=${PREFIX}
$root@host:/home/arm/build-tools/build-binutils# make
$root@host:/home/arm/build-tools/build-binutils# make install 1. At the same
time, some files starting with arm-linux should be generated under ${PREFIX}/bin.
$root@host:/home/arm/build-tools/build-binutils# ls ${PREFIX}/bin .
3. Generate glibc header files:
$root@host:/home/arm/build-tools/build-binutils# cd ..
$root@host:/home/arm/build-tools/# tar xvjf glibc-2.6.1.tar.bz2
$root@host:/home/arm/build-tools/#
tar xvzf glibc-2.6.1.tar.gz --directory ./glibc-2.6.1/
$root@host:/home/arm/build-tools/# cd glibc-2.6.1
$root@host:/home/arm/build-tools/glibc-2.6.1# mv glibc-ports-2.6.1 ports –vApply
the patch:
$root@host:/home/arm/build-tools/glibc-2.6.1#
patch –Np1 –i /home/arm/build-tools/patch/glibc-2.6.1-*patch
$root@host:/home/arm/build-tools/glibc-2.6.1# cd ..
$root@host:/home/arm/build-tools/# cd build-glibc-headersHere
you need to add support for the NPTL thread library:
$root@host:/home/arm/build-tools/build-glibc-headers#
echo “libc_cv_forced_unwind=yes”>>config.cache
echo “libc_cv_c_cleanup=yes”>>config.cache
echo “libc_cv_arm_tls=yes”>>config.cacheNote
: If “cannot compute long double size” appears during compilation, add:
echo "ac_cv_sizeof_long_double=12">>config.cache
$root@host:/home/arm/build-tools/build-glibc-headers#
../glibc-2.6.1/configure --host=${TARGET} --prefix=”/usr” --enable-add-ons
--with-headers=${TARGET_PREFIX}/include --cache-file=config.cache
$root@host:/ home/arm/build-tools/build-glibc-headers#
make cross-compiling=yes install_root=${TARGET_PREFIX} prefix=””
install-headers
$root@host:/home/arm/build-tools/build-glibc-headers#
mkdir –p ${TARGET_PREFIX}/include/gnu
$root@host:/home/arm/build-tools/build-glibc-headers#
touch ${TARGET_PREFIX}/include/gnu/stubs.h
Note: If an error occurs during compilation that the header file cannot be found, you can use the touch command to create an empty file in the corresponding directory according to the file name in the error prompt. Generally, the compilation can be successful.
Previous article:Linux 2.6.22 port based on 3c2410 (1)
Next article:Linux 2.6.22 port based on 3c2410 (3)
Recommended Content
Latest Microcontroller Articles
He Limin Column
Microcontroller and Embedded Systems Bible
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
MoreSelected Circuit Diagrams
MorePopular Articles
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
MoreDaily News
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
Guess you like
- Puzhong Technology 51 MCU Development Board v3.0 Dynamic Digital Tube Part
- STM32F103 timer clock not understood
- MicroPython plugin for PyCharm
- Xilinx FPGA Design Advanced (Advanced Edition)
- Sentenced to 4 years! Megvii Technology driver attempted to extort 3 million yuan from the chairman but failed
- Problems and Solutions in TMS320F206 Simulation Debugging
- Disassembly of 10 yuan smart bracelet
- Last day! Microchip Live Broadcast | How to solve precision timing challenges in ADAS systems
- [Fudan Micro FM33LG0 Series Development Board Review] Basic Introduction
- MaxplusII advanced use and improvement.rar