On 26/12/15 19:50, John Paul Adrian Glaubitz wrote:
> On 12/26/2015 08:44 PM, John Paul Adrian Glaubitz wrote:
>> Could you try to get this patch upstreamed? I will try to apply it in
>> the meantime.
> The patch isn't complete in any case, udivid3.S has to be patched as
> well:
>
> gcc -Os -Wall -I. -I../include -fomit-frame-pointer -fno-strict-aliasing
> -DSMALL_RELOC=0x280000 -DLARGE_RELOC=0x380000 -fno-stack-protector -c
> udivdi3.S
> udivdi3.S: Assembler messages:
> udivdi3.S:202: Error: detected global register use not covered by
> .register pseudo-op
> udivdi3.S:203: Error: detected global register use not covered by
> .register pseudo-op
> udivdi3.S:203: Error: detected global register use not covered by
> .register pseudo-op
> udivdi3.S:238: Error: detected global register use not covered by
> .register pseudo-op
>
> Could you give me the complete patch to get silo compile on sparc64?
>
> Adrian
>
err,..it was a slew of patches
you could just grab the src we made available? As for upstream,.. Wim doesn't
pay me enough for the necessary asbestos suit. We do have one but I dunno who 's
wearing it atm. (probably Rob)
Session transcript using x86 since we don't care about compiling, we just want
the src:
[root@emerald ~]# mkdir work
[root@emerald ~]# cd work
[root@emerald work]# git clone
https://git.kernel.org/pub/scm/linux/kernel/git/davem/silo.git
Cloning into 'silo'...
remote: Counting objects: 1395, done.
remote: Total 1395 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (1395/1395), 517.80 KiB | 526.00 KiB/s, done.
Resolving deltas: 100% (978/978), done.
Checking connectivity... done.
[root@emerald work]#
[root@emerald work]# wget
http://yum.oracle.com/repo/linux_sparc64/latest/silo-1.4.14-4.0.18.el6.src.rpm
--2015-12-26 21:28:52--
http://yum.oracle.com/repo/linux_sparc64/latest/silo-1.4.14-4.0.18.el6.src.rpm
Resolving yum.oracle.com (yum.oracle.com)... 213.123.252.136,
213.123.252.145
Connecting to yum.oracle.com (yum.oracle.com)|213.123.252.136|:80...
connected.
HTTP request sent, awaiting response... 200 OK
Length: 788058 (770K) [application/x-rpm]
Saving to: ‘silo-1.4.14-4.0.18.el6.src.rpm’
silo-1.4.14-4.0.18. 100%[=====================>] 769.59K 1020KB/s in
0.8s
2015-12-26 21:28:53 (1020 KB/s) - ‘silo-1.4.14-4.0.18.el6.src.rpm’ saved
[788058/788058]
[root@emerald work]# # there are cleaner ways of doing this
[root@emerald work]# rpmbuild --rebuild silo-1.4.14-4.0.18.el6.src.rpm
--nodeps # will FAIL but we don't care
[root@emerald work]# rpmbuild -bp --nodeps /root/rpmbuild/SPECS/silo.spec
[root@emerald work]# diff -ruN silo /root/rpmbuild/BUILD/silo-1.4.14 -x
".git*"
| tee 64bit-Oracle-Xmas.patch | wc -l
2361
[root@emerald work]# ls -l 64bit-Oracle-Xmas-patch
-rw-r--r--. 1 root root 68666 Dec 26 21:39 64bit-Oracle-Xmas.patch
Note: this is a consolidated patch! as such you loose the context of the reasons
why various patches were done. You should really look at the spec file changelog
/ individual patches, to understand our madness.
--------------------------------------------------------------------------------
diff -ruN -x '.git*' silo/common/console.c /root/rpmbuild/BUILD/silo-1.4.14/common/console.c
--- silo/common/console.c 2015-12-26 21:22:50.549144452 +0000
+++ /root/rpmbuild/BUILD/silo-1.4.14/common/console.c 2015-12-26 21:33:58.779905681 +0000
@@ -27,7 +27,7 @@
i = inc;
break;
case PROM_P1275:
- if (p1275_cmd ("read", 3, prom_stdin, &inc, 1) == 1)
+ if (p1275_cmd ("read", 3, (unsigned int) prom_stdin, &inc, 1) == 1)
i = inc;
break;
}
@@ -55,7 +55,7 @@
break;
case PROM_P1275:
outc = c;
- if (p1275_cmd ("write", 3, prom_stdout, &outc, 1) == 1)
+ if (p1275_cmd ("write", 3, (unsigned int) prom_stdout, &outc, 1) == 1)
i = 0;
break;
}
@@ -93,7 +93,7 @@
(*(romvec->pv_v2devops).v2_dev_write)(prom_stdout, s, len);
break;
case PROM_P1275:
- p1275_cmd ("write", 3, prom_stdout, s, len);
+ p1275_cmd ("write", 3, (unsigned int) prom_stdout, s, len);
break;
}
}
diff -ruN -x '.git*' silo/common/divdi3.S /root/rpmbuild/BUILD/silo-1.4.14/common/divdi3.S
--- silo/common/divdi3.S 2015-12-26 21:22:50.549144452 +0000
+++ /root/rpmbuild/BUILD/silo-1.4.14/common/divdi3.S 2015-12-26 21:33:58.777905721 +0000
@@ -17,9 +17,18 @@
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
+#if __WORDSIZE == 32
+# define STACK_BIAS 0
+#else
+#define STACK_BIAS 2047
+#endif
+
.data
.align 8
.globl __clz_tab
+ .register %g2,#scratch
+ .register %g3,#scratch
+
__clz_tab:
.byte 0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5
.byte 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6
@@ -36,7 +45,7 @@
.align 4
.globl __divdi3
__divdi3:
- save %sp,-104,%sp
+ save %sp,-STACK_BIAS-104,%sp
cmp %i0,0
bge .LL40
mov 0,%l4
diff -ruN -x '.git*' silo/common/jmp.S /root/rpmbuild/BUILD/silo-1.4.14/common/jmp.S
--- silo/common/jmp.S 2015-12-26 21:22:50.549144452 +0000
+++ /root/rpmbuild/BUILD/silo-1.4.14/common/jmp.S 2015-12-26 21:33:58.777905721 +0000
@@ -18,7 +18,13 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA. */
-#define _SV save %sp, -0x40, %sp
+#if __WORDSIZE == 32
+# define STACK_BIAS 0
+#else
+# define STACK_BIAS 2047
+#endif
+
+#define _SV save %sp, -STACK_BIAS-0x40, %sp
#define _RV restore
#define FLUSH_ALL_WINDOWS \
_SV; _SV; _SV; _SV; _SV; _SV; _SV; \
@@ -46,7 +52,7 @@
FLUSH_ALL_WINDOWS
ld [%o0], %o7 /* Return PC. */
ld [%o0 + 4], %fp /* Saved SP. */
- sub %fp, 64, %sp /* Allocate a register save area. */
+ sub %fp, 64+STACK_BIAS, %sp /* Allocate a register save area. */
tst %o1
be,a 1f
mov 1, %o1
diff -ruN -x '.git*' silo/common/Makefile /root/rpmbuild/BUILD/silo-1.4.14/common/Makefile
--- silo/common/Makefile 2015-12-26 21:22:50.549144452 +0000
+++ /root/rpmbuild/BUILD/silo-1.4.14/common/Makefile 2012-12-06 03:09:00.000000000 +0000
@@ -16,9 +16,6 @@
all: $(OBJS) $(PROGRAMS)
-bin2h: bin2h.c
- $(HOSTCC) $(HOSTCFLAGS) -o $@ $<
-
prom.o: prom.c
$(CC) $(CFLAGS) -c -Wa,-Av9 -o prom.o prom.c
diff -ruN -x '.git*' silo/common/printf.c /root/rpmbuild/BUILD/silo-1.4.14/common/printf.c
--- silo/common/printf.c 2015-12-26 21:22:50.549144452 +0000
+++ /root/rpmbuild/BUILD/silo-1.4.14/common/printf.c 2015-12-26 21:33:58.756906137 +0000
@@ -236,3 +236,8 @@
return done;
}
+
+int __sprintf_chk (char *s, int flag, size_t slen, const char *format, ...)
+{
+ return sprintf(s, format);
+}
diff -ruN -x '.git*' silo/common/prom.c /root/rpmbuild/BUILD/silo-1.4.14/common/prom.c
--- silo/common/prom.c 2015-12-26 21:22:50.550144432 +0000
+++ /root/rpmbuild/BUILD/silo-1.4.14/common/prom.c 2015-12-26 21:33:58.780905661 +0000
@@ -196,7 +196,7 @@
P1275_ARG_64B(3) | P1275_ARG_64B(4) |
P1275_ARG_64B(6) | 7,
"map",
- prom_get_mmu_ihandle(),
+ (unsigned int) prom_get_mmu_ihandle(),
mode,
size,
vaddr,
@@ -211,7 +211,7 @@
p1275_cmd("call-method",
P1275_ARG_64B(2) | P1275_ARG_64B(3) | 4,
"unmap",
- prom_get_mmu_ihandle(),
+ (unsigned int) prom_get_mmu_ihandle(),
size,
vaddr);
}
diff -ruN -x '.git*' silo/common/tree.c /root/rpmbuild/BUILD/silo-1.4.14/common/tree.c
--- silo/common/tree.c 2015-12-26 21:22:50.550144432 +0000
+++ /root/rpmbuild/BUILD/silo-1.4.14/common/tree.c 2015-12-26 21:33:58.780905661 +0000
@@ -22,7 +22,7 @@
if (prom_vers != PROM_P1275)
cnode = prom_nodeops->no_child(node);
else
- cnode = p1275_cmd ("child", 1, node);
+ cnode = p1275_cmd ("child", 1, (unsigned int) node);
if (cnode == 0 || cnode == -1)
return 0;
@@ -43,7 +43,7 @@
if (prom_vers != PROM_P1275)
sibnode = prom_nodeops->no_nextnode(node);
else
- sibnode = p1275_cmd ("peer", 1, node);
+ sibnode = p1275_cmd ("peer", 1, (unsigned int) node);
if (sibnode == 0 || sibnode == -1)
return 0;
@@ -64,7 +64,7 @@
if (prom_vers != PROM_P1275)
ret = prom_nodeops->no_proplen(node, prop);
else
- ret = p1275_cmd ("getproplen", 2, node, prop);
+ ret = p1275_cmd ("getproplen", 2, (unsigned int) node, prop);
}
return ret;
}
@@ -85,7 +85,7 @@
if (prom_vers != PROM_P1275)
ret = prom_nodeops->no_getprop(node, prop, buffer);
else
- ret = p1275_cmd ("getprop", 4, node, prop, buffer, bufsize);
+ ret = p1275_cmd ("getprop", 4, (unsigned int) node, prop, buffer, bufsize);
}
return ret;
}
diff -ruN -x '.git*' silo/common/udivdi3.S /root/rpmbuild/BUILD/silo-1.4.14/common/udivdi3.S
--- silo/common/udivdi3.S 2015-12-26 21:22:50.550144432 +0000
+++ /root/rpmbuild/BUILD/silo-1.4.14/common/udivdi3.S 2015-12-26 21:33:58.777905721 +0000
@@ -17,11 +17,19 @@
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
+#if __WORDSIZE == 32
+# define STACK_BIAS 0
+#else
+# define STACK_BIAS 2047
+#endif
.text
.align 4
.globl __udivdi3
+ .register %g2,#scratch
+ .register %g3,#scratch
+
__udivdi3:
- save %sp,-104,%sp
+ save %sp,STACK_BIAS-104,%sp
mov %i3,%o3
cmp %i2,0
bne .LL40
diff -ruN -x '.git*' silo/first-isofs/crt0.S /root/rpmbuild/BUILD/silo-1.4.14/first-isofs/crt0.S
--- silo/first-isofs/crt0.S 2015-12-26 21:22:50.551144412 +0000
+++ /root/rpmbuild/BUILD/silo-1.4.14/first-isofs/crt0.S 2015-12-26 21:33:58.783905602 +0000
@@ -21,6 +21,12 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA. */
+#if __WORDSIZE == 32
+# define STACK_BIAS 0
+#else
+# define STACK_BIAS 2047
+#endif
+
#define COPY jmpl %o7 + (copy - _start), %l7
.text
@@ -76,7 +82,7 @@
! Set up a stack
setup_stack:
set 0x400000, %l1
- save %l1, -64, %sp
+ save %l1, -STACK_BIAS-64, %sp
! Call cd_main() to start the whole thingie up
diff -ruN -x '.git*' silo/first-isofs/isofs.c /root/rpmbuild/BUILD/silo-1.4.14/first-isofs/isofs.c
--- silo/first-isofs/isofs.c 2015-12-26 21:22:50.551144412 +0000
+++ /root/rpmbuild/BUILD/silo-1.4.14/first-isofs/isofs.c 2015-12-26 21:33:58.783905602 +0000
@@ -114,7 +114,7 @@
break;
case PROM_P1275:
- p1275_cmd("close", 1, fd);
+ p1275_cmd("close", 1, (unsigned)fd);
break;
};
}
@@ -141,7 +141,7 @@
if (seekp != offset) {
if (prom_vers == PROM_P1275) {
- if (p1275_cmd("seek", P1275_ARG_64B(2) | 3, fd, 0, offset) == -1)
+ if (p1275_cmd("seek", P1275_ARG_64B(2) | 3, (unsigned)fd, 0, offset) == -1)
return -1;
} else {
if ((*romvec->pv_v2devops.v2_dev_seek)
@@ -152,7 +152,7 @@
}
if (prom_vers == PROM_P1275)
- ret = p1275_cmd ("read", 3, fd, data, size);
+ ret = p1275_cmd ("read", 3, (unsigned)fd, data, size);
else
ret = (*romvec->pv_v2devops.v2_dev_read) (fd, data, size);
diff -ruN -x '.git*' silo/include/ext2fs/bitops.h /root/rpmbuild/BUILD/silo-1.4.14/include/ext2fs/bitops.h
--- silo/include/ext2fs/bitops.h 1970-01-01 01:00:00.000000000 +0100
+++ /root/rpmbuild/BUILD/silo-1.4.14/include/ext2fs/bitops.h 2012-12-06 03:09:00.000000000 +0000
@@ -0,0 +1,608 @@
+/*
+ * bitops.h --- Bitmap frobbing code. The byte swapping routines are
+ * also included here.
+ *
+ * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o.
+ *
+ * %Begin-Header%
+ * This file may be redistributed under the terms of the GNU Public
+ * License.
+ * %End-Header%
+ *
+ * i386 bitops operations taken from <asm/bitops.h>, Copyright 1992,
+ * Linus Torvalds.
+ */
+
+
+extern int ext2fs_set_bit(int nr,void * addr);
+extern int ext2fs_clear_bit(int nr, void * addr);
+extern int ext2fs_test_bit(int nr, const void * addr);
+extern __u16 ext2fs_swab16(__u16 val);
+extern __u32 ext2fs_swab32(__u32 val);
+
+/*
+ * EXT2FS bitmap manipulation routines.
+ */
+
+/* Support for sending warning messages from the inline subroutines */
+extern const char *ext2fs_block_string;
+extern const char *ext2fs_inode_string;
+extern const char *ext2fs_mark_string;
+extern const char *ext2fs_unmark_string;
+extern const char *ext2fs_test_string;
+extern void ext2fs_warn_bitmap(errcode_t errcode, unsigned long arg,
+ const char *description);
+extern void ext2fs_warn_bitmap2(ext2fs_generic_bitmap bitmap,
+ int code, unsigned long arg);
+
+extern int ext2fs_mark_block_bitmap(ext2fs_block_bitmap bitmap, blk_t block);
+extern int ext2fs_unmark_block_bitmap(ext2fs_block_bitmap bitmap,
+ blk_t block);
+extern int ext2fs_test_block_bitmap(ext2fs_block_bitmap bitmap, blk_t block);
+
+extern int ext2fs_mark_inode_bitmap(ext2fs_inode_bitmap bitmap, ino_t inode);
+extern int ext2fs_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap,
+ ino_t inode);
+extern int ext2fs_test_inode_bitmap(ext2fs_inode_bitmap bitmap, ino_t inode);
+
+extern void ext2fs_fast_mark_block_bitmap(ext2fs_block_bitmap bitmap,
+ blk_t block);
+extern void ext2fs_fast_unmark_block_bitmap(ext2fs_block_bitmap bitmap,
+ blk_t block);
+extern int ext2fs_fast_test_block_bitmap(ext2fs_block_bitmap bitmap,
+ blk_t block);
+
+extern void ext2fs_fast_mark_inode_bitmap(ext2fs_inode_bitmap bitmap,
+ ino_t inode);
+extern void ext2fs_fast_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap,
+ ino_t inode);
+extern int ext2fs_fast_test_inode_bitmap(ext2fs_inode_bitmap bitmap,
+ ino_t inode);
+extern blk_t ext2fs_get_block_bitmap_start(ext2fs_block_bitmap bitmap);
+extern ino_t ext2fs_get_inode_bitmap_start(ext2fs_inode_bitmap bitmap);
+extern blk_t ext2fs_get_block_bitmap_end(ext2fs_block_bitmap bitmap);
+extern ino_t ext2fs_get_inode_bitmap_end(ext2fs_inode_bitmap bitmap);
+
+extern void ext2fs_mark_block_bitmap_range(ext2fs_block_bitmap bitmap,
+ blk_t block, int num);
+extern void ext2fs_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap,
+ blk_t block, int num);
+extern int ext2fs_test_block_bitmap_range(ext2fs_block_bitmap bitmap,
+ blk_t block, int num);
+extern void ext2fs_fast_mark_block_bitmap_range(ext2fs_block_bitmap bitmap,
+ blk_t block, int num);
+extern void ext2fs_fast_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap,
+ blk_t block, int num);
+extern int ext2fs_fast_test_block_bitmap_range(ext2fs_block_bitmap bitmap,
+ blk_t block, int num);
+extern void ext2fs_set_bitmap_padding(ext2fs_generic_bitmap map);
+
+/*
+ * The inline routines themselves...
+ *
+ * If NO_INLINE_FUNCS is defined, then we won't try to do inline
+ * functions at all; they will be included as normal functions in
+ * inline.c
+ */
+#ifdef NO_INLINE_FUNCS
+#if (defined(__GNUC__) && (defined(__i386__) || defined(__i486__) || \
+ defined(__i586__) || defined(__mc68000__) || \
+ defined(__sparc__)))
+ /* This prevents bitops.c from trying to include the C */
+ /* function version of these functions */
+#define _EXT2_HAVE_ASM_BITOPS_
+#endif
+#endif /* NO_INLINE_FUNCS */
+
+#if (defined(INCLUDE_INLINE_FUNCS) || !defined(NO_INLINE_FUNCS))
+#ifdef INCLUDE_INLINE_FUNCS
+#define _INLINE_ extern
+#else
+#ifdef __GNUC__
+#define _INLINE_ extern __inline__
+#else /* For Watcom C */
+#define _INLINE_ extern inline
+#endif
+#endif
+
+#if ((defined __GNUC__) && (defined(__i386__) || defined(__i486__) || \
+ defined(__i586__)))
+
+#define _EXT2_HAVE_ASM_BITOPS_
+
+/*
+ * These are done by inline assembly for speed reasons.....
+ *
+ * All bitoperations return 0 if the bit was cleared before the
+ * operation and != 0 if it was not. Bit 0 is the LSB of addr; bit 32
+ * is the LSB of (addr+1).
+ */
+
+/*
+ * Some hacks to defeat gcc over-optimizations..
+ */
+struct __dummy_h { unsigned long a[100]; };
+#define EXT2FS_ADDR (*(struct __dummy_h *) addr)
+#define EXT2FS_CONST_ADDR (*(const struct __dummy_h *) addr)
+
+_INLINE_ int ext2fs_set_bit(int nr, void * addr)
+{
+ int oldbit;
+
+ __asm__ __volatile__("btsl %2,%1\n\tsbbl %0,%0"
+ :"=r" (oldbit),"=m" (EXT2FS_ADDR)
+ :"r" (nr));
+ return oldbit;
+}
+
+_INLINE_ int ext2fs_clear_bit(int nr, void * addr)
+{
+ int oldbit;
+
+ __asm__ __volatile__("btrl %2,%1\n\tsbbl %0,%0"
+ :"=r" (oldbit),"=m" (EXT2FS_ADDR)
+ :"r" (nr));
+ return oldbit;
+}
+
+_INLINE_ int ext2fs_test_bit(int nr, const void * addr)
+{
+ int oldbit;
+
+ __asm__ __volatile__("btl %2,%1\n\tsbbl %0,%0"
+ :"=r" (oldbit)
+ :"m" (EXT2FS_CONST_ADDR),"r" (nr));
+ return oldbit;
+}
+
+#undef EXT2FS_ADDR
+
+#endif /* i386 */
+
+#ifdef __mc68000__
+
+#define _EXT2_HAVE_ASM_BITOPS_
+
+_INLINE_ int ext2fs_set_bit(int nr,void * addr)
+{
+ char retval;
+
+ __asm__ __volatile__ ("bfset %2@{%1:#1}; sne %0"
+ : "=d" (retval) : "d" (nr^7), "a" (addr));
+
+ return retval;
+}
+
+_INLINE_ int ext2fs_clear_bit(int nr, void * addr)
+{
+ char retval;
+
+ __asm__ __volatile__ ("bfclr %2@{%1:#1}; sne %0"
+ : "=d" (retval) : "d" (nr^7), "a" (addr));
+
+ return retval;
+}
+
+_INLINE_ int ext2fs_test_bit(int nr, const void * addr)
+{
+ char retval;
+
+ __asm__ __volatile__ ("bftst %2@{%1:#1}; sne %0"
+ : "=d" (retval) : "d" (nr^7), "a" (addr));
+
+ return retval;
+}
+
+#endif /* __mc68000__ */
+
+#ifdef __sparc__
+
+#define _EXT2_HAVE_ASM_BITOPS_
+
+#ifndef EXT2_OLD_BITOPS
+
+/*
+ * Do the bitops so that we are compatible with the standard i386
+ * convention.
+ */
+
+_INLINE_ int ext2fs_set_bit(int nr,void * addr)
+{
+#if 1
+ int mask;
+ unsigned char *ADDR = (unsigned char *) addr;
+
+ ADDR += nr >> 3;
+ mask = 1 << (nr & 0x07);
+ __asm__ __volatile__("ldub [%0], %%g6\n\t"
+ "or %%g6, %2, %%g5\n\t"
+ "stb %%g5, [%0]\n\t"
+ "and %%g6, %2, %0\n"
+ : "=&r" (ADDR)
+ : "0" (ADDR), "r" (mask)
+ : "g5", "g6");
+ return (int) ADDR;
+#else
+ int mask, retval;
+ unsigned char *ADDR = (unsigned char *) addr;
+
+ ADDR += nr >> 3;
+ mask = 1 << (nr & 0x07);
+ retval = (mask & *ADDR) != 0;
+ *ADDR |= mask;
+ return retval;
+#endif
+}
+
+_INLINE_ int ext2fs_clear_bit(int nr, void * addr)
+{
+#if 1
+ int mask;
+ unsigned char *ADDR = (unsigned char *) addr;
+
+ ADDR += nr >> 3;
+ mask = 1 << (nr & 0x07);
+ __asm__ __volatile__("ldub [%0], %%g6\n\t"
+ "andn %%g6, %2, %%g5\n\t"
+ "stb %%g5, [%0]\n\t"
+ "and %%g6, %2, %0\n"
+ : "=&r" (ADDR)
+ : "0" (ADDR), "r" (mask)
+ : "g5", "g6");
+ return (int) ADDR;
+
+#else
+ int mask, retval;
+ unsigned char *ADDR = (unsigned char *) addr;
+
+ ADDR += nr >> 3;
+ mask = 1 << (nr & 0x07);
+ retval = (mask & *ADDR) != 0;
+ *ADDR &= ~mask;
+ return retval;
+#endif
+}
+
+_INLINE_ int ext2fs_test_bit(int nr, const void * addr)
+{
+ int mask;
+ const unsigned char *ADDR = (const unsigned char *) addr;
+
+ ADDR += nr >> 3;
+ mask = 1 << (nr & 0x07);
+ return ((mask & *ADDR) != 0);
+}
+
+#else
+
+/* Do things the old, unplesant way. */
+
+_INLINE_ int ext2fs_set_bit(int nr, void *addr)
+{
+ int mask, retval;
+ unsigned long *ADDR = (unsigned long *) addr;
+
+ ADDR += nr >> 5;
+ mask = 1 << (nr & 31);
+ retval = ((mask & *ADDR) != 0);
+ *ADDR |= mask;
+ return retval;
+}
+
+_INLINE_ int ext2fs_clear_bit(int nr, void *addr)
+{
+ int mask, retval;
+ unsigned long *ADDR = (unsigned long *) addr;
+
+ ADDR += nr >> 5;
+ mask = 1 << (nr & 31);
+ retval = ((mask & *ADDR) != 0);
+ *ADDR &= ~mask;
+ return retval;
+}
+
+_INLINE_ int ext2fs_test_bit(int nr, const void *addr)
+{
+ int mask;
+ const unsigned long *ADDR = (const unsigned long *) addr;
+
+ ADDR += nr >> 5;
+ mask = 1 << (nr & 31);
+ return ((mask & *ADDR) != 0);
+}
+#endif
+
+#endif /* __sparc__ */
+
+#ifndef _EXT2_HAVE_ASM_SWAB
+
+_INLINE_ __u16 ext2fs_swab16(__u16 val)
+{
+ return (val >> 8) | (val << 8);
+}
+
+_INLINE_ __u32 ext2fs_swab32(__u32 val)
+{
+ return ((val>>24) | ((val>>8)&0xFF00) |
+ ((val<<8)&0xFF0000) | (val<<24));
+}
+
+#endif /* !_EXT2_HAVE_ASM_SWAB */
+
+_INLINE_ int ext2fs_mark_generic_bitmap(ext2fs_generic_bitmap bitmap,
+ __u32 bitno);
+_INLINE_ int ext2fs_unmark_generic_bitmap(ext2fs_generic_bitmap bitmap,
+ blk_t bitno);
+_INLINE_ int ext2fs_test_generic_bitmap(ext2fs_generic_bitmap bitmap,
+ blk_t bitno);
+
+_INLINE_ int ext2fs_mark_generic_bitmap(ext2fs_generic_bitmap bitmap,
+ __u32 bitno)
+{
+ if ((bitno < bitmap->start) || (bitno > bitmap->end)) {
+ ext2fs_warn_bitmap2(bitmap, EXT2FS_MARK_ERROR, bitno);
+ return 0;
+ }
+ return ext2fs_set_bit(bitno - bitmap->start, bitmap->bitmap);
+}
+
+_INLINE_ int ext2fs_unmark_generic_bitmap(ext2fs_generic_bitmap bitmap,
+ blk_t bitno)
+{
+ if ((bitno < bitmap->start) || (bitno > bitmap->end)) {
+ ext2fs_warn_bitmap2(bitmap, EXT2FS_UNMARK_ERROR, bitno);
+ return 0;
+ }
+ return ext2fs_clear_bit(bitno - bitmap->start, bitmap->bitmap);
+}
+
+_INLINE_ int ext2fs_test_generic_bitmap(ext2fs_generic_bitmap bitmap,
+ blk_t bitno)
+{
+ if ((bitno < bitmap->start) || (bitno > bitmap->end)) {
+ ext2fs_warn_bitmap2(bitmap, EXT2FS_TEST_ERROR, bitno);
+ return 0;
+ }
+ return ext2fs_test_bit(bitno - bitmap->start, bitmap->bitmap);
+}
+
+_INLINE_ int ext2fs_mark_block_bitmap(ext2fs_block_bitmap bitmap,
+ blk_t block)
+{
+ return ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap)
+ bitmap,
+ block);
+}
+
+_INLINE_ int ext2fs_unmark_block_bitmap(ext2fs_block_bitmap bitmap,
+ blk_t block)
+{
+ return ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap,
+ block);
+}
+
+_INLINE_ int ext2fs_test_block_bitmap(ext2fs_block_bitmap bitmap,
+ blk_t block)
+{
+ return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap,
+ block);
+}
+
+_INLINE_ int ext2fs_mark_inode_bitmap(ext2fs_inode_bitmap bitmap,
+ ino_t inode)
+{
+ return ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) bitmap,
+ inode);
+}
+
+_INLINE_ int ext2fs_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap,
+ ino_t inode)
+{
+ return ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap,
+ inode);
+}
+
+_INLINE_ int ext2fs_test_inode_bitmap(ext2fs_inode_bitmap bitmap,
+ ino_t inode)
+{
+ return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap,
+ inode);
+}
+
+_INLINE_ void ext2fs_fast_mark_block_bitmap(ext2fs_block_bitmap bitmap,
+ blk_t block)
+{
+#ifdef EXT2FS_DEBUG_FAST_OPS
+ if ((block < bitmap->start) || (block > bitmap->end)) {
+ ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_MARK, block,
+ bitmap->description);
+ return;
+ }
+#endif
+ ext2fs_set_bit(block - bitmap->start, bitmap->bitmap);
+}
+
+_INLINE_ void ext2fs_fast_unmark_block_bitmap(ext2fs_block_bitmap bitmap,
+ blk_t block)
+{
+#ifdef EXT2FS_DEBUG_FAST_OPS
+ if ((block < bitmap->start) || (block > bitmap->end)) {
+ ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_UNMARK,
+ block, bitmap->description);
+ return;
+ }
+#endif
+ ext2fs_clear_bit(block - bitmap->start, bitmap->bitmap);
+}
+
+_INLINE_ int ext2fs_fast_test_block_bitmap(ext2fs_block_bitmap bitmap,
+ blk_t block)
+{
+#ifdef EXT2FS_DEBUG_FAST_OPS
+ if ((block < bitmap->start) || (block > bitmap->end)) {
+ ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_TEST,
+ block, bitmap->description);
+ return 0;
+ }
+#endif
+ return ext2fs_test_bit(block - bitmap->start, bitmap->bitmap);
+}
+
+_INLINE_ void ext2fs_fast_mark_inode_bitmap(ext2fs_inode_bitmap bitmap,
+ ino_t inode)
+{
+#ifdef EXT2FS_DEBUG_FAST_OPS
+ if ((inode < bitmap->start) || (inode > bitmap->end)) {
+ ext2fs_warn_bitmap(EXT2_ET_BAD_INODE_MARK,
+ inode, bitmap->description);
+ return;
+ }
+#endif
+ ext2fs_set_bit(inode - bitmap->start, bitmap->bitmap);
+}
+
+_INLINE_ void ext2fs_fast_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap,
+ ino_t inode)
+{
+#ifdef EXT2FS_DEBUG_FAST_OPS
+ if ((inode < bitmap->start) || (inode > bitmap->end)) {
+ ext2fs_warn_bitmap(EXT2_ET_BAD_INODE_UNMARK,
+ inode, bitmap->description);
+ return;
+ }
+#endif
+ ext2fs_clear_bit(inode - bitmap->start, bitmap->bitmap);
+}
+
+_INLINE_ int ext2fs_fast_test_inode_bitmap(ext2fs_inode_bitmap bitmap,
+ ino_t inode)
+{
+#ifdef EXT2FS_DEBUG_FAST_OPS
+ if ((inode < bitmap->start) || (inode > bitmap->end)) {
+ ext2fs_warn_bitmap(EXT2_ET_BAD_INODE_TEST,
+ inode, bitmap->description);
+ return 0;
+ }
+#endif
+ return ext2fs_test_bit(inode - bitmap->start, bitmap->bitmap);
+}
+
+_INLINE_ blk_t ext2fs_get_block_bitmap_start(ext2fs_block_bitmap bitmap)
+{
+ return bitmap->start;
+}
+
+_INLINE_ ino_t ext2fs_get_inode_bitmap_start(ext2fs_inode_bitmap bitmap)
+{
+ return bitmap->start;
+}
+
+_INLINE_ blk_t ext2fs_get_block_bitmap_end(ext2fs_block_bitmap bitmap)
+{
+ return bitmap->end;
+}
+
+_INLINE_ ino_t ext2fs_get_inode_bitmap_end(ext2fs_inode_bitmap bitmap)
+{
+ return bitmap->end;
+}
+
+_INLINE_ int ext2fs_test_block_bitmap_range(ext2fs_block_bitmap bitmap,
+ blk_t block, int num)
+{
+ int i;
+
+ if ((block < bitmap->start) || (block+num-1 > bitmap->end)) {
+ ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_TEST,
+ block, bitmap->description);
+ return 0;
+ }
+ for (i=0; i < num; i++) {
+ if (ext2fs_fast_test_block_bitmap(bitmap, block+i))
+ return 0;
+ }
+ return 1;
+}
+
+_INLINE_ int ext2fs_fast_test_block_bitmap_range(ext2fs_block_bitmap bitmap,
+ blk_t block, int num)
+{
+ int i;
+
+#ifdef EXT2FS_DEBUG_FAST_OPS
+ if ((block < bitmap->start) || (block+num-1 > bitmap->end)) {
+ ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_TEST,
+ block, bitmap->description);
+ return 0;
+ }
+#endif
+ for (i=0; i < num; i++) {
+ if (ext2fs_fast_test_block_bitmap(bitmap, block+i))
+ return 0;
+ }
+ return 1;
+}
+
+_INLINE_ void ext2fs_mark_block_bitmap_range(ext2fs_block_bitmap bitmap,
+ blk_t block, int num)
+{
+ int i;
+
+ if ((block < bitmap->start) || (block+num-1 > bitmap->end)) {
+ ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_MARK, block,
+ bitmap->description);
+ return;
+ }
+ for (i=0; i < num; i++)
+ ext2fs_set_bit(block + i - bitmap->start, bitmap->bitmap);
+}
+
+_INLINE_ void ext2fs_fast_mark_block_bitmap_range(ext2fs_block_bitmap bitmap,
+ blk_t block, int num)
+{
+ int i;
+
+#ifdef EXT2FS_DEBUG_FAST_OPS
+ if ((block < bitmap->start) || (block+num-1 > bitmap->end)) {
+ ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_MARK, block,
+ bitmap->description);
+ return;
+ }
+#endif
+ for (i=0; i < num; i++)
+ ext2fs_set_bit(block + i - bitmap->start, bitmap->bitmap);
+}
+
+_INLINE_ void ext2fs_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap,
+ blk_t block, int num)
+{
+ int i;
+
+ if ((block < bitmap->start) || (block+num-1 > bitmap->end)) {
+ ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_UNMARK, block,
+ bitmap->description);
+ return;
+ }
+ for (i=0; i < num; i++)
+ ext2fs_clear_bit(block + i - bitmap->start, bitmap->bitmap);
+}
+
+_INLINE_ void ext2fs_fast_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap,
+ blk_t block, int num)
+{
+ int i;
+
+#ifdef EXT2FS_DEBUG_FAST_OPS
+ if ((block < bitmap->start) || (block+num-1 > bitmap->end)) {
+ ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_UNMARK, block,
+ bitmap->description);
+ return;
+ }
+#endif
+ for (i=0; i < num; i++)
+ ext2fs_clear_bit(block + i - bitmap->start, bitmap->bitmap);
+}
+
+#undef _INLINE_
+#endif
+
diff -ruN -x '.git*' silo/include/ext2fs/ext2fs.h /root/rpmbuild/BUILD/silo-1.4.14/include/ext2fs/ext2fs.h
--- silo/include/ext2fs/ext2fs.h 2015-12-26 21:22:50.553144372 +0000
+++ /root/rpmbuild/BUILD/silo-1.4.14/include/ext2fs/ext2fs.h 2012-12-06 03:09:00.000000000 +0000
@@ -17,6 +17,13 @@
#endif
/*
+ * Non-GNU C compilers won't necessarily understand inline
+ */
+#if (!defined(__GNUC__) && !defined(__WATCOMC__))
+#define NO_INLINE_FUNCS
+#endif
+
+/*
* Where the master copy of the superblock is located, and how big
* superblocks are supposed to be. We define SUPERBLOCK_SIZE because
* the size of the superblock structure is not necessarily trustworthy
@@ -214,6 +221,12 @@
struct ext2_inode_cache *icache;
};
+#if EXT2_FLAT_INCLUDES
+#include "e2_bitops.h"
+#else
+#include "ext2fs/bitops.h"
+#endif
+
/*
* Return flags for the block iterator functions
*/
@@ -836,6 +849,184 @@
extern int ext2fs_get_library_version(const char **ver_string,
const char **date_string);
+/* inline functions */
+extern errcode_t ext2fs_get_mem(unsigned long size, void **ptr);
+extern errcode_t ext2fs_free_mem(void **ptr);
+#if 0
+extern errcode_t ext2fs_resize_mem(unsigned long old_size,
+ unsigned long size, void **ptr);
+#endif
+extern void ext2fs_mark_super_dirty(ext2_filsys fs);
+extern void ext2fs_mark_changed(ext2_filsys fs);
+extern int ext2fs_test_changed(ext2_filsys fs);
+extern void ext2fs_mark_valid(ext2_filsys fs);
+extern void ext2fs_unmark_valid(ext2_filsys fs);
+extern int ext2fs_test_valid(ext2_filsys fs);
+extern void ext2fs_mark_ib_dirty(ext2_filsys fs);
+extern void ext2fs_mark_bb_dirty(ext2_filsys fs);
+extern int ext2fs_test_ib_dirty(ext2_filsys fs);
+extern int ext2fs_test_bb_dirty(ext2_filsys fs);
+extern int ext2fs_group_of_blk(ext2_filsys fs, blk_t blk);
+extern int ext2fs_group_of_ino(ext2_filsys fs, ino_t ino);
+extern blk_t ext2fs_inode_data_blocks(ext2_filsys fs,
+ struct ext2_inode *inode);
+
+/*
+ * The actual inlined functions definitions themselves...
+ *
+ * If NO_INLINE_FUNCS is defined, then we won't try to do inline
+ * functions at all!
+ */
+#if (defined(INCLUDE_INLINE_FUNCS) || !defined(NO_INLINE_FUNCS))
+#ifdef INCLUDE_INLINE_FUNCS
+#define _INLINE_ extern
+#else
+#ifdef __GNUC__
+#define _INLINE_ extern __inline__
+#else /* For Watcom C */
+#define _INLINE_ extern inline
+#endif
+#endif
+
+#ifndef EXT2_CUSTOM_MEMORY_ROUTINES
+/*
+ * Allocate memory
+ */
+_INLINE_ errcode_t ext2fs_get_mem(unsigned long size, void **ptr)
+{
+ *ptr = malloc(size);
+ if (!*ptr)
+ return EXT2_ET_NO_MEMORY;
+ return 0;
+}
+
+/*
+ * Free memory
+ */
+_INLINE_ errcode_t ext2fs_free_mem(void **ptr)
+{
+ free(*ptr);
+ *ptr = 0;
+ return 0;
+}
+
+#if 0
+/*
+ * Resize memory
+ */
+_INLINE_ errcode_t ext2fs_resize_mem(unsigned long old_size,
+ unsigned long size, void **ptr)
+{
+ void *p;
+
+ p = realloc(*ptr, size);
+ if (!p)
+ return EXT2_ET_NO_MEMORY;
+ *ptr = p;
+ return 0;
+}
+#endif
+#endif /* Custom memory routines */
+
+/*
+ * Mark a filesystem superblock as dirty
+ */
+_INLINE_ void ext2fs_mark_super_dirty(ext2_filsys fs)
+{
+ fs->flags |= EXT2_FLAG_DIRTY | EXT2_FLAG_CHANGED;
+}
+
+/*
+ * Mark a filesystem as changed
+ */
+_INLINE_ void ext2fs_mark_changed(ext2_filsys fs)
+{
+ fs->flags |= EXT2_FLAG_CHANGED;
+}
+
+/*
+ * Check to see if a filesystem has changed
+ */
+_INLINE_ int ext2fs_test_changed(ext2_filsys fs)
+{
+ return (fs->flags & EXT2_FLAG_CHANGED);
+}
+
+/*
+ * Mark a filesystem as valid
+ */
+_INLINE_ void ext2fs_mark_valid(ext2_filsys fs)
+{
+ fs->flags |= EXT2_FLAG_VALID;
+}
+
+/*
+ * Mark a filesystem as NOT valid
+ */
+_INLINE_ void ext2fs_unmark_valid(ext2_filsys fs)
+{
+ fs->flags &= ~EXT2_FLAG_VALID;
+}
+
+/*
+ * Check to see if a filesystem is valid
+ */
+_INLINE_ int ext2fs_test_valid(ext2_filsys fs)
+{
+ return (fs->flags & EXT2_FLAG_VALID);
+}
+
+/*
+ * Mark the inode bitmap as dirty
+ */
+_INLINE_ void ext2fs_mark_ib_dirty(ext2_filsys fs)
+{
+ fs->flags |= EXT2_FLAG_IB_DIRTY | EXT2_FLAG_CHANGED;
+}
+
+/*
+ * Mark the block bitmap as dirty
+ */
+_INLINE_ void ext2fs_mark_bb_dirty(ext2_filsys fs)
+{
+ fs->flags |= EXT2_FLAG_BB_DIRTY | EXT2_FLAG_CHANGED;
+}
+
+/*
+ * Check to see if a filesystem's inode bitmap is dirty
+ */
+_INLINE_ int ext2fs_test_ib_dirty(ext2_filsys fs)
+{
+ return (fs->flags & EXT2_FLAG_IB_DIRTY);
+}
+
+/*
+ * Check to see if a filesystem's block bitmap is dirty
+ */
+_INLINE_ int ext2fs_test_bb_dirty(ext2_filsys fs)
+{
+ return (fs->flags & EXT2_FLAG_BB_DIRTY);
+}
+
+/*
+ * Return the group # of a block
+ */
+_INLINE_ int ext2fs_group_of_blk(ext2_filsys fs, blk_t blk)
+{
+ return (blk - fs->super->s_first_data_block) /
+ fs->super->s_blocks_per_group;
+}
+
+/*
+ * Return the group # of an inode number
+ */
+_INLINE_ int ext2fs_group_of_ino(ext2_filsys fs, ino_t ino)
+{
+ return (ino - 1) / fs->super->s_inodes_per_group;
+}
+#undef _INLINE_
+#endif
+
#ifdef __cplusplus
}
#endif
diff -ruN -x '.git*' silo/include/silo.h /root/rpmbuild/BUILD/silo-1.4.14/include/silo.h
--- silo/include/silo.h 2015-12-26 21:22:50.554144353 +0000
+++ /root/rpmbuild/BUILD/silo-1.4.14/include/silo.h 2015-12-26 21:33:58.819904889 +0000
@@ -46,6 +46,7 @@
} sun_partition;
#define SUN_LABEL_MAGIC 0xDABE
+#define GPT_LABEL_MAGIC 0x0000
struct silo_inode {
unsigned int inolen;
diff -ruN -x '.git*' silo/include/stringops.h /root/rpmbuild/BUILD/silo-1.4.14/include/stringops.h
--- silo/include/stringops.h 2015-12-26 21:22:50.554144353 +0000
+++ /root/rpmbuild/BUILD/silo-1.4.14/include/stringops.h 2015-12-26 21:33:58.756906137 +0000
@@ -31,4 +31,7 @@
char *strstr(const char *, const char *);
int memcmp(const void *, const void *, size_t);
+/* This isn't really a string op, but we need to put it here for size_t. */
+int __sprintf_chk (char *s, int flag, size_t slen, const char *format, ...);
+
#endif /* __STRINGOPS_H */
diff -ruN -x '.git*' silo/Rules.make /root/rpmbuild/BUILD/silo-1.4.14/Rules.make
--- silo/Rules.make 2015-12-26 21:22:50.548144472 +0000
+++ /root/rpmbuild/BUILD/silo-1.4.14/Rules.make 2015-12-26 21:33:58.808905107 +0000
@@ -1,11 +1,23 @@
VERSION=1.4.14
+# WARNING! RELEASE is defined in /usr/include/scsi/scsi.h! use SILO_RELEASE as var name
+SILO_RELEASE=$(shell if $$(SILO_RELEASE) ; then echo $$(SILO_RELEASE) ; else date +%Y-%m-%d-%H:%M; fi;)
+ifdef DEBUG
+ ifeq (DEBUG, 1)
+ DEBUGGING=1
+ else
+ DEBUGGING=0
+ endif
+else
+ DEBUGGING=0
+endif
+
IMGVERSION=0.99
+
SHELL=/bin/bash
RM=rm -f
-# We want to force 32-bit builds
-CC=gcc -m32
-HOSTCC=gcc
-LD=ld -m elf32_sparc
+# We want to force 64-bit builds
+CC=gcc
+LD=ld -m elf64_sparc
AS=as
STRIP=strip
NM=nm
@@ -18,10 +30,9 @@
cc-option-yn = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null \
> /dev/null 2>&1; then echo "y"; else echo "n"; fi;)
-CFLAGS = -Os -Wall -I. -I../include -fomit-frame-pointer \
+CFLAGS = -static -Os -Wall -I. -I../include -fomit-frame-pointer \
-fno-strict-aliasing -DSMALL_RELOC=$(SMALL_RELOC) \
-DLARGE_RELOC=$(LARGE_RELOC)
-HOSTCFLAGS = -O2 -Wall
ifeq ($(call cc-option-yn, -fno-stack-protector),y)
CFLAGS += -fno-stack-protector
diff -ruN -x '.git*' silo/second/cfg.c /root/rpmbuild/BUILD/silo-1.4.14/second/cfg.c
--- silo/second/cfg.c 2015-12-26 21:22:50.555144333 +0000
+++ /root/rpmbuild/BUILD/silo-1.4.14/second/cfg.c 2015-12-26 21:33:58.815904968 +0000
@@ -42,7 +42,7 @@
void *data;
} CONFIG;
-#define MAX_TOKEN 200
+#define MAX_TOKEN 2047
#define MAX_VAR_NAME MAX_TOKEN
#ifndef EOF
#define EOF -1
@@ -93,7 +93,6 @@
{cft_flag, "pause-after", NULL},
{cft_strg, "pause-message", NULL},
{cft_flag, "solaris", NULL},
- {cft_flag, "flash", NULL},
{cft_flag, "fill-reboot-cmd", NULL},
{cft_strg, "bootblock", NULL},
{cft_flag, "single-key", NULL},
@@ -416,6 +415,8 @@
} else {
if (!(printl_count % 3))
printf ("\n");
+ else
+ putchar (' ');
printf ("%s", label);
while (len++ < 25)
putchar (' ');
diff -ruN -x '.git*' silo/second/crt0.S /root/rpmbuild/BUILD/silo-1.4.14/second/crt0.S
--- silo/second/crt0.S 2015-12-26 21:22:50.555144333 +0000
+++ /root/rpmbuild/BUILD/silo-1.4.14/second/crt0.S 2015-12-26 21:33:58.778905701 +0000
@@ -21,6 +21,12 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA. */
+#if __WORDSIZE == 32
+# define STACK_BIAS 0
+#else
+# define STACK_BIAS 2047
+#endif
+
#define COPY jmpl %o7 + (copy - _start), %l7
.text
@@ -82,7 +88,11 @@
sub %l0, 16, %l0
sethi %hi(gzminpi), %l1
add %l1, %i3, %l1
+#if __WORDSIZE == 32
st %l0, [%l1 + %lo(gzminpi)]
+#else
+ stx %l0, [%l1 + %lo(gzminpi)]
+#endif
/* Jump to relocated code */
sethi %hi(_end), %l0
@@ -121,12 +131,15 @@
! Set up a stack
setup_stack:
- save %i0,-120,%sp
-
+ save %i0,-STACK_BIAS-120,%sp
tst %i4
be 0f
sethi %hi(gzminpi+0x100000), %l0
+#if __WORDSIZE == 32
ld [%l0 + %lo(gzminpi)], %l1
+#else
+ ldx [%l0 + %lo(gzminpi)], %l1
+#endif
sethi %hi(LARGE_RELOC), %l2
1: lduh [%l1], %l3
add %l1, 2, %l1
@@ -147,7 +160,11 @@
add %l3, 16, %l3
ba 3b
stb %l3, [%l2]
+#if __WORDSIZE == 32
4: st %l1, [%l0 + %lo(gzminpi)]
+#else
+4: stx %l1, [%l0 + %lo(gzminpi)]
+#endif
! Call my_main() to start the whole thingie up
diff -ruN -x '.git*' silo/second/decomp.c /root/rpmbuild/BUILD/silo-1.4.14/second/decomp.c
--- silo/second/decomp.c 2015-12-26 21:22:50.555144333 +0000
+++ /root/rpmbuild/BUILD/silo-1.4.14/second/decomp.c 2015-12-26 21:33:58.807905127 +0000
@@ -154,7 +154,7 @@
prom_puts ("O", 1);
#endif
- printf(" Version %s\n", VERSION);
+ printf(" Version %s - Rel: %s\n", VERSION, SILO_RELEASE);
if (!cifh) {
unsigned short *pt = (unsigned short *)gzminpi;
diff -ruN -x '.git*' silo/second/disk.c /root/rpmbuild/BUILD/silo-1.4.14/second/disk.c
--- silo/second/disk.c 2015-12-26 21:22:50.556144313 +0000
+++ /root/rpmbuild/BUILD/silo-1.4.14/second/disk.c 2015-12-26 21:33:58.783905602 +0000
@@ -79,7 +79,7 @@
fd = p1275_cmd ("open", 1, device);
if ((unsigned)(fd + 1) > 1) {
- node = p1275_cmd ("instance-to-package", 1, fd);
+ node = p1275_cmd ("instance-to-package", 1, (unsigned)fd);
/*
* Don't use our argument due to devalias.
* Alas, flash has no device_type property.
@@ -301,7 +301,7 @@
}
if (seekp != offset) {
if (prom_vers == PROM_P1275) {
- if ((rc = p1275_cmd ("seek", P1275_ARG_64B(2) | 3, fd, 0, offset)) == -1)
+ if ((rc = p1275_cmd ("seek", P1275_ARG_64B(2) | 3, (unsigned) fd, 0, offset)) == -1)
return -1;
} else {
if ((*romvec->pv_v2devops.v2_dev_seek) (fd, (unsigned)(offset >> 32), (unsigned)offset) == -1)
@@ -311,7 +311,7 @@
}
}
if (prom_vers == PROM_P1275) {
- rc = p1275_cmd ("read", 3, fd, buff, size);
+ rc = p1275_cmd ("read", 3, (unsigned) fd, buff, size);
} else {
int i;
for (i = 0; i < 2; i++) {
@@ -355,7 +355,7 @@
case PROM_V3:
(*romvec->pv_v2devops.v2_dev_close) (fd); break;
case PROM_P1275:
- p1275_cmd ("close", 1, fd); break;
+ p1275_cmd ("close", 1, (unsigned) fd); break;
}
}
*currentdevice = 0;
diff -ruN -x '.git*' silo/second/file.c /root/rpmbuild/BUILD/silo-1.4.14/second/file.c
--- silo/second/file.c 2015-12-26 21:22:50.556144313 +0000
+++ /root/rpmbuild/BUILD/silo-1.4.14/second/file.c 2015-12-26 21:33:58.781905642 +0000
@@ -53,8 +53,8 @@
/* Array of our supported ops */
static struct fs_ops *silo_fs_ops[] = {
- &ext2_fs_ops,
&iso_fs_ops,
+ &ext2_fs_ops,
&rom_fs_ops,
&ufs_fs_ops,
NULL,
@@ -193,7 +193,7 @@
}
last_blockcnt = -1;
}
- if ((char *)filebuffer + (block_cnt + ((*blocknr) ? (blockcnt - last_blockcnt - 1) : 0)) * bs > filelimit) {
+ if ((unsigned int)filebuffer + (block_cnt + ((*blocknr) ? (blockcnt - last_blockcnt - 1) : 0)) * bs > filelimit) {
silo_fatal("Image too large to fit in destination");
return BLOCK_ABORT;
}
diff -ruN -x '.git*' silo/second/fs/iom.c /root/rpmbuild/BUILD/silo-1.4.14/second/fs/iom.c
--- silo/second/fs/iom.c 2015-12-26 21:22:50.556144313 +0000
+++ /root/rpmbuild/BUILD/silo-1.4.14/second/fs/iom.c 2015-12-26 21:33:58.819904889 +0000
@@ -37,8 +37,8 @@
silo_fatal("Cannot read partition");
return 0;
}
- if (sdl.magic != SUN_LABEL_MAGIC)
- silo_fatal("Wrong disklabel magic");
+ if ((sdl.magic != SUN_LABEL_MAGIC) && (sdl.magic != GPT_LABEL_MAGIC))
+ printf("Wrong disklabel magic [0x%X]\n", (unsigned int) sdl.magic);
for (csum = 0, ush = ((unsigned short *) ((&sdl) + 1)) - 1; ush >= (unsigned short *) &sdl;)
csum ^= *ush--;
if (csum)
diff -ruN -x '.git*' silo/second/main.c /root/rpmbuild/BUILD/silo-1.4.14/second/main.c
--- silo/second/main.c 2015-12-26 21:22:50.557144293 +0000
+++ /root/rpmbuild/BUILD/silo-1.4.14/second/main.c 2015-12-26 21:33:58.804905186 +0000
@@ -86,7 +86,6 @@
int tab_ambiguous = 0;
int other_part = -1;
int solaris = 0;
-int flash = 0;
int other = 0;
char *password = 0;
int initrd_can_do_64bit_phys = 0;
@@ -538,8 +537,6 @@
other = 1;
else if (cfg_get_flag (label, "solaris"))
solaris = 1;
- else if (cfg_get_flag (label, "flash"))
- flash = 1;
p = cfg_get_strg (label, "literal");
if (!p && other)
p = cfg_get_strg (label, "append");
@@ -854,11 +851,6 @@
}
}
}
- if (!flash) {
- p = strstr (*params, "flash");
- if (p)
- flash = 1;
- }
return 0;
}
@@ -927,27 +919,7 @@
"ELF image");
prom_halt ();
}
- if (flash) {
- int i;
-
- if (architecture != sun4u) {
- silo_fatal("Flash boots only supported on sun4u "
- "and later");
- prom_halt ();
- }
- for (i = 0; i < hp.e->e_phnum; i++, p++) {
- printf("SILO: Loading flash segment %d at vaddr[0x%x] len[0x%x]\n",
- i, p->p_vaddr, p->p_filesz);
- memcpy ((char *)p->p_vaddr,
- (base + p->p_offset), p->p_filesz);
- if (p->p_filesz < p->p_memsz)
- memset ((char *)(p->p_vaddr + p->p_filesz), 0,
- p->p_memsz - p->p_filesz);
- }
- isfile = 1;
- st = hp.e->e_entry;
- printf("SILO: Flash image entry is at vaddr[0x%x]\n", st);
- } else if (solaris) {
+ if (solaris) {
int i;
unsigned long sa = (unsigned long)&_start;
@@ -1005,28 +977,7 @@
"ELF image");
prom_halt ();
}
- if (flash) {
- int i;
-
- if (architecture != sun4u) {
- silo_fatal("Flash boots only supported on sun4u "
- "and later");
- prom_halt ();
- }
- for (i = 0; i < hp.f->e_phnum; i++, p++) {
- printf("SILO: Loading flash segment %d at vaddr[0x%x] len[0x%x]\n",
- i, (unsigned int) p->p_vaddr, (unsigned int) p->p_filesz);
- memcpy ((Elf64_Addr *)(long)(p->p_vaddr),
- (Elf64_Addr *)(long)(base + p->p_offset),
- p->p_filesz);
- if (p->p_filesz < p->p_memsz)
- memset ((Elf64_Addr *)(long)(p->p_vaddr + p->p_filesz),
- 0, p->p_memsz - p->p_filesz);
- }
- isfile = 1;
- st = hp.f->e_entry;
- printf("SILO: Flash image entry is at vaddr[0x%x]\n", st);
- } else if (solaris) {
+ if (solaris) {
int i;
unsigned long sa = (unsigned long)&_start;
@@ -1306,7 +1257,7 @@
if (solaris) {
params = params_device;
params_device = sol_params;
- } else if (!other && !flash) {
+ } else if (!other) {
struct HdrS_struct *hdrs;
params_device = 0;
@@ -1316,6 +1267,12 @@
hdrs = (struct HdrS_struct *)
silo_find_linux_HdrS((char *)image_base, image_len);
+ /* DEBUGGING! (passed via Rules.make which has a controlling var in the spec file) */
+ #if defined (DEBUGGING) && (DEBUGGING == 1)
+ #warning "*** DEBUGGING hdrs ***"
+ printf ("MAGIC: %c %c %c %c\n", hdrs->magic[0], hdrs->magic[1], hdrs->magic[2], hdrs->magic[3]);
+ #endif
+
if (hdrs && hdrs->ver < 0x300 && image_base != (unsigned char *)0x4000) {
/* Kernel doesn't support being loaded to other than
* phys_base, so let's try to copy it down there. */
diff -ruN -x '.git*' silo/second/Makefile /root/rpmbuild/BUILD/silo-1.4.14/second/Makefile
--- silo/second/Makefile 2015-12-26 21:22:50.555144333 +0000
+++ /root/rpmbuild/BUILD/silo-1.4.14/second/Makefile 2015-12-26 21:33:58.807905127 +0000
@@ -73,19 +73,20 @@
file.o: file.c
decompnet.o: decomp.c
- $(CC) $(CFLAGS) -DTFTP -DVERSION='"$(VERSION)"' -c -o $@ $<
+ $(CC) $(CFLAGS) -DTFTP -DVERSION='"$(VERSION)"' -DSILO_RELEASE='"$(SILO_RELEASE)"' -c -o $@ $<
decomp.o: decomp.c
- $(CC) $(CFLAGS) -DVERSION='"$(VERSION)"' -c $<
+ $(CC) $(CFLAGS) -DVERSION='"$(VERSION)"' -DSILO_RELEASE='"$(SILO_RELEASE)"' -c $<
mainnet.o: main.c
- $(CC) $(CFLAGS) -DTFTP -c -o $@ $<
+ # DEBUGGING passed from Rules.make
+ $(CC) $(CFLAGS) -DTFTP -DDEBUGGING=$(DEBUGGING) -c -o $@ $<
malloc.o: ../common/malloc.c
$(CC) $(CFLAGS) -c -o $@ $<
util: util.c
- $(HOSTCC) $(HOSTCFLAGS) -DSMALL_RELOC=$(SMALL_RELOC) -DLARGE_RELOC=$(LARGE_RELOC) -o $@ $<
+ $(CC) -DSMALL_RELOC=$(SMALL_RELOC) -DLARGE_RELOC=$(LARGE_RELOC) -o $@ $<
clean:
$(RM) *.o fs/*.o second* silotftp* util fs/libfs.a
diff -ruN -x '.git*' silo/second/memory.c /root/rpmbuild/BUILD/silo-1.4.14/second/memory.c
--- silo/second/memory.c 2015-12-26 21:22:50.557144293 +0000
+++ /root/rpmbuild/BUILD/silo-1.4.14/second/memory.c 2015-12-26 21:33:58.771905840 +0000
@@ -24,6 +24,8 @@
#define INITRD_VIRT_ADDR 0x40c00000
#define IMAGE_VIRT_ADDR 0x40000000
+#define PHYS_MEM_ADDR_BOUNDARY 0x400000ULL
+
extern int initrd_can_do_64bit_phys;
static char *sun4u_memory_find (unsigned int len, int is_kernel);
@@ -284,6 +286,8 @@
} *p = (struct p1275_mem *)0;
unsigned int virt = (is_kernel ? IMAGE_VIRT_ADDR : INITRD_VIRT_ADDR);
unsigned long long phys = 0, phys_base;
+ long long psize;
+ unsigned int poff;
p = (struct p1275_mem *)malloc(2048);
@@ -302,10 +306,26 @@
phys_base = ~(unsigned long long)0;
for (i = 0; i < n; i++) {
- if (p[i].phys < phys_base)
- phys_base = p[i].phys;
+ if (p[i].phys < phys_base) {
+ /* align 4MB memory boundary */
+ poff = p[i].phys & (PHYS_MEM_ADDR_BOUNDARY - 1);
+ if (poff != 0) {
+ psize = p[i].size - (long long)poff;
+ if ( psize > 0 ) {
+ p[i].size = (unsigned long long)psize;
+ /* roundup physical memory address */
+ phys_base = p[i].phys - (unsigned long long)poff + PHYS_MEM_ADDR_BOUNDARY;
+ p[i].phys = phys_base;
+ } else {
+ continue;
+ }
+ } else {
+ phys_base = p[i].phys;
+ }
+ }
}
+
for (i = 0; i < n; i++) {
/* Do not mess with first 4 Megs of memory */
if (p[i].phys == phys_base) {
@@ -330,8 +350,13 @@
continue;
if (p[i].size >= len) {
- phys = p[i].phys;
- break;
+ if (is_kernel) {
+ phys = p[i].phys;
+ break;
+ } else if (p[i].phys > phys) {
+ phys = p[i].phys;
+ continue;
+ }
}
}
diff -ruN -x '.git*' silo/second/muldi3.S /root/rpmbuild/BUILD/silo-1.4.14/second/muldi3.S
--- silo/second/muldi3.S 2015-12-26 21:22:50.558144273 +0000
+++ /root/rpmbuild/BUILD/silo-1.4.14/second/muldi3.S 2015-12-26 21:33:58.778905701 +0000
@@ -17,11 +17,19 @@
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
+#if __WORDSIZE == 32
+# define STACK_BIAS 0
+#else
+# define STACK_BIAS 2047
+#endif
+
.text
.align 4
.globl __muldi3
+ .register %g2,#scratch
+ .register %g3,#scratch
__muldi3:
- save %sp, -104, %sp
+ save %sp, -STACK_BIAS-104, %sp
wr %g0, %i1, %y
sra %i3, 0x1f, %g2
and %i1, %g2, %g2
diff -ruN -x '.git*' silo/second/timer.c /root/rpmbuild/BUILD/silo-1.4.14/second/timer.c
--- silo/second/timer.c 2015-12-26 21:22:50.558144273 +0000
+++ /root/rpmbuild/BUILD/silo-1.4.14/second/timer.c 2015-12-26 21:33:58.812905028 +0000
@@ -145,7 +145,7 @@
prom_getstring(node, "device_type", node_str, sizeof(node_str));
if (!strcmp(node_str, "cpu")) {
foundcpu = 1;
- clock_frequency = prom_getintdefault(node, "clock-frequency", 0) / 100;
+ clock_frequency = (unsigned int) prom_getintdefault(node, "clock-frequency", 0) / 100;
}
}
if (notimer) {
@@ -155,7 +155,7 @@
}
}
if (!foundcpu || !clock_frequency)
- clock_frequency = prom_getint(prom_root_node, "clock-frequency") / 100;
+ clock_frequency = (unsigned int) prom_getint(prom_root_node, "clock-frequency") / 100;
if (notimer && !sun4v_cpu) {
sun4u_notimer = 1;
__asm__ __volatile__ ("\t"
diff -ruN -x '.git*' silo/second/util.c /root/rpmbuild/BUILD/silo-1.4.14/second/util.c
--- silo/second/util.c 2015-12-26 21:22:50.558144273 +0000
+++ /root/rpmbuild/BUILD/silo-1.4.14/second/util.c 2012-12-06 03:09:00.000000000 +0000
@@ -21,7 +21,6 @@
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
-#include <arpa/inet.h>
FILE *f, *e;
unsigned char buffer[2048];
@@ -62,11 +61,11 @@
goto bad1;
if (k >= prevoff)
k = prevoff - 1;
- diffs[type][ndiffs[type]] = htons(k - lastv[type]);
+ diffs[type][ndiffs[type]] = k - lastv[type];
lastv[type] = k;
ndiffs[type]++;
}
- diffs[type][ndiffs[type]] = htons(curoff + j - lastv[type]);
+ diffs[type][ndiffs[type]] = curoff + j - lastv[type];
lastv[type] = curoff + j;
ndiffs[type]++;
} else if (buffer2[j] == buffer[j] + 16) {
@@ -78,13 +77,11 @@
goto bad2;
if (k >= prevoff)
k = prevoff - 1;
- diffs[type+1][ndiffs[type+1]] =
- htons(k - lastv[type+1]);
+ diffs[type+1][ndiffs[type+1]] = k - lastv[type+1];
lastv[type+1] = k;
ndiffs[type+1]++;
}
- diffs[type+1][ndiffs[type+1]] =
- htons(curoff + j - lastv[type+1]);
+ diffs[type+1][ndiffs[type+1]] = curoff + j - lastv[type+1];
lastv[type+1] = curoff + j;
ndiffs[type+1]++;
} else {
diff -ruN -x '.git*' silo/silo/Makefile /root/rpmbuild/BUILD/silo-1.4.14/silo/Makefile
--- silo/silo/Makefile 2015-12-26 21:22:50.559144254 +0000
+++ /root/rpmbuild/BUILD/silo-1.4.14/silo/Makefile 2015-12-26 21:33:58.807905127 +0000
@@ -31,7 +31,7 @@
$(MAKE) -C ../first first.h ultra.h fd.h
silo.o: silo.c floppy.h $(UFSDEPS)
- $(CC) $(CFLAGS) -DVERSION='"$(VERSION)"' -DIMGVERSION='"$(IMGVERSION)"' -c silo.c
+ $(CC) $(CFLAGS) -DVERSION='"$(VERSION)"' -DSILO_RELEASE='"$(SILO_RELEASE)"' -DIMGVERSION='"$(IMGVERSION)"' -c silo.c
clean:
$(RM) *.o silo floppy.h ufs.h silocheck
diff -ruN -x '.git*' silo/silo/silo.c /root/rpmbuild/BUILD/silo-1.4.14/silo/silo.c
--- silo/silo/silo.c 2015-12-26 21:22:50.559144254 +0000
+++ /root/rpmbuild/BUILD/silo-1.4.14/silo/silo.c 2015-12-26 21:33:58.808905107 +0000
@@ -107,14 +107,14 @@
/* This is just so that we don't have to fight with incompatible ufs_fs.h headers */
#define SILO_UFS_MAGIC 0x00011954
-struct silo_ufs_super_block {
+struct __attribute__((packed)) silo_ufs_super_block {
unsigned char xxx1[36];
unsigned int fs_fsize;
unsigned char xxx2[1332];
unsigned int fs_magic;
};
-struct sun_disklabel {
+struct __attribute__((packed)) sun_disklabel {
unsigned char info[128]; /* Informative text string */
unsigned char spare[292]; /* Boot information etc. */
unsigned short rspeed; /* Disk rotational speed */
@@ -127,9 +127,9 @@
unsigned short ntrks; /* Tracks per cylinder */
unsigned short nsect; /* Sectors per track */
unsigned char spare3[4]; /* Even more magic... */
- struct sun_partition {
- unsigned long start_cylinder;
- unsigned long num_sectors;
+ struct __attribute__((packed)) sun_partition {
+ unsigned int start_cylinder;
+ unsigned int num_sectors;
} partitions[8];
unsigned short magic; /* Magic number */
unsigned short csum; /* Label xor'd checksum */
@@ -205,7 +205,7 @@
{
struct silo_ufs_super_block ufs;
struct ext2_super_block sb; /* Super Block Info */
- struct romfs_super_block {
+ struct __attribute__((packed)) romfs_super_block {
__u32 word0;
__u32 word1;
__u32 size;
@@ -632,7 +632,7 @@
void usage (char *s)
{
fprintf (stderr,
- "SILO " VERSION " Sparc Improved boot LOader\n"
+ "SILO " VERSION "-" SILO_RELEASE " Sparc Improved boot LOader\n"
"Usage: %s [options]\n"
"Options:\n"
" -r root_path chroots into root_path (all paths relative to this)\n"
@@ -1212,7 +1212,7 @@
}
if (!new_root) new_root = getenv("ROOT");
if (version) {
- fprintf(stderr, "SILO version " VERSION "\n");
+ fprintf(stderr, "SILO version " VERSION "-" SILO_RELEASE"\n");
return 0;
}
if (argc) usage(name);
diff -ruN -x '.git*' silo/tilo/crt0.S /root/rpmbuild/BUILD/silo-1.4.14/tilo/crt0.S
--- silo/tilo/crt0.S 2015-12-26 21:22:50.560144234 +0000
+++ /root/rpmbuild/BUILD/silo-1.4.14/tilo/crt0.S 2015-12-26 21:33:58.794905384 +0000
@@ -23,15 +23,11 @@
#define COPY jmpl %o7 + (copy - _start), %l7
-#ifdef SUPERTILO
-#define STACK_BASE 0xa00000
-#else
#ifndef LARGETILO
#define STACK_BASE 0x400000
#else
#define STACK_BASE 0x500000
#endif
-#endif
.text
.global _start
@@ -126,6 +122,26 @@
tst %i4 /* quit unless it's Sun4u */
be 0f
nop
+
+ /* Careful, we cannot read the %ver register on sun4v because
+ * there that register is hyperprivileged and we are executing
+ * in privileged mode.
+ *
+ * This early on it's difficult to portably detect sun4v as
+ * that requires OBP calls. So do this super-ugly trick of
+ * trying to set the PSTATE_AG bit in %pstate which will read
+ * back as zero on sun4u.
+ */
+ rdpr %pstate, %l0
+ or %l0, 0x1, %l1
+ wrpr %l1, %pstate
+ rdpr %pstate, %l1
+ wrpr %l0, %pstate
+ andcc %l1, 0x1, %g0
+ be,pn %xcc, 0f
+ nop
+
+
rdpr %ver, %l0
srlx %l0, (32 + 16), %l1
cmp %l1, 0x3e
diff -ruN -x '.git*' silo/tilo/Makefile /root/rpmbuild/BUILD/silo-1.4.14/tilo/Makefile
--- silo/tilo/Makefile 2015-12-26 21:22:50.560144234 +0000
+++ /root/rpmbuild/BUILD/silo-1.4.14/tilo/Makefile 2015-12-26 21:33:58.768905899 +0000
@@ -10,8 +10,6 @@
LDFLAGS_SMALL=-N -Ttext 0x3c0000
# This is even more, but will be used only for extra large images.
LDFLAGS_LARGE=-N -Ttext 0x4c0000
-# This is even more, but will be used only for super large images.
-LDFLAGS_SUPER=-N -Ttext 0x9c0000
all: maketilo
@@ -27,10 +25,9 @@
../common/divdi3.o ../common/udivdi3.o
OBJS = crt0.o tilo.o $(OBJS_COMMON) malloc.o
OBJS2 = crt0l.o tilol.o $(OBJS_COMMON) mallocl.o
-OBJS3 = crt0sup.o tilosup.o $(OBJS_COMMON) mallocsup.o
-maketilo: maketilo.c b.h b2.h b3.h
- $(HOSTCC) $(HOSTCFLAGS) -g maketilo.c -o maketilo
+maketilo: maketilo.c b.h b2.h
+ $(CC) $(CFLAGS) maketilo.c -o maketilo
b.h : b.out $(BIN2H)
$(BIN2H) -l BOOT_LEN boot_loader $< > $@ || ($(RM) $@; exit 1)
@@ -38,23 +35,14 @@
b2.h : b2.out $(BIN2H)
$(BIN2H) -l LARGE_BOOT_LEN large_boot_loader $< > $@ || ($(RM) $@; exit 1)
-b3.h : b3.out $(BIN2H)
- $(BIN2H) -l SUPER_BOOT_LEN super_boot_loader $< > $@ || ($(RM) $@; exit 1)
-
b.out: $(OBJS)
- $(LD) $(LDFLAGS_SMALL) -Bstatic -o boot $(OBJS)
+ $(LD) $(LDFLAGS_SMALL) -Bstatic -o boot $(OBJS) -lc
$(ELFTOAOUT) boot -o b.out
b2.out: $(OBJS2)
- $(LD) $(LDFLAGS_LARGE) -Bstatic -o boot2 $(OBJS2)
+ $(LD) $(LDFLAGS_LARGE) -Bstatic -o boot2 $(OBJS2) -lc
$(ELFTOAOUT) boot2 -o b2.out
-b3.out: $(OBJS3)
- $(LD) $(LDFLAGS_SUPER) -Bstatic -o boot3 $(OBJS3)
- $(ELFTOAOUT) boot3 -o b3.out
-
-mallocsup.o: ../common/malloc.c
- $(CC) $(CFLAGS) -DMALLOC_BASE=0x9D0000 -c -o $@ $<
mallocl.o: ../common/malloc.c
$(CC) $(CFLAGS) -DMALLOC_BASE=0x4D0000 -c -o $@ $<
@@ -62,9 +50,6 @@
malloc.o: ../common/malloc.c
$(CC) $(CFLAGS) -DMALLOC_BASE=0x3D0000 -c -o $@ $<
-tilosup.o: tilo.c
- $(CC) $(CFLAGS) -DSUPERTILO -c -o $@ $<
-
tilol.o: tilo.c
$(CC) $(CFLAGS) -DLARGETILO -c -o $@ $<
@@ -74,8 +59,5 @@
crt0l.o: crt0.S
$(CC) $(CFLAGS) -c -Wa,-Av9 -DLARGETILO -o $@ $<
-crt0sup.o: crt0.S
- $(CC) $(CFLAGS) -c -Wa,-Av9 -DSUPERTILO -o $@ $<
-
clean:
- $(RM) *.o boot boot2 boot3 *.out b.h b2.h b3.h maketilo
+ $(RM) *.o boot boot2 *.out b.h b2.h maketilo
diff -ruN -x '.git*' silo/tilo/maketilo.c /root/rpmbuild/BUILD/silo-1.4.14/tilo/maketilo.c
--- silo/tilo/maketilo.c 2015-12-26 21:22:50.560144234 +0000
+++ /root/rpmbuild/BUILD/silo-1.4.14/tilo/maketilo.c 2015-12-26 21:33:58.791905443 +0000
@@ -7,21 +7,18 @@
to the boot loader and patches the addresses in its image_table[]
Parameters:
- sun4=<filename>
- sun4c=<filename>
- sun4u=<filename>
- ... compressed kernel images
- (in a.out or ELF format)
+ kernel4=<filename>
+ kernel4c=<filename>
+ kernel4u=<filename>
+ ... compressed kernel images (in a.out format)
size4=<bytes>
size4c=<bytes>
size4u=<bytes>
- ... original sizes of kernel images
- (uncompressed)
+ ... original sizes of kernel images (uncompressed)
root4=<addr>
root4c=<addr>
root4u=<addr>
- ... virtual address of root image for each
- kernel (in hex)
+ ... virtual address of root image for each kernel (in hex)
root=<filename>
... compressed root image
out=<filename>
@@ -31,16 +28,12 @@
#include <stdio.h>
#include <sys/stat.h>
-#include <arpa/inet.h>
#include <stdlib.h>
#include <string.h>
#include "b.h"
#include "b2.h"
-#include "b3.h"
-#define MAX_BOOT_LEN 0x900000
-
-char output_buffer[MAX_BOOT_LEN];
+char *output_buffer;
struct ImageInfo {
unsigned packed_start;
@@ -57,18 +50,10 @@
return p ? (p + 32 + 0x1fff) & ~0x1fff : 0; /* add 32 bytes and round to 8 KB */
}
-static void check_size (char const *name, int len, int pos, int max)
-{
- if (max - pos < len) {
- fprintf (stderr, "%s will not fit into the image.\n", name);
- exit (EXIT_FAILURE);
- }
-}
-
int main (int argc, char **argv)
{
int i,len,rootlen;
- FILE *f, *g = NULL;
+ FILE *f, *g;
struct ImageInfo *ii;
char *sun4_kernel_start;
@@ -124,26 +109,26 @@
if (!sun4_kernel) {
/*fprintf (stderr, "WARNING: Kernel for Sun4 not specified\n");*/
- } else if (!sun4_size || (!sun4_root && root_image)) {
+ } else if (!sun4_size || !sun4_root) {
fprintf (stderr, "WARNING: Original size and root address must be specified for Sun4\n");
return -1;
}
if (!sun4c_kernel) {
fprintf (stderr, "WARNING: Kernel for Sun4c/m/d not specified\n");
- } else if (!sun4c_size || (!sun4c_root && root_image)) {
+ } else if (!sun4c_size || !sun4c_root) {
fprintf (stderr, "ERROR: Original size and root address must be specified for Sun4c\n");
return -1;
}
if (!sun4u_kernel) {
fprintf (stderr, "WARNING: Kernel for Sun4u not specified\n");
- } else if (!sun4u_size || (!sun4u_root && root_image)) {
+ } else if (!sun4u_size || !sun4u_root) {
fprintf (stderr, "ERROR: Original size and root address must be specified for Sun4u\n");
return -1;
}
- if (!root_image && (sun4_root || sun4c_root || sun4u_root)) {
+ if (!root_image) {
fprintf (stderr, "ERROR: Root image not specified\n");
return -1;
}
@@ -153,38 +138,34 @@
return -1;
}
- if (root_image) {
- g = fopen (root_image, "rb");
- if (!g) {
- fprintf (stderr, "Can't load %s\n", root_image);
- return -1;
- }
- fseek (g, 0, SEEK_END);
- rootlen = ftell (g);
- fseek (g, 0, SEEK_SET);
- } else {
- rootlen = 0;
+ g = fopen (root_image, "rb");
+ if (!g) {
+ fprintf (stderr, "Can't load %s\n", root_image);
+ return -1;
}
- if (rootlen + sun4_size + 0x4000 + 0x10000 >= 0x430000 ||
- rootlen + sun4c_size + 0x4000 + 0x10000 >= 0x430000 ||
- rootlen + sun4u_size + 0x4000 + 0x10000 >= 0x430000) {
- printf("Images are super large. Will load on machines with at least 10M mapped by PROM only\n");
+ fseek (g, 0, SEEK_END);
+ rootlen = ftell (g);
+ fseek (g, 0, SEEK_SET);
+
+ /* Note that this code relies in the fact that the raw kernel
+ sizes are bigger than the corresponding compressed
+ images. */
+ output_buffer = malloc (rootlen + sun4_size + sun4c_size + sun4u_size);
- for (i=0; i<SUPER_BOOT_LEN; i++)
- output_buffer[i] = super_boot_loader[i];
- } else if (rootlen + sun4_size + 0x4000 + 0x10000 >= 0x330000 ||
+ if (rootlen + sun4_size + 0x4000 + 0x10000 >= 0x330000 ||
rootlen + sun4c_size + 0x4000 + 0x10000 >= 0x330000 ||
rootlen + sun4u_size + 0x4000 + 0x10000 >= 0x330000) {
printf("Images are large. Will load on machines with at least 5M mapped by PROM only\n");
for (i=0; i<LARGE_BOOT_LEN; i++)
output_buffer[i] = large_boot_loader[i];
- } else
+ sun4_kernel_start = output_buffer + LARGE_BOOT_LEN;
+ } else {
for (i=0; i<BOOT_LEN; i++)
output_buffer[i] = boot_loader[i];
-
- sun4_kernel_start = output_buffer + BOOT_LEN;
+ sun4_kernel_start = output_buffer + BOOT_LEN;
+ }
if (sun4_kernel) {
f = fopen (sun4_kernel, "rb");
@@ -196,8 +177,6 @@
fseek (f, 0, SEEK_END);
len = ftell (f);
fseek (f, 0, SEEK_SET);
- check_size (sun4_kernel, sun4_kernel_start - output_buffer, len,
- MAX_BOOT_LEN);
fread (sun4_kernel_start, 1, len, f);
fclose (f);
} else
@@ -215,8 +194,6 @@
fseek (f, 0, SEEK_END);
len = ftell (f);
fseek (f, 0, SEEK_SET);
- check_size (sun4c_kernel, sun4c_kernel_start - output_buffer,
- len, MAX_BOOT_LEN);
fread (sun4c_kernel_start, 1, len, f);
fclose (f);
} else
@@ -234,8 +211,6 @@
fseek (f, 0, SEEK_END);
len = ftell (f);
fseek (f, 0, SEEK_SET);
- check_size (sun4u_kernel, sun4u_kernel_start - output_buffer,
- len, MAX_BOOT_LEN);
fread (sun4u_kernel_start, 1, len, f);
fclose (f);
} else
@@ -243,17 +218,13 @@
root_image_start = sun4u_kernel_start + len;
- if (root_image) {
- check_size (root_image, root_image_start - output_buffer, len,
- MAX_BOOT_LEN);
- fread (root_image_start, 1, rootlen, g);
- fclose (g);
- }
+ fread (root_image_start, 1, rootlen, g);
+ fclose (g);
output_end = root_image_start + rootlen;
/* patch code, data and BSS size in the .out header */
- *(unsigned*)(output_buffer+4) = htonl(output_end - output_buffer);
+ *(unsigned*)(output_buffer+4) = output_end - output_buffer;
*(unsigned*)(output_buffer+8) = 0;
*(unsigned*)(output_buffer+12) = 0;
@@ -301,13 +272,6 @@
ii[3].unpacked_len = 0;
ii[3].root_start = 0;
- for (i = 0; i < 4; i++) {
- ii[i].packed_start = htonl(ii[i].packed_start);
- ii[i].packed_len = htonl(ii[i].packed_len);
- ii[i].unpacked_len = htonl(ii[i].unpacked_len);
- ii[i].root_start = htonl(ii[i].root_start);
- }
-
f = fopen (output_file, "wb");
if (!f) {
fprintf (stderr, "Can't open %s for writing\n", output_file);
diff -ruN -x '.git*' silo/tilo/tilo.c /root/rpmbuild/BUILD/silo-1.4.14/tilo/tilo.c
--- silo/tilo/tilo.c 2015-12-26 21:22:50.560144234 +0000
+++ /root/rpmbuild/BUILD/silo-1.4.14/tilo/tilo.c 2012-12-06 03:09:00.000000000 +0000
@@ -18,22 +18,17 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA. */
-#include <elf.h>
#include <silo.h>
#include <setjmp.h>
#ifndef NULL
#define NULL (void *)0
#endif
-#ifdef SUPERTILO
-#define MOVED_BASE 0x9c0000
-#else
#ifndef LARGETILO
#define MOVED_BASE 0x3c0000
#else
#define MOVED_BASE 0x4c0000
#endif
-#endif
/*
* gzip declarations
@@ -171,178 +166,11 @@
#define HDRS_TAG (('H'<<24) | ('d'<<16) | ('r'<<8) | 'S')
-static char *sun4u_memory_find (unsigned int len)
-{
- int n, node, i;
- struct p1275_mem {
- unsigned long long phys;
- unsigned long long size;
- } *p = (struct p1275_mem *)0;
- unsigned int virt = 0x40000000;
- unsigned long long phys = 0, phys_base;
-
- p = (struct p1275_mem *)malloc(2048);
-
- node = prom_finddevice("/memory");
-
- n = prom_getproplen(node, "available");
-
- if (!n || n == -1 ||
- prom_getproperty(node, "available", (char *)p, 2048) == -1) {
- free (p);
- printf("Could not get available property\n");
- return (char *)0;
- }
-
- phys = 0;
- n /= sizeof(*p);
-
- phys_base = ~(unsigned long long)0;
- for (i = 0; i < n; i++) {
- if (p[i].phys < phys_base)
- phys_base = p[i].phys;
- }
-
- for (i = 0; i < n; i++) {
- /* Do not mess with first 16 Megs of memory */
- if (p[i].phys == phys_base) {
- if (p[i].size <= 0x1000000)
- continue;
- p[i].phys += 0x1000000;
- p[i].size -= 0x1000000;
- }
-
- if (p[i].size >= len) {
- phys = p[i].phys;
- break;
- }
- }
-
- free (p);
-
- if (!phys) {
- printf("Could not find any available memory\n");
- return (char *)0;
- }
-
- if (prom_map(PROM_MAP_DEFAULT, (unsigned long long)len, virt, phys) ==
- -1) {
- printf("Could not map memory\n");
- return (char *)0;
- }
-
- return (char *)virt + 0x4000;
-}
-
-void parse_executable(char *base, int image_len)
-{
- union {
- char *b;
- struct aout_hdr *a;
- Elf32_Ehdr *e;
- Elf64_Ehdr *f;
- } hp;
- unsigned off = 0;
- int len = 0;
-
- /*
- * Check if the image is an executable file, either an a.out or an elf
- * binary.
- */
-
- hp.b = base;
- if (hp.a->magic == 0x01030107) {
- off = sizeof (struct aout_hdr);
- if (image_len > hp.a->ltext + hp.a->ldata)
- len = hp.a->ltext + hp.a->ldata;
- else
- len = image_len;
- } else if (hp.e->e_ident[EI_MAG0] == ELFMAG0 &&
- hp.e->e_ident[EI_MAG1] == ELFMAG1 &&
- hp.e->e_ident[EI_MAG2] == ELFMAG2 &&
- hp.e->e_ident[EI_MAG3] == ELFMAG3) {
- if (hp.e->e_ident[EI_DATA] != ELFDATA2MSB) {
- printf("Image is not a MSB ELF.\n");
- prom_halt();
- }
- if (hp.e->e_ident[EI_CLASS] == ELFCLASS32) {
- Elf32_Phdr *p;
- int i;
- unsigned long n;
- Elf32_Phdr *q;
-
- p = (Elf32_Phdr *) (hp.b + hp.e->e_phoff);
- if (p->p_type != PT_LOAD) {
- printf("Cannot find a loadable segment in your ELF image.\n");
- prom_halt();
- }
-
- q = p + 1;
- for (i = 1; i < hp.e->e_phnum; i++, q++) {
- if (q->p_type != PT_LOAD)
- break;
- n = q->p_offset - p->p_offset;
- if (q->p_vaddr - p->p_vaddr == n &&
- q->p_paddr - p->p_paddr == n &&
- p->p_memsz == p->p_filesz &&
- p->p_memsz <= n) {
- p->p_filesz = n + q->p_filesz;
- p->p_memsz = n + q->p_memsz;
- } else {
- printf("Multiple loadable segments in your ELF image.\n");
- prom_halt();
- }
- }
- off = p->p_offset + hp.e->e_entry - p->p_vaddr;
- len = p->p_filesz;
- if (len > image_len)
- len = image_len;
- } else if (hp.e->e_ident[EI_CLASS] == ELFCLASS64) {
- Elf64_Phdr *p;
- unsigned long long n;
- int i;
- Elf64_Phdr *q;
-
- p = (Elf64_Phdr *) (hp.b + hp.f->e_phoff);
- if (p->p_type != PT_LOAD) {
- printf("Cannot find a loadable segment in your ELF image.\n");
- prom_halt();
- }
- q = p + 1;
- for (i = 1; i < hp.f->e_phnum; i++, q++) {
- if (q->p_type != PT_LOAD)
- break;
- n = q->p_offset - p->p_offset;
- if (q->p_vaddr - p->p_vaddr == n &&
- q->p_paddr - p->p_paddr == n &&
- p->p_memsz == p->p_filesz &&
- p->p_memsz <= n) {
- p->p_filesz = n + q->p_filesz;
- p->p_memsz = n + q->p_memsz;
- } else {
- printf("Multiple loadable segments in your ELF image.\n");
- prom_halt();
- }
- }
- off = p->p_offset + hp.f->e_entry - p->p_vaddr;
- len = p->p_filesz;
- if (len > image_len)
- len = image_len;
- }
- } else {
- /* Assume "raw" a.out format prepared by tilo.sh. */
- return;
- }
- memmove(base, base + off, len);
-}
-
char *my_main (struct linux_romvec *promvec, void *cifh, void *cifs)
{
-char *orig_code,*moved_code,*moved_ramdisk = NULL,*moved_kernel,*kernel_base;
+char *orig_code,*moved_code,*moved_ramdisk,*moved_kernel,*kernel_base;
unsigned *p,*q = NULL;
int kernel_number;
-char *kernel_end, *kernel_limit;
-int move_ramdisk;
prom_init(promvec, cifh, cifs);
@@ -371,69 +199,26 @@
}
orig_code = (char*) 0x4000;
-
- /*
- * On sun4u we can allocate more memory and relocate the kernel.
- */
- if (kernel_number == SUN4U_KERNEL) {
- unsigned int size;
-
- for (size = 64 * 1024 * 1024; size >= 4 * 1024 * 1024;
- size -= 4 * 1024 * 1024) {
- kernel_base = sun4u_memory_find(size);
- if (kernel_base)
- break;
- }
- if (!kernel_base)
- goto no_mem;
- kernel_limit = kernel_base + size;
- gzminp = (unsigned char *)orig_code +
- image_table[kernel_number].packed_start;
- if (image_table[ROOT_IMAGE].packed_len)
- image_table[kernel_number].root_start = (unsigned)orig_code +
- image_table[ROOT_IMAGE].packed_start + 0x400000;
- else
- image_table[kernel_number].root_start = 0;
- move_ramdisk = 0;
- } else {
-no_mem:
- move_ramdisk = 1;
- moved_code = (char*)MOVED_BASE;
- moved_ramdisk = (char*)((long)(moved_code -
- image_table[ROOT_IMAGE].packed_len) & ~0xfff);
- moved_kernel = (char*)((long)(moved_ramdisk -
- image_table[kernel_number].packed_len) & ~0xfff);
+ moved_code = (char*) MOVED_BASE;
+ moved_ramdisk = (char*)((long)(moved_code - image_table[ROOT_IMAGE].packed_len) & ~0xfff);
+ moved_kernel = (char*)((long)(moved_ramdisk - image_table[kernel_number].packed_len) & ~0xfff);
#ifdef TILO_DEBUG
- printf("Locations: moved_code=%x moved_ramdisk=%x moved_kernel=%x\n",
- moved_code, moved_ramdisk, moved_kernel);
+ printf("Locations: moved_code=%x moved_ramdisk=%x moved_kernel=%x\n",
+ moved_code, moved_ramdisk, moved_kernel);
#endif
- memmove(moved_ramdisk, orig_code + image_table[ROOT_IMAGE].packed_start,
- image_table[ROOT_IMAGE].packed_len);
- memmove(moved_kernel,
- orig_code + image_table[kernel_number].packed_start,
- image_table[kernel_number].packed_len);
-
- gzminp = (unsigned char *)moved_kernel; /* decompress kernel */
- kernel_base = (char*) 0x4000;
- kernel_limit = moved_kernel;
- }
+ memmove (moved_ramdisk, orig_code + image_table[ROOT_IMAGE].packed_start, image_table[ROOT_IMAGE].packed_len);
+ memmove (moved_kernel, orig_code + image_table[kernel_number].packed_start, image_table[kernel_number].packed_len);
- kernel_end = kernel_base +
- ((image_table[kernel_number].unpacked_len + 0xfff) & ~0xfff);
+ gzminp = (unsigned char *)moved_kernel; /* decompress kernel */
+ kernel_base = (char*) 0x4000;
- if (kernel_end > kernel_limit) {
- printf("No space to decompress the kernel.\n");
- prom_halt();
- }
-
- if (decompress (kernel_base, kernel_end, get_input, unget_input) == -1)
+ if (decompress (kernel_base, kernel_base + ((image_table[kernel_number].unpacked_len
+ + 0xfff) & ~0xfff), get_input, unget_input) == -1)
{
printf ("\nKernel decompression error\n");
prom_halt();
}
- parse_executable(kernel_base, kernel_end - kernel_base);
-
switch (kernel_number)
{
case SUN4U_KERNEL:
@@ -473,9 +258,8 @@
q[5] = image_table[ROOT_IMAGE].packed_len;
/* move root image */
- if (move_ramdisk)
- memmove ((void*)(image_table[kernel_number].root_start & 0x3fffff),
- moved_ramdisk, image_table[ROOT_IMAGE].packed_len);
+ memmove ((void*)(image_table[kernel_number].root_start & 0x3fffff),
+ moved_ramdisk, image_table[ROOT_IMAGE].packed_len);
#ifdef TILO_DEBUG
printf("Returning from my_main() with address %x\n", kernel_base);
#endif
diff -ruN -x '.git*' silo/tilo/tilo.sh /root/rpmbuild/BUILD/silo-1.4.14/tilo/tilo.sh
--- silo/tilo/tilo.sh 2015-12-26 21:22:50.560144234 +0000
+++ /root/rpmbuild/BUILD/silo-1.4.14/tilo/tilo.sh 2012-12-06 03:09:00.000000000 +0000
@@ -50,18 +50,16 @@
to_remove="$to_remove $KERNEL.gz"
PSIZE=`ls -l $KERNEL.gz | awk '{print$5}'`
SIZE=`ls -l $KERNEL.raw | awk '{print$5}'`
- ROOTA=`nm $KERNEL | awk '/[AB] _end$/{print$1}'`
+ ROOTA=`nm $KERNEL | awk '/A _end$/{print$1}'`
rm $KERNEL.raw
echo "Sizes ($tag):"
echo " raw size = $SIZE"
echo " packed size = $PSIZE"
echo " root address = $ROOTA"
if [ -n "$sun4u" ]; then
- tilo_args="$tilo_args sun4u=$KERNEL.gz size4u=$SIZE"
- root_addr="$root_addr root4u=$ROOTA"
+ tilo_args="$tilo_args sun4u=$KERNEL.gz size4u=$SIZE root4u=$ROOTA"
else
- tilo_args="$tilo_args sun4c=$KERNEL.gz size4c=$SIZE"
- root_addr="$root_addr root4c=$ROOTA"
+ tilo_args="$tilo_args sun4c=$KERNEL.gz size4c=$SIZE root4c=$ROOTA"
fi
}
@@ -82,7 +80,7 @@
fi
ROOT_SIZE=`ls -l $rootimg | awk '{print$5}'`
echo Root image packed size = $ROOT_SIZE
- root_img="root=$rootimg"
+ tilo_args="$tilo_args root=$rootimg"
}
while [ $# != 0 ]; do
@@ -114,8 +112,7 @@
exit 1
fi
-[ -n "$root_img" ] && root_img="$root_img $root_addr"
-$(dirname $0)/maketilo $tilo_args $root_img out=$output
+`echo $0 | sed 's/tilo$/maketilo/'` $tilo_args out=$output
rm -f $to_remove