From patchwork Fri Mar 16 14:02:28 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 147208 X-Patchwork-Delegate: marek.vasut@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id EB122B6EF4 for ; Sat, 17 Mar 2012 01:03:02 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 1DF1E281CD; Fri, 16 Mar 2012 15:03:00 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id w3MXuEKC8qXV; Fri, 16 Mar 2012 15:02:59 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 9CA81281D1; Fri, 16 Mar 2012 15:02:57 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 67389281D1 for ; Fri, 16 Mar 2012 15:02:54 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SC2ow7rwuaOj for ; Fri, 16 Mar 2012 15:02:52 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.9]) by theia.denx.de (Postfix) with ESMTPS id B889A281CD for ; Fri, 16 Mar 2012 15:02:51 +0100 (CET) Received: from frontend1.mail.m-online.net (unknown [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id 3V8Szq1YWKz4Kh1Z; Fri, 16 Mar 2012 15:02:47 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.8.164]) by mail.m-online.net (Postfix) with ESMTP id 3V8Szq0Hn5z4KK5g; Fri, 16 Mar 2012 15:02:47 +0100 (CET) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from smtp-auth.mnet-online.de ([192.168.8.180]) by localhost (dynscan1.mail.m-online.net [192.168.8.164]) (amavisd-new, port 10024) with ESMTP id uoyF9OUOMyum; Fri, 16 Mar 2012 15:02:46 +0100 (CET) X-Auth-Info: z4hVDuHG8e7vnL2Ch3x2fF+GYLrdx5JNQeL/Do1Sesc= Received: from mashiro.lan (host-82-135-33-74.customer.m-online.net [82.135.33.74]) by smtp-auth.mnet-online.de (Postfix) with ESMTPA; Fri, 16 Mar 2012 15:02:45 +0100 (CET) From: Marek Vasut To: u-boot@lists.denx.de Date: Fri, 16 Mar 2012 15:02:28 +0100 Message-Id: <1331906548-19789-1-git-send-email-marex@denx.de> X-Mailer: git-send-email 1.7.9 In-Reply-To: References: Cc: Marek Vasut , Stephen Warren , Tom Warren Subject: [U-Boot] [PATCH V2] BOOT: Add RAW ramdisk support to bootz X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de This patch allows loading RAW ramdisk via bootz command. The raw ramdisk is loaded only in case it's size is specified: bootz : For example: bootz 0x42000000 0x43000000:0x12345 0x44000000 Signed-off-by: Marek Vasut Cc: Tom Warren Cc: albert.u.boot@aribaud.net Cc: afleming@gmail.com, Cc: Simon Glass , Cc: Stephen Warren Cc: Nicolas Pitre Cc: Wolfgang Denk Cc: Detlev Zundel --- README | 5 +++++ common/cmd_bootm.c | 6 ++++-- common/image.c | 31 +++++++++++++++++++++++++++---- 3 files changed, 36 insertions(+), 6 deletions(-) V2: Make this feature configurable Document this feature diff --git a/README b/README index b273070..43fa160 100644 --- a/README +++ b/README @@ -4422,6 +4422,11 @@ On some platforms, it's possible to boot Linux zImage. This is done using the "bootz" command. The syntax of "bootz" command is the same as the syntax of "bootm" command. +Note, defining the CONFIG_SUPPORT_INITRD_RAW allows user to supply +kernel with raw initrd images. The syntax is slightly different, the +address of the initrd must be augmented by it's size, in the following +format: ":". + Standalone HOWTO: ================= diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index 9efac8b..872a49c 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -1628,9 +1628,11 @@ static int do_bootz(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) U_BOOT_CMD( bootz, CONFIG_SYS_MAXARGS, 1, do_bootz, "boot Linux zImage image from memory", - "[addr [initrd] [fdt]]\n - boot Linux zImage stored in memory\n" + "[addr [initrd[:size]] [fdt]]\n" + " - boot Linux zImage stored in memory\n" "\tThe argument 'initrd' is optional and specifies the address\n" - "\tof the initrd in memory.\n" + "\tof the initrd in memory. The optional argument ':size' allows\n" + "\tspecifying the size of RAW initrd.\n" #if defined(CONFIG_OF_LIBFDT) "\tWhen booting a Linux kernel which requires a flat device-tree\n" "\ta third argument is required which is the address of the\n" diff --git a/common/image.c b/common/image.c index 95c7a15..1908df6 100644 --- a/common/image.c +++ b/common/image.c @@ -797,6 +797,7 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images, ulong rd_addr, rd_load; ulong rd_data, rd_len; const image_header_t *rd_hdr; + char *end; #if defined(CONFIG_FIT) void *fit_hdr; const char *fit_uname_config = NULL; @@ -845,10 +846,21 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images, } else #endif { - rd_addr = simple_strtoul(argv[2], NULL, 16); + rd_addr = simple_strtoul(argv[2], &end, 16); debug("* ramdisk: cmdline image address = " "0x%08lx\n", rd_addr); + +#ifdef CONFIG_SUPPORT_RAW_INITRD + if (end[0] == ':') { + rd_len = simple_strtoul(++end, + NULL, 16); + debug("* ramdisk: cmdline image " + "length = 0x%08lx\n", + rd_len); + } +#endif + } #if defined(CONFIG_FIT) } else { @@ -990,9 +1002,20 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images, break; #endif default: - puts("Wrong Ramdisk Image Format\n"); - rd_data = rd_len = rd_load = 0; - return 1; +#ifdef CONFIG_SUPPORT_RAW_INITRD + /* + * Check if rd_len was manually overridden, if it was, + * we're loading RAW ramdisk. + */ + if (rd_len != 0) { + rd_data = rd_addr; + } else +#endif + { + puts("Wrong Ramdisk Image Format\n"); + rd_data = rd_len = rd_load = 0; + return 1; + } } } else if (images->legacy_hdr_valid && image_check_type(&images->legacy_hdr_os_copy,