ps:老兄你现在晚睡早起阿? 原帖由 accessory 于 2009-11-9 01:12 发表 http://linux.chinaunix.net/bbs/images/common/back.gif
To compile QEMU with just i386 and x86_64 support:
./configure --target-list=x86_64-linux-user,i386-linux-user,i386-softmmu,x86_64-softmmu
make -j2
make install
accessory,
上面 ./configure 中的内容是否足够?我在另一个干净的环境中仍然出不来界面.............. 这个我不很确定。你可以先直接 ./configure 试下。另外,编译 qemu的时候需要sdl 库,不过默认应该是在configure的时候检查的。
回复 #62 accessory 的帖子
accessory,还是不行............
有关网卡硬件方面的配置如下:
void init_hard(struct net_dev *rd)
{
u16 temp16
out_byte(rd->iobase + CR, CR_RST);
temp16 = 1000;
while((in_byte(rd->iobase + CR) & CR_RST) && (temp16>0))
{
delay(1);
temp16--;
}
if(temp16>0)
{
printl("RTL8139 reset is OK\n " );
}
else
{
printl("RTL8139 reset is fail\n " );
}
out_byte(rd->iobase + CR9346, 0x0);
out_byte(rd->iobase + CR, CR_RE | CR_TE);
out_byte(rd->iobase + CONFIG1, 0);
out_byte(rd->iobase + CONFIG1,(in_byte(rd->iobase + CONFIG1) & ~0x30) | 0x20);
out_byte(rd->iobase + CONFIG4,in_byte(rd->iobase + CONFIG4) | 0x80);
out_byte(rd->iobase + CR9346,0);
out_word(rd->iobase + RXMISS, 0);
//out_word(rd->iobase + TCR,0x3000200);
out_word(rd->iobase + TCR,0x7000300);
//out_word(rd->iobase + RCR, 0x1E0A);
out_word(rd->iobase + RCR, 0xB0D);
out_word(rd->iobase + RBSTART, rd->rx.paddr);
out_word(rd->iobase + MULINT, 0);
out_word(rd->iobase + TSAD0, rd->tx.paddr);
out_word(rd->iobase + TSAD1, rd->tx.paddr);
out_word(rd->iobase + TSAD2, rd->tx.paddr);
out_word(rd->iobase + TSAD3, rd->tx.paddr);
for(temp8=0; temp8<6; temp8++)
{
rd->mac = in_byte(rd->iobase + IDR0 + temp8 );
}
out_word(rd->iobase + RCR, in_word(rd->iobase + RCR) |0xA );
out_word(rd->iobase + MAR0, 0);
out_word(rd->iobase + MAR0 + 4 , 0);
out_word(rd->iobase + IMR, 0x0000);
//out_word(rd->iobase + IMR, 0xC07F);
out_byte(rd->iobase + IMR, 0x7F);
out_byte(rd->iobase + CR9346, 0);
out_byte(rd->iobase + CR, CR_TE | CR_RE);
if(in_byte(rd->iobase + 0x58 ) & 0x04 )
{
printl("Cable can not conneted\n");
}
}
[ 本帖最后由 sherf 于 2009-11-17 08:34 编辑 ] 我在qemu上跑过linux (rtl8139 nic). 没问题的。你的qemu版本是多少?我用的是 0.10.2
另外,你可以看下linux下的驱动。
http://lxr.linux.no/#linux+v2.6.30/drivers/net/8139too.c#L1367
只看rtl8139_hw_start 函数即可。
还有,你可以仿照下面读一下,看看发送到底打开没。
/* make sure RxTx has started */
1424 tmp = RTL_R8 (ChipCmd);
1425 if ((!(tmp & CmdRxEnb)) || (!(tmp & CmdTxEnb)))
1426 RTL_W8 (ChipCmd, CmdRxEnb | CmdTxEnb); 另外,如果你不相信QEMU里的RTL8139. 可以用个UBUNTU LIVE CD 来启动你的虚拟机试试,看看网络是不是好的.
[ 本帖最后由 accessory 于 2009-11-18 01:06 编辑 ] 原帖由 accessory 于 2009-11-17 11:05 发表 http://linux.chinaunix.net/bbs/images/common/back.gif
我在qemu上跑过linux (rtl8139 nic). 没问题的。你的qemu版本是多少?我用的是 0.10.2
另外,你可以看下linux下的驱动。
http://lxr.linux.no/#linux+v2.6.30/drivers/net/8139too.c#L1367
只看rtl8139_hw ...
已逐步模仿过(除rtl_check_media外),但都不行......
另,在linux 的 source中,除了8139too.c之外,还有一个 8139cp.c,这个是用来干什么的 ? 8139cp 支持新一点的8139. 比如C+. 8139too 只支持老的 8139,比如A,B.
对于QEMU虚拟出来的8139, 2个模块都可以用.
回复 #67 accessory 的帖子
还是没成,已看到 TSAD0 ~ 3已配置好,且数据包已复制到TSD0~3,但就是没有发出去(发出去才会根据ISR转去引发中断处理)。至于网络,我已在另一个虚拟机(qemu里安装windown)确认过网络是通的(使用TAP的情况下),并用相同的配置使用在我目前调试的qemu上... 发送的时候要向 TXSTATUS 写入一个数据长度, 如下: 你程序里加了这段没?RTL_W32_F (TxStatus0 + (entry * sizeof (u32)),
tp->tx_flag | max(len, (unsigned int)ETH_ZLEN));