public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Ciro Cattuto <ciro@prosa.it>
To: David Woodhouse <dwmw2@infradead.org>
Cc: Miguel Freitas <miguel@cetuc.puc-rio.br>, mtd@infradead.org
Subject: GRUB on DOC: 2Mb issues
Date: Mon, 28 Aug 2000 18:50:18 +0200	[thread overview]
Message-ID: <20000828185018.A2777@localhost> (raw)

David,

since the only DiskOnChip I have is a 2 Mb one, I had to solve some issues
with makecsum.c and doc_stage1.S before being able to load/run GRUB as a
replacement firmware. The ROM IPL of the 2Mb DOC (or any DOC with page256==1,
I guess) loads the first 0x2000 bytes sequentially instead of loading half
of the first 0x4000 bytes, as you describe in mtd/grub/README. This requires
some modifications to makecsum.c in order to build a valid firmware image.
Also, doc_stage1.S doesn't support the addressing scheme needed for 2Mb DOCs,
so I had to make a few modifications to make it load GRUB-stage2.

The relevant cvs diffs follow. Notice: these mods make doc_stage1.S and
makecsum.c work _only_ for 2Mb DOCs! I'd like to merge this functionality
into the existing code, but I'll wait for your feedback. I'd use a simple
"#ifdef DOC_PAGE256" both in doc_stage1.S and makecsum.c, but in the long
run it would be nice to be able to access the page256 flag (mtd->priv->page256)
from userland (page256 in mtd_info_user?).

Cheers,

Ciro


Index: doc_stage1.S
===================================================================
RCS file: /home/cvs/mtd/grub/doc_stage1.S,v
retrieving revision 1.8
diff -r1.8 doc_stage1.S
166c166
< 		/* Send new READ command - is it READ0 or READ1? */
---
> 		/* Send new READ0 command */
169c169
< 	andb	$1,%ah
---
> 	xorb	%ah,%ah
176,177c176
< 		/* We sent bits 0-7, then 9-16, then 17-23 */
< 		/* Yes bit 8 is missing. Read the NAND flash specs */		
---
> 		/* We sent bits 0-7, then 8-15, then 16-23 */
182,186c181
< 			/* Bits 9-16 */
< 	shrw	$1,%dx
< 	.byte	0x80, 0xce /* orb adrbit16, %dh */
< adrbit16:	
< 	.byte	0	
---
> 			/* Bits 8-15 */
189c184
< 		/* Bits 17-23 are also zero */
---
> 		/* Bits 16-23 */
216,217d210
< 	addb	$0x80, %cs:adrbit16	/* Increase bit 16 */
< 	jnc	endloop			/* Did it overflow? */




Index: makecsum.c
===================================================================
RCS file: /home/cvs/mtd/grub/makecsum.c,v
retrieving revision 1.1
diff -r1.1 makecsum.c
5c5
< unsigned char buf[16384];
---
> unsigned char buf[8192];
12c12
< 	memset(buf, 0xff, 16384);
---
> 	memset(buf, 0xff, 8192);
61c61
< 	len = read(st2fd, buf+512, 16384-512);
---
> 	len = read(st2fd, buf+512, 8192-512);
73,74c73
< 	i=0;
< 	while (i<16384) {
---
> 	for (i=0 ; i<8192 ; i++)
76,79d74
< 		i++;
< 		if ((i >> 8)&1)
< 			i += 256;
< 	}
85c80
< 	len = write(outfd, buf, 16384);
---
> 	len = write(outfd, buf, 8192);
94,95c89,90
< 	if (len < 16384) {
< 		fprintf(stderr, "short write of output file (%d bytes < 16384)\n",
---
> 	if (len < 8192) {
> 		fprintf(stderr, "short write of output file (%d bytes < 8192)\n",
105c100
< 		len = read(st2fd, buf, 16384);
---
> 		len = read(st2fd, buf, 8192);



-- 
Ciro Cattuto, Open Source Developer, Linuxcare Italia SpA
Tel. +39.338.3002140  Fax +39.049.8036484 
ciro@linuxcare.com    http://www.linuxcare.com/
ciro@prosa.it         http://www.prosa.it/
Linuxcare. Support for the revolution.




To unsubscribe, send "unsubscribe mtd" to majordomo@infradead.org

             reply	other threads:[~2000-08-28 16:49 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-08-28 16:50 Ciro Cattuto [this message]
2000-08-28 22:24 ` GRUB on DOC: 2Mb issues Miguel Freitas
2000-08-30  8:57 ` David Woodhouse
2000-08-30 13:46   ` Miguel Freitas
2000-08-30 15:07     ` David Woodhouse
2000-08-30 14:23       ` Miguel Freitas
2000-08-31 16:20         ` David Woodhouse
2000-08-31 23:10           ` Ciro Cattuto
2000-08-30 15:47       ` Ciro Cattuto
2000-08-30 16:31       ` David Woodhouse
2000-08-30 16:39         ` David Woodhouse
2000-08-30 14:21   ` Ciro Cattuto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20000828185018.A2777@localhost \
    --to=ciro@prosa.it \
    --cc=dwmw2@infradead.org \
    --cc=miguel@cetuc.puc-rio.br \
    --cc=mtd@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox