Finally, the cross-compilation environment, kernel porting, and root file system were successfully run on the arm Development Board. During this period, some steps went smoothly and were mostly stuck by many details. For example, the last inconspicuous small problem caused the file system to be unable to be loaded, which plagued me for a week, finally, this bug was found through analysis. There are also issues with the source package versions, and many introductions on the Internet are based on the old version. I will use all the latest versions I can find here. Of course, it is a wise topic for the new and old versions to better suit. This is not a topic discussed in this article.
Finally, the cross-compilation environment, kernel porting, and root file system were successfully run on the arm Development Board. During this period, some steps went smoothly and were mostly stuck by many details. For example, the last inconspicuous small problem caused the file system to be unable to be loaded, which plagued me for a week, finally, this bug was found through analysis. There are also issues with the source package versions, and many introductions on the Internet are based on the old version. I will use all the latest versions I can find here. Of course, it is a wise topic for the new and old versions to better suit. This is not a topic discussed in this article. I firmly believe that many people have encountered or are about to encounter similar errors and problems. Therefore, I think it is helpful to write down the work I have done in the past two weeks in detail!
The first is the platform and environment. I have been based on Ubuntu 10.04 in vmware for the past two weeks. However, I found that Ubuntu, a very popular Desktop linux release, is not suitable for embedded development, A typical problem is that the system lacks a lot of libraries, services, and so on. You need to manually install the system, which adds a lot of additional work and is much more troublesome than I used Fedora 9. So now I just installed a new Fedora 13, repeat the past work, compile and record, and strive to keep the details blank!
Process preview:
1. preparations, including downloading source code packages, patches, creating folders, and setting Environment Variables
2. Create a kernel header file
3. Create binutils
4. Create bootstrap gcc
5. Establish glibc
6. Build the complete gcc version.
7. Test hello world
Let's get started now!
1. Preparations
The source code package and patch I used are as follows:
Linux-2.6.34.tar.bz2
Binutils-2.20.tar.gz
Gcc-4.5.0.tar.bz2
Gcc-4.5.0-startfiles_fix-1.patch
Gmp-4.3.0.tar.bz2
Mpc-0.8.2.tar.gz
Mpfr-3.0.0.tar.bz2
Glibc-2.11.tar.gz
Glibc-linuxthreads-2.5.tar.bz2
Glibc-ports-2.11.tar.bz2
Glibc-2.11.2-gcc_fix-1.patch
For how to get these source code packages, find google!
Create a working directory:
Select an appropriate place, create a general folder Embedded, and create three sub-folders: build-tools, kernel and tools, and www.linuxidc.com. All subsequent operations will be performed here.
$ Mkdir Embedded
$ Cd Embedded
$ Mkdir build-tools kernel tool
$ Ls
Build-tools kernel tool
Each folder has the following functions:
Build-tools: stores the source code of binutils, gcc, and glibc and the directory for compiling these source codes.
Kernel: saves the kernel source code and patches.
Tools: saves compiled cross-compilation tools and library files.
Set environment variables:
The setting of environment variables is only for convenience, because the config of each tool requires the input of similar variables, it is better to put them in environment variables.
Open vi ~ in the command line ~ /. Bashrc, enter the following lines at the end of the document, log out of the current user, and log on again
Export PRJROOT =/home/jinglelong/MySoftware/Embedded
Export TARGET = arm-linux
Export PREFIX = $ PRJROOT/tools
Export TARGET_PREFIX = $ PREFIX/$ TARGET
Export PATH = $ PREFIX/bin: $ PATH
The specific meanings of each variable are as follows:
PRJROOT: root directory of the entire project. Embeded is used here.
TARGET: the architecture of the target file. arm-linux indicates that the compiled TARGET can only run in the arm architecture.
PREFIX: set the path PREFIX of the target folder.
TARGET_PREFIX: Specifies the path prefix path of the target folder.
PATH: add the PATH of the executable file. Here, only the intermediate compilation tool is used.