Subversion Repositories HelenOS-historic

Rev

Rev 1748 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1748 Rev 1771
Line 28... Line 28...
28
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
#
29
#
30
 
30
 
31
[ "$#" -lt 1 ] && exit 1
31
[ "$#" -lt 1 ] && exit 1
32
 
32
 
33
case "$1" in
-
 
34
	"binary")
-
 
35
		BFD="binary"
-
 
36
		;;
-
 
37
	"ecoff")
-
 
38
		BFD="ecoff-littlemips"
-
 
39
		;;
-
 
40
	*)
-
 
41
		echo "Undefined image format" >&1
-
 
42
		exit 1
-
 
43
		;;
-
 
44
esac
-
 
45
 
-
 
46
OBJCOPY="$2"
33
OBJCOPY="$1"
47
LINK="_link.ld"
34
LINK="_link.ld"
48
HEADER="_components.h"
35
HEADER="_components.h"
49
 
36
 
50
shift 2
37
shift
51
 
38
 
52
echo "OUTPUT_FORMAT(\"${BFD}\")
39
echo 'OUTPUT_FORMAT("elf64-sparc")
53
ENTRY(start)
40
ENTRY(start)
54
 
41
 
55
SECTIONS {
42
SECTIONS {
56
	.boot 0xbfc00000: AT (0) {
43
	.boot 0x4000: AT (0) {
57
		*(BOOTSTRAP);
44
		*(BOOTSTRAP);
58
		*(.text);
45
		*(.text);
59
		
-
 
60
		*(.rodata);
46
		*(.rodata);
61
		*(.rodata.*);
47
		*(.rodata.*);
62
		*(.data);		/* initialized data */
48
		*(.data);               /* initialized data */
63
		*(.sdata);
49
		*(.sdata);
64
		*(.sdata2);
50
		*(.sdata2);
65
		*(.sbss);
51
		*(.sbss);
66
		*(.scommon);
-
 
67
		*(.bss);		/* uninitialized static variables */	
52
		*(.bss);                /* uninitialized static variables */
68
		*(COMMON); 		/* global variables */
-
 
69
		*(.reginfo);" > "$LINK"
53
		*(COMMON);' > "$LINK"
70
 
54
 
71
echo '#ifndef ___COMPONENTS_H__
55
echo '#ifndef ___COMPONENTS_H__
72
#define ___COMPONENTS_H__
56
#define ___COMPONENTS_H__
73
 
57
 
74
typedef struct {
58
typedef struct {
Line 88... Line 72...
88
	SYMBOL="`echo "_binary_$TASK" | tr "./" "__"`"
72
	SYMBOL="`echo "_binary_$TASK" | tr "./" "__"`"
89
	MACRO="`echo "$BASENAME" | tr [:lower:] [:upper:]`"
73
	MACRO="`echo "$BASENAME" | tr [:lower:] [:upper:]`"
90
	echo "$TASK -> $OBJECT"
74
	echo "$TASK -> $OBJECT"
91
	
75
	
92
	echo "
76
	echo "
93
		. = ALIGN(4096);
77
		. = ALIGN(8192);
94
		*(.${BASENAME}_image);" >> "$LINK"
78
		*(.${BASENAME}_image);" >> "$LINK"
95
	
79
	
96
	echo "
80
	echo "
97
extern int ${SYMBOL}_start;
81
extern int ${SYMBOL}_start;
98
extern int ${SYMBOL}_end;
82
extern int ${SYMBOL}_end;
99
 
83
 
100
#define ${MACRO}_START ((void *) &${SYMBOL}_start)
84
#define ${MACRO}_START ((void *) &${SYMBOL}_start)
101
#define ${MACRO}_END ((void *) &${SYMBOL}_end)
85
#define ${MACRO}_END ((void *) &${SYMBOL}_end)
102
#define ${MACRO}_SIZE ((unsigned int) ${MACRO}_END - (unsigned int) ${MACRO}_START)" >> "$HEADER"
86
#define ${MACRO}_SIZE ((unsigned int) ${MACRO}_END - (unsigned int) ${MACRO}_START)" >> "$HEADER"
103
	
87
	
104
	"$OBJCOPY" -I binary -O elf32-tradlittlemips -B mips --rename-section ".data=.${BASENAME}_image" "$TASK" "$OBJECT"
88
	"$OBJCOPY" -I binary -O elf64-sparc -B sparc --rename-section ".data=.${BASENAME}_image" "$TASK" "$OBJECT"
105
		
89
		
106
	DATA="${DATA}
90
	DATA="${DATA}
107
	components[$COUNT].name = \"${BASENAME}\";
91
	components[$COUNT].name = \"${BASENAME}\";
108
	components[$COUNT].start = ${MACRO}_START;
92
	components[$COUNT].start = ${MACRO}_START;
109
	components[$COUNT].end = ${MACRO}_END;
93
	components[$COUNT].end = ${MACRO}_END;