world leader in high performance signal processing
Trace: » building-installer

Building coLinux Installer

This document is not meant for end users. If you want information on running/using coLinux, please see the coLinux index. This information is only for people who wish to compile the installer itself (or know more about how it actually works).

Required Software

You can build the installer from under Windows or Linux. Everything is using the NSIS installer. So install it! That is about all you will need.

Otherwise, the files that are used are kept in the Blackfin coLinux SVN. So you should check it out.

File Overview

Execute this with one argument: the base Blackfin version. It will do everything else for you (unpacking archives, creating required directory structure, creating/finding source files, etc…). If it encounters a problem, it'll be sure to let you know so you can rectify the situation.

Note that by default, you should only have to provide the tarballs/blackfin-root.tar file.


Here we hook the linuxrc file that exists inside of the initrd.gz. This allows us to execute coLinux and instead of performing the normal boot procedure, it'll execute our custom scripts instead. We leverage this during the install procedure by executing coLinux and having it to the root file system setup rather than trying to mess around with this stuff from Windows.

Our magic only gets executed if the command line variable COLINUX_SETUP is specified. This way we don't need multiple initrd's. The trick is simple:

  • COLINUX_SETUP - set to “yes” to execute the following …
  • COLINUX_SETUP_FS - mount specified cofs and then …
  • COLINUX_SETUP_EXEC - execute specified script that lives on the aforementioned cofs

Specifically, we execute coLinux during install by doing:

  nsExec::ExecToLog 'cmd /C set COLINUX_CONSOLE_EXIT_ON_DETACH=1 & \
                     colinux-daemon.exe -k -v 1 \
                         kernel=vmlinux \
                         initrd=initrd.gz \
                         cofs0=. \
                         cobd0=blackfin-rootfs.img \
                         cobd1=blackfin-swap.img \
                         COLINUX_SETUP=yes \
                         COLINUX_SETUP_FS=cofs0 \


We take the stock coLinux NSIS installer script and spice it up a bit. The notable things we do:

  • Set compression to LZMA
  • Disable WinPcap page of links
  • Disable automatic root filesystem image download page
  • Add pages to help in default coLinux configuration creation
  • Generate Start Menu Shortcuts
  • Include useful helper programs
    • Putty
    • WinPcap
    • XMing
  • Generate default coLinux configuration file
  • Set TAP Windows IP automatically based on user's input (using ipconfig/netsh)
  • Generate swap/root file system images with mkFile.exe
  • Execute coLinux with our init script and user settings


This is executed by the installer to create a usable system out of the box. Some of the highlights:


Since the passwd binary does not allow for scripting (no options to take password via command line or stdin), we recreate a user typing by using Expect. This means you need TCL and expect in the root file system in order for this to work.


Note that all tarballs here are not compressed. The NSIS installer itself will compress all files given to it, so compressing a tarball using standard gzip/bzip2/etc… and then having the NSIS installer compress things is just a waste all around.


Drop custom configuration files right into the root file system. This obviously does not allow for appending or tweaking of existing files, but for some things we don't care. This stuff gets folded into blackfin-configs.tar.


The initrd may lack a few binaries that we need when initializing the root file system. This includes file system formatting utilities (like mke2fs). So create a few static binaries and tar them up into blackfin-init.tar.


Since the initrd lacks a reboot binary, and creating a normal static C program which merely calls the C library's reboot() function results in a huge file (hundreds of kilobytes), I wrote a small assembly file that makes a system call to the kernel with the right magic values. This results in a 276 byte file :).


All files here are in SVN except for tarballs/blackfin-root.tar. Due to the size/nature of this, you must provide this file yourself. It is simply a tarball of a Linux system. If you are unable to provide your own, you can simply extract it from a previous Blackfin coLinux installer by using the p7zip program.