Skip to content

How to build a ScreenInvader

Amir Hassan edited this page Nov 16, 2013 · 1 revision

You might also want to have a look at: Build a VM from scratch and Testing in a VM

Building the ScreenInvader system from scratch

Creating a custom ScreenInvader file system from scratch is only supported on Linux. First you need to fetch the latest source code.

git clone https://github.com/Metalab/ScreenInvader.git

In the base directory of the ScreenInvader project tree there are two scripts of interest: makestick.sh and bootstrap.sh.

  • makestick.sh is responsible for preparing a storage device (e.g. USB stick) for a ScreenInvader file system.
  • bootstrap.sh is responsible for doing all necessary steps for creating a ScreenInvader file system.
makestick.sh - Prepare a file system for installation of the ScreenInvader system.

Usage: ./makestick.sh [-z][-s <sizeInM>] <device-file>

  <device-file>    a block special device.
Options:
  -s <sizeInM>     overwrite the default (= 500MB) file system size.
  -z               write zeroes to the device before creating the partition
./bootstrap.sh [-a <arch>][-l <logfile>][-c <apt-cacher-port>][-i -d -u ] <bootstrapdir>
Options:
  -a <arch> Bootstrap a system of the given architecture
  -g <num>  Build with selected graphics card
  -l <file> Specify the log file
  -p <port> Enables using apt-cacher-ng on the specified port
  -i        Don't configure and install packages
  -d        Don't debootstrap
  -u        Combined -d and -i
  -x        Install extra packages for debugging

Prepare a storage device

WARNING: The following commands will destroy all data on the storage device.

First create a bootable partition layout and a file system using makestick.sh. (Replace /dev/sdX with the path to your storage device in the following sections)

cd ScreenInvader
# make sure the device is not mounted
sudo umount /dev/sdX

# See makestick.log for verbose output
sudo ./makestick.sh /dev/sdX

Bootstrap the file system

Bootstrap the file system into a temporary directory.

# see bootstrap.log for verbose output.
sudo ./bootstrap.sh ./tmp/

Copy the file system

Mount the storage device and copy the generated file system.

sudo mkdir /media/screeninvader/
sudo mount /dev/sdX1 /media/screeninvader/
cp -a ./tmp/* /media/screeninvader/

Tinker

If you want to do more than just building the latest ScreenInvader you'll need more comfort since bootstrapping it from scratch every time is pretty time consuming. The following sections will guide you through the necessary steps to give a more agile hacking environment.

Caching Debian packages

apt-cacher-ng is a proxy for debian packages. Sometimes it is not evitable to bootstrap images from scratch repeatedly. Using a package cache does accelerate that process a lot.

Installing apt-cacher-ng

The default configuration of apt-cacher-ng should be fine as it is. On debian based systems you just need to install the corresponding package and start the daemon.

aptitude install apt-cacher-ng
/etc/init.d/apt-cacher-ng start

Bootstrapping using apt-cacher-ng

Please keep in mind that apt-cacher-ng is not a mirror. The first time you download a package you don't have any benefit of using it but the next time it will be significantly faster. To use apt-cacher-ng for bootstrapping just supply the port it is listening to, to the bootstrap.sh script.

# default port of apt-cacher-ng is 3142
./bootstrap.sh -p 3142 chrootdir

Applying changes without bootstrapping from scratch

If you already have a bootstrap and you just want to hack on ScreenInvader features, do bugfixes or change package selection you don't need to build the file system from scratch.

Changing package selection

Let's say you just want to add a new package. Simply open bootstrap.sh in a text editor and add it to the list of packages defined in "PKG_WHITE". Then run bootstrap.sh with the "-d" to suppress the invocation of debootstrap.

# does apply package configuration and copy the ScreenInvader code but won't debootstrap a new system.
./bootstrap.sh -d chrootdir
Bugfixing / Hacking features

You're fine with the package selection and system configuration and just want to hack on ScreenInvader source code? Run bootstrap.sh with the "-u" to suppress the invocation of debootstrap and package configuration.

# Copies changes to the ScreenInvader code only.
./bootstrap.sh -u chrootdir
Debugging

Oops. Something not right? First have a look at the logfiles, in particular makestick.log and bootstrap.log should reveal what happened. But sometimes debugging the system cold is to much of an effort. In that case you might want to bootstrap a system with extra-packages (defined in PKG_EXTRA) and debugging options enabled using the "-x" flag.

# it's a good idea to have some spare disk space for debugging. 
./makestick.sh -s 1000 /dev/sdX 

# Bootstrap with extra packages and debugging options.
./bootstrap.sh -x chrootdir