SlideShare uma empresa Scribd logo
1 de 15
Baixar para ler offline
Recipe of a Linux LiveCD
By
Buddhika Siddhisena
2
Agenda
What is a LiveCD
Why run a LiveCD
Understanding the Linux Boot process
Understanding the Linux LiveCD Boot process
How hardware detection could work
Achieving Data Persistence on LiveCD
Short survey of popular LiveCDs
3
What is a LiveCD
Is a CD that contains an Operating System (OS), capable of booting off
directly, without first having to be installed.
Will generally have automatic hardware detection, as the OS boots.
May contain more data than the physical size of a CDROM (~700MB) by
using on-the-fly decompression of the file system.
Generally slower to boot when compared to HDD, mainly due to slower
access times of CDROM drives.
May offer the ability to remember configuration settings by saving them
on to a drive (USB, floppy or HDD).
May offer it to be installed to the hard disk permanently
4
Why run a LiveCD
Provides an alternative way to try out a new OS/distribution.
Can be used to instantly convert any desktop to your desktop! And you
can't get blamed for doing so.
Can be a valuable resource for recovering data, resetting passwords etc.
Can be used to distribute a demo versions of software thats guaranteed to
work with minimum hassle.
And endless other possibilities....
5
Understanding the Linux Boot process
As the machine boots the BIOS looks for a bootable media depending on
the boot sequence.
BIOS loads the bootloader from a special area in the disk called the
Master Boot Record (MBR). On linux it is usually either LILO or GRUB.
LILO (or GRUB) will attempt to load the kernel and optionally an initial
RAM disk (initrd), if specified.
Control is passed to the kernel as it decompresses the initrd and mounts it
as the root device.
6
Understanding the Linux Boot process
The kernel executes /linuxrc from the root device. It will perform various
pre-boot tasks such as loading of additional drivers.
Once linuxrc exits control is passed back to the kernel which will then
mount the real root device as the root file system.
/sbin/init from the real root system is executed which uses /etc/inittab
configuration to boot rest of the system.
/etc/inittab defines the default runlevel (usually 3 or 5) and as part of
the boot process all scripts in /etc/rcX.d/ are executed.
7
Linux boot process in a nutshell
Power supply ON
PC BIOS starts
BIOS looks for a bootable media
according to the setting and
loads a program(=LILO) written
on MBR of a hard drive, and then
LILO gains control.
LILO loads a
kerne(vmlinuz)and
an initial RAM
disk(initrd)Kerne
l gains control
Kernel expands
initrd and
mounts it as a
temporary root
file system
If an executable /linuxrc exists
in the initrd, the kernel
executes it.
After the /linuxrc is
finished, the kernel
mounts a real root
file system which may
be /dev/hda1
/sbin/init executes
/etc/rc.d/rc.sysinit
according to a
description of
/etc/inittab.
Next, init executes
/etc/rc.d/rc with
a default run level as
an argument
For example, in run level 3, /etc/rc.d/rc
executes shell scripts like
SnnXXXX(nn=number) under /etc/rc.d/rc3.d
directory in order of S00XXXX to S99XXXX
with a start argument
8
Understanding the Linux LiveCD Boot process
BIOS finds a bootable CDROM and loads the bootloader (usually
ISOLINUX which is based on the Syslinux bootloader)
ISOLINUX will load the initrd and the kernel image and transfer control
to the kernel.
The kernel decompresses initrd and mounts it as root and executes the
/linuxrc script from the LiveCD.
9
Understanding the Linux LiveCD Boot process
It will load kernel modules required, attempt to guess the CDROM device and
mount it. Finally linuxrc will change the real root device of the kernel to that
of initrd, or LiveCD and exit.
#!/bin/sh
echo Mounting /proc filesystem
mount -t proc /proc /proc
echo Attempting to Mount CD-ROM
(mount -t iso9660 /dev/hdb /mnt/cdrom && ln -s /dev/hdb /dev/cdrom) ||
(mount -t iso9660 /dev/hdc /mnt/cdrom && ln -s /dev/hdc /dev/cdrom) ||
(mount -t iso9660 /dev/hdd /mnt/cdrom && ln -s /dev/hdd /dev/cdrom) ||
(mount -t iso9660 /dev/hda /mnt/cdrom && ln -s /dev/hda /dev/cdrom) ||
(echo 'cannot mount CD-ROM, dropping you to a shell';sh)
echo 0x0100 > /proc/sys/kernel/real-root-dev
umount /proc
Hardware detection scripts will take over as a runlevel service to
configure the rest of the system.
10
Hardware detection process
Scripts can use tools such as lspci, /proc/bus/pci/devices, /proc/bus/usb/devices
etc. to determine the system hardware.
bud@babytux bud $ /sbin/lspci
0000:00:01.0 PCI bridge: ATI Technologies Inc: Unknown device 7010
0000:00:02.0 USB Controller: ALi Corporation USB 1.1 Controller (rev
03)0000:00:06.0 Multimedia audio controller: ALi Corporation M5451 PCI AC-
Link Controller Audio Device (rev 02)
0000:00:09.0 Network controller: Harris Semiconductor Prism 2.5 Wavelan
chipset(rev 01)
0000:00:10.0 IDE interface: ALi Corporation M5229 IDE (rev c4)
0000:00:12.0 Ethernet controller: National Semiconductor Corporation
DP83815 (MacPhyter) Ethernet Controller
0000:01:05.0 VGA compatible controller: ATI Technologies Inc: Unknown
device 4337
Then by using a database or some sort of pattern matching we can load
the correct kernel modules to drive those devices.
Check out the Linux PCID Repository at http://pciids.sourceforge.net/ or the
file /usr/share/misc/pci.ids
11
Hardware detection process
Other tools such as kudzu(http://rhlinux.redhat.com/kudzu/) that comes
with Redhat or discover(http://hackers.progeny.com/discover/) can
also be used
Configuring X windows can be done using tools such using XFree86 and
tools such as ddcprobe or read-edid to detect monitor refresh rates.
# XFree86 -configure
# get-edid | parse-edid
Usually the /etc, /home and /tmp directories will reside on an ramdisk
and will be symlinked from the LiveCD to be able to save settings
Certain files in the /dev directory should also reside on a ram disk.
(e.g. /dev/tty*, /dev/pts/* etc.)
12
Achieving Data Persistence on LiveCD
Data persistence can be achieved by running a shell script to store the
content of /home or /etc on a USB flash or HDD.
#!/bin/sh
mount /dev/sda1 /mnt/usb
tar -zcvf /mnt/usb/home.tar.gz /home
tar -zcvf /mnt/usb/etc.tar.gz /etc
When booting the live CD using ISOLinux, it is possible to pass
parameters to the kernel, even once that the kernel doesn't understand
boot: linux26 vga=791 home=/mnt/sda etc=/mnt/sda
A bootup script could read this value by examining /proc/cmdline
# cat /proc/cmdline
13
Short survey of popular LiveCDs
Knoppix - Knoppix is a Live Linux CD based on Debian GNU/Linux
Excellent hardware detection
Uses on the fly transparent decompression to store 2.5GB or data
Easy to remaster and make your own LiveCD (e.g. Gnoppix, Damn Small
Linux(DSO), Sinhala Knoppix)
http://www.knoppix.net
Mepis – Based on Debian GNU/Linux
Very Good harware detection.
Uses on the fly decompression to store about 1.1GB or data
Contains some non-free software such as Flash, Java, RealPlayer etc.
Easy to install to the HDD
http://www.mepis.org/
SLAX – Slackware based LiveCD
Fast, works well on slightly older hardware
Fits on to a mini CD since the image is only 185MB
http://slax.linux-live.org/
14
Short survey of popular LiveCDs
LNX/BBC – Portable card-sized distribution
Design to fit to a credit card size CD
http://www.lnx-bbc.org
Mandrake Move – A live CD based on Mandrake Linux
Commercial and free edition available.
http://www.mandrakesoft.com/products/mandrakemove
FreeBSD LiveCD – A LiveCD based FreeBSD OS
http://livecd.sourceforge.net/
15
Thank You!

Mais conteúdo relacionado

Mais procurados

Mais procurados (20)

Lavigne bsdmag july
Lavigne bsdmag julyLavigne bsdmag july
Lavigne bsdmag july
 
Linux Common Command
Linux Common CommandLinux Common Command
Linux Common Command
 
Ch12
Ch12Ch12
Ch12
 
[ArabBSD] Unix Basics
[ArabBSD] Unix Basics[ArabBSD] Unix Basics
[ArabBSD] Unix Basics
 
Linuxppt
LinuxpptLinuxppt
Linuxppt
 
Linux fundamental - Chap 03 file
Linux fundamental - Chap 03 fileLinux fundamental - Chap 03 file
Linux fundamental - Chap 03 file
 
Raspberry Pi 101
Raspberry Pi 101Raspberry Pi 101
Raspberry Pi 101
 
2.Accessing the Pi
2.Accessing the Pi2.Accessing the Pi
2.Accessing the Pi
 
Asiabsdcon14 lavigne
Asiabsdcon14 lavigneAsiabsdcon14 lavigne
Asiabsdcon14 lavigne
 
Ilf2011
Ilf2011Ilf2011
Ilf2011
 
Linux fundamental - Chap 10 fs
Linux fundamental - Chap 10 fsLinux fundamental - Chap 10 fs
Linux fundamental - Chap 10 fs
 
Ha opensuse
Ha opensuseHa opensuse
Ha opensuse
 
Linux LVM Logical Volume Management
Linux LVM Logical Volume ManagementLinux LVM Logical Volume Management
Linux LVM Logical Volume Management
 
Advanced Level Training on Koha / TLS (ToT)
Advanced Level Training on Koha / TLS (ToT)Advanced Level Training on Koha / TLS (ToT)
Advanced Level Training on Koha / TLS (ToT)
 
Lavigne sept11 bsdmag
Lavigne sept11 bsdmagLavigne sept11 bsdmag
Lavigne sept11 bsdmag
 
Clase4 (consola linux)
Clase4 (consola linux)Clase4 (consola linux)
Clase4 (consola linux)
 
Linux fundamental - Chap 04 archive
Linux fundamental - Chap 04 archiveLinux fundamental - Chap 04 archive
Linux fundamental - Chap 04 archive
 
vbsd2013
vbsd2013vbsd2013
vbsd2013
 
eurobsd2013
eurobsd2013eurobsd2013
eurobsd2013
 
Summit demystifying systemd1
Summit demystifying systemd1Summit demystifying systemd1
Summit demystifying systemd1
 

Destaque

Beyond desktop/server with GNU/Linux (archived)
Beyond desktop/server with GNU/Linux (archived)Beyond desktop/server with GNU/Linux (archived)
Beyond desktop/server with GNU/Linux (archived)Bud Siddhisena
 
Contributing to FOSS (archived)
Contributing to FOSS (archived)Contributing to FOSS (archived)
Contributing to FOSS (archived)Bud Siddhisena
 
Sub Prime Mortgage Mess
Sub Prime Mortgage MessSub Prime Mortgage Mess
Sub Prime Mortgage MessJustin Gardner
 
FOSS in Sri Lanka (archived)
FOSS in Sri Lanka (archived)FOSS in Sri Lanka (archived)
FOSS in Sri Lanka (archived)Bud Siddhisena
 
Opensource opportunity
Opensource opportunityOpensource opportunity
Opensource opportunityBud Siddhisena
 

Destaque (7)

Beyond desktop/server with GNU/Linux (archived)
Beyond desktop/server with GNU/Linux (archived)Beyond desktop/server with GNU/Linux (archived)
Beyond desktop/server with GNU/Linux (archived)
 
Contributing to FOSS (archived)
Contributing to FOSS (archived)Contributing to FOSS (archived)
Contributing to FOSS (archived)
 
Sub Prime Mortgage Mess
Sub Prime Mortgage MessSub Prime Mortgage Mess
Sub Prime Mortgage Mess
 
Yoo Torture Memo Pt2
Yoo Torture Memo Pt2Yoo Torture Memo Pt2
Yoo Torture Memo Pt2
 
Foss Gadgematics
Foss GadgematicsFoss Gadgematics
Foss Gadgematics
 
FOSS in Sri Lanka (archived)
FOSS in Sri Lanka (archived)FOSS in Sri Lanka (archived)
FOSS in Sri Lanka (archived)
 
Opensource opportunity
Opensource opportunityOpensource opportunity
Opensource opportunity
 

Semelhante a Recipe of a linux Live CD (archived)

Semelhante a Recipe of a linux Live CD (archived) (20)

6 stages of linux boot process
6 stages of linux boot process6 stages of linux boot process
6 stages of linux boot process
 
6 stages of linux boot process
6 stages of linux boot process6 stages of linux boot process
6 stages of linux boot process
 
101 1.2 boot the system
101 1.2 boot the system101 1.2 boot the system
101 1.2 boot the system
 
Linux filesystemhierarchy
Linux filesystemhierarchyLinux filesystemhierarchy
Linux filesystemhierarchy
 
Linux basics
Linux basics Linux basics
Linux basics
 
Linux basics
Linux basics Linux basics
Linux basics
 
FreeBSD Portscamp, Kuala Lumpur 2016
FreeBSD Portscamp, Kuala Lumpur 2016FreeBSD Portscamp, Kuala Lumpur 2016
FreeBSD Portscamp, Kuala Lumpur 2016
 
6 stages of linux boot process
6 stages of linux boot process6 stages of linux boot process
6 stages of linux boot process
 
6 stages of linux boot process
6 stages of linux boot process6 stages of linux boot process
6 stages of linux boot process
 
Linux conf-admin
Linux conf-adminLinux conf-admin
Linux conf-admin
 
Linux Conf Admin
Linux Conf AdminLinux Conf Admin
Linux Conf Admin
 
Introduction to Operating Systems.pptx
Introduction to Operating Systems.pptxIntroduction to Operating Systems.pptx
Introduction to Operating Systems.pptx
 
First Responder Course - Session 10 - Static Evidence Collection [2004]
First Responder Course - Session 10 - Static Evidence Collection [2004]First Responder Course - Session 10 - Static Evidence Collection [2004]
First Responder Course - Session 10 - Static Evidence Collection [2004]
 
Basic Linux Internals
Basic Linux InternalsBasic Linux Internals
Basic Linux Internals
 
Linux Booting Process
Linux Booting ProcessLinux Booting Process
Linux Booting Process
 
Linux
LinuxLinux
Linux
 
Ch12 system administration
Ch12 system administration Ch12 system administration
Ch12 system administration
 
Unix Administration 2
Unix Administration 2Unix Administration 2
Unix Administration 2
 
101 2.1 design hard disk layout v2
101 2.1 design hard disk layout v2101 2.1 design hard disk layout v2
101 2.1 design hard disk layout v2
 
Texas 2013
Texas 2013Texas 2013
Texas 2013
 

Mais de Bud Siddhisena

Building apis that don’t suck!
Building apis that don’t suck!Building apis that don’t suck!
Building apis that don’t suck!Bud Siddhisena
 
Why should you android (archived)
Why should you android (archived)Why should you android (archived)
Why should you android (archived)Bud Siddhisena
 
Virtualization, The future of computing (archived)
Virtualization, The future of computing (archived)Virtualization, The future of computing (archived)
Virtualization, The future of computing (archived)Bud Siddhisena
 
Building the Next big thing (archived)
Building the Next big thing (archived)Building the Next big thing (archived)
Building the Next big thing (archived)Bud Siddhisena
 
GNU/Linux for a better home (archived)
GNU/Linux for a better home (archived)GNU/Linux for a better home (archived)
GNU/Linux for a better home (archived)Bud Siddhisena
 
Gaming on linux (archived)
Gaming on linux (archived)Gaming on linux (archived)
Gaming on linux (archived)Bud Siddhisena
 
Choosing your GNU/Linux distribution (archived)
Choosing your GNU/Linux distribution (archived)Choosing your GNU/Linux distribution (archived)
Choosing your GNU/Linux distribution (archived)Bud Siddhisena
 
Scale Apache with Nginx
Scale Apache with NginxScale Apache with Nginx
Scale Apache with NginxBud Siddhisena
 
Introduction to firewalls through Iptables
Introduction to firewalls through IptablesIntroduction to firewalls through Iptables
Introduction to firewalls through IptablesBud Siddhisena
 
Secure your IT infrastructure with GNU/Linux
Secure your IT infrastructure  with GNU/LinuxSecure your IT infrastructure  with GNU/Linux
Secure your IT infrastructure with GNU/LinuxBud Siddhisena
 
Kernel Configuration and Compilation
Kernel Configuration and CompilationKernel Configuration and Compilation
Kernel Configuration and CompilationBud Siddhisena
 

Mais de Bud Siddhisena (15)

JIT qa-docker
JIT qa-dockerJIT qa-docker
JIT qa-docker
 
Building apis that don’t suck!
Building apis that don’t suck!Building apis that don’t suck!
Building apis that don’t suck!
 
Why should you android (archived)
Why should you android (archived)Why should you android (archived)
Why should you android (archived)
 
Virtualization, The future of computing (archived)
Virtualization, The future of computing (archived)Virtualization, The future of computing (archived)
Virtualization, The future of computing (archived)
 
Building the Next big thing (archived)
Building the Next big thing (archived)Building the Next big thing (archived)
Building the Next big thing (archived)
 
GNU/Linux for a better home (archived)
GNU/Linux for a better home (archived)GNU/Linux for a better home (archived)
GNU/Linux for a better home (archived)
 
Gaming on linux (archived)
Gaming on linux (archived)Gaming on linux (archived)
Gaming on linux (archived)
 
Choosing your GNU/Linux distribution (archived)
Choosing your GNU/Linux distribution (archived)Choosing your GNU/Linux distribution (archived)
Choosing your GNU/Linux distribution (archived)
 
UX talk
UX talkUX talk
UX talk
 
Remembering steve
Remembering steveRemembering steve
Remembering steve
 
Scale Apache with Nginx
Scale Apache with NginxScale Apache with Nginx
Scale Apache with Nginx
 
Introduction to firewalls through Iptables
Introduction to firewalls through IptablesIntroduction to firewalls through Iptables
Introduction to firewalls through Iptables
 
FOSS and Security
FOSS and SecurityFOSS and Security
FOSS and Security
 
Secure your IT infrastructure with GNU/Linux
Secure your IT infrastructure  with GNU/LinuxSecure your IT infrastructure  with GNU/Linux
Secure your IT infrastructure with GNU/Linux
 
Kernel Configuration and Compilation
Kernel Configuration and CompilationKernel Configuration and Compilation
Kernel Configuration and Compilation
 

Último

GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 

Último (20)

GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 

Recipe of a linux Live CD (archived)

  • 1. Recipe of a Linux LiveCD By Buddhika Siddhisena
  • 2. 2 Agenda What is a LiveCD Why run a LiveCD Understanding the Linux Boot process Understanding the Linux LiveCD Boot process How hardware detection could work Achieving Data Persistence on LiveCD Short survey of popular LiveCDs
  • 3. 3 What is a LiveCD Is a CD that contains an Operating System (OS), capable of booting off directly, without first having to be installed. Will generally have automatic hardware detection, as the OS boots. May contain more data than the physical size of a CDROM (~700MB) by using on-the-fly decompression of the file system. Generally slower to boot when compared to HDD, mainly due to slower access times of CDROM drives. May offer the ability to remember configuration settings by saving them on to a drive (USB, floppy or HDD). May offer it to be installed to the hard disk permanently
  • 4. 4 Why run a LiveCD Provides an alternative way to try out a new OS/distribution. Can be used to instantly convert any desktop to your desktop! And you can't get blamed for doing so. Can be a valuable resource for recovering data, resetting passwords etc. Can be used to distribute a demo versions of software thats guaranteed to work with minimum hassle. And endless other possibilities....
  • 5. 5 Understanding the Linux Boot process As the machine boots the BIOS looks for a bootable media depending on the boot sequence. BIOS loads the bootloader from a special area in the disk called the Master Boot Record (MBR). On linux it is usually either LILO or GRUB. LILO (or GRUB) will attempt to load the kernel and optionally an initial RAM disk (initrd), if specified. Control is passed to the kernel as it decompresses the initrd and mounts it as the root device.
  • 6. 6 Understanding the Linux Boot process The kernel executes /linuxrc from the root device. It will perform various pre-boot tasks such as loading of additional drivers. Once linuxrc exits control is passed back to the kernel which will then mount the real root device as the root file system. /sbin/init from the real root system is executed which uses /etc/inittab configuration to boot rest of the system. /etc/inittab defines the default runlevel (usually 3 or 5) and as part of the boot process all scripts in /etc/rcX.d/ are executed.
  • 7. 7 Linux boot process in a nutshell Power supply ON PC BIOS starts BIOS looks for a bootable media according to the setting and loads a program(=LILO) written on MBR of a hard drive, and then LILO gains control. LILO loads a kerne(vmlinuz)and an initial RAM disk(initrd)Kerne l gains control Kernel expands initrd and mounts it as a temporary root file system If an executable /linuxrc exists in the initrd, the kernel executes it. After the /linuxrc is finished, the kernel mounts a real root file system which may be /dev/hda1 /sbin/init executes /etc/rc.d/rc.sysinit according to a description of /etc/inittab. Next, init executes /etc/rc.d/rc with a default run level as an argument For example, in run level 3, /etc/rc.d/rc executes shell scripts like SnnXXXX(nn=number) under /etc/rc.d/rc3.d directory in order of S00XXXX to S99XXXX with a start argument
  • 8. 8 Understanding the Linux LiveCD Boot process BIOS finds a bootable CDROM and loads the bootloader (usually ISOLINUX which is based on the Syslinux bootloader) ISOLINUX will load the initrd and the kernel image and transfer control to the kernel. The kernel decompresses initrd and mounts it as root and executes the /linuxrc script from the LiveCD.
  • 9. 9 Understanding the Linux LiveCD Boot process It will load kernel modules required, attempt to guess the CDROM device and mount it. Finally linuxrc will change the real root device of the kernel to that of initrd, or LiveCD and exit. #!/bin/sh echo Mounting /proc filesystem mount -t proc /proc /proc echo Attempting to Mount CD-ROM (mount -t iso9660 /dev/hdb /mnt/cdrom && ln -s /dev/hdb /dev/cdrom) || (mount -t iso9660 /dev/hdc /mnt/cdrom && ln -s /dev/hdc /dev/cdrom) || (mount -t iso9660 /dev/hdd /mnt/cdrom && ln -s /dev/hdd /dev/cdrom) || (mount -t iso9660 /dev/hda /mnt/cdrom && ln -s /dev/hda /dev/cdrom) || (echo 'cannot mount CD-ROM, dropping you to a shell';sh) echo 0x0100 > /proc/sys/kernel/real-root-dev umount /proc Hardware detection scripts will take over as a runlevel service to configure the rest of the system.
  • 10. 10 Hardware detection process Scripts can use tools such as lspci, /proc/bus/pci/devices, /proc/bus/usb/devices etc. to determine the system hardware. bud@babytux bud $ /sbin/lspci 0000:00:01.0 PCI bridge: ATI Technologies Inc: Unknown device 7010 0000:00:02.0 USB Controller: ALi Corporation USB 1.1 Controller (rev 03)0000:00:06.0 Multimedia audio controller: ALi Corporation M5451 PCI AC- Link Controller Audio Device (rev 02) 0000:00:09.0 Network controller: Harris Semiconductor Prism 2.5 Wavelan chipset(rev 01) 0000:00:10.0 IDE interface: ALi Corporation M5229 IDE (rev c4) 0000:00:12.0 Ethernet controller: National Semiconductor Corporation DP83815 (MacPhyter) Ethernet Controller 0000:01:05.0 VGA compatible controller: ATI Technologies Inc: Unknown device 4337 Then by using a database or some sort of pattern matching we can load the correct kernel modules to drive those devices. Check out the Linux PCID Repository at http://pciids.sourceforge.net/ or the file /usr/share/misc/pci.ids
  • 11. 11 Hardware detection process Other tools such as kudzu(http://rhlinux.redhat.com/kudzu/) that comes with Redhat or discover(http://hackers.progeny.com/discover/) can also be used Configuring X windows can be done using tools such using XFree86 and tools such as ddcprobe or read-edid to detect monitor refresh rates. # XFree86 -configure # get-edid | parse-edid Usually the /etc, /home and /tmp directories will reside on an ramdisk and will be symlinked from the LiveCD to be able to save settings Certain files in the /dev directory should also reside on a ram disk. (e.g. /dev/tty*, /dev/pts/* etc.)
  • 12. 12 Achieving Data Persistence on LiveCD Data persistence can be achieved by running a shell script to store the content of /home or /etc on a USB flash or HDD. #!/bin/sh mount /dev/sda1 /mnt/usb tar -zcvf /mnt/usb/home.tar.gz /home tar -zcvf /mnt/usb/etc.tar.gz /etc When booting the live CD using ISOLinux, it is possible to pass parameters to the kernel, even once that the kernel doesn't understand boot: linux26 vga=791 home=/mnt/sda etc=/mnt/sda A bootup script could read this value by examining /proc/cmdline # cat /proc/cmdline
  • 13. 13 Short survey of popular LiveCDs Knoppix - Knoppix is a Live Linux CD based on Debian GNU/Linux Excellent hardware detection Uses on the fly transparent decompression to store 2.5GB or data Easy to remaster and make your own LiveCD (e.g. Gnoppix, Damn Small Linux(DSO), Sinhala Knoppix) http://www.knoppix.net Mepis – Based on Debian GNU/Linux Very Good harware detection. Uses on the fly decompression to store about 1.1GB or data Contains some non-free software such as Flash, Java, RealPlayer etc. Easy to install to the HDD http://www.mepis.org/ SLAX – Slackware based LiveCD Fast, works well on slightly older hardware Fits on to a mini CD since the image is only 185MB http://slax.linux-live.org/
  • 14. 14 Short survey of popular LiveCDs LNX/BBC – Portable card-sized distribution Design to fit to a credit card size CD http://www.lnx-bbc.org Mandrake Move – A live CD based on Mandrake Linux Commercial and free edition available. http://www.mandrakesoft.com/products/mandrakemove FreeBSD LiveCD – A LiveCD based FreeBSD OS http://livecd.sourceforge.net/