设为首页 加入收藏

TOP

QEMU MINI2440 的 Linux Fedora 8 下网络配置
2014-11-24 11:15:19 来源: 作者: 【 】 浏览:0
Tags:QEMU MINI2440 Linux Fedora 网络 配置

(注意:QEMU的版本是2009/5/21 0:28:03 Michel pollet提交的版本, uboot是 2010/4/26 23:47:44 Michel Pollet 提交的版本


最下面,有这两个版本的链接资源)


首先编译QEMU:
cd qemu
./configure --target-list=arm-softmmu
make

编译 UBOOT,这里注意,我使用的是RTEMS 4.9的ARM编译工具,使用


cd uboot


2.有些网上说是/etc/net/tun的权限不对,输入以下命令:
ls -l /dev/net/tun
crw-rw-rw- 1 root root 10, 200 2011-03-16 07:05 /dev/net/tun
很显然,也不是。这里注意一下,如果有些童鞋这步问题,可以采用以下命令解决:
mkdir /dev/net
mknod /dev/net/tun c 10 200
chmod 666 /dev/net/tun


3.关于/etc/qemu-ifup的脚本权限,已经输入以下命令:
chmod 777 /etc/qemu-ifup


chmod 777 /etc/qemu-ifdown


4.需要安装uml-utilies和bridge-utils:
对于fedora 8,使用命令:
yum install bridge-utils
很轻松的安装上了。


(有bridge-utils-1.2-2.fc8.i386.rpm可以供下载


使用 rpm -U bridge-utils-1.2-2.fc8.i386.rpm 安装)


但uml-utilies安装不是通过yum install uml-utilies,没有这个包。
而是下载:uml-utilities-20040406-75.i586.rpm,
使用命令 rpm -U uml-utilities-20040406-75.i586.rpm
完成安装的。这两个包安装完毕,系统里才有tunctl、brctl命令。

依旧是:/etc/qemu-ifup:could not launch network script ……
这下傻眼了。仔细考虑一下,我认为是QEMU自身代码的问题。
于是稍微跟踪了一下代码,发现qemu中的net.c代码,第1023行的
static int launch_script(const char *setup_script, const char *ifname, int fd)函数老是返回 -1。
原来是第1045行的execv(setup_script, args);函数没有成功启动脚本,
加了打印函数,errno 是 8,即


ENOEXEC

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


意思是,权限没有问题,但是格式不对。哦,难道是exec函数族不能直接启动脚本?
呵呵,BUG,绝对的BUG。

于是更改代码如下:

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 = sysconf (_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;
}

键入命令:
make;./mini2440/mini2440_start.sh


】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇eCos在mini2440 Qemu的网络功能测.. 下一篇ARM学习心得之 TFTP安装配置

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·Redis on AWS:Elast (2025-12-27 04:19:30)
·在 Spring Boot 项目 (2025-12-27 04:19:27)
·使用华为开发者空间 (2025-12-27 04:19:24)
·Getting Started wit (2025-12-27 03:49:24)
·Ubuntu 上最好用的中 (2025-12-27 03:49:20)