| 1 |
30 |
unneback |
|
| 2 |
|
|
RPM support for BSPs
|
| 3 |
|
|
====================
|
| 4 |
|
|
|
| 5 |
|
|
Introduction
|
| 6 |
|
|
------------
|
| 7 |
|
|
|
| 8 |
|
|
Building an rpm requires to have a tar archive of the sources, and a
|
| 9 |
|
|
rpm-spec files specifying the details of building.
|
| 10 |
|
|
|
| 11 |
|
|
To support per bsp rpms, one rpm-spec is used per BSP.
|
| 12 |
|
|
Instead of writing one rpm-spec for each BSP, I have written a shell script
|
| 13 |
|
|
(mkspec) which generates one *.spec (rtems--.spec) per BSP
|
| 14 |
|
|
bsp from an rpm-spec template (rtems.spec.in).
|
| 15 |
|
|
|
| 16 |
|
|
A second shell script (mkrpms) is a convienience script which invokes a
|
| 17 |
|
|
sequence of building rpms for several bsps.
|
| 18 |
|
|
|
| 19 |
|
|
|
| 20 |
|
|
mkbinutilspec
|
| 21 |
|
|
-------------
|
| 22 |
|
|
|
| 23 |
|
|
mkbinutilspec takes two arguments:
|
| 24 |
|
|
|
| 25 |
|
|
$1 ... the target_alias for binutils RPMs of this toolset
|
| 26 |
|
|
|
| 27 |
|
|
Invoking mkbinutilspec will generate a -binutils.spec either in
|
| 28 |
|
|
|
| 29 |
|
|
/usr/src/packages/SPECS (SuSE convention) or
|
| 30 |
|
|
/usr/src/redhat/SPECS (Redhat convention) or
|
| 31 |
|
|
/usr/src/SPECS
|
| 32 |
|
|
|
| 33 |
|
|
Eg. ./mkbinutilspec sparc-rtems generates
|
| 34 |
|
|
|
| 35 |
|
|
On SuSE-6.2: /usr/src/packages/SPECS/sparc-rtems-binutils.spec
|
| 36 |
|
|
On RedHat 6.0: /usr/src/redhat/SPECS/sparc-rtems-binutils.spec
|
| 37 |
|
|
|
| 38 |
|
|
mkgccnewlibspec
|
| 39 |
|
|
---------------
|
| 40 |
|
|
|
| 41 |
|
|
mkgccnewlibspec takes two arguments:
|
| 42 |
|
|
|
| 43 |
|
|
$1 ... the target_alias for the gcc/newlib RPMs of this toolset
|
| 44 |
|
|
|
| 45 |
|
|
Invoking mkgccnewlibspec will generate a -gccnewlibs.spec
|
| 46 |
|
|
either in:
|
| 47 |
|
|
|
| 48 |
|
|
/usr/src/packages/SPECS (SuSE convention) or
|
| 49 |
|
|
/usr/src/redhat/SPECS (Redhat convention) or
|
| 50 |
|
|
/usr/src/SPECS
|
| 51 |
|
|
|
| 52 |
|
|
Eg. ./mkgccnewlibspec sparc-rtems generates
|
| 53 |
|
|
|
| 54 |
|
|
On SuSE-6.2: /usr/src/packages/SPECS/sparc-rtems-gcc_newlib.spec
|
| 55 |
|
|
On RedHat 6.0: /usr/src/redhat/SPECS/sparc-rtems-gcc_newlib.spec
|
| 56 |
|
|
|
| 57 |
|
|
mkgdbspec
|
| 58 |
|
|
---------
|
| 59 |
|
|
|
| 60 |
|
|
mkgdbspec takes two arguments:
|
| 61 |
|
|
|
| 62 |
|
|
$1 ... the target_alias for the gdb RPMs of this toolset
|
| 63 |
|
|
|
| 64 |
|
|
Invoking mkgdbspec will generate a -gdb.spec
|
| 65 |
|
|
either in:
|
| 66 |
|
|
|
| 67 |
|
|
/usr/src/packages/SPECS (SuSE convention) or
|
| 68 |
|
|
/usr/src/redhat/SPECS (Redhat convention) or
|
| 69 |
|
|
/usr/src/SPECS
|
| 70 |
|
|
|
| 71 |
|
|
Eg. ./mkgdbspec sparc-rtems generates
|
| 72 |
|
|
|
| 73 |
|
|
On SuSE-6.2: /usr/src/packages/SPECS/sparc-rtems-gcc_newlib.spec
|
| 74 |
|
|
On RedHat 6.0: /usr/src/redhat/SPECS/sparc-rtems-gcc_newlib.spec
|
| 75 |
|
|
|
| 76 |
|
|
|
| 77 |
|
|
# XXX BSPs not tested yet by Joel
|
| 78 |
|
|
#
|
| 79 |
|
|
# mkbspspec
|
| 80 |
|
|
# ---------
|
| 81 |
|
|
#
|
| 82 |
|
|
# mkbspspec takes two arguments:
|
| 83 |
|
|
# $1 ... the target_alias this bsp belongs to
|
| 84 |
|
|
# $2 ... the bsp to be built
|
| 85 |
|
|
#
|
| 86 |
|
|
# Invoking mkbspspec will generate a rtems--.spec either in
|
| 87 |
|
|
# /usr/src/packages/SPECS (SuSE convention) or
|
| 88 |
|
|
# /usr/src/redhat/SPECS (Redhat convention) or
|
| 89 |
|
|
# /usr/src/SPECS
|
| 90 |
|
|
#
|
| 91 |
|
|
# Eg. ./mkspec gensh1 sh-rtemself generates
|
| 92 |
|
|
# /usr/src/packages/SPECS/rtems-sh-rtemself-gensh1.spec on SuSE-6.2.
|
| 93 |
|
|
|
| 94 |
|
|
mkspec
|
| 95 |
|
|
---------
|
| 96 |
|
|
|
| 97 |
|
|
mkspec takes two arguments:
|
| 98 |
|
|
|
| 99 |
|
|
$1 ... the target_alias for the RPMs composing this toolset
|
| 100 |
|
|
$2 ... the bsp to be built
|
| 101 |
|
|
|
| 102 |
|
|
Invoking mkspec will generate a set of spec files either in:
|
| 103 |
|
|
|
| 104 |
|
|
/usr/src/packages/SPECS (SuSE convention) or
|
| 105 |
|
|
/usr/src/redhat/SPECS (Redhat convention) or
|
| 106 |
|
|
/usr/src/SPECS
|
| 107 |
|
|
|
| 108 |
|
|
Eg. ./mkspec sparc-rtems erc32 generates
|
| 109 |
|
|
|
| 110 |
|
|
On SuSE-6.2: /usr/src/packages/SPECS/sparc-rtems-binutils.spec
|
| 111 |
|
|
/usr/src/packages/SPECS/sparc-rtems-gcc_newlib.spec
|
| 112 |
|
|
/usr/src/packages/SPECS/sparc-rtems-gdb.spec
|
| 113 |
|
|
On RedHat 6.0: /usr/src/packages/SPECS/sparc-rtems-binutils.spec
|
| 114 |
|
|
/usr/src/packages/SPECS/sparc-rtems-gcc_newlib.spec
|
| 115 |
|
|
/usr/src/packages/SPECS/sparc-rtems-gdb.spec
|
| 116 |
|
|
|
| 117 |
|
|
|
| 118 |
|
|
Building binutils-rpms
|
| 119 |
|
|
----------------------
|
| 120 |
|
|
|
| 121 |
|
|
0. Login as root.
|
| 122 |
|
|
|
| 123 |
|
|
1. Install a tarball of the various tool sources (with the
|
| 124 |
|
|
version number attached!) to /usr/src/[packages|redhat]/SOURCES
|
| 125 |
|
|
|
| 126 |
|
|
cd /usr/src/[packages|redhat]/SOURCES
|
| 127 |
|
|
cp .../binutils- .
|
| 128 |
|
|
cp .../binutils--rtems-.diff .
|
| 129 |
|
|
|
| 130 |
|
|
2. Generate and install the required rpm-spec file[s]
|
| 131 |
|
|
|
| 132 |
|
|
cd rtems-/scripts/
|
| 133 |
|
|
mkbinutilspec
|
| 134 |
|
|
|
| 135 |
|
|
where target_alias is of the form sparc-rtems or sh-rtems-elf.
|
| 136 |
|
|
|
| 137 |
|
|
3. Build the rpms
|
| 138 |
|
|
|
| 139 |
|
|
Building a binary rpm:
|
| 140 |
|
|
|
| 141 |
|
|
rpm -bb /usr/src/[packages|redhat]/SPECS/rtems--binutils.spec
|
| 142 |
|
|
|
| 143 |
|
|
Building a source and binary rpm
|
| 144 |
|
|
rpm -ba /usr/src/[packages|redhat]/SPECS/rtems--binutils.spec
|
| 145 |
|
|
|
| 146 |
|
|
XXX Note: a BSP's src.rpm contains its spec-file and the tar-archive of the
|
| 147 |
|
|
sources (approx. 4-5MB per BSP).
|
| 148 |
|
|
|
| 149 |
|
|
Building TOOL-rpms
|
| 150 |
|
|
------------------
|
| 151 |
|
|
|
| 152 |
|
|
0. Login as root.
|
| 153 |
|
|
|
| 154 |
|
|
1. Install a tarball of the various tool sources (with the
|
| 155 |
|
|
version number attached!) to /usr/src/[packages|redhat]/SOURCES
|
| 156 |
|
|
|
| 157 |
|
|
cd /usr/src/[packages|redhat]/SOURCES
|
| 158 |
|
|
cp .../binutils- .
|
| 159 |
|
|
cp .../gcc- .
|
| 160 |
|
|
cp .../newlib- .
|
| 161 |
|
|
|
| 162 |
|
|
2. Generate and install the required rpm-spec file[s]
|
| 163 |
|
|
|
| 164 |
|
|
cd rtems-/scripts/
|
| 165 |
|
|
mktoolspec
|
| 166 |
|
|
|
| 167 |
|
|
3. Build the rpms
|
| 168 |
|
|
|
| 169 |
|
|
Building a binary rpm:
|
| 170 |
|
|
rpm -bb /usr/src/[packages|redhat]/SPECS/rtems-.spec
|
| 171 |
|
|
|
| 172 |
|
|
Building a source and binary rpm
|
| 173 |
|
|
rpm -ba /usr/src/[packages|redhat]/SPECS/rtems-.spec
|
| 174 |
|
|
|
| 175 |
|
|
XXX Note: a BSP's src.rpm contains its spec-file and the tar-archive of the
|
| 176 |
|
|
sources (approx. 4-5MB per BSP).
|
| 177 |
|
|
|
| 178 |
|
|
Building BSP-rpms
|
| 179 |
|
|
-----------------
|
| 180 |
|
|
|
| 181 |
|
|
0. Login as root.
|
| 182 |
|
|
|
| 183 |
|
|
1. Install a tarball of RTEMS's sources (with version number attached!) to
|
| 184 |
|
|
/usr/src/[packages|redhat]/SOURCES
|
| 185 |
|
|
Eg.
|
| 186 |
|
|
tar czvf /usr/src/packages/SOURCES/rtems-.tar.gz rtems-
|
| 187 |
|
|
|
| 188 |
|
|
2. Generate and install the required rpm-spec file[s]
|
| 189 |
|
|
cd rtems-/scripts/
|
| 190 |
|
|
mkspec
|
| 191 |
|
|
|
| 192 |
|
|
3. Build the rpms
|
| 193 |
|
|
Building a binary rpm:
|
| 194 |
|
|
rpm -bb /usr/src/[packages|redhat]/SPECS/rtems--.spec
|
| 195 |
|
|
|
| 196 |
|
|
Building a source and binary rpm
|
| 197 |
|
|
rpm -ba /usr/src/[packages|redhat]/SPECS/rtems--.spec
|
| 198 |
|
|
|
| 199 |
|
|
Note: a BSP's src.rpm contains its spec-file and the tar-archive of the
|
| 200 |
|
|
sources (approx. 4-5MB per BSP).
|
| 201 |
|
|
|
| 202 |
|
|
Known Bugs/Deficiencies
|
| 203 |
|
|
-----------------------
|
| 204 |
|
|
|
| 205 |
|
|
* All files mentioned in here are in its early infancy ;-)
|
| 206 |
|
|
|
| 207 |
|
|
* Building for a single bsp requires an own copy of the source tree inside
|
| 208 |
|
|
rpm's build directory.
|
| 209 |
|
|
* Building inside the RTEMS source tree doesn't work.
|
| 210 |
|
|
* Dependencies on toolchain-rpms not yet supported in rtems.spec.in.
|
| 211 |
|
|
* Installing multiple binary bsp rpms for the same target can cause
|
| 212 |
|
|
warnings from rpm, because these bsp-rpms share files.
|
| 213 |
|
|
* rtems.spec.in is prepared for rpm relocation support, but RTEMS is not
|
| 214 |
|
|
relocatible (yet?)
|
| 215 |
|
|
* rtems.spec.in deserves to be extended (description, authors etc)
|
| 216 |
|
|
* The final packaging stage to build a binary rpm takes an awful lot of
|
| 217 |
|
|
time - deserves to be investigated.
|
| 218 |
|
|
* Some RTEMS's cross executables (eg. hello.exe for sparc-rtems/erc32) cause
|
| 219 |
|
|
warnings from rpm and/or objdump. AFAIS, this is a bug in rpm.
|
| 220 |
|
|
* Probably many more ...
|
| 221 |
|
|
|
| 222 |
|
|
* Last but not least: RTEMS should be split.
|
| 223 |
|
|
|
| 224 |
|
|
Remarks
|
| 225 |
|
|
-------
|
| 226 |
|
|
* It would make sense to split RTEMS host/cross-tools and files depending on
|
| 227 |
|
|
the target only (/make/*.cfg -- Whow, RTEMS really has files
|
| 228 |
|
|
which depend on the target only :) into separate rpms.
|
| 229 |
|
|
* Instead of using a single rpm-spec for each bsp, RTEMS could also use a
|
| 230 |
|
|
single rpm-spec for all (or at least a given subset of all) bsps of a target.
|
| 231 |
|
|
* rpm -b[b|a] leaves its built trees unpacked in
|
| 232 |
|
|
/usr/src/[packages|redhat]/BUILD. Therefore you will rather soon run out of disc
|
| 233 |
|
|
space if not removing them. (Use rpm --clean -b[a|b] for cleaning them up
|
| 234 |
|
|
automatically after building)
|
| 235 |
|
|
* The size of binary rpms can differ up to one magnitude depending on the
|
| 236 |
|
|
target/bsp (eg. sh-rtems/gensh1 ~10MB vs. sh-rtemself/gensh1 ~32MB)
|
| 237 |
|
|
|
| 238 |
|
|
Ralf Corsepius, 1999/10/14
|