. prerequiresites:
- DHCP/TFTP, so that you can netboot with PXE;
1) create an standalone grub efi image:
sudo grub2-mkstandalone -d /usr/lib/grub/x86_64-efi/ -O x86_64-efi --fonts="unicode" -o grub2.efi /boot/grub/grub.cfg=/tftpboot/netgrub.cfg
netgrub.cfg is something like:
set timeout=5
# linux (tftp)/vmlinuz
menuentry 'Linux diskless' --class gentoo --class gnu-linux --class gnu --class os {
insmod net
insmod efinet
insmod tftp
insmod http
insmod gzio
insmod part_gpt
insmod efi_gop
insmod efi_uga
set net_default_server=192.168.1.1
net_add_addr eno0 efinet0 192.168.1.81
echo 'Network status: '
net_ls_cards
net_ls_addr
net_ls_routes
echo 'Loading Linux ...'
linux (tftp)/vmlinuz root=/dev/nfs rw nfsroot=192.168.1.11:/exports/nfs/gentoo ip=on
}
and let DHCP server send grub2.efi (filename=grub2.efi) to our client (192.168.1.81).
2) build OVMF from EDK2.
3) running a recent qemu (>= 1.6.0)
sudo qemu-system-x86_64 -enable-kvm -m 2048 -vga qxl -L . -bios OVMF.fd -device virtio-net-pci,romfile=,netdev=mynet0,mac=00:12:34:56:78:9a -netdev tap,script=/etc/qemu/qemu-ifup,id=mynet0 -vnc :30
- Because we use macaddr above, need make sure DHCP server configure macaddr from above to ip address 192.168.1.81.
- Make sure romfile is empty, which will use OVMF virtio-net-pci driver instead of iPXE virtio-net-pci driver (in my case it runs into error: failure at drivers/bus/virtio-ring.c:69)
4) vncview :30 and check status.
Note:
a) In theory this can also boot a box supports PXE into EFI mode (diskless), so that you don't have to create a EFI boot disk (I don't like this way).
dmesg from booted linux with above method:
http://pastebin.com/84xEtwMS
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment