summaryrefslogtreecommitdiffstats
path: root/EXTERNAL/build-arm-linux-3.4.4
blob: 655c0d9b84f78f84783999720cb3dd545a60009f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214

HOWTO build arm-linux toolchain for ARM/XSCALE
----------------------------------------------

These instructions document how to build an arm-linux tool chain
that contains both little-endian and big-endian target libraries.


1. Packages used:

    binutils-2.16.tar.gz
    gcc-3.4.4.tar.gz
    glibc-2.3.3.tar.gz
    glibc-linuxthreads-2.3.3.tar.gz


2. binutils-2.16

   tar xvzf binutils-2.16.tar.gz
   cd binutils-2.16
   mkdir arm-linux
   cd arm-linux
   ../configure --target=arm-linux --with-lib-path=/usr/local/arm-linux/lib:/usr/local/arm-linux/lib/be:/usr/local/arm-linux/lib/soft-float:/usr/local/arm-linux/lib/be/soft-float
   make
   make install
   chmod 777 /usr/local/arm-linux


3. gcc-3.4.4

   tar xvzf gcc-3.4.4.tar.gz
   cd gcc-3.4.4

   cp $(ATTACHED t-linux file) gcc/config/arm/
   vi gcc/config/arm/linux-elf.h
     -- remove line that defines LIBGCC_SPEC

   mkdir arm-linux
   cd arm-linux
   ../configure --target=arm-linux --disable-shared --disable-threads \
	--prefix=/usr/local --with-headers=linux-2.4.x/include \
	--with-gnu-as --with-gnu-ld --enable-multilib --enable-languages=c
   make
   make install


4. glibc-2.3.3 (big-endian)

   tar xvzf glibc-2.3.3.tar.gz
   cd glibc-2.3.3
   tar xvzf glibc-linuxthreads-2.3.3.tar.gz

   rm -rf nptl
   vi sysdeps/unix/sysv/linux/arm/ioperm.c
      - change "BUS_ISA" to be "CTL_BUS_ISA" lines 103 and 104
   vi config.make.in
      - change "slibdir = @...@" to "slibdir = @libdir@"
   vi Makeconfig
      - change all occurrances of "O2" to "O"
      - remove any occurrances of -lgcc_eh
   vi configure
      - change all occurrances of "O2" to "O"
   touch sysdeps/arm/framestate.c

   mkdir arm-linux
   cd arm-linux
   CC="arm-linux-gcc -mbig-endian -finline-limit=10000" \
   AS="arm-linux-as -mbig-endian" \
   LD="arm-linux-ld -EB" \
   ../configure --host=arm-linux --build=i686-pc-linux-gnu \
	--with-headers=linux-2.4.x/include \
	--enable-add-ons --enable-shared --prefix=/usr/local/arm-linux \
	--libdir=/usr/local/arm-linux/lib/be
   make
   make install


5. glibc-2.3.3 (little-endian)

   tar xvzf glibc-2.3.3.tar.gz
   cd glibc-2.3.3
   tar xvzf glibc-linuxthreads-2.3.3.tar.gz

   [ Apply same fixes as above ]

   mkdir arm-linux
   cd arm-linux
   CC="arm-linux-gcc -finline-limit=10000" \
   AS="arm-linux-as" \
   LD="arm-linux-ld" \
   ../configure --host=arm-linux --build=i686-pc-linux-gnu \
	--with-headers=linux-2.4.x/include \
	--enable-add-ons --enable-shared --prefix=/usr/local/arm-linux
   make
   make install



6. glibc-2.3.3 (big-endian/soft-float)

   tar xvzf glibc-2.3.3.tar.gz
   cd glibc-2.3.3
   tar xvzf glibc-linuxthreads-2.3.3.tar.gz

   [ Apply same fixes as above ]

   mkdir arm-linux
   cd arm-linux
   CC="arm-linux-gcc -mbig-endian -msoft-float -finline-limit=10000" \
   AS="arm-linux-as -mbig-endian" \
   LD="arm-linux-ld -EB" \
   ../configure --host=arm-linux --build=i686-pc-linux-gnu \
	--with-headers=linux-2.4.x/include \
	--enable-add-ons --enable-shared --prefix=/usr/local/arm-linux \
	--without-fp --libdir=/usr/local/arm-linux/lib/be/soft-float
   make
   make install



7. glibc-2.3.3 (little-endian/soft-float)

   tar xvzf glibc-2.3.3.tar.gz
   cd glibc-2.3.3
   tar xvzf glibc-linuxthreads-2.3.3.tar.gz

   [ Apply same fixes as above ]

   mkdir arm-linux
   cd arm-linux

   CC="arm-linux-gcc -msoft-float -finline-limit=10000" \
   AS="arm-linux-as" \
   LD="arm-linux-ld" \
   ../configure --host=arm-linux --build=i686-pc-linux-gnu \
	--with-headers=linux-2.4.x/include \
	--enable-add-ons --enable-shared --prefix=/usr/local/arm-linux \
	--without-fp --libdir=/usr/local/arm-linux/lib/soft-float
   make
   make install


8. gcc-3.4.4 (c++, etc)

   tar xvzf gcc-3.4.4.tar.gz
   cd gcc-3.4.4

   cp $(ATTACHED t-linux file) gcc/config/arm/
   vi gcc/config/arm/t-linux  
      - remove all "-Dinhibit_libc" occruances
   vi gcc/config/arm/linux-elf.h
     -- remove line that defines LIBGCC_SPEC
   perl -pi -e 's/int namelen/unsigned int namelen/' libjava/java/net/natInetAddressPosix.cc

   mkdir arm-linux
   cd arm-linux
   ../configure --target=arm-linux --disable-shared \
	--prefix=/usr/local --with-headers=linux-2.4.x/include \
	--with-gnu-as --with-gnu-ld --enable-multilib
   make
   make install


9. cd /
   find /usr/local/arm-linux -name CVS -type d | xargs rm -rf
   strip /usr/local/arm-linux/bin/*
   strip /usr/local/bin/arm-linux-*
   tar cvzf /tmp/arm-linux-tools-xxxxxxxx.tar.gz \
	/usr/local/arm-linux \
	/usr/local/lib/gcc/arm-linux \
	/usr/local/include/c++/3.4.4 \
	/usr/local/bin/arm-linux-* \
	/usr/local/libexec/gcc/arm-linux/3.4.4 \
	/usr/local/bin/genext2fs


------------------------------------------------------------------------------

APPENDIX A  --  modified t-linux for gcc-3.4.4

------------------------------------------------------------------------------
# Just for these, we omit the frame pointer since it makes such a big
# difference.  It is then pointless adding debugging.
TARGET_LIBGCC2_CFLAGS = -fomit-frame-pointer -fPIC -Dinhibit_libc -D__gthr_posix
LIBGCC2_DEBUG_CFLAGS = -g0

# Don't build enquire
ENQUIRE=

LIB1ASMSRC = arm/lib1funcs.asm
LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx \
	_bb_init_func _call_via_rX _interwork_call_via_rX \
	_negdf2 _addsubdf3 _muldivdf3 _cmpdf2 _unorddf2 _fixdfsi _fixunsdfsi \
	_truncdfsf2 _negsf2 _addsubsf3 _muldivsf3 _cmpsf2 _unordsf2 \
	_fixsfsi _fixunssfsi

MULTILIB_OPTIONS = mlittle-endian/mbig-endian mhard-float/msoft-float
MULTILIB_DIRNAMES = le be hard-float soft-float

EXTRA_MULTILIB_PARTS = crtbegin.o crtbeginS.o crtend.o crtendS.o crti.o crtn.o

LIBGCC = stmp-multilib
INSTALL_LIBGCC = install-multilib
T_CFLAGS = -Dinhibit_libc -D__gthr_posix_h

# Assemble startup files.
$(T)crti.o: $(srcdir)/config/arm/crti.asm $(GCC_PASSES)
	$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \
	  -c -o $(T)crti.o -x assembler-with-cpp $(srcdir)/config/arm/crti.asm

$(T)crtn.o: $(srcdir)/config/arm/crtn.asm $(GCC_PASSES)
	$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \
	  -c -o $(T)crtn.o -x assembler-with-cpp $(srcdir)/config/arm/crtn.asm
------------------------------------------------------------------------------