1 | Applying RTEMS-toolchain RPM-specs for Canadian Cross Compilation |
---|
2 | ================================================================= |
---|
3 | |
---|
4 | Example: Building a Cygwin-based xxx-rtems toolchain under Linux: |
---|
5 | |
---|
6 | Quickstart |
---|
7 | ---------- |
---|
8 | The command to invoke rpm for building RTEMS's gnu toolchain cdn. cross |
---|
9 | under Linux is: |
---|
10 | rpmbuild -ba xxx-rtems-yyy.spec \ |
---|
11 | --define='_build i686-pc-linux-gnu' |
---|
12 | --define='_host i386-cygwin' \ |
---|
13 | --target=i386-cygwin |
---|
14 | |
---|
15 | [If using rpm < 4.1, use "rpm" instead of "rpmbuild".] |
---|
16 | |
---|
17 | |
---|
18 | If you don't understand this, read on ... :-) |
---|
19 | |
---|
20 | 1. Prerequisites |
---|
21 | ---------------- |
---|
22 | * a native Linux-toolchain (eg. gcc, binutils). |
---|
23 | Prebuild binaries should come with any Linux distribution. |
---|
24 | We further on assume this toolchain to be installed in /usr, such that |
---|
25 | /usr/bin/gcc is supposed to be your native CC. |
---|
26 | |
---|
27 | * a Linux -> Cygwin cross-toolchain |
---|
28 | RPM-specs are available in the contrib/cygwin directory in RTEMS's sourcetree. |
---|
29 | Prebuild binaries should be available from |
---|
30 | ftp://ftp.OARCorp.com |
---|
31 | http://packman.links2linux.de |
---|
32 | |
---|
33 | We further on assume this toolchain to be installed in /opt/i386-cygwin, |
---|
34 | i.e. /opt/i386-cygwin/bin/i386-cygwin-gcc is assumed to be the linux->cygwin |
---|
35 | cross compiler. |
---|
36 | |
---|
37 | 2. Preparations |
---|
38 | --------------- |
---|
39 | |
---|
40 | * Make sure to have /usr/bin and /opt/i386-cygwin/bin in $PATH. |
---|
41 | |
---|
42 | * Download the source-tarballs and patches. Put them into a directory where |
---|
43 | rpm can pick them up (/usr/src/redhat/SOURCES under RH) |
---|
44 | |
---|
45 | * configure this directory |
---|
46 | ./configure |
---|
47 | [Many files being generated] |
---|
48 | |
---|
49 | Among these files the rpm.specs will be generated, one per tool in its |
---|
50 | corresponding subdirectory. |
---|
51 | |
---|
52 | The spec-files you are looking for are: |
---|
53 | binutils/xxx-rtems-binutils.spec |
---|
54 | gcc3newlib/xxx-rtems-gccnewlib.spec |
---|
55 | gdb/xxx-rtems-gdb.spec |
---|
56 | |
---|
57 | [You must have appropriate versions of autoconf and |
---|
58 | automake installed.] |
---|
59 | |
---|
60 | 3. Building |
---|
61 | ----------- |
---|
62 | |
---|
63 | rpmbuild -ba binutils/xxx-rtems-binutils-<binutilsvers>.spec \ |
---|
64 | --define='_build=i686-pc-linux-gnu' \ |
---|
65 | --define='_host=i386-cygwin' \ |
---|
66 | --target=i386-cygwin |
---|
67 | |
---|
68 | rpmbuild -ba gcc3newlib/xxx-rtems-gcc-<gccvers>-newlib-<newlibvers>.spec \ |
---|
69 | --define='_build=i686-pc-linux-gnu' \ |
---|
70 | --define='_host=i386-cygwin' \ |
---|
71 | --target=i386-cygwin |
---|
72 | |
---|
73 | rpmbuild -ba |
---|
74 | gdb/xxx-rtems-gdb-<gdbvers>.spec \ |
---|
75 | --define='_build=i686-pc-linux-gnu' \ |
---|
76 | --define='_host=i386-cygwin' \ |
---|
77 | --target=i386-cygwin |
---|
78 | |
---|
79 | Each of these commands builds several corresponding rpms. |
---|
80 | [Beware: This can take several hours.] |
---|
81 | |
---|
82 | NOTE: These packages will be packaged as Linux' rpms, but contain Cygwin |
---|
83 | binaries. If using the default rpm-directories, this will put the rpms into |
---|
84 | your linux RPM-directories, i.e. pollute these directories with foreign |
---|
85 | RPMs. |
---|
86 | |
---|
87 | To avoid this, I recommend to set up RPM's internal variable %_rpmdir to |
---|
88 | point to a different directory than the default or to use a different root for the cygwin |
---|
89 | RPM directory tree, i.e. to set %_topdir. [1] |
---|
90 | |
---|
91 | 4. Repackaging the RPMS into tarballs |
---|
92 | ------------------------------------- |
---|
93 | |
---|
94 | Basically, there exist two ways: |
---|
95 | |
---|
96 | * Applying "alien". |
---|
97 | I highly recommend using this, but unfortunately alien is not |
---|
98 | shipped with all Linux distributions. |
---|
99 | [alien can also be applied to repackage the rpms into other packaging |
---|
100 | formats.] |
---|
101 | |
---|
102 | * Manual unpacking and tar-ing |
---|
103 | cd <empty-directory> |
---|
104 | rpmcpio xxx-rtems-yyy.<arch>.rpm | cpio -i --make-directories |
---|
105 | tar cjvf <where-ever>/xxx-rtems-yyy.<arch>.tar.bz2 opt/rtems |
---|
106 | rm -rf opt/rtems |
---|
107 | |
---|
108 | NOTE: You might want to consider performing repackaging as root to avoid |
---|
109 | loosing file permissions. |
---|
110 | |
---|
111 | 5. Other platforms |
---|
112 | ------------------ |
---|
113 | The procedure to build for other platforms (Solaris, ...) is analogous. Just |
---|
114 | replace i386-cygwin with your target, eg sun-sparc-solaris2.8 |
---|
115 | |
---|
116 | Ralf Corsepius 2003-01-31 |
---|
117 | |
---|
118 | [1] Setting up an rpm variable can be done: |
---|
119 | * on the command line: |
---|
120 | rpmbuild --define='_topdir /home/user/src/cygwin' ... |
---|
121 | * from a user's ~/.rpmmacros |
---|
122 | _topdir /home/user/src/cygwin |
---|