0% found this document useful (0 votes)
72 views104 pages

Embedded LINUX Part10

The document discusses the root filesystem in embedded Linux systems. It explains that the root filesystem is the first filesystem mounted by the kernel and cannot be mounted like normal filesystems. If no root filesystem is specified, the kernel will panic. It also describes the initialization process, where the kernel mounts the root filesystem according to the "root=" option before starting other processes like init.

Uploaded by

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

Embedded LINUX Part10

The document discusses the root filesystem in embedded Linux systems. It explains that the root filesystem is the first filesystem mounted by the kernel and cannot be mounted like normal filesystems. If no root filesystem is specified, the kernel will panic. It also describes the initialization process, where the kernel mounts the root filesystem according to the "root=" option before starting other processes like init.

Uploaded by

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

Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

1 embedded_system

Embedded Linux
(PART 10)
• ROOT FILE SYSTEM

• FILE SYSTEM CONTENTS

• HOW TO CREATE A MINIMAL ROOT FILESYSTEM ?

• THE INIT PROCESS

• BUSYBOX

• FILE SYSTEM TYPES

• BUILD ROOT

• THIRD PROJECT

• PART9 APPENDIX

ENG.KEROLES SHENOUDA https://www.learn-in-depth.com/


https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

2 embedded_system

Root File System

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

3
Root File System
embedded_system

 File system is an approach on how the data can be


organized in order to have a meaningful read or write in a
system
 The method used to manage these groups of data can be
called as “File systems”
 The most commonly used media to store the data are
 Storage Devices
 Hard Drive
 Optical Discs
 Flash Memories
 RAM (Temporary)
 Network like NFS
https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

4
Filesystems
embedded_system

 Filesystems are mounted in a specific


location in this hierarchy of directories
 When a filesystem is mounted in a
directory (called mount point), the
contents of this directory reflects the
contents of the storage device
 When the filesystem is unmounted, the
mount point is empty again.
 This allows applications to access files
and directories easily, regardless of
their exact storage location

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

5
mount / umount
embedded_system

 mount allows to mount filesystems


 mount -t type device mountpoint

 type is the type of filesystem (optional for non-virtual filesystems)

 device is the storage device, or network location to mount

 mountpoint is the directory where files of the storage device or network


location will be accessible
 mount with no arguments shows the currently mounted filesystems

 umount allows to unmount filesystems


 This is needed before rebooting, or before unplugging a USB key, because
the Linux kernel caches writes in memory to increase performance. umount
makes sure that these writes are committed to the storage.
https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

the first C routine Press


here
#LEARN_IN DEPTH

#Be_professional_in

6
Root filesystem
embedded_system

start_kernel()

 As the root filesystem is the first


mounted filesystem, it cannot be
mounted with the normal mount command
 It is mounted directly by the kernel,

according to the root= kernel


option static void __init do_basic_setup(void)
{
 When no root filesystem is available, the cpuset_init_smp();

kernel panics
usermodehelper_init();
rest_init() do_basic_setup() init_tmpfs();
driver_init();
 Please append a correct "root=" boot option init_irq_proc();
do_ctors();
 Kernel panic - not syncing: VFS: Unable to mount root fs Kernel_init()
do_initcalls();
}
on unknown block(0,0) Init_post()
init process
https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

7
Kernel initialization
embedded_system

 The bootloader initializes the processor and board, and


uncompresses the kernel code to RAM, and calls the
kernel's start_kernel() function.
 Copies the command line from the bootloader
 Identifies the processor and machine.
 Initializes the console.
 Initializes kernel services (memory allocation, scheduling,
file cache...)
 Creates a new kernel thread (future init process) and
continues in the idle loop
 Initializes devices and execute initcalls
https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

8
Location of the root filesystem
embedded_system

 It can be mounted from different locations


• root=/dev/sdXY, where X is a letter indicating the device, and Y a number
▶ From the partition of a hard disk or indicating the partition
• /dev/sdb2 is the second partition of the second disk drive (either USB key or
▶ From the partition of a USB key ATA
▶ From the partition of an SD card
hard drive)

▶ From the partition of a NAND flash chip • root=/dev/mmcblkXpY, where X is a number indicating the device and Y a number
or similar type of storage device indicating the partition
• /dev/mmcblk0p2 is the second partition of the first device

▶ From the network, using the NFS protocol • root=/dev/mtdblockX, where X is the partition number
• /dev/mtdblock3 is the fourth partition of a NAND flash chip (if only one NAND
▶ From memory (initramfs), using a pre- flash chip is present)
loaded filesystem (by the bootloader) etc.
 It is up to the system designer to choose the setenv bootargs console=${console} root=/dev/nfs rootfstype=nfs
configuration for the system, and configure ip=dhcp nfsroot=10.0.0.20:/srv/nfs/test_fileystem
the kernel behavior with root=
root=/dev/ram0 https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press

File System Contents (bin)


here
#LEARN_IN DEPTH

#Be_professional_in

9 embedded_system

Basic programs
 Place for most commonly used terminal commands
 Common Linux commands you need to use in single-user modes are located
under this directory.
 Commands used by all the users of the system are located here.
Examples:
 – ls

 – ping

 – grep

 – cp

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

10 embedded_system

File System Contents

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here

File System Contents (sbin)


#LEARN_IN DEPTH

#Be_professional_in

11 embedded_system

Basic system programs


 Just like /bin, /sbin also contains binary executables.
 But, the Linux commands located under this directory are used typically
by system administrator, for system maintenance purpose
 Examples:
 reboot

 fdisk

 ifconfig

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press

File System Contents (boot)


here
#LEARN_IN DEPTH

#Be_professional_in

12 embedded_system

Kernel image (only when the kernel is loaded from a filesystem, not
common on non-x86 architectures)

 Contains files needed to start up the system, including the Linux kernel,
a RAM disk image and bootloader configuration files

 Kernel image (only when the kernel is loaded from a file system, not
common on non-x86 architectures)

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press

File System Contents (etc)


here
#LEARN_IN DEPTH

#Be_professional_in

13 embedded_system

System-wide configuration
 Contains configuration files required by all programs.

 This also contains startup and shutdown shell scripts used to


start/stop individual programs.
 Examples:
 – /etc/resolv.conf

 – /etc/logrotate.conf

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here

File System Contents (home)


#LEARN_IN DEPTH

#Be_professional_in

14 embedded_system

Directory for the users home directories


 Home directories for all users to store their personal files.
 Example:
 /home/karas

 /home/keroles

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press

File System Contents (lib)


here
#LEARN_IN DEPTH

#Be_professional_in

15 embedded_system

Basic libraries
 Contains library files that supports the binaries located under /bin
and /sbin

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

File System Contents (media)


#Be_professional_in

16 embedded_system

Mount points for removable media

 Temporary mount directory for removable devices.

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

File System Contents (mnt)


#Be_professional_in

17 embedded_system

Mount points for static media

 Temporary mount directory where sysadmins can mount file


systems

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press

File System Contents (tmp)


here
#LEARN_IN DEPTH

#Be_professional_in

18 embedded_system

/root
Temporary files
 Directory that contains temporary files created by system
and users
 Files under this directory are deleted when system is rebooted.

/sys
https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

File System Contents (usr) Press


here
#LEARN_IN DEPTH

#Be_professional_in

/usr/bin Non-basic programs 19 embedded_system

/root
/usr/lib Non-basic libraries
/usr/sbin Non-basic system programs

 Contains binaries, libraries, documentation, and source-code


for user programs.
 /usr/bin contains binary files for user programs. If you can’t find a user
binary under /bin, look under /usr/bin.
 /usr/sbin contains binary files for system administrators. If you can’t
find a system binary under /sbin, look under /usr/sbin.
 /usr/lib contains libraries for /usr/bin and /usr/sbin
 /usr/local contains users programs that you install from source

/sys
https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

File System Contents (var)


#Be_professional_in

20 embedded_system

/root
Variable data files

 var stands for variable files.


 Content of the files that are expected to grow can be found under this
directory.
 This includes
 /var/log - system log files

 /var/lib - packages and database files

 /var/mail - emails

 /var/spool - print queues

 /var/lock - lock files

 /var/tmp - temp files needed across reboots /sys


https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

21 embedded_system

Device Files

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press

File System Contents (dev)


here
#LEARN_IN DEPTH

#Be_professional_in

22 embedded_system

Device files
 These include terminal devices, usb, or any device attached to the system.
 Examples:
 /dev/tty1

 /dev/usbmon0

 One of the kernel important roles is to allow applications to access


hardware devices

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press

File System Contents (dev)


here
#LEARN_IN DEPTH

#Be_professional_in

23 embedded_system

Device files Cont.


 In the Linux kernel, most devices are presented to user space applications through two
different abstractions
 Character device
 Originally, an infinite stream of bytes, with no beginning, no end, no size. The pure example: a
serial port.
 Used for serial ports, terminals, but also sound cards, video acquisition devices, frame buffers.
 Most of the devices that are not block devices are represented as character devices by the Linux
kernel
 Block device
 A device composed of fixed-sized blocks, that can be read and written to store data
 Used for hard disks, USB keys, SD cards, etc.
 Internally, the kernel identifies each device by a triplet of information
 Type (character or block)
 Major (typically the category of device)
 Minor (typically the identifier of the device)
https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press

File System Contents (dev)


here
#LEARN_IN DEPTH

#Be_professional_in

24 embedded_system

Device files Cont.


 Devices>>>>>> everything is a file
 Most system objects are represented in Linux as files.
 It allows applications to manipulate all system objects with the normal file API
(open, read, write, close, etc.)
 So, devices had to be represented as files to the applications
 This is done through a special artifact called a device file

 It is a special type of file, that associates a file name visible to user space
applications to the triplet (type, major, minor) that the kernel understands
 All device files are by convention stored in the /dev directory

 Example of device files in a Linux system


 brw-rw---- 1 root disk 8, 1 2011-05-27 08:56 /dev/sda1
 crw-rw---- 1 root dialout 4, 64 2011-05-27 08:56 /dev/ttyS0
https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press

File System Contents (dev)


here
#LEARN_IN DEPTH

#Be_professional_in

25 embedded_system

Device files Cont.


 Example C code that uses the usual file API to write data to a serial port
int fd;
fd = open("/dev/ttyS0", O_RDWR);
write(fd, "Hello", 5);
close(fd);
 The devtmpfs virtual filesystem can be mounted on /dev and contains all the devices known to
the kernel. The CONFIG_DEVTMPFS_MOUNT kernel configuration option makes the kernel
mount it automatically at boot time

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

26 embedded_system

Pseudo Filesystems

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here

File System Contents (proc)


#LEARN_IN DEPTH

#Be_professional_in

27 embedded_system

Mount point for the proc virtual filesystem


 Contains information about system process.
 This is a pseudo file system contains information about running process.
 It allows
 The kernel to expose statistics about running processes in the system
 The user to adjust at runtime various system parameters about process
 management, memory management, etc.
 One directory for each running process in the system
 /proc/<pid> example: cat /proc/3840/cmdline
 It contains details about the files opened by the process, the CPU and memory usage, etc.
 /proc/interrupts, /proc/devices, /proc/iomem, /proc/ioports contain general device-related
information. (review the first three parts )
 /proc/cmdline contains the kernel command line
 /proc/sys contains many files that can be written to adjust kernel parameters
 They are called sysctl. See Documentation/sysctl/ in kernel sources. Example: echo 3 >
/proc/sys/vm/drop_caches https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

File System Contents (proc) 28 embedded_system

Mount point for the proc virtual filesystem (Examples)


 init Process /proc
 init Process Memory Segments from /proc

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

File System Contents (sys)


#Be_professional_in

29 embedded_system

/root
Mount point of the sysfs virtual filesystem

 Mount point of the sysfs virtual file


system
 This is a pseudo file system
 It allows to represent in user space the
vision that the kernel has of the buses,
devices and drivers in the system
 It is useful for various user space applications
that need to list and query the available
hardware, for example udev or mdev.
 ls /sys/
 block bus class dev devices firmware fs kernel
module power
/sys
https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

30
Systool utility
embedded_system

 Many utilities use this information to


determine the characteristics of
system devices
 You can see from this listing the
variety of system information
available from sysfs

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

31 embedded_system

How to create a minimal root filesystem ?

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

32
How to create a minimal root filesystem ?
embedded_system

 you need these components:


 init: This is the program that starts everything off, usually by running a
series of scripts.
 Shell: You need a shell to give you a command prompt, also to run the shell
scripts called by init and other programs.
 Daemons: A daemon is a background program that provides a service to
others. Good examples are the system log daemon (syslogd) and the
secure shell daemon (sshd). The init program must start the initial
population of daemons to support the main system applications. In fact,
init is itself a daemon: it is the daemon that provides the service of
launching other daemons.

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

33 embedded_system

How to create a minimal root filesystem ?Cont.

 Shared libraries: Most programs are linked with shared libraries, and
so they must be present in the root filesystem.
 Configuration files: The configuration for init and other daemons is
stored in a series of text files, usually in the /etc directory.
 Device nodes: These are the special files that give access to various
device drivers.
 /proc and /sys: These two pseudo filesystems represent kernel data
structures as a hierarchy of directories and files.
 Kernel modules: If you have configured some parts of your kernel to
be modules, they need to be installed in the root filesystem, usually in
/lib/modules/[kernel version].
https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

34
The init program
embedded_system

 init application is the first user space application started by


the kernel after mounting the root filesystem
 The kernel tries to run /sbin/init, /bin/init, /etc/init and /bin/sh.
 The init path can be supplied by the init= kernel argument.
 If none of them are found, the kernel panics and the boot
process is stopped.

 The init application is responsible for starting all other user


space applications and services

The final snippet of code from .../init/main.c


Shell
Daemons Other
(services) Application

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

35
In case we initramfs
embedded_system

 In the case of an initramfs, it will only


look for /init
 The init path can be supplied by the
rdinit= kernel argument
 Then will invoke the regular system
startup (/sbin/init)

/sbin/init

Shell
Daemons Other
(services) Application
https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

36 embedded_system

The Init Process

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

37
The init Program
embedded_system

 There are many possible implementations of


init
 BusyBox init

 System V init

 Systemd init

 init manages the lifecycle of the system


from boot up to shutdown
 The most used in embedded linux is
BusyBox init

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

null::sysinit:/bin/mount -t proc proc /proc #Be_professional_in

38
BusyBox init
embedded_system

null::sysinit:/bin/mount -t sysfs sysfs /sys


console::askfirst:-/bin/sh
 askfirst: This is the same as respawn, but it prints
 init begins by reading /etc/inittab. This the message Please press Enter to activate this
contains a list of programs to run, one per console to the console, and it runs the program
line, with this format: after Enter has been pressed. It is used to start
an interactive shell on a Terminal without
 <id>::<action>:<program> prompting for a username or password.
 id: This is the controlling Terminal for the  once: Runs the program once but does not attempt
command to restart it if it terminates.
 action: This is the conditions to run this  wait: Runs the program and waits for it to
command complete.
 program: This is the program to run  restart: Runs the program when init receives the
signal SIGHUP, indicating that it should reload the
 The actions are as follows: inittab file.
 sysinit: Runs the program when init starts  ctrlaltdel: Runs the program when init receives the
before any of the other types of Actions. signal, SIGINT, usually as a result of pressing Ctrl
 respawn: Runs the program and restarts it if + Alt + Del on the console.
it terminates. It is typically used to run a  shutdown: Runs the program when init shuts down.
program as a daemon.
https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

39
The init program
embedded_system

 The init program begins by reading the configuration file,


/etc/inittab ::sysinit:/etc/init.d/rcS
 simple example ::askfirst:-/bin/sh
 The first line runs a shell script rcS, when init is started.
 The second line prints the message Please press Enter to activate this console to
the console and starts a shell when you press Enter.
 The script called /etc/init.d/rcS is the place to put initialization
commands that need to be performed at boot, for example, mounting the
proc and sysfs filesystems
#!/bin/sh
 Make sure that you make rcS executable like this:
mount -t proc proc /proc
 $ cd ~/rootfs mount -t sysfs sysfs /sys
 $ chmod +x etc/init.d/rcS mount -t devtmpfs devtmpfs /dev
https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

40
Mdev in /etc/init.d/rcS
embedded_system

 allow you to modify the permissions of device nodes as they are


created.

 you begin by running mdevwith the -s option, which causes it to


scan the /sys directory looking for information about current devices.
 If you want to keep track of new devices coming online and create
nodes for them as well, you need to make mdev a hot plug client by
writing to /proc/sys/kernel/hotplug.
 These additions to /etc/init.d/rcS will achieve all of this:
#!/bin/sh
mount -t proc proc /proc
mount -t sysfs sysfs /sys
mount -t devtmpfs devtmpfs /dev
echo /sbin/mdev > /proc/sys/kernel/hotplug
mdev -s https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

41
Vexpress Arm Cortex A9 inittab
embedded_system

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

42 embedded_system

Busybox

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

43
Why Busybox?
embedded_system

 A Linux system needs a basic set of programs to work


 An init program
 A shell
 Various basic utilities for file manipulation and system configuration
 In normal Linux systems, these programs are provided by different
projects
 coreutils, bash, grep, sed, tar, wget, modutils, etc. are all different projects
 A lot of different components to integrate
 Busybox is an alternative solution, extremely common on embedded
systems
 For a fairly featureful configuration, less than 500 KB (statically compiled
with uClibc) or less than 1 MB (statically compiled with glibc).
 http://www.busybox.net/
https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

44
BusyBox commands
embedded_system

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

45 embedded_system

File System Types

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

46
File System Types
embedded_system

 RAM File Systems


 initrd
 initramfs
 Disk File Systems
 ext2
 ext3
 ext4
 Flash File Systems
 Intro to MTD
 JFFS2
 Distributed File Systems
 NFS
 Special Purpose File Systems
 Squashfs
 Mostly used in live CDs and live USB distros https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

47 embedded_system

Build Root

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

48
Embedded Linux build system: principle
embedded_system

 Building from source ! lot of flexibility


 Cross-compilation ! leveraging fast build Cross ToolChain
machines
 Recipes for building components ! Easy
Bootloader images
 two solutions are emerging as the most
popular ones Embedded Linux Build
Open-source
 Yocto/OpenEmbedded components
System
(BuildRoot) Kernel Images
 Builds a complete Linux distribution.
Powerful, but somewhat complex, and
quite steep learning curve.
RootFS
 Buildroot
 Builds a root filesystem image, Much
simpler to use, understand and modify.
Configurations

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

49
Who’s using Buildroot?
embedded_system

 System makers
 Tesla

 GoPro

 Barco

 Rockwell Collins

 Processor vendors
 Imagination Technologies

 Marvell

 Microchip (formerly Atmel)

 SoM and board vendors


 Many companies when doing R&D on products
 Many, many hobbyists on development boards: Raspberry Pi, BeagleBone Black, etc.
https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

50 embedded_system

Lab1: create your own rootfs by buildroot to be run on


vexpress CortexA9
THIS LAB IS BASED ON LAB1 ON PART9

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

51
Configuring Buildroot for vexpress CortexA9
embedded_system

based on RPI 2 Configuration as both based on


armv7 (think in Depth)

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

52
Configuring Buildroot for vexpress CortexA9.
embedded_system

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

53
Configuring Buildroot for vexpress CortexA9.
embedded_system

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

54
Configuring Buildroot for vexpress CortexA9.
embedded_system

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

55
Configuring Buildroot for vexpress CortexA9.
embedded_system

 Build options
 How Buildroot will built the code. Leave default values

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

Configuring Buildroot for vexpress CortexA9. 56


#Be_professional_in
embedded_system

Toolchain Embedded
Buildroot
system will be compiled with tools integrated in

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

Configuring Buildroot for vexpress CortexA9. 57


#Be_professional_in
embedded_system

Toolchain

Library (small size version)


containing the typical C
libraries used in Linux
environments (stdlib, stdio,
etc)

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

Configuring Buildroot for vexpress CortexA9. 58


#Be_professional_in
embedded_system

Toolchain

Source header
files of the Linux
Kernel.

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

Configuring Buildroot for vexpress CortexA9. 59


#Be_professional_in
embedded_system

Toolchain

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

Configuring Buildroot for vexpress CortexA9. 60


#Be_professional_in
embedded_system

Toolchain

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

Configuring Buildroot for vexpress CortexA9.


#Be_professional_in

61 embedded_system

Toolchain

Binutils contains tools


to manage the binary
files obtained in the
compilation of the
different applications

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

Configuring Buildroot for vexpress CortexA9.


#Be_professional_in

62 embedded_system

Toolchain

GCC tools version to


be installed

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

Configuring Buildroot for vexpress CortexA9.


#Be_professional_in

63 embedded_system

Toolchain
 Build cross gdb for the host
 Includes the support for
GDB. GCC debugger.
 Enable C++ support
 Including support for C++
programming, compiling, and
linking.
 Enable MMU support
 Yes

 Mandatory if building a Linux


system
https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

Configuring Buildroot for vexpress CortexA9.


#Be_professional_in

64 embedded_system

System Configuration
 System Hostname
 Name of the embedded system

 System Banner
 Banner

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

Configuring Buildroot for vexpress CortexA9.


#Be_professional_in

65 embedded_system

System Configuration
 Init System
 Busybox

 /dev management
 Dynamic using devtmpfs only

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

Configuring Buildroot for vexpress CortexA9.


#Be_professional_in

66 embedded_system

System Configuration
 Run a getty: Port to run a getty
 /dev/ttyAMA0 console
 Linux device file with the port to run getty (login) process. Uses
ttyAMA0 for serial port
 Baud rate to use
 115200

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here

Configuring Buildroot for vexpress CortexA9.


#LEARN_IN DEPTH

#Be_professional_in

67 embedded_system

System Configuration

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here

Configuring Buildroot for vexpress CortexA9.


#LEARN_IN DEPTH

#Be_professional_in

68 embedded_system

kernel

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here

Configuring Buildroot for vexpress CortexA9.


#LEARN_IN DEPTH

#Be_professional_in

69 embedded_system

Target Packages
 Busybox

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here

Configuring Buildroot for vexpress CortexA9.


#LEARN_IN DEPTH

#Be_professional_in

70 embedded_system

Filesystem Images

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here

Configuring Buildroot for vexpress CortexA9.


#LEARN_IN DEPTH

#Be_professional_in

71 embedded_system

Bootloaders

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here

Configuring Buildroot for vexpress CortexA9.


#LEARN_IN DEPTH

#Be_professional_in

72 embedded_system

Host utilities
 Choose the packages which
will be needed by host.

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

73
Compiling buildroot
embedded_system

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

74
Prepare SDCARD
embedded_system

 Copy the RootFS to the second partition

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

75
Prepare SDCARD Cont.
embedded_system

Don’t forget to crate a file under /dev with


ttyAMA0

sudo mknod rootfs/dev/ttyAMA0 c 204 64

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

76
Booting LINUX
embedded_system

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

77
Reaching to login
embedded_system

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

78 embedded_system

Third Project

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

79
Third Project
embedded_system

Uboot
Server ip =localhost
Linux
Server port = 8000 Kernel

Mount RootFS

/sbin/init

Client IPC Project SW


Server IPC Project SW
Virtual Vexpress CortexA9 QEMU SoC
UBUNTU PC Full Duplex
Communication
through Ethernet
https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

80 embedded_system

PART9 Appendix

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

81 embedded_system

Kernel Configuration examples


LEARN IN DEPTH

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

82
Kernel Configuration
embedded_system

 The kernel contains thousands of device drivers, The following is a list of the main menu options
filesystem drivers, network protocols and other available to all embedded Linux architectures:
configurable items • Code maturity level options
 The kernel configuration is the process of defining • General setup
the set of options with which you want your kernel to • Loadable module support
be compiled • Block layer
 The set of options depends • Networking
 On the target architecture and on your hardware (for
• Device drivers
device drivers, etc.) • Filesystems
 On the capabilities you would like to give to your kernel
• Kernel hacking
(network capabilities, filesystems, real-time, etc.). Such • Security options
generic options are available in all architectures. • Cryptographic options
• Library routines

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

83
General setup
embedded_system

 This section has three settings that you


should turn on:
 Support for paging of anonymous
memory Enables swap disk and file support
 System V IPC Enables interprocess
communication
 Sysctl support Enables kernel parameter
changes through /proc

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

84
General setup Cont.
embedded_system

 Option: "Local version - append to kernel release“


 Variable name: LOCALVERSION

 Append an extra string to the end of your kernel


version. This will show up when you type uname
 Option: Automatically append version information
to the version string
 Variable name: LOCALVERSION_AUTO

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

85
General setup Cont.
embedded_system

 Option: Support for paging of anonymous


memory (swap)
 Variable name: SWAP

 depends on MMU

 This option allows you to choose whether you want


to have support for so called swap devices or swap
files in your kernel that are used to provide more
virtual memory than the actual RAM present in
your computer

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

86
General setup Cont.
embedded_system

 Option: System V IPC


 Variable name: SYSVIPC

 depends on MMU

 Inter Process Communication is a suite of library


functions and system calls which let processes
(running programs) synchronize and exchange
information. It is generally considered to be a good
thing, and some programs won't run unless you say
Y here

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

87
General setup Cont.
embedded_system

 Option: POSIX Message Queues


 Variable name: POSIX_MQUEUE

 depends on NET && EXPERIMENTAL

 POSIX variant of message queues is a part


of IPC. In POSIX message queues every
message has a priority which decides about
succession of receiving it by a process. If
you want to compile and run programs
written e.g. for Solaris with use of its
POSIX message queues (functions mq_*)
say Y here

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

88
General setup Cont.
embedded_system

 Option: BSD Process Accounting


 Variable name: BSD_PROCESS_ACCT

 If you say Y here, a user level program will be able


to instruct the kernel (via a special system call) to
write process accounting information
to a file: whenever a process exits, information
about that process will be appended to the file by
the kernel
 Option: BSD Process Accounting version 3 file
format
 Variable name: BSD_PROCESS_ACCT_V3

 If you say Y here, the process accounting


information is written in a new file format that also
logs the process IDs of each process

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

89
General setup Cont.
embedded_system

 Option: Kernel .config support


 Variable name: IKCONFIG

 This option enables the complete Linux kernel ".config" file contents to be
saved in the kernel. It provides documentation of which kernel options are
used in a running kernel or in an on-disk kernel. This information can be
extracted from the kernel image file with the script scripts/extract-
ikconfig and used as input to rebuild the current kernel or to build another
kernel. It can also be extracted from a running kernel by reading
/proc/config.gz if enabled (below).

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

90
General setup Cont.
embedded_system

 Option: Cpuset support


 Variable name: CPUSETS
 This option will let you create and manage CPUSETs which
allow dynamically partitioning a system into sets of CPUs
and Memory Nodes and assigning tasks to run only within
those sets. This is primarily useful on large SMP or
NUMA (non uniform access memory) systems.

For example, the following sequence of commands will setup a cpuset


named "Charlie", containing just CPUs 2 and 3, and Memory Node 1,
and then start a subshell 'sh' in that cpuset:

mount -t cgroup -ocpuset cpuset /sys/fs/cgroup/cpuset


cd /sys/fs/cgroup/cpuset
mkdir Charlie
cd Charlie
/bin/echo 2-3 > cpuset.cpus
/bin/echo 1 > cpuset.mems
/bin/echo $$ > tasks
sh
# The subshell 'sh' is now running in cpuset Charlie
# The next line should display '/Charlie'
cat /proc/self/cpuset
https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

91
General setup Cont.
embedded_system

 Option: INITRAMFS_SOURCE

 This can be either a single cpio archive with a


.cpio suffix or a space-separated list of
directories and files for building the initramfs
image. A cpio archive should contain a filesystem
archive to be used as an initramfs image
 Option: INITRAMFS_ROOT_UID
 depends on INITRAMFS_SOURCE!="“
 This setting is only meaningful if the
INITRAMFS_SOURCE is contains a directory.
Setting this user ID (UID) to something other
than "0" will cause all files owned by that UID to
be owned by user root in the initial ramdisk image.

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

92
General setup Cont.
embedded_system

 Option: Optimize for size (Look out for broken


compilers!)
 Enabling this option will pass "-Os" instead of "-
O2" to gcc resulting in a smaller kernel.
WARNING: some versions of gcc may generate
incorrect code with this option. If problems are
observed, a gcc upgrade may be needed. If unsure,
say N.

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

93
General setup Cont.
embedded_system

 Option: Load all symbols for debugging/kksymoops


 Variable name: KALLSYMS
 This increases the size of the kernel somewhat, as all
symbols have to be loaded into the kernel image
 Option: Include all symbols in kallsyms
 Variable name: KALLSYMS_ALL
 Some debuggers can use kallsyms for other symbols too: say
Y here to include all symbols, if you need them and you don't
care about adding 300k to the size of your kernel. Say N.
 Option: Enable support for printk
 Variable name: PRINTK
 This option enables normal printk support. Removing it
eliminates most of the message strings from the kernel
image and makes the kernel more or less silent. As this
makes it very difficult to diagnose system problems, saying
N here is strongly discouraged.
https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press

Linux kernel/Loadable
here
#LEARN_IN DEPTH

#Be_professional_in

94 embedded_system

module support
 Option: Enable loadable module support
 variable name: MODULES
 Kernel modules are small pieces of compiled code which can be
inserted in the running kernel, rather than being permanently built
into the kernel
 Option: Module unloading
 variable name: MODULE_UNLOAD
 Without this option you will not be able to unload any modules
 Option: Forced module unloading
 variable name: MODULE_FORCE_UNLOAD
 This option allows you to force a module to unload, even if the
kernel believes it is unsafe: the kernel will remove the module
without waiting for anyone to stop using it (using the -f option to
rmmod).
 Option: Module versioning support (EXPERIMENTAL)
 variable name: MODVERSIONS
 Usually, you have to use modules compiled with your kernel. Saying
Y here makes it sometimes possible to use modules compiled for
different kernels, by adding enough information to the moduleS https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Linux
Press
here
#LEARN_IN DEPTH

#Be_professional_in

95 embedded_system

kernel/Block layer
 Option: "Enable the block layer“
 default y

 If this option is disabled, then blockdev files


will become unusable and some filesystems
(such as ext3) will become unavailable

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press

How to configure the Linux


here
#LEARN_IN DEPTH

#Be_professional_in

96 embedded_system

kernel/fs
 Select which
extension you
need.
 Pseudo
filesystems
 RAMFS
 Miscellaneous
filesystems

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

97
Networking
embedded_system

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press

Linux kernel/Device
here
#LEARN_IN DEPTH

#Be_professional_in

98 embedded_system

drivers

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

99
Linux kernel/Device drivers
embedded_system

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

100 embedded_system

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

101
References
embedded_system

 Embedded Linux training


 https://bootlin.com/training/
 Linux kernel and driver development training
 Yocto Project and OpenEmbedded development training
 Buildroot development training
 Building Embedded Linux Systems, 2nd Edition
 Mastering Embedded Linux Programming - Second Edition
 Christopher Hallinan, Embedded Linux Primer, Prentice Hall, 2006.
 Silberschatz, Galvin, and Gagne's Operating System Concepts, Eighth Edition.
 Robert love, linux kernel develoepemnt 3 rd edition 2010
 Advanced Linux Programming By Mark Mitchell, Jeffrey Oldham, Alex Samuel
 Linux OS in Embedded Systems & Linux Kernel Internals(2/2)
 Memory Management, Paging, Virtual Memory, File system and its implementation, Secondary
Storage(HDD), I/O systems

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

102
References Cont.
embedded_system

 Memory Management article


 Introduction to Operating Systems Class 9 - Memory Management
 Virtual Memory lecture for Introduction to Computer Architecture at
Uppsala University.
 OS Lecture Note 13 - Address translation, Caches and TLBs
 CSE 331 Operating Systems Design lectures
 CSE 331 Virtual Memory
 CSE 332 Computer Organization and Architecture
 File Systems: Fundamentals.
 Linux System Programming
 System Calls, POSIX I/O
CSE 333 Spring 2019, Justin Hsia

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

103
References Cont.
embedded_system

 File Permissions in Linux/Unix with Example


 Introduction to UNIX / Linux – 4
 12.2 Basic I/O Concepts
 Communicating with Hardware
 I/O Systems I/O Hardware Application I/O Interface
 COMPUTER ARCHITECTURE
 OS
 Linux Operating System
 W4118 Operating Systems, Instructor: Junfeng Yang
 CSNB334 Advanced Operating Systems 4. Process & Resource Management.
 Using the POSIX API
 Linux Memory Management
 Porting U-Boot and Linux on new ARM boards
 Chapter 2: Operating-System Structures
 POSIX Threads Programming
 U-Boot Environment Variables
https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/
Follow us

Press
here
#LEARN_IN DEPTH

#Be_professional_in

104
References Cont.
embedded_system

 Using U-boot as production test strategy -- really?


 TFTP Boot using u-boot
 Loading the kernel with TFTP and U-boot
 https://blog.3mdeb.com/2013/2013-06-07-0x5-qemu-network-configuration-and-tftp-for-virtual-
development-board/
 Installing and Testing TFTP Server in Ubuntu
 Pthreads: A shared memory programming model https://slideplayer.com/slide/8734550/
 Detailed Linux device tree
 Device Tree for DummIES
 Device Tree Usage
 Signal Handling in Linux Tushar B. Kute
 ARM case-study: the raspberry pi
 Introduction to Sockets Programming in C using TCP/IP
 The Broadcom chip used in the Raspberry Pi 2 Model B

https://www.learn-in-depth.com/
https://www.facebook.com/groups/embedded.system.KS/

You might also like