FreeBSD Ports

From RTEMSWiki

Jump to: navigation, search

There is support in the FreeBSD Ports collection for the RTEMS development tools. This page describes how to use the ports collection.

Questions

  • RTEMS maintains RPMs and separate toolchains for each active branch and the CVS head. Does Ports do this?
  • These are the vanilla latest autotools and sometimes there are patches associated with the RTEMS ones. Why don't the FreeBSD ports have RTEMS autotools (stass: do they differ from stock ones?)?

NOTE: These do not appear to track the RTEMS Project updates very closely. And they do NOT follow RTEMS standard conventions on including a version number in the target name (stass: is it really required?). You are very likely better off building from source. Caveat emptor!

Contents

Using precompiled packages

The FreeBSD project provides a set of precompiled packages that can be used instead of ports. The only caveat that these packages may be not up-to-date with the current port version. You can use pkg_add(8) utility to install a binary package. For example, the following will install support for RTEMS version gcc and gdb for arm architecture:

pkg_add -r arm-rtems-gcc
pkg_add -r arm-rtems-gdb

Precompiled packages are available for all major architectures: arm, i386, i960, m68k, mips, powerpc, sh, and sparc on every architecture FreeBSD runs on.

Install Support for Ports Collection

The are two possible ways of updating your ports collection: using portsnap(8) utility and via CVSup.

portsnap method

Run the following command to fetch and extract the recent snapshot of ports collection:

portsnap fetch extract

Further updates can be applied by using the following command. You can put this into crontab(8) to do this regularly.

portsnap fetch update

CVSup method

Install the cvsup utility for synching to the FreeBSD CVS repo.

Packages can also be installed with the /usr/sbin/sysinstall utility under Configure/Packages/. As root:

fetch ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-6.3-release/devel/cvsup-without-gui-16.1h_3.tbz
pkg_add ./cvsup-without-gui-16.1h_3.tbz

Start with a template cvsup ports collection configuration file. The default host must be changed to a real mirror such as cvsup2.freebsd.org (the line which begins *default host=CHANGE_THIS.FreeBSD.org)

cp /usr/share/examples/cvsup/ports-supfile /etc
vi /etc/ports-supfile

Grab the up to date ports collection. A snapshot > May 12, 2008 is required. Use a different mirror if the "Rejected by server" message appears This may take a while on a slow network connection, especially if /usr/ports was not installed previously.

/usr/local/bin/cvsup /etc/ports-supfile

Build the RTEMS GNU Toolchain

This will install gcc-4.3.2, newlib-1.16.0, gdb-6.8 with the RTEMS 4.9 patches applied. arm, i386, i960, m68k, mips, powerpc, sh, and sparc architectures are also supported with FreeBSD ports. The following builds the arm toolset.

cd /usr/ports/devel/arm-rtems-gcc
make install
(use default options CXX, OBJC)

cd /usr/ports/devel/arm-rtems-gdb
make install

Install Autotools

NOTE: dependencies such as perl will be installed by these ports.

cd /usr/ports/devel/autoconf261
make install

cd /usr/ports/devel/automake110
make install


Things To Watch Out For

BASH Not Being Installed

Mark Fullmer reports running into a bug where if your login shell is zsh and bash is not installed the configure script will not emit the last few lines shown below that indicate that a BSP is available.

target architecture: arm.
available BSPs: rtl22xx.
'gmake all' will build the following BSPs: rtl22xx.
other BSPs can be built with 'gmake RTEMS_BSP="bsp1 bsp2 ..."'

Later, it will not compile the BSP code in the build process. The workaround is to install bash from ports before trying to build RTEMS.

Personal tools