Ubuntu Disk Image for ARM Full System

From gem5
Revision as of 20:23, 8 August 2011 by Gwblake (talk | contribs) (Created page with "This page describes how to build a serial-console filesystem of Ubuntu Linux for ARM ISA simulation after the bare image file is created. == Using Rootstock and Qemu to build t...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This page describes how to build a serial-console filesystem of Ubuntu Linux for ARM ISA simulation after the bare image file is created.


Using Rootstock and Qemu to build the filesystem

The easiest way to create a disk image is to use the rootstock tool provided in Ubuntu to build an ARM filesystem. To create a base 2GB filesystem that can be booted to the serial console, run the following command:

%>rootstock --fqdn gem5sim --user gem5 --password 5meg --imagesize 2G --seed build-essential

Other packages can be added to the --seed option list to be installed by rootstock. Rootstock will create a tar file containing the file system. Unpack this tar file into the blank disk image. Packages can also be installed at a later date by mounting the filesystem to a loop device, mounting its proc filesystem and chroot'ing into the filesystem. Qemu will be used to emulate the binaries within the ARM filesystem to install additional packages using apt-get.

Setting up Upstart to be Gem5 friendly

Instead of the old SysV and init.d, Ubuntu uses Upstart for mounting filesystems and loading the various daemons upon boot. To speed up the process and subsequent simulations the following upstart scripts should be removed from the /etc/init folder in the new filesystem:

  • cron.conf
  • dmesg.conf
  • hwclock.conf
  • hwclock-save.conf
  • mounted-debugfs.conf
  • plymouth.conf
  • plymouth-log.conf
  • plymouth-splash.conf
  • plymouth-stop.conf
  • plymouth-upstart-bridge.conf
  • rsyslog.conf
  • setvtrgb.conf
  • udev-fallback-graphics.conf
  • ureadahead.conf
  • ureadahead-other.conf

The following changes should be made to the mountall.conf script:

  • Remove the fsck checks at the beginning of the script declaration
  • Remove the fsck checks in the post-script declaration
  • Remove the exec mountall --daemon declaration so total control of what filesystems are mounted and when is retained

To the scrip field on the mountall.conf file, add at least the following:

# Mount appropriate file systems from fstab and remount root. mount /proc mount /tmp mount /sys mount -o remount,rw /dev/sda1 / swapon /swapfile # if present # Make sure to emit all events that mountall would have initctl emit virtual-filesystems initctl emit local-filesystems initctl emit remote-filesystems initctl emit all-swaps initctl emit filesystem initctl emit mounting initctl emit mounted

Additionally, one of the tty.conf scripts should be modified like below to get a login prompt within m5term or load an .rcS job script with multi-user and job-control enabled:

script if [ ! -c /dev/ttyAMA0 ] then mknod /dev/ttyAMA0 c 204 64 fi if [ ! -c /dev/ttySA0 ] then if [ ! -L /dev/ttySA0 ] then ln -s /dev/ttyAMA0 /dev/ttySA0 fi fi /sbin/m5 readfile > /tmp/script chmod 755 /tmp/script if [ -s /tmp/script ] then exec su root -c '/tmp/script' # gives script full privileges as root user in multi-user mode exit 0 else exec /sbin/getty -L ttySA0 38400 vt100 # login prompt fi end script