From patchwork Mon Aug 2 16:11:57 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin O'Connor X-Patchwork-Id: 60555 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id B8A32B6F01 for ; Tue, 3 Aug 2010 02:30:09 +1000 (EST) Received: from localhost ([127.0.0.1]:32837 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ofxtu-0005Wp-Fz for incoming@patchwork.ozlabs.org; Mon, 02 Aug 2010 12:30:06 -0400 Received: from [140.186.70.92] (port=39461 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OfxcP-0004UB-RR for qemu-devel@nongnu.org; Mon, 02 Aug 2010 12:12:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OfxcO-0002M2-Mk for qemu-devel@nongnu.org; Mon, 02 Aug 2010 12:12:01 -0400 Received: from mail-qw0-f45.google.com ([209.85.216.45]:48770) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OfxcO-0002Lp-KY for qemu-devel@nongnu.org; Mon, 02 Aug 2010 12:12:00 -0400 Received: by qwi4 with SMTP id 4so1771245qwi.4 for ; Mon, 02 Aug 2010 09:11:59 -0700 (PDT) Received: by 10.229.232.198 with SMTP id jv6mr239270qcb.36.1280765519583; Mon, 02 Aug 2010 09:11:59 -0700 (PDT) Received: from localhost (207-172-165-101.c3-0.avec-ubr1.nyr-avec.ny.cable.rcn.com [207.172.165.101]) by mx.google.com with ESMTPS id t21sm231850qcs.8.2010.08.02.09.11.58 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 02 Aug 2010 09:11:59 -0700 (PDT) Date: Mon, 2 Aug 2010 12:11:57 -0400 From: Kevin O'Connor To: qemu-devel@nongnu.org Message-ID: <20100802161157.GA11743@morn.localdomain> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-12-10) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: [Qemu-devel] [PATCHv3] Load "bootsplash.jpg" if present X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Load the "bootsplash.jpg" file into fw_cfg if it is found in the roms directory. Signed-off-by: Kevin O'Connor --- Changes v2->v3: Fix coding style (missing braces). Changes v1->v2: Add signed-off-by line. --- hw/fw_cfg.c | 9 +++++++-- hw/pc.c | 8 ++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/hw/fw_cfg.c b/hw/fw_cfg.c index 72866ae..5a2c0aa 100644 --- a/hw/fw_cfg.c +++ b/hw/fw_cfg.c @@ -304,8 +304,13 @@ 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); }