public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH 2/2] Make redboot partition table location configurable
@ 2004-10-29 13:33 Ian Campbell
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Campbell @ 2004-10-29 13:33 UTC (permalink / raw)
  To: linux-mtd

Hi all,

RedBoot has a compile time configuration option called
CYGNUM_REDBOOT_FIS_DIRECTORY_BLOCK. 

The patch below (against BK) adds an equivalent option to the Linux
redboot partition table parsing code.

Is it OK to commit to MTD CVS and send to Linus?

Ian.

Index: 2.6-bk/drivers/mtd/Kconfig
===================================================================
--- 2.6-bk.orig/drivers/mtd/Kconfig	2004-10-29 09:52:28.814675295 +0100
+++ 2.6-bk/drivers/mtd/Kconfig	2004-10-29 10:09:19.565036333 +0100
@@ -54,8 +54,8 @@
 	depends on MTD_PARTITIONS
 	---help---
 	  RedBoot is a ROM monitor and bootloader which deals with multiple
-	  'images' in flash devices by putting a table in the last erase
-	  block of the device, similar to a partition table, which gives
+	  'images' in flash devices by putting a table one of the erase
+	  blocks on the device, similar to a partition table, which gives
 	  the offsets, lengths and names of all the images stored in the
 	  flash.
 
@@ -68,6 +68,23 @@
 	  SA1100 map driver (CONFIG_MTD_SA1100) has an option for this, for 
 	  example.
 
+config MTD_REDBOOT_DIRECTORY_BLOCK
+	int "Location of RedBoot partition table"
+	depends on MTD_REDBOOT_PARTS
+	default "-1"
+	---help---
+	  This option is the Linux counterpart to the
+	  CYGNUM_REDBOOT_FIS_DIRECTORY_BLOCK RedBoot compile time
+	  option.
+
+	  The option specifies which Flash sectors holds the RedBoot
+	  partition table.  A zero or positive value gives an absolete
+	  erase block number. A negative value specifies a number of
+	  sectors before the end of the device.
+	  
+	  For example "2" means block number 2, "-1" means the last
+	  block and "-2" means the penultimate block.
+	  
 config MTD_REDBOOT_PARTS_UNALLOCATED
 	bool "  Include unallocated flash regions"
 	depends on MTD_REDBOOT_PARTS
Index: 2.6-bk/drivers/mtd/redboot.c
===================================================================
--- 2.6-bk.orig/drivers/mtd/redboot.c	2004-10-29 10:09:01.798848528 +0100
+++ 2.6-bk/drivers/mtd/redboot.c	2004-10-29 10:09:35.374754066 +0100
@@ -30,6 +30,9 @@
 	struct fis_list *next;
 };
 
+static int directory = CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK;
+module_param(directory, int, 0);
+
 static inline int redboot_checksum(struct fis_image_desc *img)
 {
 	/* RedBoot doesn't actually write the desc_cksum field yet AFAICT */
@@ -51,6 +54,7 @@
 	int namelen = 0;
 	int nulllen = 0;
 	int numslots;
+	unsigned long offset;
 #ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED
 	static char nullstring[] = "unallocated";
 #endif
@@ -60,8 +64,15 @@
 	if (!buf)
 		return -ENOMEM;
 
-	/* Read the start of the last erase block */
-	ret = master->read(master, master->size - master->erasesize,
+	if ( directory < 0 )
+		offset = master->size + directory*master->erasesize;
+	else
+		offset = directory*master->erasesize;
+
+	printk(KERN_NOTICE "Searching for RedBoot partition table in %s at offset 0x%lx\n",
+	       master->name, offset);
+
+	ret = master->read(master, offset,
 			   master->erasesize, &retlen, (void *)buf);
 
 	if (ret)

-- 
Ian Campbell, Senior Design Engineer
                                        Web: http://www.arcom.com
Arcom, Clifton Road, 			Direct: +44 (0)1223 403 465
Cambridge CB1 7EA, United Kingdom	Phone:  +44 (0)1223 411 200

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

* Re: [PATCH 2/2] Make redboot partition table location configurable
@ 2012-07-03 20:21 Aaron Hobley
  0 siblings, 0 replies; 2+ messages in thread
From: Aaron Hobley @ 2012-07-03 20:21 UTC (permalink / raw)
  To: linux-mtd; +Cc: 'Aaron Hobley'

Hi.
Thought you guys could help?
When device boots it show :-
Initial Program Loader

Power Micro
Partition Table

My question is? Can you send the partition table to us?

Thanks Aaron.

MC9060
Monitor 2.05.4
Power Micro 30.9.2
ASIC 1.1
Outhouse 1.3
Opt CPLD ID=3 Rev=0.1
CPU Rev id: 69052d06

Platform Symbol Gemini Xscale PXA255

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

end of thread, other threads:[~2012-07-03 20:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-03 20:21 [PATCH 2/2] Make redboot partition table location configurable Aaron Hobley
  -- strict thread matches above, loose matches on Subject: below --
2004-10-29 13:33 Ian Campbell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox