How to use gPXE with RHEL 5.4 (qemu-kvm 0.9.1)


QEMU/KVM in RedHat Enterprise Linux 5.4 uses a version based on qemu 0.9.1 with kvm-83. The etherboot roms are included by default in that package.

In order to use the gPXE some patches may be applied to the qemu source as well as to gPXE source.

Problem Description

The Etherboot roms fit into 64k of option rom but gPXE roms may be bigger than 64k.

The qemu patches allow the larger roms to load into the BIOS.

Note: Newer versions of qemu may already include full gPXE support and compatibility.

We could stop there but there is a problem with QEMU BIOS not being PnP compatible so the int19 boot interrupt is hooked instead. The default gPXE behaviour when this happens is to always attempt network boot first if the gPXE option rom is loaded and the user does not press N to stop it.

The gPXE patch changes the prompt to 'Press N to skip booting' to 'Press N to boot from' along with the necessary logic. This makes the default to skip network booting and prefer the boot setting stored in register by the Boot Menu or by the QEMU -boot option.

Additionally, changing the prompt timeout to 0 will completely remove the prompt so it behaves more like the etherboot roms do.

Software Used

Software used in this HowTo:

Please use other resources for how to download and build from source.

QEMU Patches

Apply these two patches to qemu source (if necessary)…

Compute checksum for roms bigger than a segment

Get roms more room:

gPXE 1.0.0 Patch

diff -urp gpxe-1.0.0/src/arch/i386/prefix/romprefix.S gpxe-1.0.0-mod/src/arch/i386/prefix/romprefix.S
--- gpxe-1.0.0/src/arch/i386/prefix/romprefix.S	2010-02-02 08:12:44.000000000 -0800
+++ gpxe-1.0.0-mod/src/arch/i386/prefix/romprefix.S	2010-02-09 13:47:02.000000000 -0800
@@ -912,17 +912,20 @@ int19_entry:
        movw	$int19_message_done, %si
        call	print_message
        jz	1f
-	/* Leave keypress in buffer and start gPXE.  The keypress will
-	 * cause the usual initial Ctrl-B prompt to be skipped.
-	 */
-	pushw	%cs
-	call	exec
-1:	/* Try to call original INT 19 vector */
+	/* Try to call original INT 19 vector */
        movl	%cs:orig_int19, %eax
        testl	%eax, %eax
        je	2f
        ljmp	*%cs:orig_int19
+1:	/* Leave keypress in buffer and start gPXE.  The keypress will
+	 * cause the usual initial Ctrl-B prompt to be skipped.
+	 */
+	pushw	%cs
+	call	exec
2:	/* No chained vector: issue INT 18 as a last resort */
        int	$0x18
        .size	int19_entry, . - int19_entry
@@ -931,7 +934,7 @@ orig_int19:
        .size	orig_int19, . - orig_int19

-	.asciz	"Press N to skip booting from "
+	.asciz	"Press N to boot from "
        .size	int19_message_prompt, . - int19_message_prompt
        .asciz	"..."

The BANNER_TIMEOUT value in gpxe-1.0.0/src/config/general.h may also need to be changed to 0 so the int19_message_prompt is skipped.

James Ko

QR Code
QR Code appnotes:gpxeonqemu091 (generated for current page)