Transcript slides

Enabling Palacios PXE-Boot
Chen Jin
Bharath Pattabiraman
Patrick Foley
What is PXE?
• Preboot eXecution Environment - a standard for booting
an OS from the network. Most machines’ BIOSes
support PXE. But, the BIOS used by Palacios does not.
• Capability to boot independent of data storage devices
(like hard disks) or installed OS'es.
• Defined on the foundation of widely used internet
protocols such as DHCP, and TFTP.
Our Goal
• Add PXE network boot support to a Palacios guest so
that we can network-boot VMs.
o Change the BIOS (or)
o Find any other alternative solution
How does it work?
Step 1: Client makes DHCP request (broadcast) for IP
address
Step 2: DHCP Server responds with IP address and also the
next-server, which is the IP address of the boot server
that contains the bootloader. It also sends the file name
that should be used for booting.
Step 3: Client contacts the boot server (using the TFTP Trivial FTP protocol)
How does it work? (contd...)
Step 4: Boot server replies with bootloader.
Step 5: Client loads bootloader into memory.
Step 6: Boot loader retrieves other files needed for
booting from boot server and starts the booting process.
The files required to be present in the TFTP server are:
pxelinux.0 - boot loader for linux-like OS for PXE
bzImage - the compressed kernel image
init_task - the initial root filesystem
How does it work?
Client and Server setup
• Server side
o DHCP and TFTP server running on server side
o Knoppix (debian-based OS) which has these servers
preinstalled was used on one Qemu
o Configured the servers and created a hard drive image
• Client side
o Kitten/Palacios running on another Qemu
Server side Setup
DHCP Server configuration:
subnet 172.21.0.0 netmask 255.255.0.0 {
range 172.21.0.3 172.21.0.100;
option broadcast-address 172.21.0.255;
}
group {
next-server 172.21.0.2;
host test {
fixed-address 172.21.0.50;
hardware ethernet 52:54:00:12:34:57;
filename "pxelinux.0";
}
}
Server side Setup
TFTP Server setup:
• When a client boots up it will check if there is a file
corresponding to its own MAC address in the
/var/lib/tftpboot/pxelinux.cfg/ directory.
• However after trying several options it will fall back to
requesting a default file.
• So, we simply changed to default file to contain the
configuration we want.
DEFAULT kitten
LABEL kitten
kernel bzImage
append serial.baud=115200 console=serial initrd=init_task
• The pxelinux.0, bzImage and init_task files were
placed in the tftpboot directory
Implementation
• Create a test bench for PXE booting, which
need consider both server and client
o
o
o
Hard drive image
Tap device
VLAN
• Boot guest os in kitten
o
o
Boot PXE on client direcly to make sure rom omatic approcach
working
NIC problems
Server
• Hard drive image
o in order to avoid reconfiguring the system
every time we use the Qemu, we decided to
create hard drive image which saves all the
configuration status.
Server (cont'd)
• Default
o "-net nic -net user
• Tap device
o Host
 Create the /dev/net/tun device node
mkdir /dev/net
mknod /dev/net/tun c 10 200
 Setup the tap0 interface,
sudo tunctl //Create the tap0 interface using tunctl
sudo ifconfig tap0 192.168.100.1 up
o
guest
-net tap,ifname=tap0
enter 192.168.100.2 as the ip address
Tap Device
-net tap,ifname=tap0
Server-client connection
• VLAN
-net nic,vlan=0,macaddr=52:54:00:12:34:56,model=e1000
Guest NIC
OS
VLAN 0
tap
…
socket
VLANs
-net nic,vlan=0,macaddr=52:54:00:12:34:56,model=e1000
-net socket,vlan=0,listen=localhost:9000
-net nic,vlan=2,macaddr=52:54:00:12:34:57,model=ne2k_pci
-net socket,vlan=2,connect=localhost:9000
Guest
A
Guest
B
tap
NIC
NIC
VLAN 0
…
socket
VLAN 2
…
tap
socket
gPXE
• Reboot the client machine with gpxe iso
image
• http://rom-o-matic.net/
• It worked, yeah!
• Happiness didn’t last long
Final Step
• Is it possible to start a VM that contains
just gpxe.
Reboot Guest in kitten/palacios
• PCI NICs
o
E1000 / rtl8139
 DMA execution: the devices write to Guest physical
memory directly. (offset is needed)
o
ne2k_pci (there is no gpxe iso image available)
• ne2k_isa
o
o
o
Requests from client are delivered, however the packets
sent from server are dropped
Port I/O to receive the packets
NIC device interrupt is not handled
• Modification in Palacios
o
o
v3_hook_passthrough_irq(...)
v3_raise_irq(...)
A lot of thanks to Prof.Dinda and Lei Xia!