Skip to content

DIBS How To: Installation and Usage

C. Towne Springer edited this page Oct 14, 2015 · 6 revisions

DIBS is the Debian Image Build System, a script for quickly and simply creating a Debian root filesystem image or tarball (Linux shorthand for Tape ARchive) for your embedded project.

###What you need###

  • Linux Debian Build Environment (Virtual Machine is fine)
    • Git installed on your system (sudo apt-get install git)
    • Tip: If you have a clean Debian VM, make a copy for each project and avoid problems with $PATH and conflicts with tool chains.
  • DIBS

###Installing### Install or update the debootstrap and qemu-user-static packages on your Debian

$ sudo apt-get install debootstrap qemu-user-static

Download DIBS and cd into it's directory.

$ git clone https://github.com/ARMWorks/dibs.git
$ cd dibs

You are now ready to start building the Debian filesystem for the target system.

###Setup### ####Set Config File#### First, set the config file to use your target board. NanoPi in this case.

$ ./dibs.sh nanopi defconfig

On success you will see something like ${DIBS}/targets/nanopi.conf copied to nanopi.conf.

####Build Image#### This will download all the packages for your Debian image, and create an .img file The .img file will be used for other commands, such as creating a tarball of the files, or mounting and editing of the files. This command must be run before the others. The process may take some time as it downloads and configures everything needed.

$ ./dibs.sh nanopi build

###Usage### From here you have several choices, create your tarball or xz archive, edit the filesystem in a shell environment, even use qemu to emulate the system (Be aware that emulation will trigger any first boot scripts, so it is just for testing, and my require additional setup).

####Create Tar or XZ Archive#### Once the image is built, you can create a tarball or tar.xz archive from the files within, this is useful for the NanoPi as you can extract it directly to the SD Card.

To create the tarball run:

$ ./dibs.sh nanopi tarball

To create the tar.xz archive run:

$ ./dibs.sh nanopi tarxz

What could be easier?

###Customization### There are a couple ways you can customize your root filesystem image. Prior to creation, edit the config file, or after creation use a shell to interact with the image.

####Config file customization#### Under dibs/targets you will find the file *.conf and *_overlay directories. The available configurations can be customized to your needs, or an entirely new configuration created in place of our example, nanopi.

Overlay This directory structure houses specific files and directories you want included in the final image. You can place config files, data files, pre-compiled applications, what ever you like. And it will be copied into the final filesystem image.

conf files These are shell scripts that contain a list of Debian packages to install, and a post_install() routine. You can modify the packages by adding a name to the list under the line read -r -d '' EXTRA_PACKAGES << EOF and before the second EOF. The post_install() routine is run after everything is downloaded and will execute whatever commands are there, on the filesystem. This is good if you need to rename a file from the normal Debian name, change a config file option, or whatever you can manage to do with shell scripts, can be done here.

####Using the Shell#### After creating the image, you can use the shell command, to interact with your image. This can be used for modifying files, creating new ones, deleting, etc.

$ ./dibs.sh nanopi shell

From here you have your normal Linux commands and functionality.

##Conclusion## DIBS is a easy to use and powerful tool for creating your own Debian OS. From the basic default set up, to customized specialty applications, with a little configuration the build process only takes a couple commands to accomplish.

Clone this wiki locally