linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* fadsrom -> mkrombin
@ 1999-12-09 10:06 Ruedi.Hofer
  0 siblings, 0 replies; 2+ messages in thread
From: Ruedi.Hofer @ 1999-12-09 10:06 UTC (permalink / raw)
  To: linuxppc-embedded

[-- Attachment #1: Type: TEXT/PLAIN, Size: 842 bytes --]

After some little changes I'm now able to compile fadsrom.

(I had to define __fswab16, __fswab32 and ffz)



Next problem: mkrombin doesn't work. It fails with an output message of

"something wrong with file fadsrom" in line 63

I compiled mkrombin with debug options and had a look why it fails.

It expects a value of 2 for nscns but it gets:

(gdb) print nscns
$3 = 512
(gdb) 

whereas nscns is basically a copy of ehp->e_phnum

(gdb) print *ehp
$1 = {e_ident = "\177ELF\001\002\001\000\000\000\000\000\000\000\000", 
e_type = 512, e_machine = 5120, e_version = 16777216, e_entry = 254, 
e_phoff = 872415232, e_shoff = 3837985280, e_flags = 0, e_ehsize = 13312, 
e_phentsize = 8192, e_phnum = 512, e_shentsize = 10240, e_shnum = 2560, 
e_shstrndx = 1792}
(gdb) 



Any ideas? Is cross-"mkrombin" a problem? (We develop on Intel)

Ruedi


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

* Re: fadsrom -> mkrombin
@ 1999-12-09 13:42 kd
  0 siblings, 0 replies; 2+ messages in thread
From: kd @ 1999-12-09 13:42 UTC (permalink / raw)
  To: Ruedi.Hofer; +Cc: linuxppc-embedded

[-- Attachment #1: Type: text/plain, Size: 2445 bytes --]


Yes thats correct I had to change mkrombin tooo.

Here is my diffs.

(See attached file: mkrombin.diff)
K.D.



                                                                                                                                                    
                    Ruedi.Hofer@ascom.ch                                                                                                            
                    Sent by:                                To:     linuxppc-embedded@lists.linuxppc.org                                            
                    owner-linuxppc-embedded@lists.li        cc:                                                                                     
                    nuxppc.org                              Subject:     fadsrom -> mkrombin                                                        
                                                                                                                                                    
                                                                                                                                                    
                    12/09/99 10:06 AM                                                                                                               
                                                                                                                                                    
                                                                                                                                                    




After some little changes I'm now able to compile fadsrom.

(I had to define __fswab16, __fswab32 and ffz)



Next problem: mkrombin doesn't work. It fails with an output message of

"something wrong with file fadsrom" in line 63

I compiled mkrombin with debug options and had a look why it fails.

It expects a value of 2 for nscns but it gets:

(gdb) print nscns
$3 = 512
(gdb)

whereas nscns is basically a copy of ehp->e_phnum

(gdb) print *ehp
$1 = {e_ident = "\177ELF\001\002\001\000\000\000\000\000\000\000\000",
e_type = 512, e_machine = 5120, e_version = 16777216, e_entry = 254,
e_phoff = 872415232, e_shoff = 3837985280, e_flags = 0, e_ehsize = 13312,
e_phentsize = 8192, e_phnum = 512, e_shentsize = 10240, e_shnum = 2560,
e_shstrndx = 1792}
(gdb)



Any ideas? Is cross-"mkrombin" a problem? (We develop on Intel)

Ruedi




[-- Attachment #2: mkrombin.diff --]
[-- Type: application/octet-stream, Size: 2757 bytes --]

--- fadsrom/mkrombin.c	Wed Nov 18 06:43:39 1998
+++ fadsrom_current/mkrombin.c	Tue May  4 14:58:12 1999
@@ -10,6 +10,9 @@
  * We strip the header, place the code first, and move the data to
  * a 4K page boundary following the code.
  */
+
+
+#include "byteconv.h"
 #include <sys/types.h>
 #include <fcntl.h>
 #include <string.h>
@@ -50,31 +53,42 @@
 		exit(2);
 	}
 	ehp = (Elf32_Ehdr *) ibuf;
+#ifdef _DEBUG
+	fprintf(stdout,"ibuf = %u, ehp = %u ", ibuf, ehp);
+#endif
 
 	if (strncmp(ehp->e_ident, ELFMAG, 4) != 0) {
 		fprintf(stderr, "%s doesn't look like ELF\n", argv[1]);
 		exit(2);
 	}
 
-	nscns = ehp->e_phnum;
-	epp = (Elf32_Phdr *)((uint)ehp + ehp->e_phoff);
+	nscns = CTOHS(ehp->e_phnum);
+	epp = (Elf32_Phdr *)((uint)ehp + CTOHL(ehp->e_phoff));
+#ifdef _DEBUG
+	fprintf(stdout,"nscsn = %i, e_phoff = %i\n", nscns, CTOHL(ehp->e_phoff));
+#endif
 
 	if (nscns != 2) {
-		fprintf(stderr, "something wrong with file %s\n", argv[1]);
-		exit(2);
+		fprintf(stderr, "1something wrong with file %s\n", argv[1]);
+	//	exit(2);
 	}
 
 	/* Get the data portion.
 	*/
-	if ((epp->p_type != PT_LOAD) || (epp->p_offset != 0x10000)) {
-		fprintf(stderr, "something wrong with file %s\n", argv[1]);
+#ifdef _DEBUG
+	fprintf(stdout, "p_type = %i, p_offset = %i\n",
+				CTOHL(epp->p_type),CTOHL(epp->p_offset));
+#endif
+	if ((CTOHL(epp->p_type) != PT_LOAD) ||
+				(CTOHL(epp->p_offset) != 0x10000)) {
+		fprintf(stderr, "2something wrong with file %s\n", argv[1]);
 		exit(2);
 	}
-	dsize = epp->p_filesz;
+	dsize = CTOHL(epp->p_filesz);
 
-#if 0
-	printf(" %d %d %d %d\n", epp->p_type, epp->p_offset, epp->p_filesz,
-		epp->p_memsz);
+#if _DEBUG
+	printf(" %d %d %d %d\n", CTOHL(epp->p_type), CTOHL(epp->p_offset),
+			CTOHL(epp->p_filesz), CTOHL(epp->p_memsz));
 #endif
 	if (read(elf_fd, dbuf, sizeof(dbuf)) != sizeof(dbuf)) {
 		fprintf(stderr, "%s doesn't look like ELF\n", argv[1]);
@@ -84,16 +98,17 @@
 	/* Get the instruction portion.
 	*/
 	epp++;
-	if ((epp->p_type != PT_LOAD) || (epp->p_offset != 0x20000) ||
-		(epp->p_filesz != epp->p_memsz)) {
-		fprintf(stderr, "something wrong with file %s\n", argv[1]);
+	if ((CTOHL(epp->p_type) != PT_LOAD) ||
+			(CTOHL(epp->p_offset) != 0x20000) ||
+			(CTOHL(epp->p_filesz) != CTOHL(epp->p_memsz))) {
+		fprintf(stderr, "3something wrong with file %s\n", argv[1]);
 		exit(2);
 	}
 #if 0
-	printf(" %d %d %d %d\n", epp->p_type, epp->p_offset, epp->p_filesz,
-		epp->p_memsz);
+	printf(" %d %d %d %d\n", CTOHL(epp->p_type), CTOHL(epp->p_offset), 
+			CTOHL(epp->p_filesz), CTOHL(epp->p_memsz));
 #endif
-	size = epp->p_filesz;
+	size = CTOHL(epp->p_filesz);
 	if (read(elf_fd, ibuf, size) != size) {
 		fprintf(stderr, "%s doesn't look like ELF\n", argv[1]);
 		exit(2);

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

end of thread, other threads:[~1999-12-09 13:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1999-12-09 10:06 fadsrom -> mkrombin Ruedi.Hofer
  -- strict thread matches above, loose matches on Subject: below --
1999-12-09 13:42 kd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).