Network console

The wiki is being retired!

Documentation is now handled by the same processes we use for code: Add something to the Documentation/ directory in the coreboot repo, and it will be rendered to https://doc.coreboot.org/. Contributions welcome!

Qemu Howto

Introduction

Qemu can emulate the ne2k, so why not using it to test the network console...

Howto

Create a tap device(the device will be named tap0 here):

openvpn --mktun --dev tap0

Then create the required files for making the tap interface come up(or down) when qemu starts(or stops): Create /etc/qemu-ifup with the following content:

ip addr add 10.10.10.1/24 dev tap0

And /etc/qemu-ifdown with the following content:

ip addr del 10.10.10.1/24 dev tap0 

I'm not sure if it's necessary but better making both files executables.

Then boot a GNU/Linux distribution:

qemu-system-i386 -no-kvm -bios build/coreboot.rom -serial stdio -m 1024 -net nic,vlan=0,model=ne2k_pci -net tap,vlan=0,ifname=tap0,script=no -hda ../virt/parabola.img -cdrom ../virt/parabola-2012.10.17-dual.iso

Once it is booted, identify the BAR of the ne2k PCI card inside the OS like that:

# lspci 
00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02)
00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]
00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 03)
00:02.0 VGA compatible controller: Cirrus Logic GD 5446
00:03.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8029(AS)

Look for a Realtek Ethernet card, and then do the following on the PCI address of that card:

# lspci -s 00:03.0 -vvvv
00:03.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8029(AS)
	Subsystem: Red Hat, Inc Qemu virtual machine
	Control: I/O+ Mem- BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
	Status: Cap- 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Interrupt: pin A routed to IRQ 11
	Region 0: I/O ports at 0e00 [size=256]
	[virtual] Expansion ROM at e0000000 [disabled] [size=64K]
	Kernel driver in use: ne2k-pci

Here you can see that the BAR 0 is at 0e00, which is the default config in the make menuconfig configuration that we will look at in an instant.

Then do:

make menuconfig

And go in:

Console  --->

Select the following:

[*] Network console over NE2000 compatible Ethernet adapter

Which will make the following appear:

(26:77:e3:c7:5b:dd) Destination MAC address of remote system
(10.10.10.1) Destination IP of logging system
(10.10.10.2) IP address of coreboot system 
(0xe00) NE2000 adapter fixed IO port address

Identify the mac address of the tun0 interface on the host and fill it in "Destination MAC address of remote system":

ip addr show dev tap0
9: tap0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 100
    link/ether 26:77:e3:c7:5b:dd brd ff:ff:ff:ff:ff:ff
    inet 10.10.10.1/24 scope global tap0
       valid_lft forever preferred_lft forever
    inet6 fe80::2477:e3ff:fec7:5bdd/64 scope link 
       valid_lft forever preferred_lft forever

Then fill in the IP of that address that we have put in /etc/qemu-ifup before in "Destination IP of logging system"

Then fill in a compatible IP for the coreboot system.

Run the following command for receiving the coreboot logs:

nc -u -l -p 6666

Then run qemu again like before:

qemu-system-i386 -no-kvm -bios build/coreboot.rom -serial stdio -m 1024 -net nic,vlan=0,model=ne2k_pci -net tap,vlan=0,ifname=tap0,script=no -hda ../virt/parabola.img -cdrom ../virt/parabola-2012.10.17-dual.iso