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

[Xen-changelog] [xen-unstable] [HVM] Add Etherboot option ROM, for network-booting HVM guests.



# HG changeset patch
# User Tim Deegan <Tim.Deegan@xxxxxxxxxxxxx>
# Date 1166615994 0
# Node ID b258c7587d8ddf5dbdae872ea54e74a119dbfd1f
# Parent  e2fcb70bec59f49f06fdccc8e417d1096b391af1
[HVM] Add Etherboot option ROM, for network-booting HVM guests.
Signed-off-by: Tim Deegan <Tim.Deegan@xxxxxxxxxxxxx>
---
 tools/examples/xmexample.hvm         |    4 ++--
 tools/firmware/etherboot/README      |    7 +++++++
 tools/firmware/hvmloader/Makefile    |    3 ++-
 tools/firmware/hvmloader/hvmloader.c |   29 +++++++++++++++++++++++++++++
 firmware/etherboot/eb-rtl8139.zrom   |    0 
 5 files changed, 40 insertions(+), 3 deletions(-)

diff -r e2fcb70bec59 -r b258c7587d8d tools/examples/xmexample.hvm
--- a/tools/examples/xmexample.hvm      Wed Dec 20 11:57:53 2006 +0000
+++ b/tools/examples/xmexample.hvm      Wed Dec 20 11:59:54 2006 +0000
@@ -29,7 +29,7 @@ memory = 128
 
 # Shadow pagetable memory for the domain, in MB.
 # Should be at least 2KB per MB of domain memory, plus a few MB per vcpu.
-shadow_memory = 8
+# shadow_memory = 8
 
 # A name for your domain. All domains must have different names.
 name = "ExampleHVMDomain"
@@ -116,7 +116,7 @@ device_model = '/usr/' + arch_libdir + '
 device_model = '/usr/' + arch_libdir + '/xen/bin/qemu-dm'
 
 #-----------------------------------------------------------------------------
-# boot on floppy (a), hard disk (c) or CD-ROM (d) 
+# boot on floppy (a), hard disk (c), Network (n) or CD-ROM (d) 
 # default: hard disk, cd-rom, floppy
 #boot="cda"
 
diff -r e2fcb70bec59 -r b258c7587d8d tools/firmware/etherboot/README
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/firmware/etherboot/README   Wed Dec 20 11:59:54 2006 +0000
@@ -0,0 +1,7 @@
+
+This is an Etherboot option ROM for the rtl8139 NIC.  It has a few
+non-standard settings, just to do with timeouts and when to give up.
+
+Rom-o-matic.net will provide this image at the following URL:
+
+http://rom-o-matic.net/5.4.2/build.php?version=5.4.2&F=ignore&nic=rtl8139%3Artl8139+--+%5B0x10ec%2C0x8139%5D&ofmt=Binary+ROM+Image%28.zrom%29&arch=i386&ASK_BOOT=-1&BOOT_FIRST=BOOT_NIC&BOOT_SECOND=BOOT_NOTHING&BOOT_THIRD=BOOT_NOTHING&BOOT_INDEX=0&STATIC_CLIENT_IP=&STATIC_SUBNET_MASK=&STATIC_SERVER_IP=&STATIC_GATEWAY_IP=&STATIC_BOOTFILE=&EXIT_ON_FILE_LOAD_ERROR=on&DHCP_CLIENT_ID=&DHCP_CLIENT_ID_LEN=&DHCP_CLIENT_ID_TYPE=&DHCP_USER_CLASS=&DHCP_USER_CLASS_LEN=&ALLOW_ONLY_ENCAPSULATED=on&DEFAULT_BOOTFILE=&CONGESTED=on&BACKOFF_LIMIT=7&TIMEOUT=180&TRY_FLOPPY_FIRST=0&EXIT_IF_NO_OFFER=on&TAGGED_IMAGE=on&ELF_IMAGE=on&PXE_IMAGE=on&DOWNLOAD_PROTO_TFTP=on&COMCONSOLE=0x3F8&CONSPEED=9600&COMPARM=0x03&PXE_EXPORT=on&CONFIG_PCI=on&CONFIG_ISA=on&BUILD_ID=&PCBIOS=on&A=Get+ROM
diff -r e2fcb70bec59 -r b258c7587d8d tools/firmware/etherboot/eb-rtl8139.zrom
Binary file tools/firmware/etherboot/eb-rtl8139.zrom has changed
diff -r e2fcb70bec59 -r b258c7587d8d tools/firmware/hvmloader/Makefile
--- a/tools/firmware/hvmloader/Makefile Wed Dec 20 11:57:53 2006 +0000
+++ b/tools/firmware/hvmloader/Makefile Wed Dec 20 11:59:54 2006 +0000
@@ -51,11 +51,12 @@ acpi/acpi.a:
 acpi/acpi.a:
        $(MAKE) -C acpi
 
-roms.h:        ../rombios/BIOS-bochs-latest ../vgabios/VGABIOS-lgpl-latest.bin 
../vgabios/VGABIOS-lgpl-latest.cirrus.bin ../vmxassist/vmxassist.bin
+roms.h:        ../rombios/BIOS-bochs-latest ../vgabios/VGABIOS-lgpl-latest.bin 
../vgabios/VGABIOS-lgpl-latest.cirrus.bin ../vmxassist/vmxassist.bin 
../etherboot/eb-rtl8139.zrom
        sh ./mkhex rombios ../rombios/BIOS-bochs-latest > roms.h
        sh ./mkhex vgabios_stdvga ../vgabios/VGABIOS-lgpl-latest.bin >> roms.h
        sh ./mkhex vgabios_cirrusvga ../vgabios/VGABIOS-lgpl-latest.cirrus.bin 
>> roms.h
        sh ./mkhex vmxassist ../vmxassist/vmxassist.bin >> roms.h
+       sh ./mkhex etherboot ../etherboot/eb-rtl8139.zrom >> roms.h
 
 .PHONY: clean
 clean:
diff -r e2fcb70bec59 -r b258c7587d8d tools/firmware/hvmloader/hvmloader.c
--- a/tools/firmware/hvmloader/hvmloader.c      Wed Dec 20 11:57:53 2006 +0000
+++ b/tools/firmware/hvmloader/hvmloader.c      Wed Dec 20 11:59:54 2006 +0000
@@ -34,6 +34,7 @@
 /* memory map */
 #define HYPERCALL_PHYSICAL_ADDRESS    0x00080000
 #define VGABIOS_PHYSICAL_ADDRESS      0x000C0000
+#define ETHERBOOT_PHYSICAL_ADDRESS    0x000C8000
 #define VMXASSIST_PHYSICAL_ADDRESS    0x000D0000
 #define ROMBIOS_PHYSICAL_ADDRESS      0x000F0000
 
@@ -279,6 +280,27 @@ static void pci_setup(void)
     }
 }
 
+static 
+int must_load_nic(void) 
+{
+    /* If the network card is in the boot order, load the Etherboot 
+     * option ROM.  Read the boot order bytes from CMOS and check 
+     * if any of them are 0x4. */
+    uint8_t boot_order;
+
+    /* Read CMOS register 0x3d (boot choices 0 and 1) */
+    outb(0x70, 0x3d);
+    boot_order = inb(0x71);
+    if ( (boot_order & 0xf) == 0x4 || (boot_order & 0xf0) == 0x40 ) 
+        return 1;
+    /* Read CMOS register 0x38 (boot choice 2 and FDD test flag) */
+    outb(0x70, 0x38);
+    boot_order = inb(0x71);
+    if ( (boot_order & 0xf0) == 0x40 ) 
+        return 1;
+    return 0;
+}
+
 int main(void)
 {
     int acpi_sz;
@@ -310,6 +332,13 @@ int main(void)
         printf("Loading Standard VGABIOS ...\n");
         memcpy((void *)VGABIOS_PHYSICAL_ADDRESS,
                vgabios_stdvga, sizeof(vgabios_stdvga));
+    }
+
+    if ( must_load_nic() )
+    {
+        printf("Loading ETHERBOOT ...\n");
+        memcpy((void *)ETHERBOOT_PHYSICAL_ADDRESS,
+               etherboot, sizeof(etherboot));
     }
 
     if ( get_acpi_enabled() != 0 )

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.