0% found this document useful (0 votes)
53 views6 pages

Buildroot Rootfs Only

Uploaded by

dungnt02121211
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views6 pages

Buildroot Rootfs Only

Uploaded by

dungnt02121211
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
You are on page 1/ 6

Build root - make root FS only

Build root can help us to generate only a root file system:


We can use it to split our entire builds into separate builds in case we will need to make clean one of
them.
Sometimes we must do make clean because we added a package and we still got an error.
For example.
We add PNG support for QT5 after we already built the image.
We added libmount and blueZ after we have the image ready.
Those operation and many others in buildroot will require to to clean and make which will takes
time.
For example. We can seperate the kernel build and root file system into two separate directories and
each one will create the files we need.

When we build , for example raspberry pi 3 full image , we get:


two partitions , boot( as FAT16) and ext2,3 or 4 as we select

Suppose we want only to compile the root file system. The rootfs.ext4 and only that one to copy to
the image.

The steps can be as follow:


1. Do create a full image, compile your kernel , file system.
2. Copy that folder into a new folder , and remove everything related to kernel.
3. flash the rootfs.ext2 or 4 into the sd card only using dd command

This task of using rootfs buildroot only require a lot of attension because there are option that affect
the kernel , for example , when adding firmware options like bluetooth and wifii , it add drivers to
the kernel build, there for a kernel should be build again.

When building rootfs only really require that only rootfs related packages will be selected.
Before we start:
We want to use xconfig , for that we need to install QT 4

We need QT4 dev tools:


https://askubuntu.com/questions/520864/how-to-install-needed-qt-packages-to-build-kernel-on-14-
04

sudo apt-get update


sudo apt-get install libqt4-dev pkg-config

or full:
sudo apt-get install -y build-essential kernel-package libncurses5-dev bzip2 bin86 qt4-
dev-tools wget libncurses5 git-core nautilus-open-terminal

I will start with the raspberry pi 3 defconfig , for the 32 bit arm
make raspberrypi3_defconfig
#
# configuration written to /home/first/buildroot/buildroot-2017.05/.config
#
it will copy the config to the current directory as .config
and this is the file make xconfig or make menuconfig will work on.

Run
make xconfig
and in kernel , uncheck the linux kernel-package

Two changes to build options:

for savedef config and a common place for the downloads.

We learned already how to build a compiler using crosstool-ng and


how to tell buildroot to use this compiler as external pre built compiler:
When I built the cross tool ng for arm hf compiler it was for 32 bit compiler.
It must match the settings of the buildroot
Some notes:

prefix is the name of the compiler without the -gcc or -g++, just the name
the path is without the bin directory

in hardware and handling

We should remove the rpi-firmware or any other firmware.


Why? As mentioned , the firmware are also drivers modules that are located in the linux kernel,
which we are not compiling now.
we are ready to start the build:

type
make

using external pre-build cross compile will save us about an hour in the build.

We can see how much time it takes:

8.9.Graphing the build duration (from buildroot manual)


make graph-build

see prerequisites in 8.9


https://buildroot.org/downloads/manual/manual.html#_graphing_the_build_duration

install python:
https://askubuntu.com/questions/101591/how-do-i-install-the-latest-python-2-7-x-or-3-x-on-ubuntu

install matplotlib
https://matplotlib.org/users/installing.html
The root fs file is about 63 mega:
rw-r--r-- 1 first first 62914560 Jun 2 01:17 output/images/rootfs.ext2

Using gparted ( sudo apt-get install gparted)


we can see the partitions on the sd card

At the end , we will have a rootfs.ext4 in output/images.


Buildroot will try to run the script that produce the entire image , but it will failed to find all the
files
We can ignore those error, what we need is only the the rootfs.ext4

ln -sf rootfs.ext2 /home/first/buildroot/blrpi3_32_extcompiler/buildroot-2017.05/output/images/


rootfs.ext4
>>> Executing post-image script board/raspberrypi3/post-image.sh
grep: /home/first/buildroot/blrpi3_32_extcompiler/buildroot-2017.05/output/images/rpi-firmware/
config.txt: No such file or directory
Adding 'dtoverlay=pi3-miniuart-bt' to config.txt (fixes ttyAMA0 serial console).
board/raspberrypi3/post-image.sh: 12: board/raspberrypi3/post-image.sh: cannot create
/home/first/buildroot/blrpi3_32_extcompiler/buildroot-2017.05/output/images/rpi-firmware/
config.txt: Directory nonexistent
file(bcm2710-rpi-3-b.dtb): stat(/home/first/buildroot/blrpi3_32_extcompiler/buildroot-2017.05/
output/images/bcm2710-rpi-3-b.dtb) failed: No such file or directory
vfat(boot.vfat): could not setup bcm2710-rpi-3-b.dtb
make[1]: *** [target-post-image] Error 1
make: *** [_all] Error 2
first@eliaradfirst:~/buildroot/blrpi3_32_extcompiler/buildroot-2017.05$ ls
output/images/rootfs.ext

using gpared we can see our previous disk image


the partition was created before when I did a full image build with buildroot.

Now lets copy using dd command , the file system that we built into the second partition and
replace the existing one:
If it is the first time, just create the two partitions using gparted.

let's move to output/images

sudo dd if=rootfs.ext4 of=/dev/sdb2

if = is the source
of = the destination

122880+0 records in
122880+0 records out
62914560 bytes (63 MB) copied, 52.5073 s, 1.2 MB/s

Suggestion to work flow:


* Create your entire image , with rootfs , kernel and boot files.
* Test it on your raspberry pi 3.
* now copy the buildroot directory into two directories.
1. Kernel
2.rootfs
In the kernel , just leave a kernel options checked.
In the root fs just leave rootfs options checked.

You might also like