A virtual devboard for evaluating embedded Linux.
C Roff C++ Makefile Yacc Shell Other
Latest commit 28a838e Jan 24, 2017 @troglobit pkg.mk: Actually fix tmpfile leak, without messing up build
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
Permalink
Failed to load latest commit information.
arch Initial sync of PPC and ARM Linux .config Jan 19, 2017
bin check-toolchain: Remember tee to logfile as well Jan 19, 2017
doc/kconfig Add kconfig/ documentation Jan 2, 2016
initramfs qemu: refactor qemu setup Jan 3, 2017
kconfig Refactor build system to make room for more $ARCHs Nov 13, 2016
kernel kernel/Makefile: Unpack kernel before menuconfig Jan 13, 2017
lib ncurses: Fix build, CPPFLAGS=-P required for v5.9 Jan 12, 2017
packages finit: Fix packages/finit-build target Jan 12, 2017
user hello: Add optional user argument Oct 9, 2016
.gitignore Ignore download and persistent in-tree directories Oct 20, 2016
AUTHORS Minor updates and remove useless symlinks Dec 28, 2015
Kconfig Refactor configure and build system Dec 26, 2016
LICENSE Remove Henrik Nordström from copyright holders, reason in AUTHORS Jan 11, 2015
Makefile qemu: refactor qemu setup Jan 3, 2017
README.md Small sample config including docs on how to build Dec 31, 2016
TODO.md TODO: Remember to try out Docker as build environment Mar 24, 2016
core.mk qemu: refactor qemu setup Jan 3, 2017
example.png README: Update screenshot Sep 22, 2016
initramfs.devnodes Major overhaul of build system Jan 9, 2015
pkg.mk pkg.mk: Actually fix tmpfile leak, without messing up build Jan 24, 2017
quick.mk Followup to 58cd8dd, fix quick rules w/o side effects Dec 31, 2016
ramdisk.mk core.mk: Share variables between kernel/Makefile and ramdisk.mk Dec 26, 2016
rules.mk Fix distclean target after refactor Dec 26, 2016
small.config Small sample config including docs on how to build Dec 31, 2016

README.md

TroglOS Linux | A Virtual Devboard

Image of TroglOS Example Run

Table of Contents

Introduction

TroglOS is a playful, but working, example of how to create a virtual devboard from components like Qemu, Linux and BusyBox.

Use the build framework in TroglOS to test your embedded applications before the actual hardware arrives. Or as a stable reference when said hardware starts acting up -- as it invariably does ... you can even use it as a reference to other embedded Linux build systems. TroglOS is relatively clean and vanilla, the intent is to keep it as close to upstream sources as possible.

Currently TroglOS targets an ARM Versatile PB devboard with Qemu and is only tested on a Ubuntu 64-bit build host, using a crosstool-NG based toolchain. Pull requests for more targets are most welcome! :)

To try it out, simply clone this repository, install the dependencies listed in the Requirements section, then type:

make

Or modify the configuration using the well known menuconfig interface

make menuconfig
make

When the build has completed, start Qemu. Use root to login.
No password by default.

make run

For a truly minimal setup, only Busybox and an ARM/Versatile config:

make distclean
cp small.config .config && make oldconfig
make
make run

Now go have fun! :-)

Requirements

The build environment currently requires at least the following tools, tested on Ubuntu 16.04 (x86_64):

  • build-essential (gcc, make, etc.)
  • automake autoconf libtool pkg-config flex bison wget quilt
  • bc lzop device-tree-compiler u-boot-tools (mkimage)
  • qemu-system-arm (install libvirt-bin and virt-manager as well!)
  • arm-unknown-linux-gnueabi toolchain
  • probably more, gzip?

Qemu Networking

TroglOS uses Qemu to run the resulting kernel + image. For networking you may need to do the following to your host system:

sudo chmod 4755 /usr/lib/qemu/qemu-bridge-helper
sudo dpkg-statoverride --add root root 4755 /usr/lib/qemu/qemu-bridge-helper

The first command makes the Qemu helper "suid root", which means we're allowed to manipulate the network to gain external network access. The last command is for Debian/Ubuntu systems, it makes sure to record your change so that any Qemu package upgrades will not overwrite our mode change.

Now you need to tell Qemu what bridges in the system you are allowed to connect to, edit/create the file /etc/qemu/bridge.conf and add:

allow virbr0

Assuming you have a virbr0 interface in your system. If you've run anything in virt-manager prior to this then you're set, otherwise you're unfortunately on your own.

Troubleshooting

TroglOS builds silent. You will not see any compiler output, warnings or such by default. When something does not work this can be slightly annoying, so there are several shortcuts and other tricks to help you!

First, check the file build.log, everything is redirected there, except for some status messages. If that does not help, try enabling verbose mode:

make V=1

This is what you are probably used to from other build systems. But what if you only want to rebuild a single package?

make V=1 packages/busybox-build

This builds only BusyBox, with verbose mode enabled. Other useful shortcuts are:

make packages/busybox-clean
make packages/busybox-distclean
make packages/busybox-install

To tweak the kernel the following build shortcuts are available:

make kernel
make kernel_menuconfig
make kernel_saveconfig

There are a few more, see the Makefile for details, it is surprisingly readable! :-)

Upgrading Linux

Change the Linux kernel version using make menuconfig. If the kernel is just a minor patch release, you're done.

If it is a major kernel upgrade, copy the latest kernel/config-X.YY to kernel/config-X.ZZ and call make kernel_oldconfig. This will unpack the kernel and give you a set of questions for all new features.

Make sure to do a make kernel_saveconfig, and possibly add the new kernel/config-X.ZZ to GIT.

Testing SNMP

TroglOS use mini-snmpd as its SNMP agent. It is very small and therefore also very limited in functionality, but it is enough to monitor TroglOS by remote if needed.

To test it you need an SNMP client. The following command installs snmpset, snmpget, snmpwalk, base MIBs and all standard MIBs needed. You may also be interested in a more graphical alternative, snmpB

$ sudo apt-get install snmp libsnmp-base snmp-mibs-downloader

When done you should be able to do the following:

$ snmpwalk -v2c -c public 192.0.2.42

SNMPv2-MIB::sysDescr.0 = STRING: TroglOS Linux Virtual Devboard
SNMPv2-MIB::sysObjectID.0 = OID: SNMPv2-SMI::enterprises
SNMPv2-MIB::sysUpTime.0 = Timeticks: (465) 0:00:04.65
SNMPv2-MIB::sysContact.0 = STRING: troglobit@gmail.com
SNMPv2-MIB::sysName.0 = STRING: chaos
SNMPv2-MIB::sysLocation.0 = STRING: GitHub
IF-MIB::ifNumber.0 = INTEGER: 1
IF-MIB::ifIndex.1 = INTEGER: 1
IF-MIB::ifDescr.1 = STRING: eth0
IF-MIB::ifOperStatus.1 = INTEGER: up(1)
IF-MIB::ifInOctets.1 = Counter32: 5557
IF-MIB::ifInUcastPkts.1 = Counter32: 45
IF-MIB::ifInDiscards.1 = Counter32: 0
IF-MIB::ifInErrors.1 = Counter32: 0
IF-MIB::ifOutOctets.1 = Counter32: 2958
IF-MIB::ifOutUcastPkts.1 = Counter32: 19
IF-MIB::ifOutDiscards.1 = Counter32: 0
IF-MIB::ifOutErrors.1 = Counter32: 0
SNMPv2-SMI::mib-2.25.1.1.0 = Timeticks: (71983) 0:11:59.83

$ snmpget -c public -v 2c 192.0.2.42 system.sysUpTime.0

SNMPv2-MIB::sysUpTime.0 = Timeticks: (2344) 0:00:23.44

Dropbear SSH

The most common embedded SSH daemon in use on embedded Linux systems today is Dropbear by the incredibly humble Matt Johnston.

Dropbear is started by default in TroglOS. It currently allows root access, but we recommend disabling this and instead setting up another user: adduser example

Test SSH from your host simply by: ssh example@192.0.2.42

Using Telnet

Currently telnetd is started by default in TroglOS, this will change in the future, but it will still be available.

Test it from your host by simply calling telnet 192.0.2.42

Bugs & Feature Requests

Feel free to report bugs and request features, or even submit your own pull requests using GitHub

Cheers!
-- Joachim