forked from Imagelibrary/rtems
Ralf Corsepius (corsepiu@faw.uni-ulm.de) submitted these scripts to
help build RPMs.
This commit is contained in:
94
scripts/README
Normal file
94
scripts/README
Normal file
@@ -0,0 +1,94 @@
|
||||
|
||||
RPM support for BSPs
|
||||
====================
|
||||
|
||||
Introduction
|
||||
------------
|
||||
|
||||
Building an rpm requires to have a tar archive of the sources, and a
|
||||
rpm-spec files specifying the details of building.
|
||||
|
||||
To support per bsp rpms, one rpm-spec is used per BSP.
|
||||
Instead of writing one rpm-spec for each BSP, I have written a shell script
|
||||
(mkspec) which generates one *.spec (rtems-<target_alias>-<bsp>.spec) per BSP
|
||||
bsp from an rpm-spec template (rtems.spec.in).
|
||||
|
||||
A second shell script (mkrpms) is a convienience script which invokes a
|
||||
sequence of building rpms for several bsps.
|
||||
|
||||
mkspec
|
||||
------
|
||||
|
||||
mkspec takes two arguments:
|
||||
$1 ... the bsp to be built
|
||||
$2 ... the target_alias this bsp belongs to
|
||||
|
||||
Invoking mkspecs will generate a rtems-<target_alias>-<bsp>.spec either in
|
||||
/usr/src/packages/SPECS (SuSE convention) or
|
||||
/usr/src/redhat/SPECS (Redhat convention) or
|
||||
/usr/src/SPECS
|
||||
|
||||
Eg. ./mkspec gensh1 sh-rtemself generates
|
||||
/usr/src/packages/SPECS/rtems-sh-rtemself-gensh1.spec on SuSE-6.2.
|
||||
|
||||
Building BSP-rpms
|
||||
-----------------
|
||||
|
||||
0. Login as root.
|
||||
|
||||
1. Install a tarball of RTEMS's sources (with version number attached!) to
|
||||
/usr/src/[packages|redhat]/SOURCES
|
||||
Eg.
|
||||
tar czvf /usr/src/packages/SOURCES/rtems-<VERSION>.tar.gz rtems-<VERSION>
|
||||
|
||||
2. Generate and install the required rpm-spec file[s]
|
||||
cd rtems-<VERSION>/scripts/
|
||||
mkspec <bsp> <target_alias>
|
||||
|
||||
3. Build the rpms
|
||||
Building a binary rpm:
|
||||
rpm -bb /usr/src/[packages|redhat]/SPECS/rtems-<target_alias>-<bsp>.spec
|
||||
|
||||
Building a source and binary rpm
|
||||
rpm -ba /usr/src/[packages|redhat]/SPECS/rtems-<target_alias>-<bsp>.spec
|
||||
|
||||
Note: a BSP's src.rpm contains its spec-file and the tar-archive of the
|
||||
sources (approx. 4-5MB per BSP).
|
||||
|
||||
Known Bugs/Deficiencies
|
||||
-----------------------
|
||||
|
||||
* All files mentioned in here are in its early infancy ;-)
|
||||
|
||||
* Building for a single bsp requires an own copy of the source tree inside
|
||||
rpm's build directory.
|
||||
* Building inside the RTEMS source tree doesn't work.
|
||||
* Dependencies on toolchain-rpms not yet supported in rtems.spec.in.
|
||||
* Installing multiple binary bsp rpms for the same target can cause
|
||||
warnings from rpm, because these bsp-rpms share files.
|
||||
* rtems.spec.in is prepared for rpm relocation support, but RTEMS is not
|
||||
relocatible (yet?)
|
||||
* rtems.spec.in deserves to be extended (description, authors etc)
|
||||
* The final packaging stage to build a binary rpm takes an awful lot of
|
||||
time - deserves to be investigated.
|
||||
* Some RTEMS's cross executables (eg. hello.exe for sparc-rtems/erc32) cause
|
||||
warnings from rpm and/or objdump. AFAIS, this is a bug in rpm.
|
||||
* Probably many more ...
|
||||
|
||||
* Last but not least: RTEMS should be split.
|
||||
|
||||
Remarks
|
||||
-------
|
||||
* It would make sense to split RTEMS host/cross-tools and files depending on
|
||||
the target only (<target_alias>/make/*.cfg -- Whow, RTEMS really has files
|
||||
which depend on the target only :) into separate rpms.
|
||||
* Instead of using a single rpm-spec for each bsp, RTEMS could also use a
|
||||
single rpm-spec for all (or at least a given subset of all) bsps of a target.
|
||||
* rpm -b[b|a] leaves its built trees unpacked in
|
||||
/usr/src/[packages|redhat]/BUILD. Therefore you will rather soon run out of disc
|
||||
space if not removing them. (Use rpm --clean -b[a|b] for cleaning them up
|
||||
automatically after building)
|
||||
* The size of binary rpms can differ up to one magnitude depending on the
|
||||
target/bsp (eg. sh-rtems/gensh1 ~10MB vs. sh-rtemself/gensh1 ~32MB)
|
||||
|
||||
Ralf Corsepius, 1999/10/14
|
||||
31
scripts/mkbspspec
Normal file
31
scripts/mkbspspec
Normal file
@@ -0,0 +1,31 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
|
||||
RTEMS_DIR=`dirname $0`
|
||||
RTEMS_VERSION=`grep Version ${RTEMS_DIR}/../VERSION | \
|
||||
sed -e 's%RTEMS[ ]*Version[ ]*\(.*\)[ ]*%\1%g'`
|
||||
|
||||
bsp=$1
|
||||
target_alias=$2
|
||||
release=0
|
||||
|
||||
# Some linux distributions use /usr/src/packages
|
||||
# redhat uses /usr/src/redhat
|
||||
# others might use /usr/src
|
||||
if test -d /usr/src/packages/SPECS;
|
||||
then
|
||||
dst=/usr/src/packages/SPECS;
|
||||
elif test -d /usr/src/redhat/SPECS;
|
||||
then
|
||||
dst=/usr/src/redhat/SPECS;
|
||||
elif test -d /usr/src/SPECS/;
|
||||
then
|
||||
dst=/usr/src/SPECS;
|
||||
fi
|
||||
|
||||
sed -e "s%@Version@%${RTEMS_VERSION}%g" \
|
||||
-e "s%@bsp@%${bsp}%g" \
|
||||
-e "s%@Release@%${release}%g" \
|
||||
-e "s%@target_alias@%${target_alias}%g" \
|
||||
< ${RTEMS_DIR}/rtems.spec.in \
|
||||
> ${dst}/rtems-$target_alias-$bsp.spec
|
||||
32
scripts/mkrpms
Executable file
32
scripts/mkrpms
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# A simple shell script to build several rpms in a row.
|
||||
#
|
||||
# Used for testing rtems.spec.in
|
||||
#
|
||||
|
||||
# Some linux distributions use /usr/src/packages
|
||||
# redhat uses /usr/src/redhat
|
||||
# others might use /usr/src
|
||||
if test -d /usr/src/packages/SPECS;
|
||||
then
|
||||
dst=/usr/src/packages/SPECS;
|
||||
elif test -d /usr/src/redhat/SPECS;
|
||||
then
|
||||
dst=/usr/src/redhat/SPECS;
|
||||
elif test -d /usr/src/SPECS/;
|
||||
then
|
||||
dst=/usr/src/SPECS;
|
||||
fi
|
||||
|
||||
./mkspec pc386 i386-rtems
|
||||
rpm -ba $dst/rtems-i386-rtems-pc386.spec
|
||||
|
||||
./mkspec gensh1 sh-rtemself
|
||||
rpm -ba $dst/rtems-sh-rtemself-gensh1.spec
|
||||
|
||||
./mkspec mcp750 powerpc-rtems
|
||||
rpm -ba $dst/rtems-powerpc-rtems-mcp750.spec
|
||||
|
||||
|
||||
14
scripts/mkspec
Executable file
14
scripts/mkspec
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
|
||||
RTEMS_DIR=`dirname $0`
|
||||
RTEMS_VERSION=`grep Version ${RTEMS_DIR}/../VERSION | \
|
||||
sed -e 's%RTEMS[ ]*Version[ ]*\(.*\)[ ]*%\1%g'`
|
||||
|
||||
bsp=$1
|
||||
target_alias=$2
|
||||
release=0
|
||||
|
||||
${RTEMS_DIR}/scripts/mkbspspec $bsp $target_alias
|
||||
${RTEMS_DIR}/scripts/mktoolspec $target_alias
|
||||
|
||||
33
scripts/mktoolspec
Normal file
33
scripts/mktoolspec
Normal file
@@ -0,0 +1,33 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
|
||||
RTEMS_DIR=`dirname $0`
|
||||
RTEMS_VERSION=`grep Version ${RTEMS_DIR}/../VERSION | \
|
||||
sed -e 's%RTEMS[ ]*Version[ ]*\(.*\)[ ]*%\1%g'`
|
||||
|
||||
bsp=$1
|
||||
target_alias=$2
|
||||
release=0
|
||||
|
||||
# Some linux distributions use /usr/src/packages
|
||||
# redhat uses /usr/src/redhat
|
||||
# others might use /usr/src
|
||||
if test -d /usr/src/packages/SPECS;
|
||||
then
|
||||
dst=/usr/src/packages/SPECS;
|
||||
elif test -d /usr/src/redhat/SPECS;
|
||||
then
|
||||
dst=/usr/src/redhat/SPECS;
|
||||
elif test -d /usr/src/SPECS/;
|
||||
then
|
||||
dst=/usr/src/SPECS;
|
||||
fi
|
||||
|
||||
sed -e "s%@Version@%${RTEMS_VERSION}%g" \
|
||||
-e "s%@bsp@%${bsp}%g" \
|
||||
-e "s%@Release@%${release}%g" \
|
||||
-e "s%@target_alias@%${target_alias}%g" \
|
||||
< ${RTEMS_DIR}/toolchain.spec.in \
|
||||
> ${dst}/rtems-$target_alias-tools.spec
|
||||
|
||||
|
||||
70
scripts/rtems.spec.in
Normal file
70
scripts/rtems.spec.in
Normal file
@@ -0,0 +1,70 @@
|
||||
#
|
||||
# spec file for package rtems
|
||||
#
|
||||
# Copyright (c) 1999 OARCorp, Huntsville, AL
|
||||
#
|
||||
# please send bugfixes or comments to joel@OARcorp.com
|
||||
#
|
||||
|
||||
# neededforbuild @target_alias@-binutils @target_alias@-gcc
|
||||
|
||||
Vendor: OAR Corporation
|
||||
Distribution: Linux
|
||||
Name: rtems-@target_alias@-@bsp@
|
||||
Release: @Release@
|
||||
Copyright: 1999 OARCorp
|
||||
Group: unsorted
|
||||
Provides: rtems-@target_alias@-@bsp@
|
||||
|
||||
Autoreqprov: on
|
||||
Packager: corsepiu@faw.uni-ulm.de
|
||||
|
||||
Version: @Version@
|
||||
Summary: A free operating system for embedded systems
|
||||
Source: rtems-@Version@.tar.gz
|
||||
# We claim to be relocatible, but in fact we are not
|
||||
Prefix: /opt
|
||||
Buildroot: /tmp
|
||||
# Patch:
|
||||
%description
|
||||
RTEMS is a free operating system for embedded systems.
|
||||
|
||||
Authors:
|
||||
--------
|
||||
Joel Sherrill (joel@oarcorp.com)
|
||||
...
|
||||
|
||||
%prep
|
||||
# untar the sources inside rtems-@target_alias@-@bsp@-@Version@
|
||||
%setup -c -n rtems-@target_alias@-@bsp@-@Version@
|
||||
# no patch needed
|
||||
# %patch
|
||||
%build
|
||||
# rtems does not support building inside the source tree
|
||||
if test ! -f rtems-@Version@/configure;
|
||||
then
|
||||
( cd rtems-@Version@; ./autogen )
|
||||
fi
|
||||
./rtems-@Version@/configure \
|
||||
--target=@target_alias@ \
|
||||
--prefix=/opt/rtems/@target_alias@ \
|
||||
--enable-networking \
|
||||
--enable-posix \
|
||||
--enable-cxx \
|
||||
--disable-tests \
|
||||
--enable-rdbg \
|
||||
--disable-multiprocessing
|
||||
make RTEMS_BSP=@bsp@
|
||||
%install
|
||||
make RTEMS_BSP=@bsp@ prefix=$RPM_BUILD_ROOT/opt/rtems/@target_alias@ install
|
||||
%files
|
||||
%dir /opt/rtems/@target_alias@/@bsp@
|
||||
/opt/rtems/@target_alias@/@bsp@/*
|
||||
/opt/rtems/@target_alias@/make/*
|
||||
/opt/rtems/@target_alias@/bin/install-if-change
|
||||
/opt/rtems/@target_alias@/bin/packhex
|
||||
/opt/rtems/@target_alias@/bin/unhex
|
||||
/opt/rtems/@target_alias@/bin/lock-directory
|
||||
/opt/rtems/@target_alias@/bin/unlock-directory
|
||||
/opt/rtems/@target_alias@/bin/eolstrip
|
||||
/opt/rtems/@target_alias@/bin/cklength
|
||||
125
scripts/toolchain.spec.in
Normal file
125
scripts/toolchain.spec.in
Normal file
@@ -0,0 +1,125 @@
|
||||
#
|
||||
# spec file for package rtems
|
||||
#
|
||||
# Copyright (c) 1999 OARCorp, Huntsville, AL
|
||||
#
|
||||
# please send bugfixes or comments to joel@OARcorp.com
|
||||
#
|
||||
|
||||
# neededforbuild @target_alias@-binutils @target_alias@-gcc
|
||||
|
||||
Vendor: OAR Corporation
|
||||
Distribution: Linux
|
||||
Name: rtems-@target_alias@-tools
|
||||
Release: @Release@
|
||||
Copyright: 1999 OARCorp
|
||||
Group: unsorted
|
||||
Provides: rtems-@target_alias@-tools
|
||||
|
||||
Autoreqprov: on
|
||||
Packager: corsepiu@faw.uni-ulm.de
|
||||
|
||||
Version: @Version@
|
||||
Summary: rtems gcc tool chain for target @target_alias@
|
||||
Source0: gcc-2.95.1.tar.gz
|
||||
Source1: newlib-1.8.2.tar.gz
|
||||
Source2: binutils-2.9.5.tar.gz
|
||||
Patch0: gcc-2.95.1-rtems-19991014.diff
|
||||
Patch1: newlib-1.8.2-rtems-19991014.diff
|
||||
Patch2: binutils-2.9.5-rtems-19991014.diff
|
||||
|
||||
Buildroot: /tmp
|
||||
# Patch:
|
||||
%description
|
||||
RTEMS is a free operating system for embedded systems.
|
||||
|
||||
Authors:
|
||||
--------
|
||||
Joel Sherrill (joel@oarcorp.com)
|
||||
...
|
||||
|
||||
%prep
|
||||
# untar the sources inside rtems-@target_alias@-@bsp@-@Version@
|
||||
%setup -c -n rtems-@target_alias@-tools -a 1 -a 2
|
||||
|
||||
# %setup -c -n rtems-@target_alias@ -a 1 -a 2
|
||||
%patch0 -p0
|
||||
%patch1 -p0
|
||||
%patch2 -p0
|
||||
|
||||
mkdir src
|
||||
( cd src
|
||||
# The configure scripts and share libraries should be taken from
|
||||
# the tool component with the newest version.
|
||||
GET_CONFIGURE_SCRIPTS_FROM=gcc-2.95.1
|
||||
for f in config config.guess config.sub configure configure.in \
|
||||
config-ml.in Makefile.in install-sh move-if-change \
|
||||
mkinstalldirs libiberty config.if ltconfig missing
|
||||
do
|
||||
ln -s ../${GET_CONFIGURE_SCRIPTS_FROM}/$f .
|
||||
done
|
||||
|
||||
# Link in GCC or EGCS
|
||||
for f in gcc libio libstdc++ texinfo xiberty
|
||||
do
|
||||
ln -s ../gcc-2.95.1/${f} .
|
||||
done
|
||||
|
||||
# Get these components from binutils
|
||||
for f in bfd binutils gas gprof ld opcodes etc
|
||||
do
|
||||
ln -s ../binutils-2.9.5/$f .
|
||||
done
|
||||
|
||||
# Now get the C library
|
||||
ln -s ../newlib-1.8.2/newlib .
|
||||
)
|
||||
|
||||
%build
|
||||
test -d build || mkdir build
|
||||
( cd build
|
||||
../src/configure --target=@target_alias@ \
|
||||
--with-gnu-as --with-gnu-ld --verbose \
|
||||
--prefix=/opt/rtems \
|
||||
--with-sys-includes=$RPM_BUILD_ROOT/opt/rtems/@target_alias@/sys-include
|
||||
|
||||
test -d $RPM_BUILD_ROOT/opt \
|
||||
|| mkdir $RPM_BUILD_ROOT/opt
|
||||
test -d $RPM_BUILD_ROOT/opt/rtems \
|
||||
|| mkdir $RPM_BUILD_ROOT/opt/rtems
|
||||
test -d $RPM_BUILD_ROOT/opt/rtems/@target_alias@ \
|
||||
|| mkdir $RPM_BUILD_ROOT/opt/rtems/@target_alias@
|
||||
test -d $RPM_BUILD_ROOT/opt/rtems/@target_alias@/include \
|
||||
|| mkdir $RPM_BUILD_ROOT/opt/rtems/@target_alias@/include
|
||||
test -d $RPM_BUILD_ROOT/opt/rtems/@target_alias@/sys-include \
|
||||
|| mkdir $RPM_BUILD_ROOT/opt/rtems/@target_alias@/sys-include
|
||||
|
||||
srclimits=../src/newlib/libc/sys/rtems/include/limits.h
|
||||
for dir in $RPM_BUILD_ROOT/opt/rtems/@target_alias@/include \
|
||||
$RPM_BUILD_ROOT/opt/rtems/@target_alias@/sys-include
|
||||
do
|
||||
cp ${srclimits} ${dir}
|
||||
done
|
||||
|
||||
make LANGUAGES="c c++" all
|
||||
|
||||
cd gcc
|
||||
rm -f stmp-multilib
|
||||
find . -name "*.a" -print | xargs -e rm -f
|
||||
|
||||
make LANGUAGES="c c++" all
|
||||
cd ..
|
||||
)
|
||||
|
||||
%install
|
||||
( cd build
|
||||
make prefix=$RPM_BUILD_ROOT/opt/rtems LANGUAGES="c c++" install
|
||||
)
|
||||
|
||||
%files
|
||||
/opt/rtems/@target_alias@/bin
|
||||
/opt/rtems/@target_alias@/include
|
||||
/opt/rtems/@target_alias@/lib
|
||||
/opt/rtems/@target_alias@/sys-include
|
||||
/opt/rtems/bin/@target_alias@*
|
||||
/opt/rtems/lib/gcc-lib/@target_alias@/2.95.1
|
||||
Reference in New Issue
Block a user