Skip to main content.

14.1.1. ELDK Installation under FreeBSD

How can I install ELDK on a FreeBSD system?

[Thanks to Rafal Jaworowski for these detailed instructions.] This is a short tutorial how to host ELDK on FreeBSD 5.x and 6.x. The procedure described below was tested on 5.2.1, 5.3 and 6-current releases; we assume the reader is equipped with the ELDK 3.x CDROM or ISO image for installation, and is familiar with FreeBSD basic administration tasks like ports/packages installation.
  1. Prerequisites:
    1. Install linux_base

      The first step is to install the Linux compatibility layer from ports /usr/ports/emulators/linux_base/ or packages

      ALERT! Please make sure to install version 7.1_5 (linux_base-7.1_5.tbz) or later; in particular, version 6.1.5 which can also be found in the ports tree does not work properly!

      The compatibility layer is activated by
      # kldload linux
    2. Install bash

      Since ELDK and Linux build scripts are organised around bash while FreeBSD does not have it in base, this shell needs to be installed either from ports /usr/ports/shells/bash2/ or packages collection

      The installation puts the bash binary in /usr/local/bin. It is a good idea to create a symlink in /bin so that hash bang from scripts (#!/bin/bash) works without modifications:
      # cd /bin 
      # ln -s /usr/local/bin/bash
  2. Prepare ELDK

    ALERT! This step is only needed for ELDK release 3.1 and older versions.

    Copy the install files from the CDROM or ISO image to a writable location. Brand the ELDK installer as Linux ELF file:
    # cd <elkd_install_dir>
    # brandelf -t Linux ./install
    TIP Note: The following workaround might be a good alternative for the tedious copying of the installation CDROM to a writable location and manual branding: you can set a fallback branding in FreeBSD - when the loader cannot recognise the ELF brand it will switch to the last resort defined.
    # sysctl -w kern.elf32.fallback_brand=3
    kern.elf32.fallback_brand: -1 -> 3
    With this setting, the normal ELDK CDROM images should work.
  3. Install ELDK normally as described in 3.5.3. Initial Installation
  4. Set envrionment variables and PATH as needed for ELDK (in bash); for example:
    bash$ export CROSS_COMPILE=ppc_8xx-
    bash$ export PATH=${PATH}:/opt/eldk/bin:/opt/eldk/usr/bin
  5. Hints for building U-Boot:

    FreeBSD normally uses BSD-style 'make' in base, but in order to compile U-Boot 'gmake' (GNU make) has to be used; this is installed as part of the 'linux_base' package (see above).

    U-Boot should build according to standard ELDK instructions, for example:
    bash$ cd /opt/eldk/ppc_8xx/usr/src/u-boot-1.1.2
    bash$ gmake TQM823L_config
    bash$ gmake all
  6. Hints for building Linux:

    There are three issues with the Makefile in the Linux kernel source tree:
    • GNU make has to be used.
    • The 'expr' utility in FreeBSD base behaves differently from the version than is used in Linux so we need to modify the Makefile to explicitly use the Linux version (which is part of the Linux compatibility package). This is best achieved with defining "EXPR = /compat/linux/usr/bin/expr" somewhere at =Makefile='s beginning and replacing all references to 'expr' with the variable ${EXPR).
    • Some build steps (like when running 'scripts/mkdep' can generate very long arguments lists (especially is the Linux kernel tree is in a directory with long absolute filenames). A solution is to use xargs to split such long commands into several with shorter argument lists.

      The Linux kernel can then be built following the standard instructions, for example:
      bash$ cd /opt/eldk/ppc_8xx/usr/src/linux-2.4.25/
      bash$ gmake mrproper
      bash$ gmake TQM823L_config
      bash$ gmake oldconfig
      bash$ gmake dep
      bash$ gmake -j6 uImage
14.1. ELDK 1. Abstract 14.1.2. ELDK Installation Hangs
Prev Home Next