IoT and Buildroot
IoT and Buildroot
Buildroot can help you configure embedded Linux images for multiple platform. This let's you use IoT's inherent insecurity in your favor to build images.
Join the DZone community and get the full member experience.Join For Free
One of the nifty things about the Internet of Things is how spectacularly insecure it is. Let's admit it, it is, and it's not because of things we don't have control over either. Especially today, with Buildroot.
So what is this Buildroot thing, and how can you use it?
Buildroot is a system that helps you configure embedded Linux images for a variety of platforms. It uses make and makefile syntax to configure and build from a group of specified options. You specify these options via a configuration file that you can assemble from a GUI. It's stable, but complicated. That said, it's much less complicated than putting together an embedded Linux image without it.
Internally, the generated image uses busybox and a few other utilities to create a stable, usable system.
So, how to go about using this? First, let's get some preliminaries out of the way. I installed Vagrant with my VMWare Fusion provider, but this caused issues with the Buildroot Vagrantfile configuration. The stock installation, using VirtualBox, works just fine. When I use VirtualBox as the provider, I use this command line:
$ vagrant up --provider virtualbox
As I have VMWare Fusion installed. If you want to use the VMWare Fusion provider, you need to make this change to the VagrantFile:
# config.vm.box = 'ubuntu/trusty64' config.vm.box = 'jpease/ubuntu-trusty'
As the ubuntu/trusty64 box only supports the VirtualBox provider. The jpease/ubuntu-trusty box works fine, is 64-bit, and supports the VMWare provider. Personally, this is what I use, but like I said, the VirtualBox version is just fine if you don't have VMWare Fusion (and you don't have the VMWare Fusion provider from Vagrant, which isn't free).
Once you have Vagrant installed and configured, grab the Buildroot Vagrantfile like this:
$ curl -O https://buildroot.org/downloads/Vagrantfile
And start it up and connect to it like so:
$ vagrant up ... $ vagrant ssh
You should see, in the vagrant user's home directory, the Buildroot installation. At this point, you can CC to the directory and you can start using Buildroot.
Now Buildroot is a pretty interesting program in that the developers leveraged pre-existing technologies in interesting ways. The .config file that you change via the various configuration editors is a makefile defining groups of possible make variables. Move to the Buildroot home directory and take a look at the .config file I mentioned. You'll see what I mean.
Next, fire up either of the command line editors, via either of these commands:
$ menu menuconfig $ menu nconfig
The first one uses the older menuing system, the second a newer menuing system. They both use curses for the interface. More sophisticated GUIs exist using QT or X as well, but as we're running this in a Vagrant managed VM, I don't use them. Go ahead if you'd like.
As a test, try running the menu nconfig command. You should see this:
If you do, your installation is looking good! Next, we'll build and run an image using QEMU.
Opinions expressed by DZone contributors are their own.