qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCHv2] Load "bootsplash.jpg" if present
@ 2010-08-02 15:32 Kevin O'Connor
  2010-08-02 15:51 ` Anthony Liguori
  0 siblings, 1 reply; 2+ messages in thread
From: Kevin O'Connor @ 2010-08-02 15:32 UTC (permalink / raw)
  To: qemu-devel

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

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
---
Changes v1->v2:
  Add signed-off-by line.
---
 hw/fw_cfg.c |    8 ++++++--
 hw/pc.c     |    8 ++++++++
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/hw/fw_cfg.c b/hw/fw_cfg.c
index 72866ae..c4319d7 100644
--- 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);
     }
-- 
1.7.2

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

* Re: [Qemu-devel] [PATCHv2] Load "bootsplash.jpg" if present
  2010-08-02 15:32 [Qemu-devel] [PATCHv2] Load "bootsplash.jpg" if present Kevin O'Connor
@ 2010-08-02 15:51 ` Anthony Liguori
  0 siblings, 0 replies; 2+ messages in thread
From: Anthony Liguori @ 2010-08-02 15:51 UTC (permalink / raw)
  To: Kevin O'Connor; +Cc: qemu-devel

On 08/02/2010 10:32 AM, Kevin O'Connor wrote:
> Load the "bootsplash.jpg" file into fw_cfg if it is found in the roms
> directory.
>
> Signed-off-by: Kevin O'Connor<kevin@koconnor.net>
> ---
> Changes v1->v2:
>    Add signed-off-by line.
> ---
>   hw/fw_cfg.c |    8 ++++++--
>   hw/pc.c     |    8 ++++++++
>   2 files changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/hw/fw_cfg.c b/hw/fw_cfg.c
> index 72866ae..c4319d7 100644
> --- 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));
>    

Missing {}s around the ifs :-)

Regards,

Anthony Liguori

>       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	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-08-02 15:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-02 15:32 [Qemu-devel] [PATCHv2] Load "bootsplash.jpg" if present Kevin O'Connor
2010-08-02 15:51 ` Anthony Liguori

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).