[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-discuss] Customizing emulated boards?

From: Alexander Duff
Subject: [Qemu-discuss] Customizing emulated boards?
Date: Wed, 13 Apr 2016 11:04:32 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0


I'm emulating routers running OpenWrt for ARM using the realview-eb-mpcore machine and I've run into the problem of not being able to create more than one NIC. For what it's worth, when specifying that the NIC should be an smc91c111, qemu-system-arm -M realview-eb-mpcore says that this machine doesn't support that device. When the device is unspecified, it defaults to the smc91c111 once the machine is booted. Every NIC after the first defaults to rtl8139, but emulation of the PCI bus is missing (I am unsure if it's missing due to the OpenWrt kernel built for ARM or something in QEMU) so these devices show in QEMU's monitor, but not on the guest.

Since it's a router, I would very much like to have more than one ethernet port. I downloaded the QEMU source and looked through it to see how the devices are created and assigned. In realview.c (lines 265 through 281), I found the following code:

    for(n = 0; n < nb_nics; n++) {
        nd = &nd_table[n];

        if (!done_nic && (!nd->model ||
strcmp(nd->model, is_pb ? "lan9118" : "smc91c111") == 0)) {
            if (is_pb) {
                lan9118_init(nd, 0x4e000000, pic[28]);
            } else {
                smc91c111_init(nd, 0x4e000000, pic[28]);
            done_nic = 1;
        } else {
            if (pci_bus) {
                pci_nic_init_nofail(nd, pci_bus, "rtl8139", NULL);

So my understanding is that it checks to see if a NIC has been created. If it hasn't, it creates an smc91c111 NIC and maps it to 0x4e000000, then sets "done_nic" to 1 and creates all subsequent NICs as rtl8139 devices.

So, I have the following questions:

1) Could I make my own customized board by more-or-less copying the realview.c file and changing this section so that the first 8 or so NICs (however many I can fit in that memory space) are smc91c111 devices and offset them by the space it takes (I want to say 16 but I'll double check first)? The next address on the memory map is 0x4f00000000 (USB, which I don't need anyway).

2) Is there any documentation on programming a custom board? In this case, I don't think I need it, but it would be good to have. I apologize if I've missed it, there are a lot of moving parts in this endeavor.

3) Is there a simpler way to get more than one ethernet port on a virtualized ARM machine? I've been working on this for a long time and I'm afraid I'm getting tunnel vision and missing an obvious solution.

4) Is this the right mailing list? I've never done this before, so I apologize if the dev mailing list would have been better. If there's a better place to ask this question or if anyone can point me in the right direction, I would be grateful for that information. I already posted on the OpenWrt forums and received 0 replies.

Thank you very much, and I appreciate any help I can get on this.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]