I'm embedded systems engineer, Mozilla rep, blogger and writer, Violinist. Founder of mookhtabar. In my area, the people call me a scientist but I call my self a thinker.

Using Buildroot for building a first embedded Linux system for Raspberry Pi 4 model B


In this article, I'll help you to make a small embedded Linux system. In this work, I've used Raspberry pi 4 Model B, it's the last board that Raspberry pi Foundation manufactured it when I've written this article. 

Raspberry pi 4 model B board
In general, There are three ways to develop an embedded Linux system: building everything manually, developing based a binary distribution or build systems using tools like buildroot, yocto and other. We can resume the positives and the negatives of each method by this table:


In this article, we are developing with the "Build systems" method, and for this method and today, there are two solutions that are the most popular: Yocto/Open Embedded and buildroot. 

The yocto or Open Embedded are tools to build a complete Linux distribution with binary packages, there are powerful but somewhat complex and quite sleep learning curve; we will talk about it and try to use it in next articles.

The buildroot is a tool to build a root filesystem image, no binary packages; it's much simpler to use, understand and modify.  by this tool, you can build a toolchain, a rootfs, a kernel, a bootloader and more.
The home page of buildroot

The work with this tool is so easy, but you need a good internet connection because my first build takes a long time (From 10 am to 3 pm) with an internet connection of 2MBPS. And you need some experience with Linux and embedded Linux, to know what you need to put in your embedded Linux system. This is not a problem for me, I have an experience of six years with Linux and I use a great book call " building Embedded Linux Systems" to get a theoric background in this field of Embedded system. 

Karim Yaghmour, Jon Masters, Gilad Ben-Yossef, Philippe Gerum - Building Embedded Linux Systems (2008, O'Reilly Media)

 In other, you can just build a simple Embedded Linux System by few commends, but the best thing to learn is to practice, so for that I've gotten  Rpi 4 Model B  board, and I've used a file that descript how to build an embedded Linux system for Rpi 3; and use it to make an embedded Linux system for Rpi4, I've learned line by line what buildroot give us and I've read the datasheet of Rpi 4 Model B and the processor that integers in this board, I've learned what we need to choose in the buildroot to OS run; I tell you that you can build it for Rpi 4 by few commends because this work it is in the GitHub of the buildroot (See it by click here), and someone has done what I've done here and saved the config file and he shared it, but I rebuild this work without seeing this config file to learn how I can do it for other boards.  

So there is two way here to continue this article: use the easy way to build this OS for Rpi 4 or use the hard way that I use it to build My first embedded Linux system for Rpi 4.

before start talking about how we build, you need to get a Linux in your host computer, just download any Linux distribution you like and install it as the second OS in your computer, because the compile is so speeding in Linux when compare with Windows. I've used Ubuntu (elementry os based Ubuntu), it's the best for me. so you can choose and download one  from this (I recommend it): 
Or just search about that, and how to install it.

And you need to download a version of buildroot tool from here:https://buildroot.org  for my experience I use buildroot 2019.8, you found it here in my GitHub ( to download it Click here ).

1- Build an Embedded Linux System for Raspberry pi 4 model B by use defconfig file:
After download the buildroot file and extra it, you need to open the terminal of Linux in the buildroot folder and you will see something like that:

 Just write: 
$ make raspberrypi4_defconfig
$ make

and direct the buildroot tool to start to make an embedded Linux system for raspberry pi 4 by the configurations in the default from the defconfig file that you put it in the .congif by the first line.

2- Build an Embedded Linux System for Raspberry pi 4 model B by yourself (DIY):
In this choose you to need to know more about the Rpi 4 Model B board, I will add a table that you can follow it to config the buildroot to make a simple embedded Linux system for Rpi 4, just keep following this article I will update it later by this table. 
For my experience I use this file that has a table for making an embedded Linux system for Rpi 3 (click here to see the file), you can use it to learn by the same method that I use to learn or just waiting me to make a table for Rpi 4.  

Picture from the screen from Rpi 4, you see that I put "Welcome to Walid Amriou OS for Raspberry pi 4 " in the start of the system and after that and my logo, and I test it by writing "date" and the system give me the date
 
  • You can follow this work in GitHub: 

  • To know more about the processor that integrated in Rpi 4 Model B: 



No comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel