BuildRoot A Simplified way to kick start

Let us try to Understand,Learn and getting hands dirty over practical and Internals of Embedded Linux System.Embedded Linux is very versatile in nature and free nature of open source Linux(free as in freedom). So let us begin with overall view of the nature.

To create an Embedded Linux system from scratch we has multiple choices

1)Pre-built binary distribution
2)Automated build system
3)Build all system components manually

Choice 1 and 2  is ease and choice 3rd is bit pain and need more effort.So i choose 2nd option since for the beginners to understand overall view of Embedded Linux Systems.

Automated build system:

We have numerous automated build system is available as open source to name few of them.
1)Buildroot
2)OpenWRT
3)PTXdist
4)OpenBricks,
5)OpenEmbedded
6)Yocto, etc…

Among these let us choose Buildroot as our 1st step learning towards embedded system.
Reason for choosing Buildroot:
1)Very simple to use, and easily hackable code base.
2)Fast
3)Designed for small to medium sized embedded systems
when compared with yacto and Openembedded.

The Basic Element of Embedded Linux Software are :

1)Cross-compilation toolchain:- Compiler that runs on the development machine, but generates code for the target.
2)Bootloader:- Started by the hardware, responsible for basic initialization, loading and executing the kernel
3)Linux Kernel:-Contains the process and memory management, network stack, device drivers and provides services to user space applications
4)C library:- The interface between the kernel and the user space applications
5)RootFile System:-Individual component will be explained in detail later in upcoming blogs be stay tuned

Armed with this Knowledge will quickly have a hands on experience on building Embedded Linux System.

“Oh what the **** i don’t have Hardware and how can i get in to practical experience … Calm down well we have QEMU- virtual emulator”

Qemu-is a generic and open source machine emulator and visualizer.When used as a machine emulator, QEMU can run OSes and programs made for one machine (e.g. an ARM board) on a different machine

Download Buildroot:

1)wget http://buildroot.org/downloads/buildroot-2016.02.tar.bz2
2)Unzip the source code
$ tar xvf buildroot-2016.02.tar.bz2
3)cd buildroot-2016.02

Here will select Arm based Architecture which qemu is supporting .

4)make qemu_arm_versatile_defconfig

All config files are present in config folder.

This will generate default versatile configuration .config.

5)make menuconfig

Buildroot_5
Here one can select and change the configuration as of now will leave for default one.
Note: menuconfig requires ncurses library to launch UI.

6) make

ufff its time to take a break… give sometime to build to generate required Output Images.

7) check the readme.txt for command help

cat board/qemu/arm-versatile/readme.txt

Run the emulation with:

The login prompt will appear in the terminal that started Qemu. The
graphical window is the framebuffer.

8)qemu-system-arm -M versatilepb -kernel output/images/zImage -dtb output/images/versatile-pb.dtb -drive file=output/images/rootfs.ext2,if=scsi,format=raw -append "root=/dev/sda console=ttyAMA0,115200" -serial stdio -net nic,model=rtl8139 -net user

Buildroot_8Buildroot_9

This above command will emulate ARM Versatile Board.

9) login —> root

Yes Its booting .

This Blog is Just quick guide for beginners and upcoming blog will throw more light on Buildroot Internals and Embedded Linux.

Resources and References:

1)https://buildroot.org/
2)http://free-electrons.com/training/buildroot/
3)http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.set.boards/index.html
4)http://wiki.qemu.org/Main_Page

About VinayMahadev

I am passionate about Embedded Linux systems . I believe in "If you want to learn something, read about it. If you want to understand something, write about it. If you want to master something, teach it". Here I am just trying to connect the Dots.
This entry was posted in Uncategorized. Bookmark the permalink.

3 Responses to BuildRoot A Simplified way to kick start

  1. Pingback: Buildroot :- Inside Out – LearningFromU

  2. Manjunath Goudar says:

    Nice explanation Vinay keep it up………….

    Liked by 1 person

Leave a reply to VinayMahadev Cancel reply