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.
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.
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
2)Unzip the source code $ tar xvf buildroot-2016.02.tar.bz2
Here will select Arm based Architecture which qemu is supporting .
All config files are present in config folder.
This will generate default versatile configuration .config.
Here one can select and change the configuration as of now will leave for default one.
Note: menuconfig requires ncurses library to launch UI.
ufff its time to take a break… give sometime to build to generate required Output Images.
7) check the readme.txt for command help
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
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: