SlideShare a Scribd company logo
Root File System for
Embedded Systems
-By ALOK PAL
Batch:-Aug-2018,DESD
CDAC HYDERABAD
Agenda
 Introduction
 Types of file system
 Root file system content
 Mounting and unmounting of file system
 Libraries
 Root file system setup
 BusyBox
 Summary
What is Embedded Systems?
 It is a combination of Hardware and Software.
 Embedded = Hardware + Software
 “Embedded” means hidden inside so one can’t see it.
 “System” means hidden multiple components interfaced together for
a common purpose.
Introduction to file systems
 An OS can support more then one file system.
 Home directories for all users to store their personal files.
 Example: – /home/username
 Library file names are either ld* or lib*.so.*
 Examples: – ld-2.11.1.so
 – libncurses.so.5.7
 File systems can be discussed in the following context:
 – Contents
 – Types
 – Partitions
 Two major parts of a file system are User
File –naming system
File access systesm
What is Root File System?
 DATA stored on storage device in binary format as 1s and 0s form.
 It is impossible to understand files/folders from the sea of binary.
 File system was designed as a novel way to organize such data easily understandable by
all users.
 The software which provides the core support for implementing the Operating
System/Kernel.
/
bin lib …………..
dev home etc
Root/Top level
Directory
Types of file systems
 Block-device File Systems
 Flash File Systems
 Flash File Systems II
 In-Memory File system
 User Space File system
 Compressed Read-only File systems
 Linux Virtual File system
Block- device file systems
 Considers storage device as a simple linear collection of blocks or sectors.
 Size of blocks vary (512, 1024 …)
 Have two main operation : Read & Write
 Type of Devices:
 LBA devices (HDDs)
 FTL devices (USB flash drive, SD, SSDs etc).
 In case of bad blocks, the FTL or hardware (for LBA devices) takes care of
hiding from user.
 File system drivers : ext2, ext3, ext4, FAT, NTFS, ReiserFS etc.
Flash File Systems
 Mainly used on Raw Flash Devices
 Linux provides MTD as a primitive translation Layer.
 How are they Different?
 They are not block devices
 Mostly raw NAND / NOR storage media.
 They consist of ERASEBLOCKS
 Have 3 main operation : Read, Write & Erase block
 Each block has limited lifespan (1000s of write cycles)
 Needs write to be spread.
Flash File Systems II
 FTL devices Vs Raw Flash device
 FTL devices has a micro-controller which runs FTL firmware.
 Helps to emulate a block device.
 Why FFS is unique?
 Needs to spread write
 Perform Garbage collection
 Bad blocks handling
 Better reliability compared to FTL (Since FTL is vendor specific)
 E.g. UBIFS, JFFS2 etc.
In-Memory File system
 Uses primary memory e.g. RAM
 Features:
 Has higher I/O performance
 Volatile Memory
 E.g.:- ramfs, tmpfs, ramdisk.
 Why not ramdisk?
 It emulates block device in RAM.
 Block device store recently accessed files in caches. Hence using ramdisk creates a
large memory foot print
 Hard limit on max size of ram disk
User Space File system
 Mainly intended for block devices.
 Resides in the user space.
 Overhead of communicating to and from kernel and User space.
 Distinct Advantage:
 A bad user space file-system can never cause a system crash.
 E.g. ntfs-3g (New Technology File System-3rd generation).
 NTFS-3G supports all operations for writing files: files of any size can be
created, modified, renamed, moved, or deleted on NTFS partitions, it is a
proprietary file system developed by Microsoft.
Compressed Read-only File systems
 Read-only filesystem
 Data Stored in compressed format.
 Especially useful in low memory systems
 E.g.
 Cramfs:
 Metadata not stored (No time stamps or user permissions)
 Possible security issues.
 Max file system size = 256 MB
 Squashfs
 stores metadata information.
 Max filesystem size = 2^64.
Linux Virtual File system
 Role of VFS:
 Register/de-register
 Associate devices and file
system drivers.
 Generic File operations
 Caching
 Look ups
 Forward File-system specific
operation:
 Read
 Write
 etc
Root file system top-level directories
How to create Root file system?
 First make a directory for this purpose:-
 $ cd ${PRJROOT}/rootfs
 Now create the core root filesystem directories required for your system:-
 $ mkdir bin dev etc lib proc sbin sys tmp usr var
 $chmod 1777 tmp
 After this now you can proceed with this creation of /usr hierarchy:-
 $mkdir usr/bin usr/lib usr/sbin
 To demonstrate more give a command :- $ ls –al /usr
 The last entries to create are in the /var directory:-
 $mkdir var/lib var/lock var/log var/run var/tmp
 Chmod 1777 var/tmp
 The directories we created are the bare minimum required for the normal
operation of most application found in an embedded Linux system.
Mounting and unmounting of file system
 The access of the data are done using a process called as mounting
 A file system must be mounted in order to be usable by the system.
 For example, if you want to mount(access) a CD-ROM to the
directory /mnt/cdrom, you can type a command:-
 $ mount –t iso9660 /dev/cdrom/mnt/cdrom
 After mounting, you can use the cd command to navigate the newly available
file system through the mount point you just made.
 To unmount (remove) the file system from your system command is :-
 $ unmount /dev/cdrom
Libraries
 Shared library archives
 The glibc package contains a number of libraries.
 Glibc :- ${TARGET_PREFIX}/lib to see the entire listr of libraries installed
during the package’s build process.
 Ld:- dynamic linker , it is compulsory needed to use any shared libraries.
 Actual shared libraries formatted as:- libLIBRARY_NAME-GLIBC_VERSION.so
 Many people do not know that .so files are also executable ELF binaries that
can return useful information :- /lib/libc-2.5.so
 Static library archives
 These archives are used by applications that choose to link statically with a
library :- libLIBRARY_NAME.a.
Some more libraries for linux file system
 uClibc
 As with glibc, uClibc contains a number of libraries.it contains the same four
different types of files as the glibc directory.
 uClibc is meant to be a glibc replacement.
 $cd ${PREFIX}/uclibc/lib
 $for file in libuClibc ld-uClibc libc libdl
 Keeping the file system in RAM
 “Tmpfs” :-it is used as a Rootfs via the Initramfs.
 Tmpfs uses the linux page and dentry caches as temporary storage areas, it
saves memory in the common case where the embedded device frequently
uses system software and static data.
Some useful commands
 The DF(disk free) command :- $ df -k
 It displays the disk space usage in kilobytes.
 The Du(disk usage) command :- $ du –h
 It tells the size of root file system .
 And displays number of blocks consumed by each directory .
 A single block may take either 512 Bytes or 1 Kilo Byte depending on your
system.
 For kernel compilation :- arch/x86/boot/bzimage ; is ready command
 File vmlinux
 Vmlinux:- ELF 64_bit LSB executable, x86_64, version1
 If $du –h vmlinux ; command typed it will give size in MBs (45)
Root file system setup
 Characterizing :-
 ->online write support
 ->persistence
 ->power-down reliability
 -> compression
 E.g:- Cramfs
 Cramfs as a filesystem with a bare-minimum feature set, it is a very simple , and sometimes
simplistic, compressed and read-only filesystem aimed at embedded systems. There are no current (.)
or parent(..) directory entries.
 To build the utilities download the package, un-tar the archive, and issue the make command:-
 $ tar zxvf cramfs-1.1.tar.gz
 $cd cramfs-1.1
 $ make; unfortunately, the package Makefile does not provide an install target. Copy the tools in
appropriate directory: $ cp cramfs ${PREFIX}/bin/
 $ cd ${PRJROOT}
 $mkcramfs rootfs/image/cramfs.img
 bin boot dev etc lib linuxrc proc sbin tmp usr
 ‘bin’: addgroup…;
 ‘boot’: boot.b …;
 ‘sbin’: chroot…; in this case compression ratio 50% will be achieved.
BusyBox
 BusyBox implements most linux commands through a single executable that is less than
1 MB (statically linked with glibc) or less then 500KB(statically linked with uClibc)
 BusyBox is available under the GNU GPL
 By default BusyBox is dynamically linked with the C library.
 The project’s location is:- https://www.busybox.net this website includes
documentation , downloads , links, and a mailing list archive.
 After downloading and extracting the package, move into directory for the rest setup:
$cd ${PRJROOT}/sysapps/busybox-1.29.3 (latest stable version released on
9sep2018).
 Give a command : $ make help , it explains all the available Makefil targets, such as
make clean, make mrproper, and make install.
 Compilation:- by setting CONFIG_STATIC=y for BusyBox after configuration
 Now you can compile and install it When linking the glibc, use the command :- $ make
ARCH=ppc CROSS_COMPILE=powerpc-linux- >CONFIG_PREFIX=${PRJROOT}/rootfs install
 To build BusyBox with uClibc instead of the GNU C library, command is:-
 $ make ARCH=ppc CROSS_COMPILE=power-uclibc- 
 >CONFIG_PREFIX=${PRJROOT}/rootfs install , BusyBox is now installed on your target’s
root filesystem and ready to be used.
Summary
 Root file system can be volatile or non volatile in nature .
 If root file is present in RAM then it will be not persistence , because when power
goes Off it will be vanished, but if it present in the ROM then it will be always
persistence.
 E.g:- init ram fs can act as a root file system created by user inside the volatile
memory but it will not be present there after the system power Off.
 So the file system will implement three objects:-
 ->Files-that hold persistence data
 ->Open files:- that allows to access(mount)files
 ->Directories:- that name the files.
 You can create your own root file system ,some commands are :-
 $ ls ; to check the rootfile is present or not
 $bin linuxrc sbin usr
 $du –h :- tells size of the root file system
 $ ls etc/proc
 $ ls –al
 BusyBox init:- sysinit, respawn, askfirst,wait once, ctrlaltdel,shutdown, restart
Root file system for embedded systems

More Related Content

What's hot

Memory Forensics
Memory ForensicsMemory Forensics
Memory Forensics
Prince Boonlia
 
Introduction to the DAOS Scale-out object store (HLRS Workshop, April 2017)
Introduction to the DAOS Scale-out object store (HLRS Workshop, April 2017)Introduction to the DAOS Scale-out object store (HLRS Workshop, April 2017)
Introduction to the DAOS Scale-out object store (HLRS Workshop, April 2017)
Johann Lombardi
 
Embedded Linux Kernel - Build your custom kernel
Embedded Linux Kernel - Build your custom kernelEmbedded Linux Kernel - Build your custom kernel
Embedded Linux Kernel - Build your custom kernel
Emertxe Information Technologies Pvt Ltd
 
Linux device drivers
Linux device drivers Linux device drivers
Part 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module ProgrammingPart 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module Programming
Tushar B Kute
 
Linux Memory Management
Linux Memory ManagementLinux Memory Management
Linux Memory ManagementNi Zo-Ma
 
Linux kernel modules
Linux kernel modulesLinux kernel modules
Linux kernel modules
Eddy Reyes
 
Linux Kernel Module - For NLKB
Linux Kernel Module - For NLKBLinux Kernel Module - For NLKB
Linux Kernel Module - For NLKB
shimosawa
 
Virtualization Support in ARMv8+
Virtualization Support in ARMv8+Virtualization Support in ARMv8+
Virtualization Support in ARMv8+
Aananth C N
 
BusyBox for Embedded Linux
BusyBox for Embedded LinuxBusyBox for Embedded Linux
BusyBox for Embedded Linux
Emertxe Information Technologies Pvt Ltd
 
Storage Management in Linux OS.ppt
Storage Management in Linux OS.pptStorage Management in Linux OS.ppt
Storage Management in Linux OS.ppt
Rakesh Kadu
 
Introduction to Modern U-Boot
Introduction to Modern U-BootIntroduction to Modern U-Boot
Introduction to Modern U-Boot
GlobalLogic Ukraine
 
U-Boot - An universal bootloader
U-Boot - An universal bootloader U-Boot - An universal bootloader
U-Boot - An universal bootloader
Emertxe Information Technologies Pvt Ltd
 
U Boot or Universal Bootloader
U Boot or Universal BootloaderU Boot or Universal Bootloader
U Boot or Universal Bootloader
Satpal Parmar
 
Data-Intensive Workflows with DAOS
Data-Intensive Workflows with DAOSData-Intensive Workflows with DAOS
Data-Intensive Workflows with DAOS
Johann Lombardi
 
Trusted firmware deep_dive_v1.0_
Trusted firmware deep_dive_v1.0_Trusted firmware deep_dive_v1.0_
Trusted firmware deep_dive_v1.0_
Linaro
 
Continguous Memory Allocator in the Linux Kernel
Continguous Memory Allocator in the Linux KernelContinguous Memory Allocator in the Linux Kernel
Continguous Memory Allocator in the Linux Kernel
Kernel TLV
 
Linux Locking Mechanisms
Linux Locking MechanismsLinux Locking Mechanisms
Linux Locking Mechanisms
Kernel TLV
 
Linux Kernel Booting Process (1) - For NLKB
Linux Kernel Booting Process (1) - For NLKBLinux Kernel Booting Process (1) - For NLKB
Linux Kernel Booting Process (1) - For NLKB
shimosawa
 

What's hot (20)

Memory Forensics
Memory ForensicsMemory Forensics
Memory Forensics
 
Introduction to the DAOS Scale-out object store (HLRS Workshop, April 2017)
Introduction to the DAOS Scale-out object store (HLRS Workshop, April 2017)Introduction to the DAOS Scale-out object store (HLRS Workshop, April 2017)
Introduction to the DAOS Scale-out object store (HLRS Workshop, April 2017)
 
Embedded Linux Kernel - Build your custom kernel
Embedded Linux Kernel - Build your custom kernelEmbedded Linux Kernel - Build your custom kernel
Embedded Linux Kernel - Build your custom kernel
 
Linux device drivers
Linux device drivers Linux device drivers
Linux device drivers
 
Part 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module ProgrammingPart 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module Programming
 
Linux Memory Management
Linux Memory ManagementLinux Memory Management
Linux Memory Management
 
Linux kernel modules
Linux kernel modulesLinux kernel modules
Linux kernel modules
 
Linux Kernel Module - For NLKB
Linux Kernel Module - For NLKBLinux Kernel Module - For NLKB
Linux Kernel Module - For NLKB
 
Virtualization Support in ARMv8+
Virtualization Support in ARMv8+Virtualization Support in ARMv8+
Virtualization Support in ARMv8+
 
Basic Linux Internals
Basic Linux InternalsBasic Linux Internals
Basic Linux Internals
 
BusyBox for Embedded Linux
BusyBox for Embedded LinuxBusyBox for Embedded Linux
BusyBox for Embedded Linux
 
Storage Management in Linux OS.ppt
Storage Management in Linux OS.pptStorage Management in Linux OS.ppt
Storage Management in Linux OS.ppt
 
Introduction to Modern U-Boot
Introduction to Modern U-BootIntroduction to Modern U-Boot
Introduction to Modern U-Boot
 
U-Boot - An universal bootloader
U-Boot - An universal bootloader U-Boot - An universal bootloader
U-Boot - An universal bootloader
 
U Boot or Universal Bootloader
U Boot or Universal BootloaderU Boot or Universal Bootloader
U Boot or Universal Bootloader
 
Data-Intensive Workflows with DAOS
Data-Intensive Workflows with DAOSData-Intensive Workflows with DAOS
Data-Intensive Workflows with DAOS
 
Trusted firmware deep_dive_v1.0_
Trusted firmware deep_dive_v1.0_Trusted firmware deep_dive_v1.0_
Trusted firmware deep_dive_v1.0_
 
Continguous Memory Allocator in the Linux Kernel
Continguous Memory Allocator in the Linux KernelContinguous Memory Allocator in the Linux Kernel
Continguous Memory Allocator in the Linux Kernel
 
Linux Locking Mechanisms
Linux Locking MechanismsLinux Locking Mechanisms
Linux Locking Mechanisms
 
Linux Kernel Booting Process (1) - For NLKB
Linux Kernel Booting Process (1) - For NLKBLinux Kernel Booting Process (1) - For NLKB
Linux Kernel Booting Process (1) - For NLKB
 

Similar to Root file system for embedded systems

101 4.1 create partitions and filesystems
101 4.1 create partitions and filesystems101 4.1 create partitions and filesystems
101 4.1 create partitions and filesystemsAcácio Oliveira
 
File system hiearchy
File system hiearchyFile system hiearchy
File system hiearchy
sritolia
 
Edubooktraining
EdubooktrainingEdubooktraining
Edubooktraining
norhloudspeaker
 
Unix Administration
Unix AdministrationUnix Administration
Unix Administration
Nishant Munjal
 
Files and directories in Linux 6
Files and directories  in Linux 6Files and directories  in Linux 6
Files and directories in Linux 6
Meenakshi Paul
 
Root file system
Root file systemRoot file system
Root file system
Bindu U
 
CIT173_Ch15_Mnstr_23.pdf
CIT173_Ch15_Mnstr_23.pdfCIT173_Ch15_Mnstr_23.pdf
CIT173_Ch15_Mnstr_23.pdf
LilyMorningstar1
 
Lamp ppt
Lamp pptLamp ppt
Lamp pptReka
 
Linux directory structure by jitu mistry
Linux directory structure by jitu mistryLinux directory structure by jitu mistry
Linux directory structure by jitu mistry
JITU MISTRY
 
Linux basics
Linux basics Linux basics
Linux basics
suniljosekerala
 
Linux
LinuxLinux
Building Mini Embedded Linux System for X86 Arch
Building Mini Embedded Linux System for X86 ArchBuilding Mini Embedded Linux System for X86 Arch
Building Mini Embedded Linux System for X86 Arch
Sherif Mousa
 
Unix Administration 4
Unix Administration 4Unix Administration 4
Unix Administration 4
Information Technology
 

Similar to Root file system for embedded systems (20)

101 4.1 create partitions and filesystems
101 4.1 create partitions and filesystems101 4.1 create partitions and filesystems
101 4.1 create partitions and filesystems
 
File system discovery
File system discovery File system discovery
File system discovery
 
File system hiearchy
File system hiearchyFile system hiearchy
File system hiearchy
 
Edubooktraining
EdubooktrainingEdubooktraining
Edubooktraining
 
Unix Administration
Unix AdministrationUnix Administration
Unix Administration
 
Lamp ppt
Lamp pptLamp ppt
Lamp ppt
 
Linux filesystemhierarchy
Linux filesystemhierarchyLinux filesystemhierarchy
Linux filesystemhierarchy
 
Files and directories in Linux 6
Files and directories  in Linux 6Files and directories  in Linux 6
Files and directories in Linux 6
 
Root file system
Root file systemRoot file system
Root file system
 
CIT173_Ch15_Mnstr_23.pdf
CIT173_Ch15_Mnstr_23.pdfCIT173_Ch15_Mnstr_23.pdf
CIT173_Ch15_Mnstr_23.pdf
 
Lamp ppt
Lamp pptLamp ppt
Lamp ppt
 
Linux directory structure by jitu mistry
Linux directory structure by jitu mistryLinux directory structure by jitu mistry
Linux directory structure by jitu mistry
 
Linux basics
Linux basics Linux basics
Linux basics
 
Linux
LinuxLinux
Linux
 
Building Mini Embedded Linux System for X86 Arch
Building Mini Embedded Linux System for X86 ArchBuilding Mini Embedded Linux System for X86 Arch
Building Mini Embedded Linux System for X86 Arch
 
Unix Administration 4
Unix Administration 4Unix Administration 4
Unix Administration 4
 
Sahul
SahulSahul
Sahul
 
Sahul
SahulSahul
Sahul
 
beginner.en.print
beginner.en.printbeginner.en.print
beginner.en.print
 
beginner.en.print
beginner.en.printbeginner.en.print
beginner.en.print
 

Recently uploaded

In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
AMB-Review
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
Cyanic lab
 
Enterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptxEnterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptx
QuickwayInfoSystems3
 
Launch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in MinutesLaunch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in Minutes
Roshan Dwivedi
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
Globus
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Globus
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
wottaspaceseo
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
informapgpstrackings
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
Globus
 
Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)
abdulrafaychaudhry
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
Neo4j
 
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptxText-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
ShamsuddeenMuhammadA
 

Recently uploaded (20)

In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
 
Enterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptxEnterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptx
 
Launch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in MinutesLaunch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in Minutes
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
 
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptxText-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
 

Root file system for embedded systems

  • 1. Root File System for Embedded Systems -By ALOK PAL Batch:-Aug-2018,DESD CDAC HYDERABAD
  • 2. Agenda  Introduction  Types of file system  Root file system content  Mounting and unmounting of file system  Libraries  Root file system setup  BusyBox  Summary
  • 3. What is Embedded Systems?  It is a combination of Hardware and Software.  Embedded = Hardware + Software  “Embedded” means hidden inside so one can’t see it.  “System” means hidden multiple components interfaced together for a common purpose.
  • 4. Introduction to file systems  An OS can support more then one file system.  Home directories for all users to store their personal files.  Example: – /home/username  Library file names are either ld* or lib*.so.*  Examples: – ld-2.11.1.so  – libncurses.so.5.7  File systems can be discussed in the following context:  – Contents  – Types  – Partitions  Two major parts of a file system are User File –naming system File access systesm
  • 5. What is Root File System?  DATA stored on storage device in binary format as 1s and 0s form.  It is impossible to understand files/folders from the sea of binary.  File system was designed as a novel way to organize such data easily understandable by all users.  The software which provides the core support for implementing the Operating System/Kernel. / bin lib ………….. dev home etc Root/Top level Directory
  • 6. Types of file systems  Block-device File Systems  Flash File Systems  Flash File Systems II  In-Memory File system  User Space File system  Compressed Read-only File systems  Linux Virtual File system
  • 7. Block- device file systems  Considers storage device as a simple linear collection of blocks or sectors.  Size of blocks vary (512, 1024 …)  Have two main operation : Read & Write  Type of Devices:  LBA devices (HDDs)  FTL devices (USB flash drive, SD, SSDs etc).  In case of bad blocks, the FTL or hardware (for LBA devices) takes care of hiding from user.  File system drivers : ext2, ext3, ext4, FAT, NTFS, ReiserFS etc.
  • 8. Flash File Systems  Mainly used on Raw Flash Devices  Linux provides MTD as a primitive translation Layer.  How are they Different?  They are not block devices  Mostly raw NAND / NOR storage media.  They consist of ERASEBLOCKS  Have 3 main operation : Read, Write & Erase block  Each block has limited lifespan (1000s of write cycles)  Needs write to be spread.
  • 9. Flash File Systems II  FTL devices Vs Raw Flash device  FTL devices has a micro-controller which runs FTL firmware.  Helps to emulate a block device.  Why FFS is unique?  Needs to spread write  Perform Garbage collection  Bad blocks handling  Better reliability compared to FTL (Since FTL is vendor specific)  E.g. UBIFS, JFFS2 etc.
  • 10. In-Memory File system  Uses primary memory e.g. RAM  Features:  Has higher I/O performance  Volatile Memory  E.g.:- ramfs, tmpfs, ramdisk.  Why not ramdisk?  It emulates block device in RAM.  Block device store recently accessed files in caches. Hence using ramdisk creates a large memory foot print  Hard limit on max size of ram disk
  • 11. User Space File system  Mainly intended for block devices.  Resides in the user space.  Overhead of communicating to and from kernel and User space.  Distinct Advantage:  A bad user space file-system can never cause a system crash.  E.g. ntfs-3g (New Technology File System-3rd generation).  NTFS-3G supports all operations for writing files: files of any size can be created, modified, renamed, moved, or deleted on NTFS partitions, it is a proprietary file system developed by Microsoft.
  • 12. Compressed Read-only File systems  Read-only filesystem  Data Stored in compressed format.  Especially useful in low memory systems  E.g.  Cramfs:  Metadata not stored (No time stamps or user permissions)  Possible security issues.  Max file system size = 256 MB  Squashfs  stores metadata information.  Max filesystem size = 2^64.
  • 13. Linux Virtual File system  Role of VFS:  Register/de-register  Associate devices and file system drivers.  Generic File operations  Caching  Look ups  Forward File-system specific operation:  Read  Write  etc
  • 14. Root file system top-level directories
  • 15. How to create Root file system?  First make a directory for this purpose:-  $ cd ${PRJROOT}/rootfs  Now create the core root filesystem directories required for your system:-  $ mkdir bin dev etc lib proc sbin sys tmp usr var  $chmod 1777 tmp  After this now you can proceed with this creation of /usr hierarchy:-  $mkdir usr/bin usr/lib usr/sbin  To demonstrate more give a command :- $ ls –al /usr  The last entries to create are in the /var directory:-  $mkdir var/lib var/lock var/log var/run var/tmp  Chmod 1777 var/tmp  The directories we created are the bare minimum required for the normal operation of most application found in an embedded Linux system.
  • 16. Mounting and unmounting of file system  The access of the data are done using a process called as mounting  A file system must be mounted in order to be usable by the system.  For example, if you want to mount(access) a CD-ROM to the directory /mnt/cdrom, you can type a command:-  $ mount –t iso9660 /dev/cdrom/mnt/cdrom  After mounting, you can use the cd command to navigate the newly available file system through the mount point you just made.  To unmount (remove) the file system from your system command is :-  $ unmount /dev/cdrom
  • 17. Libraries  Shared library archives  The glibc package contains a number of libraries.  Glibc :- ${TARGET_PREFIX}/lib to see the entire listr of libraries installed during the package’s build process.  Ld:- dynamic linker , it is compulsory needed to use any shared libraries.  Actual shared libraries formatted as:- libLIBRARY_NAME-GLIBC_VERSION.so  Many people do not know that .so files are also executable ELF binaries that can return useful information :- /lib/libc-2.5.so  Static library archives  These archives are used by applications that choose to link statically with a library :- libLIBRARY_NAME.a.
  • 18. Some more libraries for linux file system  uClibc  As with glibc, uClibc contains a number of libraries.it contains the same four different types of files as the glibc directory.  uClibc is meant to be a glibc replacement.  $cd ${PREFIX}/uclibc/lib  $for file in libuClibc ld-uClibc libc libdl  Keeping the file system in RAM  “Tmpfs” :-it is used as a Rootfs via the Initramfs.  Tmpfs uses the linux page and dentry caches as temporary storage areas, it saves memory in the common case where the embedded device frequently uses system software and static data.
  • 19. Some useful commands  The DF(disk free) command :- $ df -k  It displays the disk space usage in kilobytes.  The Du(disk usage) command :- $ du –h  It tells the size of root file system .  And displays number of blocks consumed by each directory .  A single block may take either 512 Bytes or 1 Kilo Byte depending on your system.  For kernel compilation :- arch/x86/boot/bzimage ; is ready command  File vmlinux  Vmlinux:- ELF 64_bit LSB executable, x86_64, version1  If $du –h vmlinux ; command typed it will give size in MBs (45)
  • 20. Root file system setup  Characterizing :-  ->online write support  ->persistence  ->power-down reliability  -> compression  E.g:- Cramfs  Cramfs as a filesystem with a bare-minimum feature set, it is a very simple , and sometimes simplistic, compressed and read-only filesystem aimed at embedded systems. There are no current (.) or parent(..) directory entries.  To build the utilities download the package, un-tar the archive, and issue the make command:-  $ tar zxvf cramfs-1.1.tar.gz  $cd cramfs-1.1  $ make; unfortunately, the package Makefile does not provide an install target. Copy the tools in appropriate directory: $ cp cramfs ${PREFIX}/bin/  $ cd ${PRJROOT}  $mkcramfs rootfs/image/cramfs.img  bin boot dev etc lib linuxrc proc sbin tmp usr  ‘bin’: addgroup…;  ‘boot’: boot.b …;  ‘sbin’: chroot…; in this case compression ratio 50% will be achieved.
  • 21. BusyBox  BusyBox implements most linux commands through a single executable that is less than 1 MB (statically linked with glibc) or less then 500KB(statically linked with uClibc)  BusyBox is available under the GNU GPL  By default BusyBox is dynamically linked with the C library.  The project’s location is:- https://www.busybox.net this website includes documentation , downloads , links, and a mailing list archive.  After downloading and extracting the package, move into directory for the rest setup: $cd ${PRJROOT}/sysapps/busybox-1.29.3 (latest stable version released on 9sep2018).  Give a command : $ make help , it explains all the available Makefil targets, such as make clean, make mrproper, and make install.  Compilation:- by setting CONFIG_STATIC=y for BusyBox after configuration  Now you can compile and install it When linking the glibc, use the command :- $ make ARCH=ppc CROSS_COMPILE=powerpc-linux- >CONFIG_PREFIX=${PRJROOT}/rootfs install  To build BusyBox with uClibc instead of the GNU C library, command is:-  $ make ARCH=ppc CROSS_COMPILE=power-uclibc-  >CONFIG_PREFIX=${PRJROOT}/rootfs install , BusyBox is now installed on your target’s root filesystem and ready to be used.
  • 22. Summary  Root file system can be volatile or non volatile in nature .  If root file is present in RAM then it will be not persistence , because when power goes Off it will be vanished, but if it present in the ROM then it will be always persistence.  E.g:- init ram fs can act as a root file system created by user inside the volatile memory but it will not be present there after the system power Off.  So the file system will implement three objects:-  ->Files-that hold persistence data  ->Open files:- that allows to access(mount)files  ->Directories:- that name the files.  You can create your own root file system ,some commands are :-  $ ls ; to check the rootfile is present or not  $bin linuxrc sbin usr  $du –h :- tells size of the root file system  $ ls etc/proc  $ ls –al  BusyBox init:- sysinit, respawn, askfirst,wait once, ctrlaltdel,shutdown, restart