Port-powerpc archive

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

arch/powerpc/stand/mkbootimage supports bebox



Hi! Tim and all


I completed debug for arch/powerpc/stand/mkbootimage.

I will commit this patch and remove arch/bebox/mkbootimage next weekend. ;-)



By the way,  I put patch for new boot(8) of bebox to
  ftp://ftp.netbsd.org/pub/NetBSD/misc/kiyohara/tmp/boot.diff

However, I will have to solve the problem of genfb and vga.  X-<


Thanks,
--
kiyohara

? mkbootimage/.gdbinit
? mkbootimage/mkbootimage
Index: Makefile
===================================================================
RCS file: /cvsroot/src/sys/arch/powerpc/stand/Makefile,v
retrieving revision 1.4
diff -u -r1.4 Makefile
--- Makefile    1 May 2008 18:13:38 -0000       1.4
+++ Makefile    21 May 2008 03:53:07 -0000
@@ -1,6 +1,6 @@
 #      $NetBSD: Makefile,v 1.4 2008/05/01 18:13:38 garbled Exp $
 
-.if ${MACHINE} == "prep"
+.if (${MACHINE} == "bebox" || ${MACHINE} == "prep" || ${MACHINE} == "rs6000")
 SUBDIR=        mkbootimage
 .endif
 
Index: mkbootimage/magic.h
===================================================================
RCS file: /cvsroot/src/sys/arch/powerpc/stand/mkbootimage/magic.h,v
retrieving revision 1.3
diff -u -r1.3 magic.h
--- mkbootimage/magic.h 20 Dec 2007 23:00:00 -0000      1.3
+++ mkbootimage/magic.h 21 May 2008 03:53:07 -0000
@@ -9,4 +9,4 @@
 #define        PREP_MAGICSIZE          sizeof (prep_magic)
 #define RS6000_MAGICSIZE       sizeof (rs6000_magic)
 #define        KERNLENSIZE             sizeof (kern_len)
-#define        ENTRY                   0x100000
+#define        ENTRY                   0x3100
Index: mkbootimage/mkbootimage.c
===================================================================
RCS file: /cvsroot/src/sys/arch/powerpc/stand/mkbootimage/mkbootimage.c,v
retrieving revision 1.9
diff -u -r1.9 mkbootimage.c
--- mkbootimage/mkbootimage.c   30 Apr 2008 21:15:33 -0000      1.9
+++ mkbootimage/mkbootimage.c   21 May 2008 03:53:07 -0000
@@ -705,7 +705,7 @@
                        continue;
 
                fstat(elf_fd, &elf_stat);
-               elf_img_len = elf_stat.st_size - ELFGET32(phdr.p_offset);
+               elf_img_len = ELFGET32(phdr.p_filesz);
                lseek(elf_fd, ELFGET32(phdr.p_offset), SEEK_SET);
 
                break;
@@ -720,7 +720,7 @@
        lseek(bebox_fd, hsize, SEEK_SET);
        
        /* write the header with the wrong values to get the offset right */
-       bebox_write_header(bebox_fd, elf_img_len, kern_len);
+       bebox_write_header(bebox_fd, elf_img_len, kern_stat.st_size);
        
        /* Copy kernel */
        kern_img = (unsigned char *)malloc(kern_stat.st_size);
@@ -761,7 +761,8 @@
 
        /* now rewrite the header correctly */
        lseek(bebox_fd, hsize, SEEK_SET);
-       toff = bebox_write_header(bebox_fd, elf_img_len, kgzlen);
+       tmp = kgzlen + BEBOX_MAGICSIZE + KERNLENSIZE;
+       toff = bebox_write_header(bebox_fd, elf_img_len, tmp);
 
        /* Copy boot image */
        elf_img = (unsigned char *)malloc(elf_img_len);
@@ -798,10 +799,11 @@
            BEBOX_FILE_BLOCK_MAP_END - BEBOX_FILE_BLOCK_MAP_START);
 
        /* fix the file size in the header */
+       tmp = endoff - BEBOX_HEADER_SIZE;
        *(long *)(header_img + BEBOX_FILE_SIZE_OFFSET) =
-           (long)sa_htobe32(endoff);
+           (long)sa_htobe32(tmp);
        *(long *)(header_img + BEBOX_FILE_SIZE_ALIGN_OFFSET) =
-           (long)sa_htobe32(roundup(endoff, BEBOX_BLOCK_SIZE));
+           (long)sa_htobe32(roundup(tmp, BEBOX_BLOCK_SIZE));
 
        gettimeofday(&tp, 0);
        for (offset = bebox_mtime_offset; *offset != -1; offset++)


Home | Main Index | Thread Index | Old Index