Module Name:    src
Committed By:   msaitoh
Date:           Tue Jun  3 15:26:34 UTC 2014

Modified Files:
        src/sys/arch/powerpc/stand/mkbootimage [netbsd-6]: bebox_bootrec.h
            mkbootimage.c pef.h

Log Message:
Pull up following revision(s) (requested by phx in ticket #1074):
        sys/arch/powerpc/stand/mkbootimage/mkbootimage.c: revision 1.18
        sys/arch/powerpc/stand/mkbootimage/pef.h: revision 1.3
        sys/arch/powerpc/stand/mkbootimage/bebox_bootrec.h: revision 1.4
Fixed mkbootimage for 64-bit architectures. Now I can create a working
BeBox boot.fs under NetBSD/amd64.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.38.1 \
    src/sys/arch/powerpc/stand/mkbootimage/bebox_bootrec.h
cvs rdiff -u -r1.14 -r1.14.10.1 \
    src/sys/arch/powerpc/stand/mkbootimage/mkbootimage.c
cvs rdiff -u -r1.2 -r1.2.14.1 src/sys/arch/powerpc/stand/mkbootimage/pef.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/powerpc/stand/mkbootimage/bebox_bootrec.h
diff -u src/sys/arch/powerpc/stand/mkbootimage/bebox_bootrec.h:1.2 src/sys/arch/powerpc/stand/mkbootimage/bebox_bootrec.h:1.2.38.1
--- src/sys/arch/powerpc/stand/mkbootimage/bebox_bootrec.h:1.2	Sat May 24 17:34:03 2008
+++ src/sys/arch/powerpc/stand/mkbootimage/bebox_bootrec.h	Tue Jun  3 15:26:34 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: bebox_bootrec.h,v 1.2 2008/05/24 17:34:03 kiyohara Exp $	*/
+/*	$NetBSD: bebox_bootrec.h,v 1.2.38.1 2014/06/03 15:26:34 msaitoh Exp $	*/
 
 #define	BEBOX_HEADER_SIZE		0x6400
 #define	BEBOX_BLOCK_SIZE		0x200
@@ -136,9 +136,9 @@ u_char bebox_image_data12[] = {
 };
 
 struct bebox_image_block {
-	long offset;
+	int32_t offset;
 	u_char *data;
-	int size;
+	int32_t size;
 };
 
 #define	BEBOX_IMG(x)		__CONCAT(bebox_image_data,x)
@@ -162,7 +162,7 @@ struct bebox_image_block bebox_image_blo
 	{ -1 }
 };
 
-long bebox_mtime_offset[] = {
+int32_t bebox_mtime_offset[] = {
 	0x00000004,
 	0x0000048c,
 	0x00000490,

Index: src/sys/arch/powerpc/stand/mkbootimage/mkbootimage.c
diff -u src/sys/arch/powerpc/stand/mkbootimage/mkbootimage.c:1.14 src/sys/arch/powerpc/stand/mkbootimage/mkbootimage.c:1.14.10.1
--- src/sys/arch/powerpc/stand/mkbootimage/mkbootimage.c:1.14	Wed Jan 26 21:35:14 2011
+++ src/sys/arch/powerpc/stand/mkbootimage/mkbootimage.c	Tue Jun  3 15:26:33 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: mkbootimage.c,v 1.14 2011/01/26 21:35:14 joerg Exp $	*/
+/*	$NetBSD: mkbootimage.c,v 1.14.10.1 2014/06/03 15:26:33 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -677,10 +677,9 @@ bebox_build_image(char *kernel, char *bo
 	unsigned char *elf_img = NULL, *kern_img = NULL, *header_img = NULL;
 	int i, ch, tmp, kgzlen, err, hsize = BEBOX_HEADER_SIZE;
 	int elf_fd, bebox_fd, kern_fd, elf_img_len = 0;
+	off_t lenpos, kstart, kend, toff, endoff, flength;
 	uint32_t swapped[128];
-	off_t lenpos, kstart, kend, toff, endoff;
-	unsigned long length;
-	long flength, *offset;
+	int32_t *offset;
 	gzFile gzf;
 	struct stat kern_stat;
 	struct bebox_image_block *p;
@@ -818,14 +817,15 @@ bebox_build_image(char *kernel, char *bo
 
 	/* fix the file size in the header */
 	tmp = endoff - BEBOX_HEADER_SIZE;
-	*(long *)(header_img + BEBOX_FILE_SIZE_OFFSET) =
-	    (long)sa_htobe32(tmp);
-	*(long *)(header_img + BEBOX_FILE_SIZE_ALIGN_OFFSET) =
-	    (long)sa_htobe32(roundup(tmp, BEBOX_FILE_BLOCK_SIZE));
+	*(int32_t *)(header_img + BEBOX_FILE_SIZE_OFFSET) =
+	    (int32_t)sa_htobe32(tmp);
+	*(int32_t *)(header_img + BEBOX_FILE_SIZE_ALIGN_OFFSET) =
+	    (int32_t)sa_htobe32(roundup(tmp, BEBOX_FILE_BLOCK_SIZE));
 
 	gettimeofday(&tp, 0);
 	for (offset = bebox_mtime_offset; *offset != -1; offset++)
-		*(long *)(header_img + *offset) = (long)sa_htobe32(tp.tv_sec);
+		*(int32_t *)(header_img + *offset) =
+		    (int32_t)sa_htobe32(tp.tv_sec);
 
 	write(bebox_fd, header_img, BEBOX_HEADER_SIZE);
 

Index: src/sys/arch/powerpc/stand/mkbootimage/pef.h
diff -u src/sys/arch/powerpc/stand/mkbootimage/pef.h:1.2 src/sys/arch/powerpc/stand/mkbootimage/pef.h:1.2.14.1
--- src/sys/arch/powerpc/stand/mkbootimage/pef.h:1.2	Sat Oct 16 05:05:09 2010
+++ src/sys/arch/powerpc/stand/mkbootimage/pef.h	Tue Jun  3 15:26:34 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: pef.h,v 1.2 2010/10/16 05:05:09 kiyohara Exp $	*/
+/*	$NetBSD: pef.h,v 1.2.14.1 2014/06/03 15:26:34 msaitoh Exp $	*/
 
 /*-
  * Copyright (C) 1995-1997 Gary Thomas (g...@linuxppc.org)
@@ -34,17 +34,17 @@
 
 struct FileHeader
 {
-	unsigned long magic;
-	unsigned long fileTypeID;
-	unsigned long archID;
-	unsigned long versionNumber;
-	unsigned long dateTimeStamp;
-	unsigned long definVersion;
-	unsigned long implVersion;
-	unsigned long currentVersion;
-	unsigned short numSections;
-	unsigned short loadableSections;
-	unsigned long memoryAddress;
+	uint32_t magic;
+	uint32_t fileTypeID;
+	uint32_t archID;
+	uint32_t versionNumber;
+	uint32_t dateTimeStamp;
+	uint32_t definVersion;
+	uint32_t implVersion;
+	uint32_t currentVersion;
+	uint16_t numSections;
+	uint16_t loadableSections;
+	uint32_t memoryAddress;
 };
 
 #define PEF_MAGIC 0x4A6F7921  /* Joy! */
@@ -53,16 +53,16 @@ struct FileHeader
 
 struct SectionHeader
 {
-	unsigned long sectionName;
-	unsigned long sectionAddress;
-	unsigned long execSize;
-	unsigned long initSize;
-	unsigned long rawSize;
-	unsigned long fileOffset;
-	unsigned char regionKind;
-	unsigned char shareKind;
-	unsigned char alignment;
-	unsigned char _reserved;
+	uint32_t sectionName;
+	uint32_t sectionAddress;
+	uint32_t execSize;
+	uint32_t initSize;
+	uint32_t rawSize;
+	uint32_t fileOffset;
+	uint8_t regionKind;
+	uint8_t shareKind;
+	uint8_t alignment;
+	uint8_t _reserved;
 };
 
 #define CodeSection	0
@@ -79,18 +79,18 @@ struct SectionHeader
 
 struct LoaderHeader
 {
-	unsigned long entryPointSection;
-	unsigned long entryPointOffset;
-	unsigned long initPointSection;
-	unsigned long initPointOffset;
-	unsigned long termPointSection;
-	unsigned long termPointOffset;
-	unsigned long numImportFiles;
-	unsigned long numImportSyms;
-	unsigned long numSections;
-	unsigned long relocationsOffset;
-	unsigned long stringsOffset;
-	unsigned long hashSlotTable;
-	unsigned long hashSlotTableSize;
-	unsigned long numExportSyms;
+	uint32_t entryPointSection;
+	uint32_t entryPointOffset;
+	uint32_t initPointSection;
+	uint32_t initPointOffset;
+	uint32_t termPointSection;
+	uint32_t termPointOffset;
+	uint32_t numImportFiles;
+	uint32_t numImportSyms;
+	uint32_t numSections;
+	uint32_t relocationsOffset;
+	uint32_t stringsOffset;
+	uint32_t hashSlotTable;
+	uint32_t hashSlotTableSize;
+	uint32_t numExportSyms;
 };

Reply via email to