Network configuration under Linux Fedora 8 for QEMU MINI2440

Publisher:科技先锋Latest update time:2024-06-25 Source: elecfansKeywords:QEMU  MINI2440  Linux  Fedora Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Recently, at the request of a friend, I studied the simulation under QEMU MINI2440. I thought this process was nothing, but I found a lot of problems in this study. I wrote it down to share with you.


The system environment I used:
1. VMware 6.5 is used, and the host machine uses Windows 7
2. The system on VMWare 6.5 is Linux Fedora 8
3. RTEMS compilation environment 4.9

First, I got the source code from the following website:

1. Get the source code of QEMU: git clone git://repo.or.cz/qemu/mini2440.git qemu
2. Get the source code of UBOOT: git clone git://repo.or.cz/u-boot-openmoko/mini2440.git uboot

(Note: The version of QEMU is the version submitted by Michel Pollet on 2009/5/21 0:28:03, and the version of uboot is the version submitted by Michel Pollet on 2010/4/26 23:47:44

At the bottom, there are links to these two versions)

First compile QEMU:
cd qemu
./configure --target-list=arm-softmmu
make

Compile UBOOT. Note that I use the ARM compilation tool of RTEMS 4.9. Use

cd uboot

gedit Makefile #(Change CROSS_COMPILE=arm-linux- in line 140 to CROSS_COMPILE=arm-rtems4.9-)
export PATH=/opt/rtems-4.9/bin:$PATH
make mini2440_config
make -j16
cp u-boot.bin ../qemu/mini2440The

process went smoothly, but then the nightmare came...

Enter the qemu folder and enter:

./mini2440/mini2440_start.shThere

is a problem here:
1. If QEMU was not installed when compiling, that is, make install, then you need to open mini2440/mini2440_start.sh and change qemu-img in line 16 to: $base/../qemu-img

2. If QEMU was installed when compiling, that is, make install, ignore this step.

The expected screen did not appear. Instead, it was:

/etc/qemu-ifup: could not launch network script
Could not initialize device 'tap'So

began a long journey to find the problem. Most of the solutions on the Internet were based on Ubuntu . There were few valuable solutions for Fedora 8:
1. Some on the Internet said that the kernel did not have a tun module, but I did have it, so I entered the following commands:
modprobe tun; lsmod | grep tun
The system displayed: tun 11713 0

2. Some people on the Internet say that the permissions of /etc/net/tun are incorrect. Enter the following command:
ls -l /dev/net/tun
crw-rw-rw- 1 root root 10, 200 2011-03-16 07:05 /dev/net/tun
Obviously, it is not. Please note that if some friends have this problem, you can use the following command to solve it:
mkdir /dev/net
mknod /dev/net/tun c 10 200
chmod 666 /dev/net/tun

3. Regarding the script permissions of /etc/qemu-ifup, the following command has been entered:
chmod 777 /etc/qemu-ifup

chmod 777 /etc/qemu-ifdown

4. You need to install uml-utilies and bridge-utils:
For fedora 8, use the command:
yum install bridge-utils
to install it easily.

(bridge-utils-1.2-2.fc8.i386.rpm is available for download

Install using rpm -U bridge-utils-1.2-2.fc8.i386.rpm)

But uml-utilities is not installed through yum install uml-utilities, there is no such package.
Instead, I downloaded: uml-utilities-20040406-75.i586.rpm,
and used the command rpm -U uml-utilities-20040406-75.i586.rpm
to complete the installation. After these two packages are installed, the tunctl and brctl commands are available in the system.

It is still: /etc/qemu-ifup: could not launch network script ...
This is dumbfounded. After careful consideration, I think it is a problem with QEMU's own code.
So I traced the code a little bit and found that the static int launch_script(const char *setup_script, const char *ifname, int fd) function on line 1023 in the net.c code in qemu
always returns -1.
It turns out that the execv(setup_script, args); function on line 1045 did not successfully start the script.
The print function was added and errno was 8, that is,

ENOEXEC

The new process image file has the appropriate access permissions, but is not in the proper format.

This means that the permissions are fine, but the format is wrong. Oh, could it be that the exec function family cannot directly start the script?
Haha, BUG, ​​absolutely BUG.

So change the code as follows:

static int launch_script(const char *setup_script, const char *ifname, int fd)
{
int pid, status;
char *args[4]; /* bacon modified */
char **parg;

/* try to launch network script */
pid = fork();
if (pid >= 0) {
if (pid == 0) {
char path[20];/* bacon add */
int open_max = sys conf (_SC_OPEN_MAX), i;
for (i = 0; i < open_max; i++)
if (i != STDIN_FILENO &&
i != STDOUT_FILENO &&
i != STDERR_FILENO &&
i != fd)
close(i);

parg = args;
strcpy(path, "/bin/bash");/*bacon add*/

*parg++ = (char *)path; /* bacon add*/
*parg++ = (char *)setup_script;
*parg++ = (char *)ifname;
*parg++ = NULL;

status = execv(path, args);/*bacon add*/
fprintf(stderr, "error:%d %d %d %s %s/n", status, errno, ENOEXEC, setup_script, ifname);/*bacon add for debug.*/
_exit(1);
}
while (waitpid(pid, &status, 0) != pid);
if (!WIFEXITED(status) ||
WEXITSTATUS(status) != 0) {
fprintf(stderr, "%s: could not launch network script/n",
setup_script);
return -1;
}
}
return 0;
}

Type the command:
make;./mini2440/mini2440_start.sh


The script prompts that the tunctl command and ifconfig command cannot be found.
Haha, this means that there is a problem with the path. I checked the path in the code carefully and there is no problem. It can be considered that there is a problem with the path in the scripts qemu-ifup and qemu-ifdown.
So all commands use absolute paths. The content of my qemu-ifup script is as follows:

/usr/bin/tunctl -t $1
/sbin/ifconfig $1 10.0.0.4 netmask 255.255.255.0 up
sleep 2The

content of my qemu-ifdown script is as follows:

/sbin/ifconfig $1 down
/usr/bin/tunctl -d $1
sleep 2Using

10.0.0.4 is to save trouble. The address of the uboot default server is 10.0.0.4. Haha, you don’t have to type a lot of commands in uboot. Note that sleep is required. After fork, the child process will exit as soon as it finishes running, and the parent process will get an error result, thinking that the script has not been executed and failed.

I also installed a tftp server to test the network boot function of uboot, which was completed successfully.

(You can refer to the great person http://www.linuxidc.com/Linux/2011-09/42196.htm to achieve)
Some friends may need qemu to access the Internet or real LAN from the host network, and the configuration process is not complicated. I will write about it in the subsequent blog post. Finally, there are pictures and truth...

Finally, considering that some friends are just starting to do these things and it is inconvenient to find them, I have packaged them for you. Enjoy it!!!

The download address of relevant files is in the No. 1 FTP server of Linux Commune, download address:

FTP address: ftp://www.linuxidc.com

Username: www.linuxidc.com

Password: www.muu.cc

Network configuration under Linux Fedora 8 on QEMU MINI2440 in LinuxIDC.com September 2011

Download method can be found here http://www.linuxidc.net/thread-1187-1-1.html


Keywords:QEMU  MINI2440  Linux  Fedora Reference address:Network configuration under Linux Fedora 8 for QEMU MINI2440

Previous article:GUI porting on MINI2440 QEMU's eCos
Next article:eCos network function test in mini2440 Qemu

Recommended ReadingLatest update time:2024-11-16 09:30

Audio-enabled applications based on simple 8-bit MCUs
Audio capture and playback is becoming a necessity for many microcontroller (MCU)-based applications. However, the range of audio support in terms of fidelity and codecs is very wide. You can host an audio-enabled application using a platform based on a simple 8-bit MCU, but high-quality audio may require a digital
[Embedded]
Audio-enabled applications based on simple 8-bit MCUs
Let's learn mini2440 bare metal development (Thirteen) --ADC principle and experiment
Overview The CMOS analog-to-digital converter ADC of S3C2440 can perform cyclic detection on 8-channel analog input signals. The ADC of S3C2440 and the touch screen share the same ADC converter, so learning ADC is also the basis for learning touch screen.     The main features of the S3C2440ADC are as follows:    
[Microcontroller]
Let's learn mini2440 bare metal development (Thirteen) --ADC principle and experiment
How to start the nfs network file system through the vivi command line
In the previous article, we talked about how to enable the nfs network file system of Ubuntu 12.04. Today, let’s study how to use the mini2440 development board of FriendlyArm to start and load the nfs network file system. As mentioned above, the nfs file system directory and service have been configured on Ubuntu.
[Microcontroller]
8.STC15W408AS MCU Timer/Counter
1. Introduction to timer counter STC15W408AS has only timer 0 and timer 2, working in timer or counter mode. The core component of the timer/counter is an adder counter, which essentially counts pulses. The only difference is the source of the counting pulse: if the counting pulse comes from the system clock, it is a
[Microcontroller]
8.STC15W408AS MCU Timer/Counter
How to achieve the lowest power consumption of Atomthreads in STM8S
Atomthreads, like many operating systems, will call idle when there is no task scheduling. (by cpuwolf) sta TI c void atomIdleThread (uint32_t param)  {      /* Compiler warning */      param = param;        /* Loop forever */      while (1)      {          /** todo Provide user idle hooks*/      }  } atomIdleThread
[Microcontroller]
How to achieve the lowest power consumption of Atomthreads in STM8S
Toshiba plans to sell two 8-inch wafer fabs to UMC
MoneyDJ quoted the Nikkan Kogyo Shimbun as reporting that multiple sources familiar with the matter revealed that Toshiba has started negotiations with UMC and plans to sell two wafer fabs to UMC, and the two parties are expected to reach an agreement as early as the end of March 2021. However, the people familiar w
[Mobile phone portable]
STM8L uses DMA in USART to send and receive data
Using USART as an example to use DMA It is divided into two parts. The first is the configuration of the DMA peripheral itself; the second is the configuration of the DMA part of USART. DMA configuration for DMA and USART void SYS_DMA_Init(void) { CLK_PeripheralClockConfig(CLK_Peripheral_DMA1, ENABLE); //Turn on the
[Microcontroller]
Moto G8 Plus specifications and photos exposed, using Snapdragon 665+ and rear triple camera
According to foreign media reports recently, Motorola seems to be preparing to launch a new member of the Moto G8 series, as the specifications and photos of the G8 Plus have been exposed on the Internet. Moto G8 Plus specifications and photos revealed Snapdragon 665+ rear triple camera WinFuture.de pointed out: T
[Mobile phone portable]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号