]> git.sesse.net Git - vlc/blob - doc/arm-crosscompile-howto.sgml
* first draft of the draft
[vlc] / doc / arm-crosscompile-howto.sgml
1 <!doctype linuxdoc system>
2 <linuxdoc><article>
3 <titlepag>
4   <title>Cross compiling VLC for ARM-Linux based platforms</title>
5   <author>Marc Ariberti <tt><htmlurl url="mailto:marcari@videolan.org" name="<marcari@videolan.org>"></tt></author>
6   <date>v0.0.1, 13 march 2003</date>
7   <abstract>
8     This document describes all the steps to cross compile vlc for ARM based
9     platforms. It describes how to build a cross compilation toolchain, how to
10     build the libraries needed by vlc and the compilation of the vlc itself.
11   </abstract>
12 </titlepag>
13
14 <toc>
15
16 <sect>
17   <heading>Introduction</heading>
18   <sect1>
19     <heading>Which platforms are targeted ?</heading>
20     <p>
21       I will describe here how to compile vlc for an ARM based
22       PDA running linux. It includes for example :
23       <itemize>
24       <item>Compaq - iPaq (H36xx, H38xx,...), using
25         <itemize>
26           <item>Familiar linux
27           <item>Opie
28         </itemize>
29       </item>
30       <item>YOPY/Linupy</item>
31       <item>Zaurus</item>
32       </itemize>
33     </p>
34   </sect1> 
35   <sect1>
36     <heading>Requirements for cross-compilation</heading>
37   </sect1>
38   <sect1>
39     <heading>Why cross-compiling ?</heading>
40     <p>
41       It is of course possible to compile directly on the targeted platform.
42       But there are a lot of great advantages to cross-compile :
43       <itemize>
44       <item>The most important one is probably the speed, because a
45         desktop computer is most of the time faster than a PDA for
46         compilation.</item>
47       <item>Another big problem is that a complete compilation toolchain
48         does take a great amount of disk space. And this space is usually
49         very limited on embedded systems.</item>
50       <item>And there also may not be enough memory to compile big files.</item>
51       </itemize>
52     </p>
53   </sect1>
54 </sect>
55
56 <sect>
57   <heading>Building the toolchain</heading>
58   <sect1>
59     <heading>Prerequisite</heading>
60     <sect2>
61       <heading></heading>
62       <p>
63         During this section, we will use the following variables :
64         <itemize>
65           <item><bf>${PREFIX}</bf> will designate where you want to install 
66             your toolchain (eg: <tt>/usr/local/arm/2.95.3</tt>).</item>
67           <item><bf>${SRCDIR}</bf> will designate the directory where 
68             sources will be uncompressed 
69             (eg: <tt>/usr/src</tt> or <tt>/home/foobar/cross-arm</tt>).</item>
70         </itemize>
71       </p>
72     </sect2>
73     <sect2>
74       <heading>Files needed</heading>
75       <p>Download the following files and put them in the <bf>${SRCDIR}</bf> :
76         <itemize>
77           <item><tt>binutils-2.11.2.tar.gz</tt></item>
78           <item><tt>linux-2.4.19.tar.bz2</tt></item>
79           <item><tt>patch-2.4.19-rmk4.bz2</tt></item>
80         </itemize>
81       </p>
82     </sect2>
83   </sect1>
84   <sect1>
85     <heading>Binutils</heading>
86     <p>Compiling binutils is pretty simple :
87     <tscreen><verb>
88 % tar xzf binutils-2.11.2.tar.gz
89 % cd binutils-2.11.2
90 % ./configure --target=arm-linux --prefix=/usr/local/arm/2.95.3
91 % make
92 % su 
93 # make install
94     </verb></tscreen>
95     </p>
96   </sect1>
97   <sect1>
98     <heading>Preparing linux kernel</heading>
99     <p>
100     <tscreen><verb>
101         % tar xzf linux-2.4.19.tar.bz2
102         % bunzip2 patch-2.4.19-rmk4.bz2
103         % cd linux-2.4.19
104         % patch -p1 &lt; ../patch-2.4.19-rmk4.bz2
105         % make clean ARCH=arm CROSS_COMPILE=arm-linux-
106         % make ARCH=arm h3600_config
107         !!! don't forget to save the configuration even if no changes are made
108         % make ARCH=arm menuconfig
109         % make symlinks ARCH=arm CROSS_COMPILE=arm-linux-
110         % mkdir -p /usr/local/arm/2.95.3/arm-linux/include
111         % cp -Rf include/asm include/asm-arm include/linux /usr/local/arm/2.95.3/arm-linux/include
112         % cd /usr/local/arm/2.95.3/arm-linux
113         % ln -s include sys-linux
114
115     </verb></tscreen>
116     </p>
117   </sect1>
118   <sect1>
119     <heading>Basic cross compiler (gcc)</heading>
120     <p>
121     tar xvzf gcc-2.95.3.tar.gz
122     bunzip2 gcc-2.95.3.diff.bz2
123     bunzip2 gcc-2.95.3.diffbis.bz2
124     patch -p1 -d gcc-2.95.3 &lt; gcc-2.95.3.diff
125     patch -p1 -d gcc-2.95.3 &lt; gcc-2.95.3.diffbis
126     cd gcc-2.95.3
127     ./configure --target=arm-linux --disable-threads --enable-languages=c --prefix=/usr/local/arm/2.95.3 --with-headers=linux-2.4.19/include
128     make
129     make install
130     </p>
131
132   </sect1>
133   <sect1>
134     <heading>Compiling glibc</heading>
135     <p>
136     Depending on your target, you may choose another glibc version (eg: 2.1.3 for linupy 1.4)
137     tar xvzf glibc-2.2.5.tar.gz
138     cd glibc-2.2.5
139     tar xvzf ../glibc-linuxthreads-2.2.5.tar.gz
140     CC=arm-linux-gcc ./configure arm-linux --target=arm-linux --prefix=/usr/local/arm/2.95.3/arm-linux --enable-add-ons
141     
142     The following step is quite long !
143     
144     CC=arm-linux-gcc make
145
146     If you have problems compiling glibc due to pread/pwrite, edit sysdeps/unix/sysv/linux/kernel-features.h
147     and turn  __ASSUME_PREAD_SYSCALL and __ASSUME_PWRITE_SYSCALL from 1 to 0.
148     
149     CC=arm-linux-gcc make install
150     </p>
151   </sect1>
152   <sect1>
153     <heading>Full cross compiler (gcc)</heading>
154     rm -Rf gcc-2.95.3
155     tar xvzf gcc-2.95.3.tar.gz
156     patch -p1 -d gcc-2.95.3 &lt; gcc-2.95.3.diff
157     patch -p1 -d gcc-2.95.3 &lt; gcc-2.95.3.diff2
158     cd gcc-2.95.3
159     ./configure --target=arm-linux --prefix=/usr/local/arm/2.95.3
160     make
161     make install
162   </sect1>
163   <sect1>
164     <heading>Misc</heading>
165     Add  /usr/local/arm/2.95.3/bin to your PATH. Add the following line (depends on your shell)
166     to your shell's configuration file :
167     export PATH=/usr/local/arm/2.95.3/bin:$PATH
168
169     cp libgcc_s.so.1 /usr/local/arm/2.95.3-new/arm-linux/lib                         
170     
171     Install theses packages on your compiler box in /usr/local/arm/2.95.3/arm-linux
172      xlibs_4.1-5_arm.ipk
173      xlibs-dev_4.1.0-16_arm.ipk
174      zlib1g_1.1.4-3_arm.ipk
175      zlib1g-dev_1.1.3-fam1_arm.ipk
176   </sect1>
177 </sect>
178
179
180
181
182
183 <sect>
184   <heading>Cross compiling libraries needed by vlc</heading>
185   Download <tt>ipaq-config.site</tt> to ${SOURCES}.
186   When downloading source tarballs copy them to your ${SOURCES} directory.
187   Each section is supposed to begin with <tt>cd ${SOURCES}</tt>.
188   <sect1>
189     <heading>SDL</heading>
190     !!!! beurk but did not found a better working method ¡¡¡¡
191     tar xvzf SDL-1.2.5.tar.gz
192     cd SDL-1.2.5
193 ./configure --enable-release --target=arm-linux --host=arm-linux \
194     --disable-esd \
195     --prefix=/usr/local/arm/2.95.3/arm-linux/usr \
196     --x-includes=/usr/local/arm/2.95.3/arm-linux/usr/X11R6/include \
197     --x-libraries=/usr/local/arm/2.95.3/arm-linux/usr/X11R6/lib \
198     --disable-video-opengl
199 export PATH=/usr/local/arm/2.95.3/arm-linux/bin:$PATH
200
201   
202 make && make install
203     
204   </sect1>
205   <sect1>
206     <heading>Glib/GTK+</heading>
207     tar xvzf glib-1.2.10.tar.gz
208     cd glib-1.2.10
209     CONFIG_SITE=../ipaq-config.site ./configure --prefix=/usr/local/arm/2.95.3/arm-linux/usr
210     make
211     make install
212     cd ..
213     tar xvzf gtk+-1.2.10.tar.gz
214     cd gtk+-1.2.10
215     CONFIG_SITE=../ipaq-config.site ./configure --prefix=/usr/local/arm/2.95.3/arm-linux/usr --with-glib=../glib-1.2.10
216     make 
217     make install
218   </sect1>
219   <sect1>
220     <heading>ffmpeg</heading>
221     tar xvzf ffmpeg.tar.gz
222     cd ffmpeg
223     ./configure --cpu=armv4l --cc=arm-linux-gcc --disable-mmx --prefix=/usr/local/arm/2.95.3/arm-linux/usr --enable-shared
224     cd libavcodec
225     make
226
227     Vlc does not require that you install ffmpeg.
228   </sect1>
229   <sect1>
230     <heading>mad</heading>
231     tar xvzf mad-0.14.2b.tar.gz
232     cd mad-0.14.2b
233 ./configure --enable-release --target=arm-linux --host=arm-linux \
234     --disable-esd \
235     --prefix=/usr/local/arm/2.95.3/arm-linux/usr \
236     --x-includes=/usr/local/arm/2.95.3/arm-linux/usr/X11R6/include \
237     --x-libraries=/usr/local/arm/2.95.3/arm-linux/usr/X11R6/lib \
238     --disable-video-opengl
239 export PATH=/usr/local/arm/2.95.3/arm-linux/bin:$PATH
240     make
241     
242   </sect1>
243   <sect1>
244     <heading>gpe</heading>
245   </sect1>
246   %%%%%%%%%%%%%%%%%%%%%%%
247   First get Tremor and ogg sources from xiph.org (through CVS for example).       
248 Then for each them, do :                                                        
249 % ./configure  --enable-release --prefix=/usr/local/arm/2.95.3/arm-linux        
250 % export PATH=/usr/local/arm/2.95.3/arm-linux/bin:$PATH                         
251 % make                                                                          
252 % su                                                                            
253 # make install                                                                  
254                                                                                 
255 I know it is not clean, but --host or --target switches does not work.          
256 The PATH I include, contains all the gcc utils for cross compilation            
257 without the arm-linux- prefix.                                                  
258                                                                                 
259 If you want to link them statically : edit the libvorbisidec.a and remove       
260 from the archive bitwise.o and framing.o (conflict with libogg.a)               
261                                                                                 
262 For flac, get the source tarball (from the videolan website for example)        
263 % ./configure --enable-release --host=arm-linux --target=arm-linux              
264 --prefix=/usr/local/arm/2.95.3/arm-linux                                        
265 % make                                                                          
266 -> will fail (xmms plugin), but not a problem, continue installation by hand    
267 % su                                                                            
268 # cp -Rf include/FLAC /usr/local/arm/2.95.3/arm-linux/include                   
269 # cd src/libFLAC                                                                
270 # make install                                                                  
271                                                                                 
272 When compiling vlc, add to the ./configure :                                    
273         --enable-ogg                                                            
274         --enable-tremor                                                         
275         --enable-flac                                                           
276 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
277   <sect1>
278     <heading>tremor</heading>
279   </sect1>
280   <sect1>
281     <heading>ogg</heading>
282   </sect1>
283   <sect1>
284     <heading>flac</heading>
285   </sect1>
286   <sect1>
287     <heading>libdvbpsi</heading>
288     tar xvzf libdvbpsi-0.1.2.tar.gz
289     cd libdvbpsi-0.1.2
290     ./bootstrap
291     ./configure --target=arm-linux --host=arm-linux
292     make
293     
294   </sect1>
295   <sect1>
296     <heading>a52</heading>
297     tar xvzf a52dec-0.7.4.tar.gz
298     cd a52dec-0.7.4
299     ./configure --enable-release --host=arm-linux --target=arm-linux --prefix=/usr/local/arm/2.95.3/arm-linux
300     make && make install
301
302   </sect1>
303 </sect>
304
305 <sect>
306   <heading>Cross compiling vlc itself</heading>
307   have a look à rules.* in the ipkg directory.
308 </sect>
309
310 </article></linuxdoc>