Commit eec85c2a0d18523f535785d15b046f427481cf5f

Authored by ths
1 parent 9ae02555

Add -boot n option for x86 using PXE, by Anthony Liguori.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2293 c046a42c-6fe2-441c-8c8c-71466251a162
Makefile
@@ -78,7 +78,8 @@ install: all $(if $(BUILD_DOCS),install-doc) @@ -78,7 +78,8 @@ install: all $(if $(BUILD_DOCS),install-doc)
78 $(INSTALL) -m 755 -s $(TOOLS) "$(DESTDIR)$(bindir)" 78 $(INSTALL) -m 755 -s $(TOOLS) "$(DESTDIR)$(bindir)"
79 mkdir -p "$(DESTDIR)$(datadir)" 79 mkdir -p "$(DESTDIR)$(datadir)"
80 for x in bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \ 80 for x in bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \
81 - video.x openbios-sparc32 linux_boot.bin; do \ 81 + video.x openbios-sparc32 linux_boot.bin pxe-ne2k_pci.bin \
  82 + pxe-rtl8139.bin pxe-pcnet.bin; do \
82 $(INSTALL) -m 644 $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \ 83 $(INSTALL) -m 644 $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \
83 done 84 done
84 ifndef CONFIG_WIN32 85 ifndef CONFIG_WIN32
pc-bios/README
@@ -14,3 +14,9 @@ @@ -14,3 +14,9 @@
14 - OpenBIOS (http://www.openbios.org/) is a free (GPL v2) portable 14 - OpenBIOS (http://www.openbios.org/) is a free (GPL v2) portable
15 firmware implementation. The goal is to implement a 100% IEEE 15 firmware implementation. The goal is to implement a 100% IEEE
16 1275-1994 (referred to as Open Firmware) compliant firmware. 16 1275-1994 (referred to as Open Firmware) compliant firmware.
  17 +
  18 +- The PXE roms come from Rom-o-Matic etherboot 5.4.2.
  19 + pcnet32:pcnet32 -- [0x1022,0x2000]
  20 + ns8390:winbond940 -- [0x1050,0x0940]
  21 + rtl8139:rtl8139 -- [0x10ec,0x8139]
  22 + http://rom-o-matic.net/
qemu-doc.texi
@@ -219,9 +219,9 @@ Use @var{file} as CD-ROM image (you cannot use @option{-hdc} and and @@ -219,9 +219,9 @@ Use @var{file} as CD-ROM image (you cannot use @option{-hdc} and and
219 @option{-cdrom} at the same time). You can use the host CD-ROM by 219 @option{-cdrom} at the same time). You can use the host CD-ROM by
220 using @file{/dev/cdrom} as filename (@pxref{host_drives}). 220 using @file{/dev/cdrom} as filename (@pxref{host_drives}).
221 221
222 -@item -boot [a|c|d]  
223 -Boot on floppy (a), hard disk (c) or CD-ROM (d). Hard disk boot is  
224 -the default. 222 +@item -boot [a|c|d|n]
  223 +Boot on floppy (a), hard disk (c), CD-ROM (d), or Etherboot (n). Hard disk boot
  224 +is the default.
225 225
226 @item -disk ide,img=file[,hdx=a..dd][,type=disk|cdrom] 226 @item -disk ide,img=file[,hdx=a..dd][,type=disk|cdrom]
227 Use @var{file} as the IDE disk/CD-ROM image. The defaults are: hdx=a,type=disk 227 Use @var{file} as the IDE disk/CD-ROM image. The defaults are: hdx=a,type=disk
@@ -6234,7 +6234,7 @@ void help(void) @@ -6234,7 +6234,7 @@ void help(void)
6234 "-hda/-hdb file use 'file' as IDE hard disk 0/1 image\n" 6234 "-hda/-hdb file use 'file' as IDE hard disk 0/1 image\n"
6235 "-hdc/-hdd file use 'file' as IDE hard disk 2/3 image\n" 6235 "-hdc/-hdd file use 'file' as IDE hard disk 2/3 image\n"
6236 "-cdrom file use 'file' as IDE cdrom image (cdrom is ide1 master)\n" 6236 "-cdrom file use 'file' as IDE cdrom image (cdrom is ide1 master)\n"
6237 - "-boot [a|c|d] boot on floppy (a), hard disk (c) or CD-ROM (d)\n" 6237 + "-boot [a|c|d|n] boot on floppy (a), hard disk (c), CD-ROM (d), or network (n)\n"
6238 "-disk ide,img=file[,hdx=a..dd][,type=disk|cdrom] \n" 6238 "-disk ide,img=file[,hdx=a..dd][,type=disk|cdrom] \n"
6239 " defaults are: hdx=a,type=disk \n" 6239 " defaults are: hdx=a,type=disk \n"
6240 "-disk scsi,img=file[,sdx=a..g][,type=disk|cdrom][,id=n] \n" 6240 "-disk scsi,img=file[,sdx=a..g][,type=disk|cdrom][,id=n] \n"
@@ -7056,7 +7056,7 @@ int main(int argc, char **argv) @@ -7056,7 +7056,7 @@ int main(int argc, char **argv)
7056 case QEMU_OPTION_boot: 7056 case QEMU_OPTION_boot:
7057 boot_device = optarg[0]; 7057 boot_device = optarg[0];
7058 if (boot_device != 'a' && 7058 if (boot_device != 'a' &&
7059 -#ifdef TARGET_SPARC 7059 +#if defined(TARGET_SPARC) || defined(TARGET_I386)
7060 // Network boot 7060 // Network boot
7061 boot_device != 'n' && 7061 boot_device != 'n' &&
7062 #endif 7062 #endif
@@ -7378,6 +7378,28 @@ int main(int argc, char **argv) @@ -7378,6 +7378,28 @@ int main(int argc, char **argv)
7378 exit(1); 7378 exit(1);
7379 } 7379 }
7380 7380
  7381 +#ifdef TARGET_I386
  7382 + if (boot_device == 'n') {
  7383 + for (i = 0; i < nb_nics; i++) {
  7384 + const char *model = nd_table[i].model;
  7385 + char buf[1024];
  7386 + if (model == NULL)
  7387 + model = "ne2k_pci";
  7388 + snprintf(buf, sizeof(buf), "%s/pxe-%s.bin", bios_dir, model);
  7389 + if (get_image_size(buf) > 0) {
  7390 + option_rom[nb_option_roms] = strdup(buf);
  7391 + nb_option_roms++;
  7392 + break;
  7393 + }
  7394 + }
  7395 + if (i == nb_nics) {
  7396 + fprintf(stderr, "No valid PXE rom found for network device\n");
  7397 + exit(1);
  7398 + }
  7399 + boot_device = 'c'; /* to prevent confusion by the BIOS */
  7400 + }
  7401 +#endif
  7402 +
7381 /* init the memory */ 7403 /* init the memory */
7382 phys_ram_size = ram_size + vga_ram_size + bios_size; 7404 phys_ram_size = ram_size + vga_ram_size + bios_size;
7383 7405