Skip to contentSkip to conversation

Arguments to skip boot menu and to hide bios output

PATCH In review Cory Fields 4 participants 12 messages Feb 6, 2009 – Feb 9, 2009 1 message not in the archive KVM

lore
Share & tools
lore
#0 lore raw

cover Arguments to skip boot menu and to hide bios output

This patchset creates new commandline arguments -quietboot and -fastboot

-quietboot silences normal text output from the bios and vgabios. I rarely care to see this output and it looks much cleaner when the first thing shown in a KVM window is init or splash (or the dreaded Windows logo)

-fastboot lets you explicitly skip the "Press f12 for boot menu" option saving ~3 seconds on each boot. It is also implied by -kernel -boot or -quietboot.

I've been working with kvm, but I realize this may be qemu related. Figured I'd give it a shot here first.

This is my first patch submitted to a mailinglist so any etiquette/procedural comments or critiques are appreciated.

Also, my asm-fu is weak so I'm sure those few lines need some help.

Cory Fields

---
 bios/rombios.c    |   80 +++++++++++++++++++++++++++++++++++++---------------
 qemu/hw/fw_cfg.c  |    2 +
 qemu/hw/fw_cfg.h  |    2 +
 qemu/sysemu.h     |    2 +
 qemu/vl.c         |   17 +++++++++++
 vgabios/vgabios.c |   17 ++++++++++-
 6 files changed, 96 insertions(+), 24 deletions(-)
#1 lore raw

PATCH 1/4 Define new channels for quietboot and fastboot

Provide a way to send quietboot and fastboot to bios

---
 qemu/hw/fw_cfg.c |    2 ++
 qemu/hw/fw_cfg.h |    2 ++
 qemu/sysemu.h    |    2 ++
 3 files changed, 6 insertions(+), 0 deletions(-)
qemu/hw/fw_cfg.c +2 -0
index 4333ed9..280f227 100644
@@ -287,6 +287,8 @@ 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)nographic);
     fw_cfg_add_i16(s, FW_CFG_NB_CPUS, (uint16_t)smp_cpus);
+    fw_cfg_add_i16(s, FW_CFG_QUIETBOOT, (uint16_t)quietboot);
+    fw_cfg_add_i16(s, FW_CFG_FASTBOOT, (uint16_t)fastboot);
 
     register_savevm("fw_cfg", -1, 1, fw_cfg_save, fw_cfg_load, s);
     qemu_register_reset(fw_cfg_reset, s);
qemu/hw/fw_cfg.h +2 -0
index ef8f378..e9b22cd 100644
@@ -8,6 +8,8 @@
 #define FW_CFG_NOGRAPHIC        0x04
 #define FW_CFG_NB_CPUS          0x05
 #define FW_CFG_MACHINE_ID       0x06
+#define FW_CFG_FASTBOOT         0x07
+#define FW_CFG_QUIETBOOT        0x08
 #define FW_CFG_MAX_ENTRY        0x10
 
 #define FW_CFG_WRITE_CHANNEL    0x4000
qemu/sysemu.h +2 -0
index f971d1b..2b1949c 100644
@@ -88,6 +88,8 @@ extern int graphic_width;
 extern int graphic_height;
 extern int graphic_depth;
 extern int nographic;
+extern int fastboot;
+extern int quietboot;
 extern const char *keyboard_layout;
 extern int win2k_install_hack;
 extern int rtc_td_hack;
Signature · 1 line
1.6.0.6
#2 lore raw

PATCH 2/4 add args for fastboot and quietboot

In reply to Cory Fields

-fastboot is implied by -boot -kernel or -quietboot because if specified, there's no need to show a menu

-quietboot must be explicitly called

---
 qemu/vl.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
qemu/vl.c +17 -0
index 93ed5fe..467171c 100644
@@ -190,6 +190,8 @@ static int vga_ram_size;
 enum vga_retrace_method vga_retrace_method = VGA_RETRACE_DUMB;
 static DisplayState *display_state;
 int nographic;
+int fastboot = 0;
+int quietboot = 0;
 static int curses;
 static int sdl;
 const char* keyboard_layout = NULL;
@@ -4000,6 +4002,8 @@ static void help(int exitcode)
            "-sd file        use 'file' as SecureDigital card image\n"
            "-pflash file    use 'file' as a parallel flash image\n"
            "-boot [a|c|d|n] boot on floppy (a), hard disk (c), CD-ROM (d), or network (n)\n"
+           "-fastboot       skip boot menu timer\n"
+           "-quietboot      silence bios display (implies -fastboot)\n"
            "-snapshot       write to temporary files instead of disk image files\n"
            "-m megs         set virtual RAM size to megs MB [default=%d]\n"
 #ifndef _WIN32
@@ -4238,6 +4242,8 @@ enum {
     QEMU_OPTION_nographic,
     QEMU_OPTION_curses,
     QEMU_OPTION_no_frame,
+    QEMU_OPTION_fastboot,
+    QEMU_OPTION_quietboot,
     QEMU_OPTION_alt_grab,
     QEMU_OPTION_no_quit,
     QEMU_OPTION_sdl,
@@ -4344,6 +4350,8 @@ static const QEMUOption qemu_options[] = {
     { "sd", HAS_ARG, QEMU_OPTION_sd },
     { "pflash", HAS_ARG, QEMU_OPTION_pflash },
     { "boot", HAS_ARG, QEMU_OPTION_boot },
+    { "fastboot", 0, QEMU_OPTION_fastboot },
+    { "quietboot", 0, QEMU_OPTION_quietboot },
     { "snapshot", 0, QEMU_OPTION_snapshot },
     { "m", HAS_ARG, QEMU_OPTION_m },
 #ifndef _WIN32
@@ -5163,9 +5171,17 @@ int main(int argc, char **argv, char **envp)
                             exit(1);
                         }
                         boot_devices_bitmap |= 1 << (*p - 'a');
+                        fastboot = 1;
                     }
                 }
                 break;
+            case QEMU_OPTION_fastboot:
+                fastboot=1;
+                break;
+            case QEMU_OPTION_quietboot:
+                quietboot=1;
+                fastboot=1;
+                break;
             case QEMU_OPTION_fda:
             case QEMU_OPTION_fdb:
                 drive_add(optarg, FD_ALIAS, popt->index - QEMU_OPTION_fda);
@@ -5698,6 +5714,7 @@ int main(int argc, char **argv, char **envp)
 #endif
     linux_boot = (kernel_filename != NULL);
     net_boot = (boot_devices_bitmap >> ('n' - 'a')) & 0xF;
+    if (linux_boot ) fastboot = 1;
 
     if (!linux_boot && net_boot == 0 &&
         !machine->nodisk_ok && nb_drives_opt == 0)
Signature · 1 line
1.6.0.6
#3 lore raw

PATCH 3/4 probe for quietboot in vgabios

In reply to Cory Fields

If quietboot is set disable all normal text output Errors should still be shown

---
 vgabios/vgabios.c |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)
vgabios/vgabios.c +16 -1
index e6fe2a0..923ea66 100644
@@ -55,6 +55,10 @@
 #endif
 
 #define USE_BX_INFO
+#define BX_CFG_CTL_PORT    0x510
+#define BX_CFG_DATA_PORT   0x511
+#define BX_CFG_SIGNATURE   0x00
+#define BX_CFG_QUIETBOOT   0x08
 
 /* Declares */
 static Bit8u          read_byte();
@@ -250,6 +254,10 @@ vgabios_init_func:
   call cirrus_init
 #endif
 
+ call   _qemu_quietboot_probe
+ test   al,al
+ jnz    skip_display
+
 ;; display splash screen
   call _display_splash_screen
 
@@ -269,7 +277,7 @@ vgabios_init_func:
 ;; show cirrus info
   call cirrus_display_info
 #endif
-
+skip_display:
   retf
 ASM_END
 
@@ -3839,6 +3847,13 @@ void printf(s)
 #endif
 
 // --------------------------------------------------------------------------------------------
+static int qemu_quietboot_probe()
+{
+  outw(BX_CFG_CTL_PORT, BX_CFG_QUIETBOOT);  
+
+  if (inb(BX_CFG_DATA_PORT)) return 1;
+  return 0;
+}
 
 ASM_START 
 ;; DATA_SEG_DEFS_HERE
Signature · 1 line
1.6.0.6
#4 lore raw

PATCH 4/4 probe for quietboot and fastboot in rombios

In reply to Cory Fields

If fastboot is set skip "Press f12 for boot menu"
If quietboot is set silence all text output
Errors should still be shown

Probes are split into separate functions to make the asm easier.

---
 bios/rombios.c |   80 +++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 57 insertions(+), 23 deletions(-)
bios/rombios.c +57 -23
index c4f6ccd..b5e3846 100644
@@ -144,6 +144,11 @@
 #define BX_PCIBIOS       1
 #define BX_APM           1
 
+#define BX_CFG_CTL_PORT    0x510
+#define BX_CFG_DATA_PORT   0x511
+#define BX_CFG_FASTBOOT    0x07
+#define BX_CFG_QUIETBOOT   0x08
+
 #define BX_USE_ATADRV    1
 #define BX_ELTORITO_BOOT 1
 
@@ -2014,6 +2019,20 @@ Bit16u i; ipl_entry_t *e;
   return 1;
 }
 
+static int qemu_fastboot_probe()
+{
+      outw(BX_CFG_CTL_PORT, BX_CFG_FASTBOOT);
+      if (inb(BX_CFG_DATA_PORT)) return 1;
+      return 0;
+    }
+
+static int qemu_quietboot_probe()
+{
+      outw(BX_CFG_CTL_PORT, BX_CFG_QUIETBOOT);
+      if (inb(BX_CFG_DATA_PORT)) return 1;
+      return 0;
+    }
+
 #if BX_ELTORITO_BOOT
   void
 interactive_bootkey()
@@ -2481,6 +2500,9 @@ void ata_detect( )
   Bit16u ebda_seg=read_word(0x0040,0x000E);
   Bit8u  hdcount, cdcount, device, type;
   Bit8u  buffer[0x0200];
+  Bit8u  quietboot;
+
+  quietboot = qemu_quietboot_probe();
 
 #if BX_MAX_ATA_INTERFACES > 0
   write_byte(ebda_seg,&EbdaData->ata.channels[0].iface,ATA_IFACE_ISA);
@@ -2739,36 +2761,38 @@ void ata_detect( )
           break;
         }
 
-      switch (type) {
-        case ATA_TYPE_ATA:
-          printf("ata%d %s: ",channel,slave?" slave":"master");
-          i=0; while(c=read_byte(get_SS(),model+i++)) printf("%c",c);
-	  if (sizeinmb < (1UL<<16))
-            printf(" ATA-%d Hard-Disk (%4u MBytes)\n", version, (Bit16u)sizeinmb);
-	  else
-            printf(" ATA-%d Hard-Disk (%4u GBytes)\n", version, (Bit16u)(sizeinmb>>10));
-          break;
-        case ATA_TYPE_ATAPI:
-          printf("ata%d %s: ",channel,slave?" slave":"master");
-          i=0; while(c=read_byte(get_SS(),model+i++)) printf("%c",c);
-          if(read_byte(ebda_seg,&EbdaData->ata.devices[device].device)==ATA_DEVICE_CDROM)
-            printf(" ATAPI-%d CD-Rom/DVD-Rom\n",version);
-          else
-            printf(" ATAPI-%d Device\n",version);
-          break;
-        case ATA_TYPE_UNKNOWN:
-          printf("ata%d %s: Unknown device\n",channel,slave?" slave":"master");
-          break;
+      if (!quietboot){
+        switch (type) {
+          case ATA_TYPE_ATA:
+            printf("ata%d %s: ",channel,slave?" slave":"master");
+            i=0; while(c=read_byte(get_SS(),model+i++)) printf("%c",c);
+	    if (sizeinmb < (1UL<<16))
+              printf(" ATA-%d Hard-Disk (%4u MBytes)\n", version, (Bit16u)sizeinmb);
+            else
+              printf(" ATA-%d Hard-Disk (%4u GBytes)\n", version, (Bit16u)(sizeinmb>>10));
+            break;
+          case ATA_TYPE_ATAPI:
+            printf("ata%d %s: ",channel,slave?" slave":"master");
+            i=0; while(c=read_byte(get_SS(),model+i++)) printf("%c",c);
+            if(read_byte(ebda_seg,&EbdaData->ata.devices[device].device)==ATA_DEVICE_CDROM)
+              printf(" ATAPI-%d CD-Rom/DVD-Rom\n",version);
+            else
+              printf(" ATAPI-%d Device\n",version);
+            break;
+          case ATA_TYPE_UNKNOWN:
+            printf("ata%d %s: Unknown device\n",channel,slave?" slave":"master");
+            break;
+          }
         }
       }
     }
-
+  
   // Store the devices counts
   write_byte(ebda_seg,&EbdaData->ata.hdcount, hdcount);
   write_byte(ebda_seg,&EbdaData->ata.cdcount, cdcount);
   write_byte(0x40,0x75, hdcount);
 
-  printf("\n");
+  if (!quietboot) printf("\n");
 
   // FIXME : should use bios=cmos|auto|disable bits
   // FIXME : should know about translation bits
@@ -10669,7 +10693,11 @@ post_default_ints:
   mov  ax, #0xc780
   call rom_scan
 
+  call   _qemu_quietboot_probe
+  test   al,al
+  jnz    skip_bios_print
   call _print_bios_banner
+  skip_bios_print:
 
 #if BX_ROMBIOS32
   call rombios32_init
@@ -10716,7 +10744,13 @@ post_default_ints:
   call rom_scan
 
 #if BX_ELTORITO_BOOT
-  call _interactive_bootkey
+
+ call   _qemu_fastboot_probe
+ test   al,al
+ jnz    skip_timer
+ call _interactive_bootkey
+ 
+skip_timer:
 #endif // BX_ELTORITO_BOOT
 
   sti        ;; enable interrupts
Signature · 1 line
1.6.0.6
#5 lore raw
In reply to Cory Fields
Quoted 6 lines · Cory Fields

This patchset creates new commandline arguments -quietboot and

(quoted diff) +0 -2
-fastboot
 
-quietboot silences normal text output from the bios and vgabios. I 

rarely care to see this output and it looks much cleaner when the first thing shown in a KVM window is init or splash (or the dreaded Windows logo)

Quoted 6 lines

-fastboot lets you explicitly skip the "Press f12 for boot menu" option saving ~3 seconds on each boot. It is also implied by -kernel -boot or -quietboot.

I've been working with kvm, but I realize this may be qemu related. Figured I'd give it a shot here first.

Yes, this should go to qemu-devel.

Instead of introducing two new args, it would be good to extend the -boot syntax. For instance, -boot dca,verbose=off,prompt=off.

Regards,

Anthony Liguori

Quoted 18 lines

This is my first patch submitted to a mailinglist so any etiquette/procedural comments or critiques are appreciated.

Also, my asm-fu is weak so I'm sure those few lines need some help.

Cory Fields

---
 bios/rombios.c    |   80 +++++++++++++++++++++++++++++++++++++---------------
 qemu/hw/fw_cfg.c  |    2 +
 qemu/hw/fw_cfg.h  |    2 +
 qemu/sysemu.h     |    2 +
 qemu/vl.c         |   17 +++++++++++
 vgabios/vgabios.c |   17 ++++++++++-
 6 files changed, 96 insertions(+), 24 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#6 lore raw

Thanks for the direction, will submit patches to the appropriate places.

I messed around with extending the -boot syntax as you suggested, but I think boot c,verbose=off,prompt=off is a little cumbersome. boot c,quiet,noprompt seems cleaner. Thoughts?

Also, I agree that they should both be on by default, though I don't want to step on anyone's toes by hiding copyright/credit info. Though, note that only normal output is hidden. Errors are still displayed. Disabling the prompt by default but leaving the text is probably the way to go.

Cory Fields

#7 lore raw
Quoted 5 lines · Cory Fields

Thanks for the direction, will submit patches to the appropriate places.

I messed around with extending the -boot syntax as you suggested, but I think boot c,verbose=off,prompt=off is a little cumbersome. boot c,quiet,noprompt seems cleaner. Thoughts?

The rest of QEMU is converging on using the same name=val syntax for optional args, even for boolean args. Thus I think we should follow that pattern here too. If we pick sensible defaults, so these flags don't need to be specified most of the time, then its not a big deal

Daniel

Signature · 4 lines
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

A message that is not in the archive (sent off-list or not yet received): [email protected]

#9 lore raw
Quoted 6 lines · Cory Fields

Thanks for the direction, will submit patches to the appropriate places.

I messed around with extending the -boot syntax as you suggested, but I think boot c,verbose=off,prompt=off is a little cumbersome. boot c,quiet,noprompt seems cleaner. Thoughts?

I prefer foo=bar syntax for consistency with the rest of QEMU. Play around with it though, it's easy enough to change once you've gotten the patch working. I'm open to persuasion too.

Regards,

Anthony Liguori

Quoted 9 lines

Also, I agree that they should both be on by default, though I don't want to step on anyone's toes by hiding copyright/credit info. Though, note that only normal output is hidden. Errors are still displayed. Disabling the prompt by default but leaving the text is probably the way to go.

Cory Fields

#10 lore raw
In reply to Cory Fields
Quoted 9 lines · Cory Fields

This patchset creates new commandline arguments -quietboot and

(quoted diff) +0 -2
-fastboot
 
-quietboot silences normal text output from the bios and vgabios. I 

rarely care to see this output and it looks much cleaner when the first thing shown in a KVM window is init or splash (or the dreaded Windows logo)

Quoted 3 lines

-fastboot lets you explicitly skip the "Press f12 for boot menu" option saving ~3 seconds on each boot. It is also implied by -kernel -boot or -quietboot.

I'd be inclined to say that both of these options should be on by default, and that you should have to give a explicit flag to turn on slow BIOS boot, and/or the F12 menu. Neither of these are very useful features in general daily usage.

Daniel

Signature · 4 lines
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
#11 lore raw
Quoted 8 lines · Daniel P. Berrange
Quoted 6 lines · Cory Fields

This patchset creates new commandline arguments -quietboot and

(quoted diff) +0 -2
-fastboot
 
-quietboot silences normal text output from the bios and vgabios. I 

rarely care to see this output and it looks much cleaner when the first thing shown in a KVM window is init or splash (or the dreaded Windows logo)

Quoted 9 lines
Quoted 3 lines

-fastboot lets you explicitly skip the "Press f12 for boot menu" option saving ~3 seconds on each boot. It is also implied by -kernel -boot or -quietboot.

I'd be inclined to say that both of these options should be on by default, and that you should have to give a explicit flag to turn on slow BIOS boot, and/or the F12 menu. Neither of these are very useful features in general daily usage.

Disabling the F12 prompt by default makes sense to me. I think we should continue letting Bochs print their splash screen though. It's good to make the role the BIOSes play visible by default.

If vendors want to disable it, the option will be there.

Regards,

Anthony Liguori

Quoted 2 lines

Daniel

#12 lore raw
In reply to Cory Fields
Quoted 2 lines · Cory Fields

This patchset creates new commandline arguments -quietboot and -fastboot

Great, this allows me to remove one item from my to-do list. :)

Quoted 9 lines

-quietboot silences normal text output from the bios and vgabios. I rarely care to see this output and it looks much cleaner when the first thing shown in a KVM window is init or splash (or the dreaded Windows logo)

-fastboot lets you explicitly skip the "Press f12 for boot menu" option saving ~3 seconds on each boot. It is also implied by -kernel -boot or -quietboot.

When reworking the patches for qemu, please turn fastboot on by default. Most qemu and kvm users don't need the boot menu of the bios. Those who really want it should explicitly enable it.

I think it is even worth suggesting the same for quietboot, but let's postpone the discussion to the final thread on qemu-devel

Jan