In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article is about how Fedora SkyEye installs cross-compilers. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Fedora SkyEye is a hardware simulation tool that can run embedded operating system, so that embedded system can be developed without hardware. The following operations are all passed in Fedora Core 1.0. Fedora SkyEye Project Resource list http://gro.clinux.org/projects/skyeye/
1. What is Fedora SkyEye?
Fedora SkyEye is an open source software project. The goal of Fedora SkyEye is to provide a complete simulation environment in Linux and Windows operating systems. Fedora SkyEye simulation environment is equivalent to an embedded computer system, you can run some embedded Linux operating systems in Fedora SkyEye, such as ARMLinux,uClinux,uc/OS-II (ucos-ii), and can analyze and debug their source code.
If you want to know more about Fedora SkyEye and embedded systems, please visit the following site:
Http://www.skyeye.org/
Http://www.skyeye.org/index_cn.html
Through Fedora SkyEye, the following hardware can be simulated: CPU Core: ARM7TDMI, ARM720T, ARM9, StrongARM, XScaleCPU: Atmel AT91/X40, Cirrus CIRRUS LOGIC EP7312, Intel SA1100/SA1110, Intel XScale PXA 250and255,CS89712, samsung 4510B
Samsung 44B0 (incomplete) memory: RAM, ROM, Flash peripherals: Timer, UART, ne2k network chip, LCD, touch screen, etc. Currently, the following operating systems and system software can be run on SkyEye:
UC/OSII-2.5.x (support network)
UClinux (based on Linux2.4.x kernel, supports network)
ARM Linux 2.4.x/2.6.x
LwIP on uC/OSII
Applications based on uC/OSII, uClinux, ARM Linux
What can 2.Fedora SkyEye do?
1. Fedora SkyEye can help promote the learning of embedded systems, learning and analyzing uclinux operating system and other embedded operating systems, such as ucosII, without additional hardware.
2. SkyEye can be used in embedded system teaching.
3. Hope to promote the research of operating system through skyeye, such as ucosII,uclinux+RTAI,uclinux2.5.x and so on.
4. The research of simulation specific hardware module can be carried out based on SkyEye.
5. SkyEye can be used as an embedded integrated development environment to develop embedded systems (of course, a lot of work needs to be done on SkyEye).
Note: quoted from Chen Yu's "SkyEye Project FAQ"
3. Install Fedora SkyEye to http://gro.clinux.org/projects/skyeye/ to download skyeye-0.7.0.tar.bz2 package: tar jxvf skyeye-v0.7.0.tar.bz2 enters the decompressed skyeye directory If the version of SkyEye is less than 0.6.0, run the following command:. / configure-- target=arm-elf-- prefix=/usr/local-- without-gtk-prefix-- without-gtk-exec-prefix-- disable-gtktest. If the version of SkyEye is higher than 0.6.0, run the following command:. / configure-- target=arm-elf-- prefix=/usr/local
Next: execute skyeye after makemake install installation. Note: a. If you are using a Mandrake Linux distribution, then you encounter an error when compiling Fedora SkyEye, and the error is related to readline, ncurse, termcap, etc., you can try the following method: ln-s / usr/include/ncurses/termcap.h / usr/local/include/termcap.h followed by make and make install to see if it works!
b. If your Linux distribution is Debian Linux, don't use gcc 2.95 or gcc 3.0. use gcc 3.2 +.
Version of c.gcc should be 2.96 or above
d. If the version of SkyEye is greater than 0.6.0, then using LCD emulation requires the installation of GTK software on the Linux system.
4. Install arm-elf cross compiler
Download arm-elf-tools-20030314.sh http://www.cnblogs.com/leivo/admin/ftp://166.111.68.183/pub/embed/uclinux/soft/tools/arm or http://www.cnblogs.com/leivo/admin/ftp://166.111.8.229/OS/Embeded
Execute: chmod adepx arm-elf-tools-20030314.sh and then:. / arm-elf-tools-20030314.shls / usr/local/bin/ you should see the executable file that starts with arm-elf, where arm-elf-gcc is used to compile the compiler for your target platform, and, of course, some gadgets, which will be discussed later.
5. Test your arm-elf-gcc compiler and write a Mini Program hello.c first
PHP Code: # i nclude int main (void)
{int i
For (I = 0; I < 6; iTunes +) {
Printf ("I =% d", I)
Printf ("Hello, embedded linux!\ n");}
Return 0;}
Then execute: the arm-elf-gcc-Wl,-elf2flt-o hello hello.c-elf2flt parameter changes the elf file format to flat file format, which is generated when you install a cross-compiler. Or you can write a Makefile file and execute: make. Here is my Makefile file, for reference only: PHP code: # begin CC = arm-elf-gcc CFLAGS =-disabled PICS _-fpic-msingle-pic-base-O2-pipe-Wall-g
LDFLAGS =-Wl,-elf2flt
LIBS =
OBJS = hello.o
All: hello
Hello: $(OBJS)
$(CC) $(CFLAGS) $(LDFLAGS)-o hello $(OBJS) $(LIBS)
Clean:
Rm-rf * .o * .elf * .gdb hello
# end
If the compilation is successful, the hello executable is generated. Use the following command: file hello you will find that it is BFLT (binary FLAT), the file format supported by your target platform.
6. Execute your hello program
Here, we will use the genromfs gadget to complete the test, which is generated when you install the cross-compiler, and you can use it directly. To http://gro.clinux.org/projects/skyey...-1.0.4.tar.bz2 package: tar jxvf skyeye-binary-testutils-1.0.4.tar.bz2
Cd testsuits/at91/uclinux2 (you can use other things, of course) mkdir romfs (create a directory, later) mount-o loop boot.rom / mnt/xxxcp-r / mnt/xxx/* romfs in addition, copy your compiled executable to the / romfs/bin directory, this is hello!
Genromfs-f boot.rom-d romfs/
Note: you can use genromfs-h to get help! OK! Execute the following command:
Skyeye linux
(skyeye) target sim
(skyeye) load
(skyeye) run
Kernel start.
You're familiar with it.
Cd / bin
Hello
Can you see the results? In fact, at this point, you can develop your own program!
7. A development example of an application
The main purpose of the program described below is to complete a network application. The standard model of network application is the client-server model, and its main execution process is as follows:
(1) the system starts the server execution. The server completes some initialization, then goes to sleep and waits for the client to request
(2) on a machine on the network, the user executes the client program.
(3) establish a connection between the client process and the server process
(4) after the connection is established, the client sends a request to the server through the network to request a certain service
(5) after receiving the client request, the server processes the request according to the content of the client request, and then returns the processing result.
(6) the server disconnects from the client, goes back to sleep and waits for requests from other clients.
Many servers in Linux system are started at the beginning of the system, such as time server, print server, file transfer server and e-mail server. Most of the time these server processes are asleep, waiting for requests from clients. The following two client-server programs are relatively simple, mainly to get a general impression of the actual operation of the network client-server model. The client-server operation is very simple: after the client establishes a connection with the server, the server returns a message to the client. The source code of the server program is as follows:
PHP Code:
/ * tcpserver.c * /
# i nclude
# i nclude
# i nclude
# i nclude
# i nclude
# i nclude
# i nclude
# i nclude
# define WAITBUF 10
Int main (int argc, char * argv [])
{
Int sockfd, new_fd
Struct sockaddr_in server_addr
Struct sockaddr_in client_addr
Unsigned int sin_size, portnumber
Char hello [] = "Hello! Socket communication world!\ n"
If (argc! = 2)
{
Fprintf (stderr, "Usage:%s portnumber\ a\ n", argv [0])
Exit (1)
}
If ((portnumber = atoi (argv [1])) < 0)
{
Fprintf (stderr, "Usage:% s portnumber error\ a\ n", argv [0])
}
If ((sockfd = socket (AF_INET, SOCK_STREAM, 0)) =-1)
{
Fprintf (stderr, "Socket error:%s\ n\ a", strerror (errno))
Exit (1)
}
Bzero (& server_addr, sizeof (struct sockaddr_in))
Server_addr.sin_family = AF_INET
Server_addr.sin_addr.s_addr = htonl (INADDR_ANY)
Server_addr.sin_port = portnumber
If (bind (sockfd, (struct sockaddr *) (& server_addr), sizeof (struct sockaddr)) =-1)
{
Fprintf (stderr, "Bind error:%s\ n\ a", strerror (errno))
Exit (1)
}
If (listen (sockfd, WAITBUF) =-1)
{
Fprintf (stderr, "Listen error:%s\ n\ a", strerror (errno))
Exit (1)
}
While (1)
{
Sin_size = sizeof (struct sockaddr_in)
If ((new_fd = accept (sockfd, (struct sockaddr *) (& client_addr), & sin_size)) =-1)
{
Fprintf (stderr, "Accept error:%s\ n\ a", strerror (errno))
Exit (1)
}
Fprintf (stderr, "Server get connection from% s\ n", inet_ntoa (client_addr.sin_addr))
If (send (new_fd, hello, strlen (hello), 0) =-1)
{
Fprintf (stderr, "Write Error:%s\ n", strerror (errno))
Exit (1)
}
Close (new_fd)
}
Close (sockfd)
Exit (0)
}
Write a Makefile file to the server program, as follows:
PHP Code:
# start
CC = arm-elf-gcc
CFLAGS =-pipe PICS _-fpic-msingle-pic-base-O2-pipe-Wall-g
LDFLAGS =-Wl,-elf2flt
LIBS =
OBJS = tcpserver.o
All: tcpserver
Tcpser: $(OBJS)
$(CC) $(CFLAGS) $(LDFLAGS)-o tcpserver $(OBJS) $(LIBS)
Clean:
Rm-rf * .o * .elf * .gdb hello
# end
The source code of the client program is as follows:
PHP Code:
/ * tcpclient.c * /
# i nclude
# i nclude
# i nclude
# i nclude
# i nclude
# i nclude
# i nclude
# i nclude
# define RECVBUFSIZE 1024
Int main (int argc, char * argv [])
{
Int sockfd
Char buffer [RECVBUFSIZE]
Struct sockaddr_in server_addr
Int portnumber, nbytes
If (argc! = 3)
{
Fprintf (stderr, "Usage:%s hostname portnumber\ a\ n", argv [0])
Exit (1)
}
If ((portnumber=atoi (argv [2])) < 0)
{
Fprintf (stderr, "Usage:%s hostname portnumber\ a\ n", argv [0])
Exit (1)
}
If ((sockfd = socket (AF_INET, SOCK_STREAM, 0)) =-1)
{
Fprintf (stderr, "Socket Error:%s\ a\ n", strerror (errno))
Exit (1)
}
Bzero (& server_addr, sizeof (server_addr))
Server_addr.sin_family = AF_INET
Server_addr.sin_port = portnumber
Server_addr.sin_addr.s_addr = inet_addr (argv [1])
If (connect (sockfd, (struct sockaddr *) (& server_addr), sizeof (struct sockaddr)) =-1)
{
Fprintf (stderr, "Connect Error:%s\ a\ n", strerror (errno))
Exit (1)
}
If ((nbytes = recv (sockfd, buffer, RECVBUFSIZE, 0)) =-1)
{
Fprintf (stderr, "Read Error:%s\ n", strerror (errno))
Exit (1)
}
Buffer [nbytes] ='\ 0'
Printf ("I have received:%s\ n", buffer)
Close (sockfd)
Exit (0)
}
Finally, extract boot.rom from the Fedora SkyEye-binary-testutils-1.1.0.tar.bz2/at91x40/uclinux1 package, use the method in step 6, put the tcpserver program in the bin directory of boot.rom, run tcpserver 2000 on the target board and run on the host. / tcpclient 10.0.0.2 2000 to see the results! The comments of the source code of the program are not given here, you can refer to some books of Linux network programming.
8. Compile and run uClinux-dist-20030909.tar.gz
To http://www.cnblogs.com/leivo/admin/ftp://166.111.68.183/pub/embed/uclinux/soft/
Or download from http://www.cnblogs.com/leivo/admin/ftp://166.111.8.229/OS/Embeded/uclinux/pub/uClinux/dist
UClinux-dist-20030909.tar.gz
Suppose you download it to the / usr/src/ directory, and then execute the following command:
Tar zxvf uClinux-dist-20030909.tar.gz
Cd uClinux-dist/
The command make xconfig is available in graphical mode
Or
Use the command make menuconfig in the command line mode
Select GDB/ARMulator in vendor/product
Kernel version selection 2.4
And then save and exit
Run the following two lives:
Make dep
Make
The executable file linux will be generated in the / usr/src/uClinux-dist/linux-2.4.x directory
Files such as romfs.img will be generated in / usr/src/uClinux-dist/images/
Create the skyeye configuration file skyeye.conf of the simulation AT91 under the uClinux-dist directory, 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"
At this point, you can debug and run kernel with skyeye, and execute the following command on / usr/src/uClinux-dist:
Skyeye linux-2.4.x/linux
(skyeye) target sim
(skyeye) load
(skyeye) run
Kernel start.
Note:
To execute skyeye linux-2.4.x/linux in the same directory as Fedora SkyEye.conf
9. Add network functions
a. Operate with root users.
b. You need to see if there is tun.o in your / lib/modules/'uname-r'/kernel/drivers/net/ directory.
If not, you need to compile your linux kernel to get tun.o.
C. (1) run the tun device module:
# insmod / lib/modules/'uname-r'/kernel/drivers/net/tun.o
If you don't have the device, you need to create it with the following command:
# mkdir / dev/net
# mknod / dev/net/tun c 10 200
(2) run the vnet (Virtual Hub) device module (this step is not required):
Get the source code of vnet, and then create the device:
# mknod / dev/net/vnet c 10 201
# chmod 666 / dev/net/vnet
Create vnet.o
# make vnet.o
Insert module vnet.o
# insmod vnet.o
Enter the test directory and use test to measure vnet.o
# cd test
# make
#. / testvnet1
d. Configure the Fedora SkyEye.conf file
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"
# format: state= "on" / off mac= "xx": xx:xx:xx:xx:xx ethmod= "tuntap" / vnet hostip= "dd" .dd.dd.dd
Net: state= "on", mac= "0": 4 mac= 3 mac= 2 1 mac= f, ethmod= "tun", hostip= "10" .0.0.1
Some of the above parameters are described below:
State=on/off means whether the simulated NIC (network interface board) is wired or wireless
MAC address of the mac= emulation adapter
Virtual devices used by ethmod=tuntap/vnet in the host environment
Hostip= means the IP used by the host environment to interact with keyeye
Format: state= "on" / off mac= "xx": xx:xx:xx:xx:xx ethmod= "tuntap" / vnet hostip= "dd" .dd.dd.dd
For example:
# set nic info state= "on" / off mac= "xx": xx:xx:xx:xx:xx ethmod= "tuntap" / vnet hostip= "dd" .dd.dd.dd
Net: state= "on", mac= "0": 4 mac= 3 mac= 2 1 mac= f, ethmod= "tun", hostip= "10" .0.0.1
Or
Net: state= "on", mac= "0": 4 mac= 3 mac= 2 1 mac= f, ethmod= "vnet", hostip= "10" .0.0.1
Note:
If you want to run two or more skyeye at the same time, use a different skyeye.conf for each skyeye
e. Run Fedora SkyEye linux-2.4.x/linux
10. After installing Fedora SkyEye, what will you do next?
1. For beginners, beginners and beginners of embedded operating systems, they can read some textbooks and books about operating systems and embedded operating systems, such as books related to uC/OS, Minix, uClinux, Linux and so on. Then you can develop some simple application examples on Fedora SkyEye (such as inter-process communication, process priority, deadlock, network applications, etc.), modify and extend some operating system functions (such as process scheduling, memory management, network subsystem, file subsystem, etc.), and run and debug through Fedora SkyEye to see what happens.
2. For experienced software engineers, it is worth doing to develop a certain application system prototype on Fedora SkyEye. For example, porting or developing a file subsystem or network subsystem to a specific operating system is believed to be easier than developing on a real development board. It is also a challenging task to port and develop some operating systems on Fedora SkyEye (such as porting RTLinux, RTAI and other operating systems to Skyeye).
3. For hardware engineers, it is meaningful to expand Fedora SkyEye and design new hardware simulation (such as USB, IDE hard disk, etc.) to make the hardware simulation function of Skyeye more powerful and support more functional software.
Thank you for reading! This is the end of this article on "how to install cross-compilers for Fedora SkyEye". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.