Skip to contentSkip to conversation

Load "bootsplash.jpg" if present

PATCH Superseded Kevin O'Connor 2 participants 2 messages Aug 2, 2010

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Load "bootsplash.jpg" if present

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

---
Changes v1->v2:
Add signed-off-by line.

---
 hw/fw_cfg.c |    8 ++++++--
 hw/pc.c     |    8 ++++++++
 2 files changed, 14 insertions(+), 2 deletions(-)
hw/fw_cfg.c +6 -2
index 72866ae..c4319d7 100644
@@ -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__,
hw/pc.c +8 -0
index 58dea57..6893799 100644
@@ -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);
     }
Signature · 1 line
1.7.2
#1 lore raw
Quoted 19 lines · Kevin O'Connor

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

---
Changes v1->v2:
Add signed-off-by line.

---
  hw/fw_cfg.c |    8 ++++++--
  hw/pc.c     |    8 ++++++++
  2 files changed, 14 insertions(+), 2 deletions(-)
hw/fw_cfg.c +0 -0
index 72866ae..c4319d7 100644
@@ -304,8 +304,12 @@ int fw_cfg_add_file(FWCfgState *s,  const char *dir, const char *filename,
          basename = filename;
      }

hw/fw_cfg.c int fw_cfg_add_file(FWCfgState *s, const char *dir, const char *filename, · line 313

Quoted 10 lines
hw/fw_cfg.c +6 -2
 
-    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));
 

Missing {}s around the ifs :-)

Regards,

Anthony Liguori

Quoted 30 lines
hw/fw_cfg.c +0 -0
      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__,
hw/pc.c +8 -0
index 58dea57..6893799 100644
@@ -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);
      }