SlideShare a Scribd company logo
Linux Minimal OS For X86
   Facebook group: Learn To Be
   Official website: www.L2b-egypt.org

   Prepared By: SHATRIX
   E-Mail: eng.shatrix@gmail.com



Learn To Be                              Embedded Linux Training
2




          A Very Expert Was Once A Beginner



              Learn The Way, Forget It, Then
                   Find Your Own Way


Learn To Be                              Embedded Linux Training
3


Introduction
  • This tutorial will show you how to create your own
    "Minimal Linux Distribution" on a USB Flash memory.
  • You will learn about:
      ▫ The FHS (Filesystem Hierarchy Standard).
      ▫ Linux minimal common commands that make the system start and
        operate well.
      ▫ How to deal with Grub bootloader (install, edit configuration files).
      ▫ How to use the Linux kernel.
      ▫ Dealing with some root commands (mount, mkfs.ext2, grub-install)
  • It is considered a good start for those people who want
    to enter the field of Embedded Linux Systems

                     PS: Development on UBUNTU 10.10
Learn To Be                                                       Embedded Linux Training
4


Prerequisites:
  • You will need to install these packages first on Ubuntu
    10.10
      ▫ sudo apt-get update
      ▫ sudo apt-get install ncurses-dev bison texinfo flex
  • You should be good in working with at least one Linux
    distribution like UBUNTU, and can understand the
    command you write and its options.




Learn To Be                                        Embedded Linux Training
5


Basic Linux Structure
  • Any Linux distribution consists of some main components:
      ▫ Root Filesystem (main directories and sub directories).
      ▫ Linux Kernel image with or without initram filesystem
        (initrd.img).
      ▫ Configuration files and startup scripts in the (/etc) directory.
      ▫ Essential Linux commands needed for system to start and
        operate well.
      ▫ C & GCC Shared Libraries needed for any C or C++ application
        to run.
      ▫ Boot Loader to start the system from its storage media.
      ▫ GUI system or not.
      ▫ Extra Programs.
  • So, we will minimize all these components to get the
    minimal Linux distribution that works very well on any X86
    CPU.

Learn To Be                                              Embedded Linux Training
6


Creating Root Filesystem /
  • Open a new Terminal, you will be right now inside your
    home directory. Assume that the user name currently
    running is (shatrix), you will be in: /home/shatrix
  • Create any directory to contain the whole OS files and
    enter it
    ▫ mkdir minimal-linux
    ▫ cd minimal-linux
    ▫ pwd
  • Now you are in: /home/shatrix/minimal-linux



Learn To Be                                   Embedded Linux Training
7


Creating Root Filesystem /
  • Execute these commands:
      ▫ mkdir   bin   boot   dev   etc   lib   proc         root
         sbin
      ▫ mkdir   media sys tmp var usr
      ▫ mkdir   usr/bin usr/sbin usr/lib          var/log
      ▫ touch   var/log/messages
      ▫ chmod   1777 tmp
  • Now you have the main filesystem directories to
    contain the whole system




Learn To Be                                    Embedded Linux Training
8


Configuration Files & Startup Scripts ( /etc )
  • Inside (/etc), create these files & fill them with these
    contents:
      ▫ gedit group
          copy and paste this line inside it:
          root:x:0:
      ▫ gedit passwd
          copy and paste this line inside it:
          root:x:0:0:root:/root:/bin/sh
      ▫ gedit shadow
          copy and paste this line inside it:
          root::10:0:0:0:::
      ▫ gedit hostname
          copy and paste this line inside it:
          LearnToBe

Learn To Be                                          Embedded Linux Training
9


Configuration Files & Startup Scripts ( /etc )
  • gedit inittab
      ▫   null::sysinit:/bin/mount -t proc proc /proc
      ▫   null::sysinit:/bin/mkdir -p /dev/pts
      ▫   null::sysinit:/bin/mount -a
      ▫   null::sysinit:/sbin/ifconfig lo 127.0.0.1 up
      ▫   null::sysinit:/sbin/ifconfig eth0 192.168.1.13 up
      ▫   ::sysinit:/etc/rc
      ▫   tty1::respawn:/sbin/getty 38400 tty1
      ▫   null::sysinit:/bin/touch /var/log/messages
      ▫   null::respawn:/sbin/syslogd -n -m 0
      ▫   null::respawn:/sbin/klogd -n
      ▫   tty2::respawn:/usr/bin/tail -f /var/log/messages
      ▫   ::ctrlaltdel:/sbin/reboot
      ▫   null::shutdown:/usr/bin/killall klogd
      ▫   null::shutdown:/usr/bin/killall syslogd
      ▫   null::shutdown:/bin/umount -a -r



Learn To Be                                     Embedded Linux Training
10


Configuration Files & Startup Scripts ( /etc )
  • gedit rc
      ▫   #!/bin/sh
      ▫   PATH=/sbin:/bin:/usr/sbin:/usr/bin
      ▫   export PATH
      ▫   /bin/hostname LearnToBe
      ▫   /sbin/hwclock -s
      ▫   /bin/echo " "
      ▫   /bin/echo "        Y A T T A "
      ▫   /bin/echo " My First Embedded Linux "
      ▫   /bin/echo " "
  • chmod +x rc

Learn To Be                              Embedded Linux Training
11


Configuration Files & Startup Scripts ( /etc )
  • gedit profile
      ▫   export PS1=‘LearnToBe # '
      ▫   export USER=`id -un`
      ▫   export LOGNAME=$USER
      ▫   export HOSTNAME=`/bin/hostname`
      ▫   export HISTSIZE=1000
      ▫   export HISTFILESIZE=1000
      ▫   alias c='clear'
      ▫   alias df='df -h'
      ▫   alias ll='ls -lh'
      ▫   alias ping='ping -w 5‘
  • After Finishing back to the main dir:
      ▫ /home/shatrix/minimal-linux
Learn To Be                                 Embedded Linux Training
12


Linux Kernel & initrd
  • To make your own Linux kernel is not easy like 1 2 3.
  • Now, we can just use the Linux kernel already exists in
    our Ubuntu distribution.
  • So, copy the kernel & initrd file from /boot:
      ▫ cp /boot/vmlinuz-2.6.35-22-generic    boot/
      ▫ cp /boot/initrd.img-2.6.35-22-generic    boot/




Learn To Be                                    Embedded Linux Training
13


Linux Commands (BusyBox)
  • Any Linux distribution need some basic commands to
    operate correctly, like (mount, ls, pwd, ifconfig, cd,
    mkdir, touch, file, rm, vi) and more. Our distribution
    should contain these commands, so there are two
    ways to get these commands inside our OS:
      ▫ Getting the source code for each command needed,
        compile it separately and copy it to any bin directory
        inside the distribution.
      ▫ Using BusyBox.




Learn To Be                                          Embedded Linux Training
14


Linux Commands (BusyBox)
  • BusyBox combines tiny versions of many common
    UNIX utilities into a single small executable. It provides
    replacements for most of the utilities you usually find
    in GNU fileutils, shellutils, etc. The utilities in BusyBox
    generally have fewer options than their full-featured
    GNU cousins; however, the options that are included
    provide the expected functionality and behave very
    much like their GNU counterparts. BusyBox provides a
    fairly complete environment for any small or
    embedded system.
  • Get Busybox (busybox-1.17.2.tar.bz2):
      ▫ http://www.busybox.net/downloads/busybox-1.17.2.tar.bz2
Learn To Be                                        Embedded Linux Training
15


Linux Commands (BusyBox)
  • Put the tar file in your home dir and open a new Terminal:
      ▫ tar xvf busybox-1.17.2.tar.bz2
      ▫ cd busybox-1.17.2/
  • Configure Busybox as required:
      ▫ make defconfig
      ▫ make menuconfig
  • The command (make menuconfig) will open a GUI
    terminal-based configuration for the BusyBox program,
    you can choose what to be installed and what not to be
    installed, or you can just choose to exit this configuration
    and remember to save your configuration settings on exit.
  • We will choose to combile the busybox as a statically
    linked application to avoid using shared libs for C & GCC
    apps.
Learn To Be                                        Embedded Linux Training
16


Linux Commands (BusyBox)
  • make menuconfig
  • This command will open a window like that




Learn To Be                                 Embedded Linux Training
17


Linux Commands (BusyBox)
  • Using arrows Enter the first choise (Busybox Settings),
    then choose the second choise (Build Options)




Learn To Be                                    Embedded Linux Training
18


Linux Commands (BusyBox)
  • On the first choise in that menu press (Space) to
    choose to build busubox as a static binary.




Learn To Be                                    Embedded Linux Training
19


Linux Commands (BusyBox)
  • Exit the configuration, but don’t forget to save your
    new configurations.




Learn To Be                                     Embedded Linux Training
20


Linux Commands (BusyBox)
  • Then execute this command to compile and install BusyBox
    inside our system:
      ▫ make CONFIG_PREFIX=/home/shatrix/minimal-linux   install
  • After finishing, close this Terminal and get back to the main
    Terminal and execute these commands
      ▫   ls   bin
      ▫   ls   sbin
      ▫   ls   usr/bin
      ▫   ls   usr/sbin
  • You will see that the commands have been installed inside
    the binary directories of our system. Also you need to
    know that all these commands are linked to one
    executable file named busybox inside /bin and all
    these commands shown are just symbolic links to that
    command.
Learn To Be                                          Embedded Linux Training
21


C & GCC Libraries
  • As we have compiled the BusyBox as a static
    executable, we won’t need shared libraries in our small
    system till now.




Learn To Be                                   Embedded Linux Training
22


What's Next ?
  • Till now this system can run on any x86 cpu, and it can
    be copied to any storage (Flash memory, partition, CD)
    to be a stand alone operating system.
  • Now, we just need a bootloader to start the system.
  • We can use the bootloader already installed on
    UBUNTU (grub).




Learn To Be                                    Embedded Linux Training
23


Boot Loader (Grub)
  • We will use the grub already installed in our Linux
    distribution, we just need to write the grub
    configuration file manually.
  • grub.cfg:
      ▫ This is a text file contains the menu entries or the list of
        operating systems that grub should list them when the
        computer starts. We will create it manually.
      ▫ Go to the PATH of our system
      ▫ Create (boot/grub) dir
      ▫ Create (boot/grub/grub.cfg) file
          cd /home/shatrix/minimal-linux
          mkdir boot/grub
          gedit boot/grub/grub.cfg

Learn To Be                                            Embedded Linux Training
24


Boot Loader (Grub)
  • copy and paste these lines in the grub.cfg file
      ▫ set menu_color_normal=yellow/red
      ▫ set menu_color_highlight=black/light-gray
      ▫ menuentry 'LINUX Minimal OS FOR X86' {
      ▫ set root=(hd0,1)
      ▫ linux /boot/vmlinuz-2.6.35-22-generic
        root=UUID=<disk-uuid> rw
      ▫ initrd /boot/initrd.img-2.6.35-22-generic
      ▫ }
  • The red text <disk-uuid> will be replaced with a value
    after that, don’t forget.


Learn To Be                                     Embedded Linux Training
25


Putting System on Flash Memory
  • Plug the USB Flash in, It will take a namelike that sdx.
  • First we need to format and partition it, from Terminal
    run these commands only if you are sure about the
    flash device name:
      ▫ sudo umount /media/flash-disk-mounted-folder
      ▫ sudo mkfs.ext2 /dev/sdx1
  • If you have one hard disk and you have connected only
    one flash disk, it will take the name sdb, the command
    should be:
     • sudo mkfs.ext2 /dev/sdb1
  • Then mount the flash back again
      ▫ sudo mkdir /media/flash
      ▫ sudo mount /dev/sdb1 /media/flash
Learn To Be                                     Embedded Linux Training
26


Putting System on Flash Memory
  • Copy all the OS files from the </home/shatrix/minimal-linux> to
    the mounted partition.
      ▫ cd /home/shatrix/minimal-linux
      ▫ cp -a * /media/flash
  • Finally install grub to the Flash device:
      ▫ sudo   grub-install --root-directory=/media/flash /dev/sdb

  • Remember that the sdb will be the Flash disk device
    name in /dev, and /media/flash is the directory where
    the flash disk is mounted




Learn To Be                                              Embedded Linux Training
27


Final step: Editing grub.cfg (UUID)
  • To get the UUID for any partition or Flash:
      ▫ sudo blkid
  • copy the UUID for the required device and paste it in
    its correct place in the grub.cfg file on the Flash
    memory.
      ▫ sudo gedit /media/flash/boot/grub/grub.cfg
  • In the kernel line (root=UUID=<disk-uuid>)
  • make it ( root=UUID=the-result-uuid-from-blkid )




Learn To Be                                       Embedded Linux Training
28


Congratulations, You Did It                      YATTA
  • If you make all these steps as it is, your flash memory
    can now boot with the new Linux OS.
  • Restart your computer, and select to boot from the
    USB flash from your BIOS settings.
  • The Grub from the Flash memory should start now,
    with one selection:
      ▫ (LINUX Minimal OS FOR X86)
  • Press Enter to start the system, and enjoy.
  • When the system starts, go to the first console by
    typing Ctrl+Alt+F1 ,it will ask for login, type ( root ) and
    press enter, the system will start without asking for
    password.

Learn To Be                                        Embedded Linux Training
Thank You
   Facebook group: Learn To Be
   Official website: www.L2b-egypt.org

   Prepared By: SHATRIX
   E-Mail: eng.shatrix@gmail.com



Learn To Be                              Embedded Linux Training

More Related Content

What's hot

Debian Linux Overview
Debian Linux OverviewDebian Linux Overview
Debian Linux Overview
DarshanRamjiyani
 
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
 
Course 102: Lecture 9: Input Output Internals
Course 102: Lecture 9: Input Output Internals Course 102: Lecture 9: Input Output Internals
Course 102: Lecture 9: Input Output Internals
Ahmed El-Arabawy
 
Linux introduction
Linux introductionLinux introduction
Linux introduction
Md. Zahid Hossain Shoeb
 
Operating Systems: Linux in Detail
Operating Systems: Linux in DetailOperating Systems: Linux in Detail
Operating Systems: Linux in Detail
Damian T. Gordon
 
Course 102: Lecture 16: Process Management (Part 2)
Course 102: Lecture 16: Process Management (Part 2) Course 102: Lecture 16: Process Management (Part 2)
Course 102: Lecture 16: Process Management (Part 2)
Ahmed El-Arabawy
 
Course 102: Lecture 27: FileSystems in Linux (Part 2)
Course 102: Lecture 27: FileSystems in Linux (Part 2)Course 102: Lecture 27: FileSystems in Linux (Part 2)
Course 102: Lecture 27: FileSystems in Linux (Part 2)
Ahmed El-Arabawy
 
Linux kernel
Linux kernelLinux kernel
Linux kernel
Goutam Sahoo
 
Introduction to Linux basic
Introduction to Linux basicIntroduction to Linux basic
Introduction to Linux basic
f114n
 
Introduction to linux
Introduction to linuxIntroduction to linux
Introduction to linux
Stephen Ahiante
 
Linux command ppt
Linux command pptLinux command ppt
Linux command ppt
kalyanineve
 
Rootlinux17: Hypervisors on ARM - Overview and Design Choices by Julien Grall...
Rootlinux17: Hypervisors on ARM - Overview and Design Choices by Julien Grall...Rootlinux17: Hypervisors on ARM - Overview and Design Choices by Julien Grall...
Rootlinux17: Hypervisors on ARM - Overview and Design Choices by Julien Grall...
The Linux Foundation
 
Linux history & features
Linux history & featuresLinux history & features
Linux history & featuresRohit Kumar
 
Linux Knowledge Transfer
Linux Knowledge TransferLinux Knowledge Transfer
Linux Knowledge Transfer
Tapio Vaattanen
 
Intro to Linux Shell Scripting
Intro to Linux Shell ScriptingIntro to Linux Shell Scripting
Intro to Linux Shell Scripting
vceder
 
Bash shell scripting
Bash shell scriptingBash shell scripting
Bash shell scripting
VIKAS TIWARI
 
Linux.ppt
Linux.ppt Linux.ppt
Linux.ppt
onu9
 
An Introduction to Linux
An Introduction to LinuxAn Introduction to Linux
An Introduction to Linux
anandvaidya
 

What's hot (20)

Debian Linux Overview
Debian Linux OverviewDebian Linux Overview
Debian Linux Overview
 
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
 
Course 102: Lecture 9: Input Output Internals
Course 102: Lecture 9: Input Output Internals Course 102: Lecture 9: Input Output Internals
Course 102: Lecture 9: Input Output Internals
 
Linux introduction
Linux introductionLinux introduction
Linux introduction
 
Operating Systems: Linux in Detail
Operating Systems: Linux in DetailOperating Systems: Linux in Detail
Operating Systems: Linux in Detail
 
Course 102: Lecture 16: Process Management (Part 2)
Course 102: Lecture 16: Process Management (Part 2) Course 102: Lecture 16: Process Management (Part 2)
Course 102: Lecture 16: Process Management (Part 2)
 
Course 102: Lecture 27: FileSystems in Linux (Part 2)
Course 102: Lecture 27: FileSystems in Linux (Part 2)Course 102: Lecture 27: FileSystems in Linux (Part 2)
Course 102: Lecture 27: FileSystems in Linux (Part 2)
 
Linux kernel
Linux kernelLinux kernel
Linux kernel
 
Introduction to Linux basic
Introduction to Linux basicIntroduction to Linux basic
Introduction to Linux basic
 
Introduction to linux
Introduction to linuxIntroduction to linux
Introduction to linux
 
Linux command ppt
Linux command pptLinux command ppt
Linux command ppt
 
Rootlinux17: Hypervisors on ARM - Overview and Design Choices by Julien Grall...
Rootlinux17: Hypervisors on ARM - Overview and Design Choices by Julien Grall...Rootlinux17: Hypervisors on ARM - Overview and Design Choices by Julien Grall...
Rootlinux17: Hypervisors on ARM - Overview and Design Choices by Julien Grall...
 
Linux history & features
Linux history & featuresLinux history & features
Linux history & features
 
Linux Knowledge Transfer
Linux Knowledge TransferLinux Knowledge Transfer
Linux Knowledge Transfer
 
Intro to Linux Shell Scripting
Intro to Linux Shell ScriptingIntro to Linux Shell Scripting
Intro to Linux Shell Scripting
 
Bash shell scripting
Bash shell scriptingBash shell scripting
Bash shell scripting
 
Linux.ppt
Linux.ppt Linux.ppt
Linux.ppt
 
An Introduction to Linux
An Introduction to LinuxAn Introduction to Linux
An Introduction to Linux
 
Linux
Linux Linux
Linux
 
Basic 50 linus command
Basic 50 linus commandBasic 50 linus command
Basic 50 linus command
 

Viewers also liked

Yocto - Embedded Linux Distribution Maker
Yocto - Embedded Linux Distribution MakerYocto - Embedded Linux Distribution Maker
Yocto - Embedded Linux Distribution Maker
Sherif Mousa
 
Building Embedded Linux Systems Introduction
Building Embedded Linux Systems IntroductionBuilding Embedded Linux Systems Introduction
Building Embedded Linux Systems Introduction
Sherif Mousa
 
Embedded Linux from Scratch to Yocto
Embedded Linux from Scratch to YoctoEmbedded Linux from Scratch to Yocto
Embedded Linux from Scratch to YoctoSherif Mousa
 
Building Embedded Linux Full Tutorial for ARM
Building Embedded Linux Full Tutorial for ARMBuilding Embedded Linux Full Tutorial for ARM
Building Embedded Linux Full Tutorial for ARM
Sherif Mousa
 
001 linux revision
001 linux revision001 linux revision
001 linux revisionSherif Mousa
 
Building Embedded Linux
Building Embedded LinuxBuilding Embedded Linux
Building Embedded LinuxSherif Mousa
 
Operating systems Basics
Operating systems BasicsOperating systems Basics
Operating systems Basics
Sherif Mousa
 
U-Boot community analysis
U-Boot community analysisU-Boot community analysis
U-Boot community analysisxulioc
 
U Boot or Universal Bootloader
U Boot or Universal BootloaderU Boot or Universal Bootloader
U Boot or Universal Bootloader
Satpal Parmar
 
Embedded Linux
Embedded LinuxEmbedded Linux
Embedded Linux
Quotient Technology Inc.
 
U boot porting guide for SoC
U boot porting guide for SoCU boot porting guide for SoC
U boot porting guide for SoCMacpaul Lin
 
Linux Porting to a Custom Board
Linux Porting to a Custom BoardLinux Porting to a Custom Board
Linux Porting to a Custom BoardPatrick Bellasi
 
U-Boot presentation 2013
U-Boot presentation  2013U-Boot presentation  2013
U-Boot presentation 2013
Wave Digitech
 
Getting started with BeagleBone Black - Embedded Linux
Getting started with BeagleBone Black - Embedded LinuxGetting started with BeagleBone Black - Embedded Linux
Getting started with BeagleBone Black - Embedded Linux
Emertxe Information Technologies Pvt Ltd
 
BusyBox for Embedded Linux
BusyBox for Embedded LinuxBusyBox for Embedded Linux
BusyBox for Embedded Linux
Emertxe Information Technologies Pvt Ltd
 
2010 05 02 10 Dr Daniel C Tsui Physics Nobel Prize King Carl Xvi Gustaf Of S...
2010 05 02 10 Dr Daniel C Tsui  Physics Nobel Prize King Carl Xvi Gustaf Of S...2010 05 02 10 Dr Daniel C Tsui  Physics Nobel Prize King Carl Xvi Gustaf Of S...
2010 05 02 10 Dr Daniel C Tsui Physics Nobel Prize King Carl Xvi Gustaf Of S...hjk888
 
Chapter 5 - Electron Configurations
Chapter 5 - Electron ConfigurationsChapter 5 - Electron Configurations
Chapter 5 - Electron Configurations
Kendon Smith
 
Chapter One- Intro to Biology
Chapter One- Intro to BiologyChapter One- Intro to Biology
Chapter One- Intro to Biology
Mary Beth Smith
 

Viewers also liked (20)

Yocto - Embedded Linux Distribution Maker
Yocto - Embedded Linux Distribution MakerYocto - Embedded Linux Distribution Maker
Yocto - Embedded Linux Distribution Maker
 
Building Embedded Linux Systems Introduction
Building Embedded Linux Systems IntroductionBuilding Embedded Linux Systems Introduction
Building Embedded Linux Systems Introduction
 
Embedded Linux from Scratch to Yocto
Embedded Linux from Scratch to YoctoEmbedded Linux from Scratch to Yocto
Embedded Linux from Scratch to Yocto
 
Building Embedded Linux Full Tutorial for ARM
Building Embedded Linux Full Tutorial for ARMBuilding Embedded Linux Full Tutorial for ARM
Building Embedded Linux Full Tutorial for ARM
 
005 skyeye
005 skyeye005 skyeye
005 skyeye
 
001 linux revision
001 linux revision001 linux revision
001 linux revision
 
003 scripting
003 scripting003 scripting
003 scripting
 
Building Embedded Linux
Building Embedded LinuxBuilding Embedded Linux
Building Embedded Linux
 
Operating systems Basics
Operating systems BasicsOperating systems Basics
Operating systems Basics
 
U-Boot community analysis
U-Boot community analysisU-Boot community analysis
U-Boot community analysis
 
U Boot or Universal Bootloader
U Boot or Universal BootloaderU Boot or Universal Bootloader
U Boot or Universal Bootloader
 
Embedded Linux
Embedded LinuxEmbedded Linux
Embedded Linux
 
U boot porting guide for SoC
U boot porting guide for SoCU boot porting guide for SoC
U boot porting guide for SoC
 
Linux Porting to a Custom Board
Linux Porting to a Custom BoardLinux Porting to a Custom Board
Linux Porting to a Custom Board
 
U-Boot presentation 2013
U-Boot presentation  2013U-Boot presentation  2013
U-Boot presentation 2013
 
Getting started with BeagleBone Black - Embedded Linux
Getting started with BeagleBone Black - Embedded LinuxGetting started with BeagleBone Black - Embedded Linux
Getting started with BeagleBone Black - Embedded Linux
 
BusyBox for Embedded Linux
BusyBox for Embedded LinuxBusyBox for Embedded Linux
BusyBox for Embedded Linux
 
2010 05 02 10 Dr Daniel C Tsui Physics Nobel Prize King Carl Xvi Gustaf Of S...
2010 05 02 10 Dr Daniel C Tsui  Physics Nobel Prize King Carl Xvi Gustaf Of S...2010 05 02 10 Dr Daniel C Tsui  Physics Nobel Prize King Carl Xvi Gustaf Of S...
2010 05 02 10 Dr Daniel C Tsui Physics Nobel Prize King Carl Xvi Gustaf Of S...
 
Chapter 5 - Electron Configurations
Chapter 5 - Electron ConfigurationsChapter 5 - Electron Configurations
Chapter 5 - Electron Configurations
 
Chapter One- Intro to Biology
Chapter One- Intro to BiologyChapter One- Intro to Biology
Chapter One- Intro to Biology
 

Similar to linux minimal os tutorial - by shatrix

Linux kernel
Linux kernelLinux kernel
The Ultimate IBM and Lotus on Linux Workshop for Windows Admins
The Ultimate IBM and Lotus on Linux Workshop for Windows AdminsThe Ultimate IBM and Lotus on Linux Workshop for Windows Admins
The Ultimate IBM and Lotus on Linux Workshop for Windows Admins
Bill Malchisky Jr.
 
Launch the First Process in Linux System
Launch the First Process in Linux SystemLaunch the First Process in Linux System
Launch the First Process in Linux System
Jian-Hong Pan
 
Crafting GNU/Linux distributions for Embedded target from Scratch/Source
Crafting GNU/Linux distributions for Embedded target from Scratch/SourceCrafting GNU/Linux distributions for Embedded target from Scratch/Source
Crafting GNU/Linux distributions for Embedded target from Scratch/Source
Sourabh Singh Tomar
 
Crafting GNU/ linux distributions for embedded target using Builroot
Crafting GNU/ linux distributions for embedded target using BuilrootCrafting GNU/ linux distributions for embedded target using Builroot
Crafting GNU/ linux distributions for embedded target using Builroot
Sourabh Singh Tomar
 
Leveraging Android's Linux Heritage at AnDevCon V
Leveraging Android's Linux Heritage at AnDevCon VLeveraging Android's Linux Heritage at AnDevCon V
Leveraging Android's Linux Heritage at AnDevCon VOpersys inc.
 
Linux Installation
Linux InstallationLinux Installation
Linux Installation
BIT DURG
 
Linux basics
Linux basics Linux basics
Linux basics
suniljosekerala
 
Linux basics
Linux basics Linux basics
Linux basics
suniljosekerala
 
Linux Booting Process
Linux Booting ProcessLinux Booting Process
Linux Booting Process
Rishabh5121993
 
Leveraging Android's Linux Heritage at AnDevCon VI
Leveraging Android's Linux Heritage at AnDevCon VILeveraging Android's Linux Heritage at AnDevCon VI
Leveraging Android's Linux Heritage at AnDevCon VIOpersys inc.
 
Yocto Project Kernel Lab, Hands-On
Yocto Project Kernel Lab, Hands-OnYocto Project Kernel Lab, Hands-On
Yocto Project Kernel Lab, Hands-On
Trevor Woerner
 
Texas 2013
Texas 2013Texas 2013
Texas 2013
krispcbsd
 
Introduction to Linux Kernel by Quontra Solutions
Introduction to Linux Kernel by Quontra SolutionsIntroduction to Linux Kernel by Quontra Solutions
Introduction to Linux Kernel by Quontra Solutions
QUONTRASOLUTIONS
 
Self 2013
Self 2013Self 2013
Self 2013
krispcbsd
 
BSDCan2013
BSDCan2013BSDCan2013
BSDCan2013
krispcbsd
 
ITFT_Introduction of linux
ITFT_Introduction of linuxITFT_Introduction of linux
ITFT_Introduction of linux
Swati Aggarwal
 
itft_Installation of linux
itft_Installation of linuxitft_Installation of linux
itft_Installation of linux
Swati Aggarwal
 
Linux booting process - Linux System Administration
Linux booting process - Linux System AdministrationLinux booting process - Linux System Administration
Linux booting process - Linux System Administration
Sreenatha Reddy K R
 

Similar to linux minimal os tutorial - by shatrix (20)

Linux kernel
Linux kernelLinux kernel
Linux kernel
 
The Ultimate IBM and Lotus on Linux Workshop for Windows Admins
The Ultimate IBM and Lotus on Linux Workshop for Windows AdminsThe Ultimate IBM and Lotus on Linux Workshop for Windows Admins
The Ultimate IBM and Lotus on Linux Workshop for Windows Admins
 
Launch the First Process in Linux System
Launch the First Process in Linux SystemLaunch the First Process in Linux System
Launch the First Process in Linux System
 
Crafting GNU/Linux distributions for Embedded target from Scratch/Source
Crafting GNU/Linux distributions for Embedded target from Scratch/SourceCrafting GNU/Linux distributions for Embedded target from Scratch/Source
Crafting GNU/Linux distributions for Embedded target from Scratch/Source
 
Linux
Linux Linux
Linux
 
Crafting GNU/ linux distributions for embedded target using Builroot
Crafting GNU/ linux distributions for embedded target using BuilrootCrafting GNU/ linux distributions for embedded target using Builroot
Crafting GNU/ linux distributions for embedded target using Builroot
 
Leveraging Android's Linux Heritage at AnDevCon V
Leveraging Android's Linux Heritage at AnDevCon VLeveraging Android's Linux Heritage at AnDevCon V
Leveraging Android's Linux Heritage at AnDevCon V
 
Linux Installation
Linux InstallationLinux Installation
Linux Installation
 
Linux basics
Linux basics Linux basics
Linux basics
 
Linux basics
Linux basics Linux basics
Linux basics
 
Linux Booting Process
Linux Booting ProcessLinux Booting Process
Linux Booting Process
 
Leveraging Android's Linux Heritage at AnDevCon VI
Leveraging Android's Linux Heritage at AnDevCon VILeveraging Android's Linux Heritage at AnDevCon VI
Leveraging Android's Linux Heritage at AnDevCon VI
 
Yocto Project Kernel Lab, Hands-On
Yocto Project Kernel Lab, Hands-OnYocto Project Kernel Lab, Hands-On
Yocto Project Kernel Lab, Hands-On
 
Texas 2013
Texas 2013Texas 2013
Texas 2013
 
Introduction to Linux Kernel by Quontra Solutions
Introduction to Linux Kernel by Quontra SolutionsIntroduction to Linux Kernel by Quontra Solutions
Introduction to Linux Kernel by Quontra Solutions
 
Self 2013
Self 2013Self 2013
Self 2013
 
BSDCan2013
BSDCan2013BSDCan2013
BSDCan2013
 
ITFT_Introduction of linux
ITFT_Introduction of linuxITFT_Introduction of linux
ITFT_Introduction of linux
 
itft_Installation of linux
itft_Installation of linuxitft_Installation of linux
itft_Installation of linux
 
Linux booting process - Linux System Administration
Linux booting process - Linux System AdministrationLinux booting process - Linux System Administration
Linux booting process - Linux System Administration
 

Recently uploaded

Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
Nguyen Thanh Tu Collection
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 

Recently uploaded (20)

Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 

linux minimal os tutorial - by shatrix

  • 1. Linux Minimal OS For X86 Facebook group: Learn To Be Official website: www.L2b-egypt.org Prepared By: SHATRIX E-Mail: eng.shatrix@gmail.com Learn To Be Embedded Linux Training
  • 2. 2 A Very Expert Was Once A Beginner Learn The Way, Forget It, Then Find Your Own Way Learn To Be Embedded Linux Training
  • 3. 3 Introduction • This tutorial will show you how to create your own "Minimal Linux Distribution" on a USB Flash memory. • You will learn about: ▫ The FHS (Filesystem Hierarchy Standard). ▫ Linux minimal common commands that make the system start and operate well. ▫ How to deal with Grub bootloader (install, edit configuration files). ▫ How to use the Linux kernel. ▫ Dealing with some root commands (mount, mkfs.ext2, grub-install) • It is considered a good start for those people who want to enter the field of Embedded Linux Systems PS: Development on UBUNTU 10.10 Learn To Be Embedded Linux Training
  • 4. 4 Prerequisites: • You will need to install these packages first on Ubuntu 10.10 ▫ sudo apt-get update ▫ sudo apt-get install ncurses-dev bison texinfo flex • You should be good in working with at least one Linux distribution like UBUNTU, and can understand the command you write and its options. Learn To Be Embedded Linux Training
  • 5. 5 Basic Linux Structure • Any Linux distribution consists of some main components: ▫ Root Filesystem (main directories and sub directories). ▫ Linux Kernel image with or without initram filesystem (initrd.img). ▫ Configuration files and startup scripts in the (/etc) directory. ▫ Essential Linux commands needed for system to start and operate well. ▫ C & GCC Shared Libraries needed for any C or C++ application to run. ▫ Boot Loader to start the system from its storage media. ▫ GUI system or not. ▫ Extra Programs. • So, we will minimize all these components to get the minimal Linux distribution that works very well on any X86 CPU. Learn To Be Embedded Linux Training
  • 6. 6 Creating Root Filesystem / • Open a new Terminal, you will be right now inside your home directory. Assume that the user name currently running is (shatrix), you will be in: /home/shatrix • Create any directory to contain the whole OS files and enter it ▫ mkdir minimal-linux ▫ cd minimal-linux ▫ pwd • Now you are in: /home/shatrix/minimal-linux Learn To Be Embedded Linux Training
  • 7. 7 Creating Root Filesystem / • Execute these commands: ▫ mkdir bin boot dev etc lib proc root sbin ▫ mkdir media sys tmp var usr ▫ mkdir usr/bin usr/sbin usr/lib var/log ▫ touch var/log/messages ▫ chmod 1777 tmp • Now you have the main filesystem directories to contain the whole system Learn To Be Embedded Linux Training
  • 8. 8 Configuration Files & Startup Scripts ( /etc ) • Inside (/etc), create these files & fill them with these contents: ▫ gedit group  copy and paste this line inside it:  root:x:0: ▫ gedit passwd  copy and paste this line inside it:  root:x:0:0:root:/root:/bin/sh ▫ gedit shadow  copy and paste this line inside it:  root::10:0:0:0::: ▫ gedit hostname  copy and paste this line inside it:  LearnToBe Learn To Be Embedded Linux Training
  • 9. 9 Configuration Files & Startup Scripts ( /etc ) • gedit inittab ▫ null::sysinit:/bin/mount -t proc proc /proc ▫ null::sysinit:/bin/mkdir -p /dev/pts ▫ null::sysinit:/bin/mount -a ▫ null::sysinit:/sbin/ifconfig lo 127.0.0.1 up ▫ null::sysinit:/sbin/ifconfig eth0 192.168.1.13 up ▫ ::sysinit:/etc/rc ▫ tty1::respawn:/sbin/getty 38400 tty1 ▫ null::sysinit:/bin/touch /var/log/messages ▫ null::respawn:/sbin/syslogd -n -m 0 ▫ null::respawn:/sbin/klogd -n ▫ tty2::respawn:/usr/bin/tail -f /var/log/messages ▫ ::ctrlaltdel:/sbin/reboot ▫ null::shutdown:/usr/bin/killall klogd ▫ null::shutdown:/usr/bin/killall syslogd ▫ null::shutdown:/bin/umount -a -r Learn To Be Embedded Linux Training
  • 10. 10 Configuration Files & Startup Scripts ( /etc ) • gedit rc ▫ #!/bin/sh ▫ PATH=/sbin:/bin:/usr/sbin:/usr/bin ▫ export PATH ▫ /bin/hostname LearnToBe ▫ /sbin/hwclock -s ▫ /bin/echo " " ▫ /bin/echo " Y A T T A " ▫ /bin/echo " My First Embedded Linux " ▫ /bin/echo " " • chmod +x rc Learn To Be Embedded Linux Training
  • 11. 11 Configuration Files & Startup Scripts ( /etc ) • gedit profile ▫ export PS1=‘LearnToBe # ' ▫ export USER=`id -un` ▫ export LOGNAME=$USER ▫ export HOSTNAME=`/bin/hostname` ▫ export HISTSIZE=1000 ▫ export HISTFILESIZE=1000 ▫ alias c='clear' ▫ alias df='df -h' ▫ alias ll='ls -lh' ▫ alias ping='ping -w 5‘ • After Finishing back to the main dir: ▫ /home/shatrix/minimal-linux Learn To Be Embedded Linux Training
  • 12. 12 Linux Kernel & initrd • To make your own Linux kernel is not easy like 1 2 3. • Now, we can just use the Linux kernel already exists in our Ubuntu distribution. • So, copy the kernel & initrd file from /boot: ▫ cp /boot/vmlinuz-2.6.35-22-generic boot/ ▫ cp /boot/initrd.img-2.6.35-22-generic boot/ Learn To Be Embedded Linux Training
  • 13. 13 Linux Commands (BusyBox) • Any Linux distribution need some basic commands to operate correctly, like (mount, ls, pwd, ifconfig, cd, mkdir, touch, file, rm, vi) and more. Our distribution should contain these commands, so there are two ways to get these commands inside our OS: ▫ Getting the source code for each command needed, compile it separately and copy it to any bin directory inside the distribution. ▫ Using BusyBox. Learn To Be Embedded Linux Training
  • 14. 14 Linux Commands (BusyBox) • BusyBox combines tiny versions of many common UNIX utilities into a single small executable. It provides replacements for most of the utilities you usually find in GNU fileutils, shellutils, etc. The utilities in BusyBox generally have fewer options than their full-featured GNU cousins; however, the options that are included provide the expected functionality and behave very much like their GNU counterparts. BusyBox provides a fairly complete environment for any small or embedded system. • Get Busybox (busybox-1.17.2.tar.bz2): ▫ http://www.busybox.net/downloads/busybox-1.17.2.tar.bz2 Learn To Be Embedded Linux Training
  • 15. 15 Linux Commands (BusyBox) • Put the tar file in your home dir and open a new Terminal: ▫ tar xvf busybox-1.17.2.tar.bz2 ▫ cd busybox-1.17.2/ • Configure Busybox as required: ▫ make defconfig ▫ make menuconfig • The command (make menuconfig) will open a GUI terminal-based configuration for the BusyBox program, you can choose what to be installed and what not to be installed, or you can just choose to exit this configuration and remember to save your configuration settings on exit. • We will choose to combile the busybox as a statically linked application to avoid using shared libs for C & GCC apps. Learn To Be Embedded Linux Training
  • 16. 16 Linux Commands (BusyBox) • make menuconfig • This command will open a window like that Learn To Be Embedded Linux Training
  • 17. 17 Linux Commands (BusyBox) • Using arrows Enter the first choise (Busybox Settings), then choose the second choise (Build Options) Learn To Be Embedded Linux Training
  • 18. 18 Linux Commands (BusyBox) • On the first choise in that menu press (Space) to choose to build busubox as a static binary. Learn To Be Embedded Linux Training
  • 19. 19 Linux Commands (BusyBox) • Exit the configuration, but don’t forget to save your new configurations. Learn To Be Embedded Linux Training
  • 20. 20 Linux Commands (BusyBox) • Then execute this command to compile and install BusyBox inside our system: ▫ make CONFIG_PREFIX=/home/shatrix/minimal-linux install • After finishing, close this Terminal and get back to the main Terminal and execute these commands ▫ ls bin ▫ ls sbin ▫ ls usr/bin ▫ ls usr/sbin • You will see that the commands have been installed inside the binary directories of our system. Also you need to know that all these commands are linked to one executable file named busybox inside /bin and all these commands shown are just symbolic links to that command. Learn To Be Embedded Linux Training
  • 21. 21 C & GCC Libraries • As we have compiled the BusyBox as a static executable, we won’t need shared libraries in our small system till now. Learn To Be Embedded Linux Training
  • 22. 22 What's Next ? • Till now this system can run on any x86 cpu, and it can be copied to any storage (Flash memory, partition, CD) to be a stand alone operating system. • Now, we just need a bootloader to start the system. • We can use the bootloader already installed on UBUNTU (grub). Learn To Be Embedded Linux Training
  • 23. 23 Boot Loader (Grub) • We will use the grub already installed in our Linux distribution, we just need to write the grub configuration file manually. • grub.cfg: ▫ This is a text file contains the menu entries or the list of operating systems that grub should list them when the computer starts. We will create it manually. ▫ Go to the PATH of our system ▫ Create (boot/grub) dir ▫ Create (boot/grub/grub.cfg) file  cd /home/shatrix/minimal-linux  mkdir boot/grub  gedit boot/grub/grub.cfg Learn To Be Embedded Linux Training
  • 24. 24 Boot Loader (Grub) • copy and paste these lines in the grub.cfg file ▫ set menu_color_normal=yellow/red ▫ set menu_color_highlight=black/light-gray ▫ menuentry 'LINUX Minimal OS FOR X86' { ▫ set root=(hd0,1) ▫ linux /boot/vmlinuz-2.6.35-22-generic root=UUID=<disk-uuid> rw ▫ initrd /boot/initrd.img-2.6.35-22-generic ▫ } • The red text <disk-uuid> will be replaced with a value after that, don’t forget. Learn To Be Embedded Linux Training
  • 25. 25 Putting System on Flash Memory • Plug the USB Flash in, It will take a namelike that sdx. • First we need to format and partition it, from Terminal run these commands only if you are sure about the flash device name: ▫ sudo umount /media/flash-disk-mounted-folder ▫ sudo mkfs.ext2 /dev/sdx1 • If you have one hard disk and you have connected only one flash disk, it will take the name sdb, the command should be: • sudo mkfs.ext2 /dev/sdb1 • Then mount the flash back again ▫ sudo mkdir /media/flash ▫ sudo mount /dev/sdb1 /media/flash Learn To Be Embedded Linux Training
  • 26. 26 Putting System on Flash Memory • Copy all the OS files from the </home/shatrix/minimal-linux> to the mounted partition. ▫ cd /home/shatrix/minimal-linux ▫ cp -a * /media/flash • Finally install grub to the Flash device: ▫ sudo grub-install --root-directory=/media/flash /dev/sdb • Remember that the sdb will be the Flash disk device name in /dev, and /media/flash is the directory where the flash disk is mounted Learn To Be Embedded Linux Training
  • 27. 27 Final step: Editing grub.cfg (UUID) • To get the UUID for any partition or Flash: ▫ sudo blkid • copy the UUID for the required device and paste it in its correct place in the grub.cfg file on the Flash memory. ▫ sudo gedit /media/flash/boot/grub/grub.cfg • In the kernel line (root=UUID=<disk-uuid>) • make it ( root=UUID=the-result-uuid-from-blkid ) Learn To Be Embedded Linux Training
  • 28. 28 Congratulations, You Did It YATTA • If you make all these steps as it is, your flash memory can now boot with the new Linux OS. • Restart your computer, and select to boot from the USB flash from your BIOS settings. • The Grub from the Flash memory should start now, with one selection: ▫ (LINUX Minimal OS FOR X86) • Press Enter to start the system, and enjoy. • When the system starts, go to the first console by typing Ctrl+Alt+F1 ,it will ask for login, type ( root ) and press enter, the system will start without asking for password. Learn To Be Embedded Linux Training
  • 29. Thank You Facebook group: Learn To Be Official website: www.L2b-egypt.org Prepared By: SHATRIX E-Mail: eng.shatrix@gmail.com Learn To Be Embedded Linux Training