From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=58636 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OfxIl-0003u9-9e for qemu-devel@nongnu.org; Mon, 02 Aug 2010 11:51:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OfxIg-0005VF-NS for qemu-devel@nongnu.org; Mon, 02 Aug 2010 11:51:40 -0400 Received: from mail-qw0-f45.google.com ([209.85.216.45]:64402) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OfxIg-0005V4-H2 for qemu-devel@nongnu.org; Mon, 02 Aug 2010 11:51:38 -0400 Received: by qwi4 with SMTP id 4so1752751qwi.4 for ; Mon, 02 Aug 2010 08:51:37 -0700 (PDT) Message-ID: <4C56E986.4020608@codemonkey.ws> Date: Mon, 02 Aug 2010 10:51:34 -0500 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCHv2] Load "bootsplash.jpg" if present References: <20100802153201.GA9112@morn.localdomain> In-Reply-To: <20100802153201.GA9112@morn.localdomain> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin O'Connor Cc: qemu-devel@nongnu.org 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 > --- > 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); > } >