Build a uClinux compiling and development environment on redhat9.2 and use Skyeye for Simulation
This document details how to start from redhat9.2 (the kernel version is linux-2.4.20-8), establish a cross-compilation environment, compile the uClinux kernel, how to verify through the Skyeye simulator, and then download to the real development board for execution, add your own application.
If you have a Linux PC environment, you can try it on your own machine. This is especially suitable for beginners who do not have a Development Board.
1. To do a good job, you must first sharpen the tool and install the cross compiler GNU toolchain.
1. Download arm-elf-tools-20011219.tar.gz (to http://www.uclinux.org/pub/uClinux/arm-elf-tools)
2. Download The arm-elf-tools-20030314.sh (go to http://www.uclinux.org/to look for it, no way to look elsewhere !)
3. These two files need to be in the same directory, the arm-elf-tools-20030314.sh is a script file that can be installed automatically
The changed attribute is an executable file:
Chmod 755 arm-elf-tools-20030314.sh
4. Execute the script to install the cross compiler.
/Arm-elf-tools-20030314.sh
5. Test it. Enter arm-elf-GCC to check whether the installation is complete?
[Root @ localhost root] # arm-elf-gcc-V
Reading specs from/usr/local/lib/GCC-lib/ARM-elf/2.95.3/specs
GCC version 2.95.3 20010315 (release) (ColdFire patches-20010318 from http://fiddes.net/coldfire/) (uClinux xip and shared lib patches from http://www.snapgear.com /)
[Root @ localhost root] # Which arm-elf-gcc
/Usr/local/bin/ARM-elf-gcc
If the above information is displayed, it indicates that the arm-elf-GCC has been installed in the/usr/local/bin/directory.
Ii. Cross-compile uClinux kernel
1. Download The uClinux-dist-20040408.tar.gz to the current working directory, my is/Skyeye (enter the: mkdir skeyey command in the root directory to create this directory)
2. Unzip the uClinux-dist-20040408.tar.gz file to the uClinux-Dist directory under the current directory
Tar xvzf uClinux-dist-20040408.tar.gz
A directory named uClinux-Dist is added to the current working directory.
3. Go to the uClinux-Dist directory
CD uClinux-Dist
4. Modify the vmlinux-armv.lds.in file,
VI linux-2.4.x/ARCH/armnommu/vmlinux-armv.lds.in
In
* (Got)/* Global Offset Table */
Then add the following statement:
Romfs_data = .;
Romfs. o
Romfs_data_end = .;
To:
65 * (. Got)/* Global Offset Table */
66
67/* add here */
68 romfs_data = .;
69 romfs. o
70 romfs_data_end = .;
5. Modify the vendors/Samsung/4510b/MAKEFILE file,
VI vendors/Samsung/4510b/makefile
In the third row of the Image Target, add a statement:
Arm-elf-LD-r-o $ (rootdir)/$ (linuxdir)/romfs. O-B binary $ (romfsimg)
As follows:
63 image:
64 [-d $ (imagedir)] | mkdir-p $ (imagedir)
65 genromfs-v "romdisk"-F $ (romfsimg)-d $ (romfsdir)
66 arm-elf-LD-r-o $ (rootdir)/$ (linuxdir)/romfs. O-B binary $ (romfsimg)
67 $ (cross_compile) objcopy-O binary -- remove-Section =. romvec/
68 -- remove-Section =. Text -- remove-Section =. ramvec/
69 -- remove-Section =. init/
70 -- remove-Section =. BSS -- remove-Section =. Eram/
71 $ (rootdir)/$ (linuxdir)/Linux $ (imagedir)/Linux. Data
6. Make menuconfig
Select
--- Select the vendor you wish to target
(Samsung) Vendor
--- Select the product you wish to target
(4510b) Samsung products
In kernel/library/defaults selection --->, select
(Linux-2.4.x) kernel version
(Uclibc) libc version
All other options remain unchanged. Follow the default settings to exit and save the configuration.
7. Modify config/. config
VI config/. config
Comment out config_user_old_passwords of Row 3.
As follows:
24 config_user_login_login = y
25 # config_user_old_passwords = y
26 # config_user_only_root is not set
8. Modify linux-2.4.x/ARCH/armnommu/MM/init. C:
VI linux-2.4.x/ARCH/armnommu/MM/init. c
Comment out the code of Line 1.
655 void free_initmem (void)
656 {
657 if (! Machine_is_integrator ()&&
658! Machine_is_p52 ()&&
659! Machine_is_cx821xx ()&&
660! Machine_is_atmel ()&&
661! Machine_is_netarm ()&&
662 //! Machine_is_ta7v ()&&
663! Machine_is_ta7s ()){
664 free_area (unsigned long) (& __ init_begin ),
665 (unsigned long) (<__ init_end ),
(666 "init ");
9. Make Dep
10. Make lib_only
11. Make user_only
12. Make romfs
13. Make image (error-prone, it doesn't matter. We only need to generate the romfs. o file in this step)
It has two functions: one is to generate a romfs image file and the other is to generate a Linux image. Because the original Linux compilation is in the ELF format, it cannot be directly used for download or compilation (but that file is also required, because if you need, the Kernel File in ELF format can contain debugging information ). Therefore, since Linux has not been compiled yet, an error will be reported during this step. But it doesn't matter, because what we need here is only the romfs image, which can be used to compile the linxu kernel below.
14. Make
(There may be error: cannot open romfs. O, in fact, this file already exists, in the linux-2.4.x/romfs. O, copy to UC can be)
With romfs images, we can compile Linux. Because romfs is embedded in the Linux kernel, A romfs. o file is required when compiling the Linux kernel. This file is generated by the make image above.
15. Make again
16. Make image again
After compilation, the images/directory contains four files: image. Bin, Linux. Data, Linux. text, and romfs. IMG.
17. Make Linux
Wait until the compilation is completed in the linux-2.4.x/directory to generate a Linux File, Linux is the file that can be simulated with Skyeye
18. Download The skyeyesoftware package skyeye-1.2-rc6.tar.bz2
Http://sourceforge.net/forum/forum.php? Forum_id = 559047
19. decompress and compile Skyeye
Tar xvzf skyeye-1.2-RC6.tar.bz2-C/Skyeye
CD/Skyeye/skyeye-V1
Make
20. Set Environment Variables
VI ~ /. Bashrc
Add path
Export Path = $ path:/Skyeye/skyeye-V1/bin
21. Put the compiled Linux File and Skyeye. conf in the same directory.
Skyeye-e Linux
Wait for a while to see the long-overdue uClinux.
# Add the Skyeye. conf file
# Skyeye config file sample
CPU: ARM7TDMI
Mach: initi4510b
Mem_bank: Map = m, type = RW, ADDR = 0x00000000, size = 0x00800000
Mem_bank: Map = m, type = RW, ADDR = 0x04000000, size = 0x00800000
Mem_bank: Map = m, type = r, ADDR = 0x01000000, size = 0x00200000
Mem_bank: Map = I, type = RW, ADDR = 0x03ff0000, size = 0x00010000
Net: TYPE = maid, hostip = 10.0.0.2, ethmod = tuntap
# Dbct: State = on