Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/powerpc/stand/mkbootimage Fixed mkbootimage for 64-...



details:   https://anonhg.NetBSD.org/src/rev/dceddde4cd09
branches:  trunk
changeset: 795657:dceddde4cd09
user:      phx <phx%NetBSD.org@localhost>
date:      Tue Apr 22 21:37:52 2014 +0000

description:
Fixed mkbootimage for 64-bit architectures. Now I can create a working
BeBox boot.fs under NetBSD/amd64.

diffstat:

 sys/arch/powerpc/stand/mkbootimage/bebox_bootrec.h |   8 +-
 sys/arch/powerpc/stand/mkbootimage/mkbootimage.c   |  18 ++--
 sys/arch/powerpc/stand/mkbootimage/pef.h           |  72 +++++++++++-----------
 3 files changed, 49 insertions(+), 49 deletions(-)

diffs (171 lines):

diff -r 87031d5a5507 -r dceddde4cd09 sys/arch/powerpc/stand/mkbootimage/bebox_bootrec.h
--- a/sys/arch/powerpc/stand/mkbootimage/bebox_bootrec.h        Tue Apr 22 19:27:17 2014 +0000
+++ b/sys/arch/powerpc/stand/mkbootimage/bebox_bootrec.h        Tue Apr 22 21:37:52 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bebox_bootrec.h,v 1.3 2012/12/24 14:01:24 kiyohara Exp $       */
+/*     $NetBSD: bebox_bootrec.h,v 1.4 2014/04/22 21:37:52 phx Exp $    */
 
 #define        BEBOX_HEADER_SIZE               0x6400
 #define        BEBOX_BLOCK_SIZE                0x200
@@ -136,9 +136,9 @@
 };
 
 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 @@
        { -1 }
 };
 
-long bebox_mtime_offset[] = {
+int32_t bebox_mtime_offset[] = {
        0x00000004,
        0x0000048c,
        0x00000490,
diff -r 87031d5a5507 -r dceddde4cd09 sys/arch/powerpc/stand/mkbootimage/mkbootimage.c
--- a/sys/arch/powerpc/stand/mkbootimage/mkbootimage.c  Tue Apr 22 19:27:17 2014 +0000
+++ b/sys/arch/powerpc/stand/mkbootimage/mkbootimage.c  Tue Apr 22 21:37:52 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mkbootimage.c,v 1.17 2013/07/09 13:10:33 joerg Exp $   */
+/*     $NetBSD: mkbootimage.c,v 1.18 2014/04/22 21:37:52 phx Exp $     */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -685,10 +685,9 @@
        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 @@
 
        /* 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);
 
diff -r 87031d5a5507 -r dceddde4cd09 sys/arch/powerpc/stand/mkbootimage/pef.h
--- a/sys/arch/powerpc/stand/mkbootimage/pef.h  Tue Apr 22 19:27:17 2014 +0000
+++ b/sys/arch/powerpc/stand/mkbootimage/pef.h  Tue Apr 22 21:37:52 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pef.h,v 1.2 2010/10/16 05:05:09 kiyohara Exp $ */
+/*     $NetBSD: pef.h,v 1.3 2014/04/22 21:37:52 phx Exp $      */
 
 /*-
  * Copyright (C) 1995-1997 Gary Thomas (gdt%linuxppc.org@localhost)
@@ -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 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 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;
 };



Home | Main Index | Thread Index | Old Index