qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Enable SeaBIOS bootsplash in qemu
@ 2010-08-01 19:42 Kevin O'Connor
  2010-08-01 19:44 ` [Qemu-devel] [PATCH][QEMU] Load "bootsplash.jpg" if present Kevin O'Connor
  2010-08-01 19:45 ` [Qemu-devel] [PATCH][SEABIOS] Allow qemu to use bootsplash code via fwcfg interface Kevin O'Connor
  0 siblings, 2 replies; 3+ messages in thread
From: Kevin O'Connor @ 2010-08-01 19:42 UTC (permalink / raw)
  To: seabios, qemu-devel

These two patches enable qemu to use the recently added SeaBIOS
bootsplash code.  The first patch is for SeaBIOS - it enables finding
the "bootsplash.jpg" file from either CBFS (on coreboot) or fw_cfg (on
QEMU).  The second patch is for qemu - it enables loading a
"bootsplash.jpg" file into fw_cfg from the bios roms directory if the
file is present.

Some notes:

This uses the qemu "rom" interface for loading the jpeg file.  It
seems to work, but I'm not sure if this is strictly correct.

The jpeg viewer in SeaBIOS will look at the image size and try to find
a vesa graphics mode that supports that size.  So, choose images that
are exactly 640x480, 1024x768, etc.  Also, the SeaBIOS viewer has
stripped down support for jpegs - not all valid jpegs will work.  Some
quick tests with the netpbm tools worked okay for me.

SeaBIOS only shows the bootsplash during the interval between vgabios
init and OS execution.  This is generally too short a time to be seen.
Add "-menu boot=on" to the qemu command line to have it shown longer.

Unfortunately, the vgabios doesn't support writing text to the screen
while in a vesa video mode.  So, this means that if a user selects F12
for the boot menu, they can't actually see the boot menu.  This will
need to be fixed in SeaBIOS in a follow up patch.

-Kevin

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Qemu-devel] [PATCH][QEMU] Load "bootsplash.jpg" if present
  2010-08-01 19:42 [Qemu-devel] [PATCH] Enable SeaBIOS bootsplash in qemu Kevin O'Connor
@ 2010-08-01 19:44 ` Kevin O'Connor
  2010-08-01 19:45 ` [Qemu-devel] [PATCH][SEABIOS] Allow qemu to use bootsplash code via fwcfg interface Kevin O'Connor
  1 sibling, 0 replies; 3+ messages in thread
From: Kevin O'Connor @ 2010-08-01 19:44 UTC (permalink / raw)
  To: seabios, qemu-devel

Load the "bootsplash.jpg" file into fw_cfg if it is found in the roms
directory.

--- a/hw/fw_cfg.c
+++ b/hw/fw_cfg.c
@@ -304,8 +304,12 @@ int fw_cfg_add_file(FWCfgState *s,  const char *dir, const char 
*filename,
         basename = filename;
     }
 
-    snprintf(s->files->f[index].name, sizeof(s->files->f[index].name),
-             "%s/%s", dir, basename);
+    if (dir && dir[0])
+        snprintf(s->files->f[index].name, sizeof(s->files->f[index].name),
+                 "%s/%s", dir, basename);
+    else
+        strncpy(s->files->f[index].name, basename,
+                sizeof(s->files->f[index].name));
     for (i = 0; i < index; i++) {
         if (strcmp(s->files->f[index].name, s->files->f[i].name) == 0) {
             FW_CFG_DPRINTF("%s: skip duplicate: %s\n", __FUNCTION__,
diff --git a/hw/pc.c b/hw/pc.c
index 58dea57..6893799 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -54,6 +54,7 @@
 #endif
 
 #define BIOS_FILENAME "bios.bin"
+#define BOOTSPLASH_FILENAME "bootsplash.jpg"
 
 #define PC_MAX_BIOS_SIZE (4 * 1024 * 1024)
 
@@ -963,6 +964,13 @@ void pc_memory_init(ram_addr_t ram_size,
     fw_cfg = bochs_bios_init();
     rom_set_fw(fw_cfg);
 
+    /* Optional bootsplash file */
+    filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, BOOTSPLASH_FILENAME);
+    if (filename) {
+        qemu_free(filename);
+        rom_add_file(BOOTSPLASH_FILENAME, "", 0);
+    }
+
     if (linux_boot) {
         load_linux(fw_cfg, kernel_filename, initrd_filename, kernel_cmdline, below_4g_mem_size);
     }

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [Qemu-devel] [PATCH][SEABIOS] Allow qemu to use bootsplash code via fwcfg interface.
  2010-08-01 19:42 [Qemu-devel] [PATCH] Enable SeaBIOS bootsplash in qemu Kevin O'Connor
  2010-08-01 19:44 ` [Qemu-devel] [PATCH][QEMU] Load "bootsplash.jpg" if present Kevin O'Connor
@ 2010-08-01 19:45 ` Kevin O'Connor
  1 sibling, 0 replies; 3+ messages in thread
From: Kevin O'Connor @ 2010-08-01 19:45 UTC (permalink / raw)
  To: seabios, qemu-devel

Allow the bootsplash code to pull the jpeg file from either cbfs (on
coreboot) or fwcfg (on qemu).

diff --git a/src/bootsplash.c b/src/bootsplash.c
index 676ece3..1dcd402 100644
--- a/src/bootsplash.c
+++ b/src/bootsplash.c
@@ -11,14 +11,14 @@
 #include "util.h" // dprintf
 #include "jpeg.h" // splash
 #include "biosvar.h" // SET_EBDA
+#include "paravirt.h" // romfile_find
 
 
 /****************************************************************
  * VESA structures
  ****************************************************************/
 
-struct vesa_info
-{
+struct vesa_info {
     u32 vesa_signature;
     u16 vesa_version;
     struct segoff_s oem_string_ptr;
@@ -36,8 +36,7 @@ struct vesa_info
 #define VESA_SIGNATURE 0x41534556 // VESA
 #define VBE2_SIGNATURE 0x32454256 // VBE2
 
-struct vesa_mode_info
-{
+struct vesa_mode_info {
     u16 mode_attributes;
     u8 win_a_attributes;
     u8 win_b_attributes;
@@ -73,6 +72,7 @@ struct vesa_mode_info
     u8 reserved[206];
 } PACKED;
 
+
 /****************************************************************
  * Helper functions
  ****************************************************************/
@@ -92,7 +92,8 @@ call16_int10(struct bregs *br)
  * VGA text / graphics console
  ****************************************************************/
 
-static void enable_vga_text_console(void)
+static void
+enable_vga_text_console(void)
 {
     dprintf(1, "Turning on vga text mode console\n");
     struct bregs br;
@@ -140,20 +141,20 @@ find_videomode(struct vesa_info *vesa_info, struct vesa_mode_info *mode_info
     }
 }
 
-void enable_vga_console(void)
+void
+enable_vga_console(void)
 {
     struct vesa_info *vesa_info = NULL;
     struct vesa_mode_info *mode_info = NULL;
     struct jpeg_decdata *jpeg = NULL;
     u8 *filedata = NULL, *picture = NULL;
 
-    /* Needs coreboot support for CBFS */
-    if (!CONFIG_BOOTSPLASH || !CONFIG_COREBOOT)
+    if (!CONFIG_BOOTSPLASH)
         goto gotext;
-    struct cbfs_file *file = cbfs_finddatafile("bootsplash.jpg");
+    u32 file = romfile_find("bootsplash.jpg");
     if (!file)
         goto gotext;
-    int filesize = cbfs_datasize(file);
+    int filesize = romfile_size(file);
 
     filedata = malloc_tmphigh(filesize);
     vesa_info = malloc_tmplow(sizeof(*vesa_info));
@@ -186,7 +187,7 @@ void enable_vga_console(void)
             vendor, product);
 
     // Parse jpeg and get image size.
-    cbfs_copyfile(file, filedata, filesize);
+    romfile_copy(file, filedata, filesize);
     int ret = jpeg_decode(jpeg, filedata);
     if (ret) {
         dprintf(1, "jpeg_decode failed with return code %d...\n", ret);
@@ -248,7 +249,7 @@ gotext:
 void
 disable_bootsplash(void)
 {
-    if (!CONFIG_BOOTSPLASH  || !CONFIG_COREBOOT || !GET_EBDA(bootsplash_active))
+    if (!CONFIG_BOOTSPLASH || !GET_EBDA(bootsplash_active))
         return;
     SET_EBDA(bootsplash_active, 0);
     enable_vga_text_console();

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-08-01 19:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-01 19:42 [Qemu-devel] [PATCH] Enable SeaBIOS bootsplash in qemu Kevin O'Connor
2010-08-01 19:44 ` [Qemu-devel] [PATCH][QEMU] Load "bootsplash.jpg" if present Kevin O'Connor
2010-08-01 19:45 ` [Qemu-devel] [PATCH][SEABIOS] Allow qemu to use bootsplash code via fwcfg interface Kevin O'Connor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).