[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH][QEMU] Load "bootsplash.jpg" if present
From: |
Kevin O'Connor |
Subject: |
[Qemu-devel] [PATCH][QEMU] Load "bootsplash.jpg" if present |
Date: |
Sun, 1 Aug 2010 15:44:07 -0400 |
User-agent: |
Mutt/1.5.20 (2009-12-10) |
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);
}