Escolar Documentos
Profissional Documentos
Cultura Documentos
Souri Guha
souriguha@gmail.com
souriguha.wordpress.com
4/23/10
reasons that we all are here
• Probably we are fed up using Windows! BSOD’s, Viruses, System
issues (pretty much incurable stuff) and what not?
• We want to explore a brand new world
• We want to learn about Computers
• We want to have higher efficiency, faster computation, higher
stability
• We all love to be free...
4/23/10
4/23/10
so what are we going to do?
•
• Go Open Source
• To get familiar with the Linux environment
• Get to know what Linux can do for you
• Get to know what you can do for Linux
4/23/10
our Agenda
• The World of Open Source
• Applications
• Contribute!
4/23/10
the world of Open Source
•
4/23/10
the beginning of Open Source
•
4/23/10
the open source Community
• What do we mean by the ‘community’?
• How they work?
• How they manage to keep it free?
• Profits, Goals and Motivations
• Long term vision
4/23/10
the open source Community
•
How they Work?
4/23/10
the difference
4/23/10
the linux enterprise coordination
4/23/10
birth of Linux
4/23/10
major Open Source Projects
• Mozilla Firefox
• VLC Media Player
• OpenOffice
• Android
• Symbian
• Maemo
4/23/10
birth of FOSS The GNU Project
4/23/10
The colors and flavours: DISTROs
4/23/10
Small and large
4/23/10
where are WE?
• The World of Open Source
• Applications
• Contribute!
4/23/10
operating systems: The basics
4/23/10
operating systems: The basics
• Architecture of OS[Linux]
4/23/10
operating systems: The big names
• Windows
• MacOS
• Linux
• Others
4/23/10
The OS that is called Linux
• The difference
• POSIX Compliance
• Supported Architectures
4/23/10
choosing the Distro
4/23/10
why choose Fedora
4/23/10
where are WE?
• The World of Open Source
• Applications
• Contribute!
4/23/10
installing Linux: diving in
• Simple!
• Download the distro
• Checksum(Thats realy optional)
• Burn the file onto your DVD
• All for free!
4/23/10
installing Methods
4/23/10
booting up
• Boot methods
• Prerequisites for a succesful boot
• Debugging boot error messages
• Screenshots
4/23/10
starting up the GUI
• gui!
• The X-Window Project
• Debugging GUI probs
• Do we really need a GUI?
4/23/10
logging IN
4/23/10
types of Users
• Root (SuperUser)
• Normal Users
• Every process is just another user
4/23/10
types of GUI’s
4/23/10
what we’re using Here
4/23/10
why GNOME?
• Simpler
• Lighter
• My personal favourite
• KDE4 is under development and sometimes unstable
in a few hardwares
4/23/10
the Gnome Interface
• The Desktop
• Panels
• Launcher
• Menus
• Possible customizations
• Screenshots
4/23/10
the Gnome Interface
• The Desktop
• Panels
• Launcher
• Menus
• Screenshots
4/23/10
the customization Possibilities
4/23/10
where are WE?
• The World of Open Source
• Applications
• Contribute!
4/23/10
preparing the system for first Use
• Movie clips
4/23/10
the God of initial configs
• www.fedoraguide.info
• repos
• codecs
4/23/10
where are WE?
• The World of Open Source
• Applications
• Contribute!
4/23/10
let’s get deeper
• The filesystem
• Files are evrything!
• interacting with the kernel: BASH
4/23/10
classification of Filesystems
4/23/10
everything and anything: Files
4/23/10
a sneek peek at the Filesystem[RootFS]
4/23/10
a sneek peek at the Filesystem[RootFS]
4/23/10
the linux Virtual Filesystem[VFS]
4/23/10
use a filesystem: Mount
4/23/10
the key files
• files in /etc
• files in /dev
• files in /bin and /sbin
• /home and /root
4/23/10
the key files
• files in /dev
• files in /bin and /sbin
• /home and /root
• files in /etc
4/23/10
files in /etc
4/23/10
windows and linux: a Comparison
• The similarities
– Users, Install locations, Apps, GUI
• The dissimilarities
– App Install, Filesystems,
• Comparable apps
4/23/10
now we know the basics
4/23/10
now start something
• What we need
– an editor
• gedit(Gnome),emacs,vi
– internet
4/23/10
the basic file operations
• cd
• mv
• cp
• rm
• mkdir
• rmdir
• ls
• mount
4/23/10
installing applications
4/23/10
configuring yum
4/23/10
configuring yum
4/23/10
yum vs rpm
4/23/10
compiling Apps from scratch
4/23/10
community support: howto
4/23/10
end of Basics
4/23/10
where are WE?
• The World of Open Source
• Applications
• Contribute!
4/23/10
getting to the heart of Linux
• The Kernel
• What the kernel is all about
• How many lines of code?
4/23/10
understanding the kernel Versions
4/23/10
hwo the kernel became what it is
4/23/10
hwo the kernel became what it is
4/23/10
the kernel: An Overview
• the UI
• User Identification
• Processes
• File management
• System Calls
• Scheduler
• Drivers
4/23/10
the kernel: Portability
– x86
– SPARC
– PowerPC
• Kernel Datatypes:
– Linked Lists
– Trees
– Binary Trees
• C
• Assembly
• Inline Assembly
• Applications
– Objdump/readelf
– Hexdump
4/23/10
objcopy
–
the kernel: Listening to the kernel
• Printk()
• Dmesg()
– Sytem Messages: sysklogd()
– Messages stored in /proc/kmsg
• Conbination of syslogd() and klogd()
4/23/10
the kernel: Some miscellaneous Quirks
• __init()
– The __init macro tells the compiler that the associate function or
variable is used only upon initialization
– If data is used during init: __initdata()
4/23/10
the kernel: Some miscellaneous Quirks
• __init()
– The __init macro tells the compiler that the associate function or
variable is used only upon initialization
– If data is used during init: __initdata()
4/23/10
the kernel: process Lifecycle
4/23/10
the kernel: Process Creation
4/23/10
the kernel: Process System Calls
• Fork() : The fork() function returns twice: once in the parent and once in the child
process. If it returns in the child process, fork() returns 0. If it returns in the parent,
fork() returns the child's PID. When the fork() function is called, the function places
the necessary information in the appropriate registers, including the index into the
system call table where the pointer to the system call resides.
• Vfork(): The vfork() function is similar to the fork() function with the exception that
the parent process is blocked until the child calls exit() or exec()
• Clone()
4/23/10
the kernel: Process State Transitions
4/23/10
the kernel: Process Killing
• Exit functions
– Sys_exit() function
– Do_exit() function
• Parent Notifications
4/23/10
– Sys_wait4()
the kernel: Process Killing
• Exit functions
– Sys_exit() function
– Do_exit() function
•
4/23/10
Parent Notifications
the kernel: Memory Management
• Pages : As the basic unit of memory managed by the memory manager, a page has
a lot of state that it needs to be kept track of.
• Slab Allocator
• Memory Request Path
• Page Faults
– Do_page_fault()
• /arch/i386/mm/fault.c
4/23/10
the kernel: task Scheduling
• Open()
• Close()
• Read()
– pdflush
4/23/10
the kernel: task Scheduling
– kernel/sched.c
– include/linux/sched.h
4/23/10
the kernel: task Scheduling - Preemption
4/23/10
the kernel: system Clock
• Real-Time Clock (RTC)
• /include/linux/rtc.h
• RTC provides timekeeping fucnctions with a small 114-byte user NVRAM
• Input to this device is a 32.768Mhz oscillator and a battery backup
• Newer RTC built into the Southbridge of a computer chipset
4/23/10
the kernel: Booting it up
4/23/10
the kernel: Bootloader
• Program residing on the boot device of the computer
• MBR is on the first sector of boot device(sector0, cylinder 0, head
0)
4/23/10
the kernel: Bootloader
• MBR Components
– 0x00 0x1bd MBR Program Code
4/23/10
the kernel: Bootloader- GRUB
4/23/10
the kernel: Bootloader- GRUB
– Jump to Stage 2
• /boot/menu.lst
4/23/10
the kernel: Bootloader- LILO
• /boot/menu.lst
4/23/10
the kernel: Bootloader- initrd
4/23/10
the kernel: Bootloader- the startup
• start_kernel()
– Spawns off Process 0
4/23/10
Building the Kernel
• What do we need
– Toolchains (GUI versions alos known as SDK)
– Compilers
– Linkers
4/23/10
Building the Kernel: The Toolchain
• Set of programs necessary to create the linux kernel image
• Toolchain concept: Output of one tool becomes the input of another tool
• Our toolchain includes:
– A compiler
– An Assembler
– A linker
4/23/10
Building the Kernel: Cross Compilers
• Building linux for other platforms
• Host PC: PC you are performing the Development Process
• Target: The device for which you are developing
4/23/10
Building the Kernel: ELF Object Files
• Format for Object Files vary from manufacturer to manufacturer
• Standard unix object file type: Executable andLining File format
• Types of ELF
– Executable
– Relocatable
4/23/10
Building the Kernel: ELF Object Files
• Format for Object Files vary from manufacturer to manufacturer
• Standard unix object file type: Executable andLining File format
• Types of ELF
– Executable
– Relocatable
4/23/10
Let’s Build it!
• Heavy involvement with the kernel Source Code
• Detailed howto www.tldp.org/HOWTO/Kernel-HOWTO/
• Download: kernel.org
• Find it under: /usr/src/linux-<version>
4/23/10
Source code Layout
4/23/10
Architecture independent Subdirectories
•
Crypto: Holds code for cryptographic API and various encrypting/decrypting algorithms
• Include: The header files. This directory has a series of subdirectories starting with the prefix asm. These directories hold the architecture-specific header files.
• init: The architecture-independent portion of the bootstrapping code and initialization code
4/23/10
Architecture dependent Subdirectories
/arch/x86
•
boot: Source code related to the x86 bootstrapping and install process
4/23/10
Miscellaneous Files
•
Copying: The GPL license under which Linux is licensed
• kbuild
• highly dependent on the hierarchical strucure of filesystem
• generates the .config file
– Take a look at it
• The makefile
– #make xconfig ARCH=ppc
– #make ARCH=ppc CROSS_COMPILE=ppc-linux-
4/23/10
makefile relationships
4/23/10
what next?
4/23/10
where are WE?
• The World of Open Source
• Applications
• Contribute!
4/23/10
what bash?
• Bash: The Bourne-Against-Shell
•
The shell's job, is to translate the user's command lines into operating
system instructions
4/23/10
history of bash
• named after Steve Bourne
• bash, intended to be the standard shell for the GNU system, was officially
"born" on Sunday, January 10, 1988
• In keeping with the GNU principles, all versions of bash since 0.99 have
been freely available from the FSF
• it includes the best features of the C and Korn shells as well as several
advantages of its own
4/23/10
bash Characters
4/23/10
bash Script basics
• A script, which is a file that contains shell commands, is a shell
program.
• Write the script <./my_script>
• Enable Permissions
– $ chmod +x scriptname
4/23/10
ways to run a script
4/23/10
the shell variables
• bash derives much of its programming functionality from shell
variables.
• $ hatter=mad$ ; echo "$hatter"mad
• positional parameters in functions
function alice
{
echo "alice: $*"
}4/23/10
the shell flow control
• if else
if condition
then
statements
[elif condition
then statements...]
[else statements]
fi
• Error Processing
then
normal processing
4/23/10
else
the shell flow control
• for
for name [in list]
do
done
• example
4/23/10
if [ -z "$dir" ]; then dir=.; fi
the shell flow control
• case
case expression in
pattern1 )
statements ;;
pattern2 )
statements ;;
...
esac
4/23/10
the shell flow control
• while
while conditiondo
statements...done
• until
until command;
do statements...done
• Example
sleep 5
done4/23/10
where are WE?
• The World of Open Source
• Applications
• Contribute!
4/23/10
say goodbye to Windows!
• Higher freedom
• Faster, Lighter
• Flexible
4/23/10
say goodbye to Windows!
• Higher freedom
• Faster, Lighter
• Flexible
4/23/10
say goodbye to Windows!
• Find Comparable apps to Windows
4/23/10
where are WE?
• The World of Open Source
• Applications
• Contribute!
4/23/10
current Applications
• Home/Personal use
• Corporate Use
• Workstations
• Parallel Computing
– Supercomputers
• Small gadgets:
– Routers
– Access Points
4/23/10
current Applications : Gaming
• Transgaming
– Used to port Windows Games to run under Linux Distros
– Almost every Game runs under Linux
• Call of Duty 4
• Counter Strike
• etc.
• Call of Duty 4
• Counter Strike
• etc.
4/23/10
Applications : Parallel
current
Computing[GRIDS]
• Try out this one at your home
– Download Parallel Knoppix
– Boot it up
– Connect it to LAN
–
You now own a supercomputer!
4/23/10
where are WE?
• The World of Open Source
• Applications
• Contribute!
4/23/10
please contribute!
• Why contribute?
– The foundation expects you to contribute back to the project for the reason you
have used the project for your own benefits
– The project is worth a billion man years! That’s fascinating right?
– Contribute, Share, Develop
– GPL and LGPL Licences
4/23/10
howto contribute!
• Use Version Control Systems
– GIT
– View a guide to GIT on my blog (souriguha.wordpress.com)
– How the community work
4/23/10
GIT Basics
4/23/10
Any Questions?
Contact: anubhav.seth@ieee.org
souri.guha@ieee.org
Visit: kernel.org
linux.com
fedoraproject.org
linuxfoundation.com
4/23/10
thank you!
4/23/10