Skip to contentSkip to conversation

Rework -boot option

PATCH RESEND In review Jan Kiszka 3 participants 5 messages Jun 27, 2009 – Jun 29, 2009

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH RESEND v2 1/2 Rework -boot option

This patch changes the boot command line option to the canonical format

-boot [order=]drives[,interactive=on|off]

where 'drives' is using the same format as the old -boot. The format switch allows to add the 'interactive' option and use the existing infrastructure to parse it. However, the old format is still understood and will be processed at least for a transition time.

The state of 'interactive' is transfered to the firmware via the new configuration value FW_CFG_BOOT_INTERACTIVE.

---

 hw/fw_cfg.c     |    1 +
 hw/fw_cfg.h     |    1 +
 qemu-options.hx |   22 ++++++++++++--
 sysemu.h        |    1 +
 vl.c            |   85 ++++++++++++++++++++++++++++++++++++++-----------------
 5 files changed, 80 insertions(+), 30 deletions(-)
hw/fw_cfg.c +1 -0
index 276c396..e6dafc5 100644
@@ -279,6 +279,7 @@ void *fw_cfg_init(uint32_t ctl_port, uint32_t data_port,
     fw_cfg_add_bytes(s, FW_CFG_UUID, qemu_uuid, 16);
     fw_cfg_add_i16(s, FW_CFG_NOGRAPHIC, (uint16_t)(display_type == DT_NOGRAPHIC));
     fw_cfg_add_i16(s, FW_CFG_NB_CPUS, (uint16_t)smp_cpus);
+    fw_cfg_add_i16(s, FW_CFG_BOOT_INTERACTIVE, (uint16_t)boot_interactive);
 
     register_savevm("fw_cfg", -1, 1, fw_cfg_save, fw_cfg_load, s);
     qemu_register_reset(fw_cfg_reset, 0, s);
hw/fw_cfg.h +1 -0
index f616ed2..b881e2c 100644
@@ -15,6 +15,7 @@
 #define FW_CFG_INITRD_SIZE      0x0b
 #define FW_CFG_BOOT_DEVICE      0x0c
 #define FW_CFG_NUMA             0x0d
+#define FW_CFG_BOOT_INTERACTIVE 0x0e
 #define FW_CFG_MAX_ENTRY        0x10
 
 #define FW_CFG_WRITE_CHANNEL    0x4000
qemu-options.hx +18 -4
index 503da33..5cf40c8 100644
@@ -221,11 +221,25 @@ Use 'file' as a parallel flash image.
 ETEXI
 
 DEF("boot", HAS_ARG, QEMU_OPTION_boot,
-    "-boot [a|c|d|n] boot on floppy (a), hard disk (c), CD-ROM (d), or network (n)\n")
+    "-boot [order=drives][,interactive=on|off]\n"
+    "                'drives': floppy (a), hard disk (c), CD-ROM (d), network (n)\n")
 STEXI
-@item -boot [a|c|d|n]
-Boot on floppy (a), hard disk (c), CD-ROM (d), or Etherboot (n). Hard disk boot
-is the default.
+@item -boot [order=@var{drives}][,interactive=on|off]
+
+Specify boot order @var{drives} as a string of drive letters. Valid
+drive letters depend on the target achitecture. The x86 PC uses: a, b
+(floppy 1 and 2), c (first hard disk), d (first CD-ROM), n-p (Etherboot
+from network adapter 1-4), hard disk boot is the default. Furthermore,
+interactive boot menus/prompts can be enabled as far as firmware/BIOS
+supports them. The default is non-interactive boot.
+
+@example
+# try to boot from network first, then from hard disk
+qemu -boot order=nc
+@end example
+
+Note: The legacy format '-boot @var{drives}' is still supported but its
+use is discouraged as it may be removed from future versions.
 ETEXI
 
 DEF("snapshot", 0, QEMU_OPTION_snapshot,
sysemu.h +1 -0
index d77de09..6dcdc2e 100644
@@ -123,6 +123,7 @@ extern int graphic_rotate;
 extern int no_quit;
 extern int semihosting_enabled;
 extern int old_param;
+extern int boot_interactive;
 
 #ifdef CONFIG_KQEMU
 extern int kqemu_allowed;
vl.c +59 -26

112 lines not on this page · raw message

#1 lore raw
Quoted 4 lines · Jan Kiszka

This patch changes the boot command line option to the canonical format

-boot [order=]drives[,interactive=on|off]

Quoted 8 lines

where 'drives' is using the same format as the old -boot. The format switch allows to add the 'interactive' option and use the existing infrastructure to parse it. However, the old format is still understood and will be processed at least for a transition time.

The state of 'interactive' is transfered to the firmware via the new configuration value FW_CFG_BOOT_INTERACTIVE.

Perhaps interactive (and the boot order itself) should be forgotten after a successful boot? A typical use case is to boot an installer off the cdrom; the next boot ought to try the hard disk. But perhaps other use cases don't want that.

Signature · 1 line
error compiling committee.c: too many arguments to function
author
#2 lore raw
Quoted 10 lines · Avi Kivity
Quoted 9 lines · Jan Kiszka

This patch changes the boot command line option to the canonical format

-boot [order=]drives[,interactive=on|off]

where 'drives' is using the same format as the old -boot. The format switch allows to add the 'interactive' option and use the existing infrastructure to parse it. However, the old format is still understood and will be processed at least for a transition time.

Quoted 9 lines
Quoted 3 lines

The state of 'interactive' is transfered to the firmware via the new configuration value FW_CFG_BOOT_INTERACTIVE.

Perhaps interactive (and the boot order itself) should be forgotten after a successful boot? A typical use case is to boot an installer off the cdrom; the next boot ought to try the hard disk. But perhaps other use cases don't want that.

We could extend the new format to

-boot [order=drives][,once=drives][,interactive=on|off]

where 'once' specifies the order to be used only for the very first boot of this machine.

Jan

#3 lore raw
In reply to Jan Kiszka
Quoted 11 lines · Jan Kiszka

This patch changes the boot command line option to the canonical format

-boot [order=]drives[,interactive=on|off]

where 'drives' is using the same format as the old -boot. The format switch allows to add the 'interactive' option and use the existing infrastructure to parse it. However, the old format is still understood and will be processed at least for a transition time.

The state of 'interactive' is transfered to the firmware via the new configuration value FW_CFG_BOOT_INTERACTIVE.

What about using "[boot]menu" instead of "interactive"?
The Phoenix BIOS i got here allows me to enable/disable the boot menu, so this seems common.

- Sebastian

author
#4 lore raw
Quoted 10 lines · Sebastian Herbszt
Quoted 9 lines · Jan Kiszka

This patch changes the boot command line option to the canonical format

-boot [order=]drives[,interactive=on|off]

where 'drives' is using the same format as the old -boot. The format switch allows to add the 'interactive' option and use the existing infrastructure to parse it. However, the old format is still understood and will be processed at least for a transition time.

Quoted 6 lines
Quoted 2 lines

The state of 'interactive' is transfered to the firmware via the new configuration value FW_CFG_BOOT_INTERACTIVE.

What about using "[boot]menu" instead of "interactive"?
The Phoenix BIOS i got here allows me to enable/disable the boot menu, so this seems common.

Yes, short is beautiful. Will sent out a new series, addressing all suggestions made so far.

Jan