1 <!doctype linuxdoc system>
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>
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.
17 <heading>Introduction</heading>
19 <heading>Which platforms are targeted ?</heading>
21 I will describe here how to compile vlc for an ARM based
22 PDA running linux. It includes for example :
24 <item>Compaq - iPaq (H36xx, H38xx,...), using
30 <item>YOPY/Linupy</item>
36 <heading>Requirements for cross-compilation</heading>
39 <heading>Why cross-compiling ?</heading>
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 :
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
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>
57 <heading>Building the toolchain</heading>
59 <heading>Prerequisite</heading>
63 During this section, we will use the following variables :
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>
74 <heading>Files needed</heading>
75 <p>Download the following files and put them in the <bf>${SRCDIR}</bf> :
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>
85 <heading>Binutils</heading>
86 <p>Compiling binutils is pretty simple :
88 % tar xzf binutils-2.11.2.tar.gz
90 % ./configure --target=arm-linux --prefix=/usr/local/arm/2.95.3
98 <heading>Preparing linux kernel</heading>
101 % tar xzf linux-2.4.19.tar.bz2
102 % bunzip2 patch-2.4.19-rmk4.bz2
104 % patch -p1 < ../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
119 <heading>Basic cross compiler (gcc)</heading>
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 < gcc-2.95.3.diff
125 patch -p1 -d gcc-2.95.3 < gcc-2.95.3.diffbis
127 ./configure --target=arm-linux --disable-threads --enable-languages=c --prefix=/usr/local/arm/2.95.3 --with-headers=linux-2.4.19/include
134 <heading>Compiling glibc</heading>
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
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
142 The following step is quite long !
144 CC=arm-linux-gcc make
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.
149 CC=arm-linux-gcc make install
153 <heading>Full cross compiler (gcc)</heading>
155 tar xvzf gcc-2.95.3.tar.gz
156 patch -p1 -d gcc-2.95.3 < gcc-2.95.3.diff
157 patch -p1 -d gcc-2.95.3 < gcc-2.95.3.diff2
159 ./configure --target=arm-linux --prefix=/usr/local/arm/2.95.3
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
169 cp libgcc_s.so.1 /usr/local/arm/2.95.3-new/arm-linux/lib
171 Install theses packages on your compiler box in /usr/local/arm/2.95.3/arm-linux
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
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>.
189 <heading>SDL</heading>
190 !!!! beurk but did not found a better working method ¡¡¡¡
191 tar xvzf SDL-1.2.5.tar.gz
193 ./configure --enable-release --target=arm-linux --host=arm-linux \
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
206 <heading>Glib/GTK+</heading>
207 tar xvzf glib-1.2.10.tar.gz
209 CONFIG_SITE=../ipaq-config.site ./configure --prefix=/usr/local/arm/2.95.3/arm-linux/usr
213 tar xvzf gtk+-1.2.10.tar.gz
215 CONFIG_SITE=../ipaq-config.site ./configure --prefix=/usr/local/arm/2.95.3/arm-linux/usr --with-glib=../glib-1.2.10
220 <heading>ffmpeg</heading>
221 tar xvzf ffmpeg.tar.gz
223 ./configure --cpu=armv4l --cc=arm-linux-gcc --disable-mmx --prefix=/usr/local/arm/2.95.3/arm-linux/usr --enable-shared
227 Vlc does not require that you install ffmpeg.
230 <heading>mad</heading>
231 tar xvzf mad-0.14.2b.tar.gz
233 ./configure --enable-release --target=arm-linux --host=arm-linux \
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
244 <heading>gpe</heading>
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
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.
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)
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
266 -> will fail (xmms plugin), but not a problem, continue installation by hand
268 # cp -Rf include/FLAC /usr/local/arm/2.95.3/arm-linux/include
272 When compiling vlc, add to the ./configure :
276 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
278 <heading>tremor</heading>
281 <heading>ogg</heading>
284 <heading>flac</heading>
287 <heading>libdvbpsi</heading>
288 tar xvzf libdvbpsi-0.1.2.tar.gz
291 ./configure --target=arm-linux --host=arm-linux
296 <heading>a52</heading>
297 tar xvzf a52dec-0.7.4.tar.gz
299 ./configure --enable-release --host=arm-linux --target=arm-linux --prefix=/usr/local/arm/2.95.3/arm-linux
306 <heading>Cross compiling vlc itself</heading>
307 have a look à rules.* in the ipkg directory.
310 </article></linuxdoc>