Building Custom Linux For Raspberry Pi Using Buildroot
Building Custom Linux For Raspberry Pi Using Buildroot
sudo apt install sed make binutils gcc g++ bash patch \gzip
bzip2 perl tar cpio python unzip rsync wget libncurses-dev
Now that we have satisfied all the prerequisites lets download the latest stable
release of Buildroot .
mkdir -p $HOME/buildroot
cd $HOME/buildroot
wget https://buildroot.org/downloads/buildroot-2020.02.2.ta
r.gz
tar xvzf buildroot-2020.02.2.tar.gz
cd buildroot-2020.02.2
Buildroot is a generic build system hence in order to build Linux for Raspberry
Pi we need to configure appropriately . In order to configure buildroot for our
board we start the configuration utility by entering make menuconfig .
make raspberrypi_defconfig
Now that you have applied the settings , you can actually start building but just
for the sake of customization lets set a custom welcome message and also set
a root password . Enter make menuconfig and then choose System
Configuration submenu and then select System Banner option and set it to
whatever message you want , since we are building the firmware for our
hypothetical IOT speaker let’s set the welcome message as “Welcome to My
Awesome Speaker” . Now if you look at a few options below , you can see an
option to set root password, set it to the password of your choice .
We are now done with our customization - exit the configuration and choose
the “save” option as you leave . Initiate a full build of the system by executing :
make all
Connect the USB end of the USB to Serial cable to your computer and open the
serial port using a serial terminal software such as Gtkterm with baud rate set
to 115200 . Power up the system and you should see the custom welcome
Won’t it be cool if we can just log in using SSH instead of using those clunky
serial cables? lets include a SSH software in our custom Linux. Buildroot
includes more than 3000 packages which you can choose to include in your
Linux image, the available packages are listed under “ package/ ” folder of
buildroot . In order to have SSH access to our device , we shall enable
Dropbear, a small SSH server which will let us log in remotely .
Go back to your host computer’s terminal window and enter make menuconfig ,
choose Target packages submenu and enable dropbear under Networking
applications — exit and save your configuration on your way out—
enter make command to start compilation .
You should now have access to your device’s terminal via SSH.
Summary:
In this article you learnt how to build a custom Linux for Raspberry Pi using
Buildroot , in this brief introduction you changed the default System welcome
message and also enabled a software package which enabled you to login
remotely into your system using SSH . I hope this blog helped you to gain some
insight into Buildroot below are some more resources for further reading:
Bootlin’s Buildroot practical lab manual: This training document provides an
hands-on approach for learning Buildroot .
Buildroot User manual : Official user manual for Buildroot .
Happy Tinkering!