From patchwork Tue May 3 12:15:15 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiko Schocher X-Patchwork-Id: 93780 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 B7DEFB6F10 for ; Tue, 3 May 2011 22:15:26 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D3BBE280FD; Tue, 3 May 2011 14:15:23 +0200 (CEST) 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 9ne40saMK4HJ; Tue, 3 May 2011 14:15:23 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id BAA7C280FE; Tue, 3 May 2011 14:15:21 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 10C41280FD for ; Tue, 3 May 2011 14:15:18 +0200 (CEST) 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 osBab0s7PSfM for ; Tue, 3 May 2011 14:15:17 +0200 (CEST) X-policyd-weight: IN_SBL_XBL_SPAMHAUS=4.35 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from pollux.denx.de (p57941208.dip.t-dialin.net [87.148.18.8]) by theia.denx.de (Postfix) with ESMTP id 3A9172810F for ; Tue, 3 May 2011 14:15:16 +0200 (CEST) Received: by pollux.denx.de (Postfix, from userid 515) id 06933180189E6; Tue, 3 May 2011 14:15:15 +0200 (CEST) From: Heiko Schocher To: u-boot@lists.denx.de Date: Tue, 3 May 2011 14:15:15 +0200 Message-Id: <1304424915-17137-1-git-send-email-hs@denx.de> X-Mailer: git-send-email 1.7.4.4 In-Reply-To: References: Cc: Valentin Longchamp , Heiko Schocher , Holger Brunck Subject: [U-Boot] [PATCH v2 2/2] cramfs: make cramfs usable without a NOR flash X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 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 cc: Wolfgang Denk cc: Detlev Zundel cc: Valentin Longchamp cc: Holger Brunck Signed-off-by: Valentin Longchamp --- changes for v2: - added comments from Wolfgang Denk: - introduce define OFFSET_ADJUSTMENT, so command can be used without a NOR flash. common/cmd_cramfs.c | 10 ++++++++-- fs/cramfs/cramfs.c | 4 ++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/common/cmd_cramfs.c b/common/cmd_cramfs.c index 9060ecc..e7f496e 100644 --- a/common/cmd_cramfs.c +++ b/common/cmd_cramfs.c @@ -45,6 +45,12 @@ #ifdef CONFIG_CRAMFS_CMDLINE #include +#ifdef CONFIG_SYS_NO_FLASH +# define OFFSET_ADJUSTMENT 0 +#else +# define OFFSET_ADJUSTMENT (flash_info[id.num].start[0]) +#endif + #ifndef CONFIG_CMD_JFFS2 #include char *mkmodestr(unsigned long mode, char *str) @@ -119,7 +125,7 @@ int do_cramfs_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) dev.id = &id; part.dev = &dev; /* fake the address offset */ - part.offset = addr - flash_info[id.num].start[0]; + part.offset = addr - OFFSET_ADJUSTMENT; /* pre-set Boot file name */ if ((filename = getenv("bootfile")) == NULL) { @@ -182,7 +188,7 @@ int do_cramfs_ls(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) dev.id = &id; part.dev = &dev; /* fake the address offset */ - part.offset = addr - flash_info[id.num].start[0]; + part.offset = addr - OFFSET_ADJUSTMENT; if (argc == 2) filename = argv[1]; diff --git a/fs/cramfs/cramfs.c b/fs/cramfs/cramfs.c index 2956d39..910955d 100644 --- a/fs/cramfs/cramfs.c +++ b/fs/cramfs/cramfs.c @@ -41,8 +41,12 @@ struct cramfs_super super; /* CPU address space offset calculation macro, struct part_info offset is * device address space offset, so we need to shift it by a device start address. */ +#if !defined(CONFIG_SYS_NO_FLASH) extern flash_info_t flash_info[]; #define PART_OFFSET(x) (x->offset + flash_info[x->dev->id->num].start[0]) +#else +#define PART_OFFSET(x) (x->offset) +#endif static int cramfs_read_super (struct part_info *info) {