How To Install device-tree-compiler on Ubuntu 20.04

In this tutorial we learn how to install device-tree-compiler on Ubuntu 20.04. device-tree-compiler is Device Tree Compiler for Flat Device Trees

Introduction

In this tutorial we learn how to install device-tree-compiler on Ubuntu 20.04.

What is device-tree-compiler

device-tree-compiler is:

Device Tree Compiler, dtc, takes as input a device-tree in a given format and outputs a device-tree in another format for booting kernels on embedded systems.

Typically, the input format is “dts”, a human readable source format, and creates a “dtb”, or binary format as output.

There are three methods to install device-tree-compiler on Ubuntu 20.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install device-tree-compiler Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install device-tree-compiler using apt-get by running the following command:

sudo apt-get -y install device-tree-compiler

Install device-tree-compiler Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install device-tree-compiler using apt by running the following command:

sudo apt -y install device-tree-compiler

Install device-tree-compiler Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install device-tree-compiler using aptitude by running the following command:

sudo aptitude -y install device-tree-compiler

How To Uninstall device-tree-compiler on Ubuntu 20.04

To uninstall only the device-tree-compiler package we can use the following command:

sudo apt-get remove device-tree-compiler

Uninstall device-tree-compiler And Its Dependencies

To uninstall device-tree-compiler and its dependencies that are no longer needed by Ubuntu 20.04, we can use the command below:

sudo apt-get -y autoremove device-tree-compiler

Remove device-tree-compiler Configurations and Data

To remove device-tree-compiler configuration and data from Ubuntu 20.04 we can use the following command:

sudo apt-get -y purge device-tree-compiler

Remove device-tree-compiler configuration, data, and all of its dependencies

We can use the following command to remove device-tree-compiler configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge device-tree-compiler

References

Summary

In this tutorial we learn how to install device-tree-compiler package on Ubuntu 20.04 using different package management tools: apt, apt-get and aptitude.