Let's make the world a better place using digital technologies!

Category: coLinux/andLinux

Building RTEMS (Real-Time Executive for Multiprocessor Systems) for Coldfire using Opensource Tools

It really took me a couple of days to set things straight for a successful build. Here are the steps that I followed. Before starting, make sure you have ca. 1GB free space as the temporary files can easily consume a lot of space. I built everything on andLinux running on a Windows XP host.

  • Create necessary folders:
    mkdir /usr/local/rtems/source
    mkdir /usr/local/rtems/source/tools
    mkdir /usr/local/rtems/rtems-4.8
  • Add the path:
  • Install the pre-requisites:
    apt-get install automake gdb bzip2 texinfo autoconf patch
  • Get and build the development tools:
    cd /usr/local/rtems/source/tools
    wget http://www.rtems.com/ftp/pub/rtems/SOURCES/binutils-2.18.tar.bz2
    wget http://www.rtems.com/ftp/pub/rtems/SOURCES/gcc-4.2.2.tar.bz2
    wget http://www.rtems.com/ftp/pub/rtems/SOURCES/newlib-1.15.0.tar.gz

    Unzip the files:
    bzcat binutils-2.18.tar.bz2 | tar xf -
    tar -xvzf newlib-1.15.0.tar.gz
    bzcat gcc-4.2.2.tar.bz2 | tar xf -

    Get and apply the patches:
    wget http://www.rtems.com/ftp/pub/rtems/SOURCES/binutils-2.18-rtems4.8-20071104.diff
    wget http://www.rtems.com/ftp/pub/rtems/SOURCES/newlib-1.15.0-rtems4.8-20071221.diff
    wget http://www.rtems.com/ftp/pub/rtems/SOURCES/gcc-core-4.2.2-rtems4.8-20071127.diff

    cd binutils-2.18
    patch -p1 <../binutils-2.18-rtems4.8-20071104.diff cd ..

    cd newlib-1.15.0
    patch -p1 <../newlib-1.15.0-rtems4.8-20071221.diff cd ..

    cd gcc-4.2.2
    patch -p1 <../gcc-core-4.2.2-rtems4.8-20071127.diff rm -rf newlib ln -s ../newlib-1.15.0/newlib newlib cd ..

    Make and instal necessary libraries

    wget http://ftp.sunet.se/pub/gnu/gmp/gmp-4.2.2.tar.gz
    tar -xvf gmp-4.2.2.tar.gz
    cd gmp-4.2.2
    make install
    cd ..

    wget http://www.mpfr.org/mpfr-current/mpfr-2.3.1.tar.bz2
    bzcat mpfr-2.3.1.tar.bz2 | tar -xf -
    cd mpfr-2.3.1
    make install
    cd ..

    Make a temporary build folder:
    rm -rf build
    mkdir build
    cd build

    ../binutils-2.18/configure -target=m68k-rtems4.8 -prefix=/usr/local/rtems/rtems-4.8
    make -w all install
    cd ..

    If you want to get the latest version of CVS-head you may use:
    cd /usr/src/rtems-4.9-9MAY08/source
    cvs -d :pserver:anoncvs@www.rtems.com:/usr1/CVS login

    (Press ENTER for password)
    cvs -d :pserver:anoncvs@www.rtems.com:/usr1/CVS -z 9 co -P rtems
    cd rtems
    (This will generate the configure script)
    cd ..
    In this case, however, the instructions given here may not apply exactly as they are.

    Clean the build folder:
    rm -rf build
    mkdir build
    cd build

    Now configure the gcc:
    ../gcc-4.2.2/configure -target=m68k-rtems4.8 \
    -prefix=/usr/local/rtems/rtems-4.8 \
    -with-gnu-as -with-gnu-ld -with-newlib -verbose \
    -with-system-zlib -disable-nls \
    -enable-version-specific-runtime-libs \
    -enable-threads=rtems \

    make -w all (It can take about an hour and newlib will also be compiled along with)
    make -w install
    cd ..\..
    (pwd: source)

  • Get and build RTEMS-4.8

    wget http://www.rtems.com/ftp/pub/rtems/4.8.0/rtems-4.8.0.tar.bz2
    bzcat rtems-4.8.0.tar.bz2 | tar -xf -

    Make a clean build folder:
    rm -rf build
    mkdir build
    cd build

    Configure the rtems:
    ../rtems-4.8.0/configure -target=m68k-rtems4.8 \
    -prefix=/usr/local/rtems/rtems-4.8 \
    -enable-cxx -disable-tests -enable-networking \
    (-enable-docs is broken, results in @include `version.texi': No such file or directory.)

    Make the kernel for a given target:
    make -w RTEMS_BSP="av5282" install

    make RTEMS_BSP="uC5282" does not succeed because of the following gcc-4.2.2 error:
    ../../../../../../rtems-4.8.0/c/src/../../cpukit/shttpd/log.c: In function '_shttpd_log_access':
    ../../../../../../rtems-4.8.0/c/src/../../cpukit/shttpd/log.c:139: error: insn does not satisfy its constraints:
    (insn 74 158 159 10 ../../../../../../rtems-4.8.0/c/src/../../cpukit/shttpd/log.c:117 (set (mem/c:SI (plus:SI (reg/f:SI 14 %a6)
    (reg:SI 1 %d1)) [57 D.6862+0 S4 A16])
    (mem/s:SI (plus:SI (reg/v/f:SI 10 %a2 [orig:48 c ] [48])
    (const_int 220 [0xdc])) [2 .loc.io.total+0 S4 A16])) 34 {*movsi_cf} (nil)
    ../../../../../../rtems-4.8.0/c/src/../../cpukit/shttpd/log.c:139: internal compiler error: in reload_cse_simplify_operands, at

    Install RTEMS:
    make -w install

  • Build Addon Packages For Command Line Utilities
    wget http://www.rtems.com/ftp/pub/rtems/4.8.0/rtems-addon-packages-4.8.0.tar.bz2

    Set the RTEMS_MAKEFILE_PATH variable to the BSP location:
    export RTEMS_MAKEFILE_PATH=/usr/local/rtems/rtems-4.8/m68k-rtems4.8/av5282
    cd /usr/local/rtems/source/rtems-addon-packages-4.8.0

    (If you have more than one targets, this needs to be done for each of them)
    Make the add-on tools
    sh bit

Continue Reading

Increasing the disk size in andLinux

  1. Stop the andLinux service and make sure no colinux daemon is running.
  2. Download dd for windows and put in the same folder as base.drv or wherever your “/” drive image is located.
  3. The following command extends a 4 GB partition to 16 GB:
    dd bs=16384 if=/dev/zero of=base.drv seek=262144 count=786432
  4. The seek=262144 tells dd that it should start filling zeros starting from this address which is the size of your 4GB image divided by 16384. In my case it is
    4294967296/16384=262144 number of 16K blocks.
  5. The count=786432 tells dd that it should fill 12GB of zeros. This is just (1024)^3/16384 number of blocks.
  6. After it has increased the file size, start the andLinux service and at the command prompt in Linux, type the following:
    apt-get install ext2resize
    ext2online /dev/cobd0
  7. Now you should have the new expanded hard disk image. To check, type:
    at the command prompt and you will see that /dev/cobd0 is now new size.
Continue Reading

andLinux Error: “cannot connect to X server”

If you encounter this error, you should check the following:

  • that the given IP address, which indicates your display, is reachable, either using ping, telnet, or some other approach
  • that Xming.exe is running. You can check it using Windows Task Manager.
  • If everything seems working, then you may try killing the Xming.exe from Task Manager and restarting it using the following command:
    <PATH-TO>\Xming.exe :0 -dpi 85 -clipboard -notrayicon -c -multiwindow -reset -terminate -unixkill -logfile Xming.log
    It solved this problem for me.
Continue Reading

Installing QEMU on andLinux

Follow these steps:

apt-get install gcc-3.4
ln -s /usr/bin/gcc-3.4 /usr/bin/gcc34
cd /usr/src
apt-get install libsdl1.2-dev
apt-get install libsdl1.2debian-all
wget http://fabrice.bellard.free.fr/qemu/qemu-0.9.1.tar.gz
tar -xvzf qemu-0.9.1.tar.gz
cd qemu-0.9.1
./configure (This selects all available targets)
make install

Continue Reading

Solving: Samba not working in andLinux with domain users

If Samba share fails to mount during boot-up and you are a domain user, do the following:

  1. Edit /etc/smbpasswd
  2. Change the first line to username = <Domain>/<Username>. e.g., devel-net/andy
  3. The password in the second line should be the domain password

Now restart the andLinux service. The share should mount okay.

Continue Reading