Linux vanilla kernel on QEMU and networking with eth0

六眼飞鱼酱① 提交于 2019-12-24 10:59:00

问题


I have downloaded and compiled vanilla linux kernel (3.7.1) I used busybox for ramdisk then I booted it using QEMU. This is my QEMU command line

qemu-system-i386 -kernel bzImage -initrd ramdisk.img -append "root=/dev/ram rw console=ttyS0 rdinit=/bin/ash" -nographic -net nic -net user

everything goes well. However, I can't use networking on vanilla kernel with busybox.

'ifup eth0' tells me

/ # ifup eth0
ip: SIOCGIFFLAGS: No such device

I googled the Internet but can' get any clue... some advice would be nice thank you in advance.


回答1:


Most probably there is no driver (in your example is should be e1000) loaded or the device has another name.

In /sys/class/net/ you should find a listing of all available net-devices. If there is none (besides lo) the driver is not loaded.

In qemu monitor type "info pci" and it will show you the PCI-address of your ethernet card. It should look like this:

...
Bus  0, device   3, function 0:
  Ethernet controller: PCI device 8086:100e
...

This device corresponds to /sys/devices/pci0000:00/0000:00:03.0/. The files "vendor" and "device" must contain "0x8086" and "0x100e" which is the PCI-id from above and by which the kernel determines the driver to load.

Try to load it manually with "modprobe e1000" or insmod. If loaded there must be a symlink named "driver". If not "dmesg" should give you the reason why not.



来源:https://stackoverflow.com/questions/24444903/linux-vanilla-kernel-on-qemu-and-networking-with-eth0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!