* [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