Compile the uClinux kernel in a cross-compilation environment
Source: Internet
Author: User
Compile the uClinux kernel-general Linux technology-Linux programming and kernel information in the Cross-compilation environment. The following is a detailed description. [Lab Learning Environment]
Operating System: fedora 7
System kernel: linux 2.6.23.17-88
Cpu model: i686
Hardware Platform: i386
(The command uname-a can be used to obtain the system information)
Compiler: GCC 4.1.2 (the gcc-v command is used to obtain the version information)
Reference books: Examples of ARM Embedded Linux system construction and driver development; Author: Zhou ligong, Chen Mingji, Chen Yu; Press: Beijing University of Aeronautics and Astronautics Press. analysis and Practice of Open Source Embedded System software-based on SkyEye and ARM development platform, Author: Chen Yu, Li Ming, Yang Yi, etc.; Press: Beijing University of Aeronautics and Astronautics Press
Recommended visit Website: http://www.uclinux.org which has a lot of files needed, including the kernel source code.
1. Create a cross-compilation environment.
There are two ways to build a cross-compilation environment: one is to create from the source code and the other is to install the binary cross tool chain.
In fact, I just succeeded in the second method. The first method, although I tried it, seems to be unsuccessful. For record, I 'd like to write it.
(1) create a cross-compiling environment from the source code
Step 1: Prepare the following files in the/source directory:
Toolkit for binutils-2.10.tar.bz2 Binaries
Binutils-2.10-full.patch toolkit Patches
Gcc-2.95.3.tar.bz2 GCC compiler
Gcc-2.95.3-full.patch GCC patch
Gcc-2.95.3-arm-pic.patch GCC patch
Gcc-2.95.3-arm-pic.patch2 GCC patch
Gcc-2.95.3-arm-mlib.patch GCC patch
Gcc-2.95.3-sigset.patch GCC patch
Gcc-2.95.3-m68k-zext.patch GCC patch
Genromfs-0.5.1.tar.gz generation tools for romfs
STLport-4.5.3.tar.gz STL patch
STLport-4.5.3.patch STL patch
Elf2flt-20030314.tar.gz tool for converting elf format files to flat format files
The script used by the build-uclinux-tools.sh to compile the cross-compilation environment
Step 2: compile your own cross-tool chain from the source code. Copy all the files in the/source directory related to the compilation environment to the same directory and enter this directory. Run the following command as the root user:
#./Build-uclinux-tools.sh build 2> & 1 | tee errs
(2) install the binary cross tool chain arm-elf Tool
You must have an execution file first. It's a arm-elf-tools-20040427.sh. Then run the following command on the command line (root identity:
; Copy arm-elf-tools-20040427.sh to root directory
# Cp/source/arm-elf-tools-20040427.sh/
; Give file arm-elf-tools-20040427.sh executable permissions
# Chmod 755 arm-elf-tools-20040427.sh
; Run the script
#./Arm-elf-tools-20040427.sh
Check whether the compiling environment file starting with arm-elf-exists in the/usr/local/bin/directory. If yes, the cross-compilation environment is successfully installed!
Yes, we can laugh. However, you are still playing well. Be patient.
2. Use gnu tools to compile the uClinux kernel
Later, this is the latest version provided by the official website, but an error occurs when I compile it as follows. The main problem lies in the Cross-compiler. After a long time, I have not found a solution. Then honestly downloaded a public version: uClinux-dist-20040408.tar.gz. Tell me who solved the problem. Thank you.
Follow these steps to compile the kernel:
(1) Decompression package: tar zxf uClinux-dist-20040408.tar.gz
(2) Go to the directory: cd uClinux-dist
(3) Kernel configuration: make xconfig (graphical) or make menuconfig (command line)
Select GDB/ARMulator in Vendor/Product, linux-2.4.x in Kernel Version, uC-Libc in libc Version, and Save and Exit.
Then, create the kernel dependency: make dep
Compile the kernel: make
Finally, a file named linux with debugging information is generated under the/usr/src/uclinux-dist/linux-2.4.x Directory, which is the kernel execution file in elf format; at the same time, generate the file system image file romfs in/usr/src/uclinux-dist/images. img.
Here, the kernel is compiled. Let's test it.
3. Use SkyEye for testing.
First, generate the configuration file and create the skyeye configuration file skyeye. conf under the uclinux-dist directory. The content is as follows:
Cpu: arm7tdmi
Mach: at91
Mem_bank: map = M, type = RW, addr = 0x00000000, size = 0x00004000
Mem_bank: map = M, type = RW, addr = 0x01000000, size = 0x00400000
Mem_bank: map = M, type = R, addr = 0x01400000, size = 0x00400000, file = images/romfs. img
Mem_bank: map = M, type = RW, addr = 0x02000000, size = 0x00400000
Mem_bank: map = M, type = RW, addr = 0x02400000, size = 0x00008000
Mem_bank: map = M, type = RW, addr = 0x04000000, size = 0x00400000
Mem_bank: map = I, type = RW, addr = 0xf0000000, size = 0x10000000
Run the following command in/usr/src/uclinux-dist:
# Skyeye-e linux-2.4.x/linux
Then you can see some new good things! Of course, if you have errors, you can only solve it by yourself. Come on!
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