Title: ROM-BIOS ??
1??? ????
2??? ??? ?? ?? ??
lt??? ??? ?? ??gt
3??? ??? ?? ?? ??
- ROM-BIOS ??
- ????? ROM-BIOS? ??
- POST(power-on self test)
- ???? ????? ??? ??? ?? ??
- ???? ?? ???? ??
- MBR(Master Boot Record)?? ?? ????(????)? ?? ??
???? ?? - ????? ???? ???
- ???? LILO, GRUB, ppcboot, uboot
- GRUB /boot/grub
4??? ??? ?? ?? ??
- ?? ??? 0? ??? ??
- grub? ??? ? MBR? ??? ?? ??? ??, ??? ? grub? ?????
? - ?? ???? ??? ??? ??? ? ?? ??? ??
- ?? ?? 0xAA55
- ??? ? ??? MBR? ??? ???? ?
- ?? 512byte
5??? ??? ?? ?? ??
- ????
- MBR(? ????)
- stage1 ? stage1.5 ? stage2
- ???? ?? ??? ???? ??? stage2? ??
6??? ??? ?? ?? ??
- ?? ??? ?? ? ??
- GRUB?? ?? ?? ???? ??
- ?? ??? ??
- ??? ???? ???
- ??? ?? ? ?? ??
- arch/i386/boot/bootsect.S
- arch/i386/boot/setup.S (start())
- arch/i386/boot/compressed/head.S (setup_32())
- arch/i386/boot/compressed/misc.c
(decompress_kernel()) - arch/i386/boot/kernel/head.S (startup_32())
- init/main.c (start_kernel())
7??? ??? ?? ?? ??
- arch/i386/boot/setup.S
- ?? ???? ???? start() ??? ??
- ???? ???? ??
- arch/i386/boot/compressed/head.S? startup_32() ??
?? - arch/i386/boot/compressed/head.S
- startup_32() ??
- ?? ??
- BSS(Block Started by Symbol)? ???
- arch/i386/boot/compressed/misc.c ??
decompress_kernel() ??? ???? ??? ?? ??
8??? ??? ?? ?? ??
- arch/i386/kernel/head.S
- startup_32()
- ??? ??? ????? ???
- ???? ???? ???
- ???? ??? ??
- ??? ??? ??? ? ??? ????(enable)
- BSS ?? ???
- IDT ??
- ?? ????? ?? ??? ??? ??
- CPU ?? ?? ? FPU ??
- GDT? IDT ??
- start_kernel() ?? ??
- ??? ?? ?? ??? start_kernel? ??
- start_kernel() ??
- init/main.c
- ???? ??? ??? ??? ???
- ??? ??? ?? ?? ???? ???? ??? ??
- init ????? ???? init() ??? ??
9??? ??? ?? ?? ??
10??? ??? ?? ?? ??
- init ????(???)? ??
- init/main.c?? init() ??
- start_kernel( ) ???? ?? ???? ?? ??? ??? ???? ?
?? ?? ?? ???? ??? - ?? ??? ?? ?? ??????? init ??(/sbin/init)? ????
- /sbin/init
- ??? ??? ??? ????
- ?? init? ?? ??? ??? ?? ? ??(panic)
- dup ??? ?
- stdin(????)? ?? ?????? ?? ?? ?? ?? ?????? ????,
?? ????? 1, 2? ?? ??? ?? ??? ???? ??
11??? ??? ?? ?? ??
- inittab ?? ??
- /etc/inittab ??? ?? ??
- init ????? ???? ? ?? ??? ????? ???? ??
- ? ??(run level)? ?? ??? ???? ?? ? ?????
getty(mingetty)? ???? ??? ????? ??? ????? ????
? ??? ? - ????? ???? ????? ?(shell)? ??? ???? ?? ??? ???
12start_kernel() ??
- 01 asmlinkage void __init start_kernel(void)
- 02
- 03 char command_line
- 04 extern char saved_command_line
- 05 lock_kernel()
- 06 printk(linux_banner)
- 07 setup_arch(command_line)
- 08 printk("Kernel command line s \n",
saved_command_line) - 09 parse_options(command_line)
- 10 trap_init()
- 11 init_IRQ()
- 12 sched_init()
- 13 softirq_init()
- 14 time_init()
- 15 console_init()
- 16 init_modules()
- 17 kmem_cache_init()
- sti()
- calibrate_delay()
20 mem_init() 21 kmem_cache_sizes_init() 2
2 pgtable_cache_init() 23 if
(num_mappedpages 0) 24 num_mappedpages
num_physpages 25 fork_init(num_mappedpages) 26
proc_caches_init() 27 vfs_caches_init(num_
physpages) 28 buffer_init(num_physpages) 29
page_cache_init(num_physpages) 30
signals_init() 31 proc_root_init() 32
check_bugs() 33 acpi_early_init() / before
LAPIC and SMP init / 34 printk("POSIX
conformance testing by UNIFIX \n") 35
smp_init() 36 rest_init() 37
13start_kernel() ??
- init/main.c
- ??? ??? ?? ?? ??? ??? ???? ??? ??
- ??? ??? ??? ?????? ??? ??? ?? ????? ???? ????
????? ??? ?? - ?? ??
- 5? ???? SMP ???? ???? ??? ?? ?? ?(lock)? ??
- include/asm/i386/smplock.h
- 6? linux_banner ??
- init/version.c
- /var/log/dmesg? ??
- cat /proc/version
14start_kernel() ??
- 7? setup_arch( )
- ?? ?????? ??? ?? ????? ???? ??? ?? ??
- ???? ?? ???? ??
- ??? ????? ?? ? ??
- ??? ??? ???
- ?? ?? ?
- arch/"CPU??"/kernel/setup.c ? arch/i386/kernel/set
up.c - 8? ??? ?? ??? ??? ??
- 9? ??? ??? ?? ??? ??
- 10? ??(??) ???? ??
- ??? ? ????? ????? ?? ???? ??
- ?????? ?? ??? ?? ???? ????? ??
- 0x00 0x19
- 0x80 ??? ?
- arch/i386/kernel/traps.c
15start_kernel() ??
- 11? init_IRQ()
- arch/i386/kernel/i8259.c
- ???? ????? ??
- init_ISA_irqs() ??? ???? ? ?? 8259A ???? ?????
???, ISA IRQ?? ?? ?? ???? ????? ?? - ???? ???? ?? ???? ????? ??
- 12? sched_init( ) ??
- ???? ????? ?? ??? ??? ??
- kernel/sched.c
- init ???? ???? CPU ?? ??
- pid ?? ???(hash table)? ???
- ???? ???? ???
- "bottom-half" ??? ???
- lazy TLB(translation lookaside buffer) ??
16start_kernel() ??
- 13? softirq_init()
- kernel/softirq.c
- tasklet, softirq? ???
- ?????? ?? ?? CPU?? bottom-half? ??? ? ???
softirq? tasklet? ?? - 14? time_init() ??
- arch/i386/kernel/time.c
- CMOS?? ???? ?? ??? ?? ?
- IRQ0 ??? ? ???? ???? ??
- ??? 3?? ??? ?? ??
- PIT ??? ??
- RTC(Real Time Clock) ??
- TSC(Time Stamp Counter) ??
- 15? console_init()
- drivers/char/tty_io.c
- ?? ???
17start_kernel() ??
- 16? init_modules( ) ??
- kernel/module.c
- ?? ??? ??
- ?? ?? ???? ??(?) ???
- 17? kmem_cache_init( ) ??
- mm/slab.c
- ?? ???(slab allocator)? ???
- ??? ??? ???? ???? ???? ?? ?????? ??? ?? ????
????? ???? - 18? sti( ) ??
- ???? ?? ??? ??
- 19? calibrate_delay( ) ??
- "loops_per_jiffy" ?? ?? ?? ??
- BogoMIPS ??
18start_kernel() ??
- 20? mem_init( ) ??
- arch/i386/mm/init.c
- empty_zero_page? ???
- ??? ??? ??(free_pages_init() )
- ??? RAM ??? ?? ???
- ???? ??? ??, ?? ?? ??, ??? ??? ??, ?? ??? ??,
init? ??, High ???? ???? ??? ?? - 21? kmem_cache_sizes_init( ) ??
- mm/slab.c
- ???? ???? ???
- 22? pgtable_cache_init( ) ??
- arch/i386/mm/init.c
- ??? ??? ??? ???
- 2324?
- num_mappedpages ??? ???? ??? ?? ??
19start_kernel() ??
- 25? fork_init() ??
- kernel/fork.c
- ?? ???? ?? ??? ??? ?? ??
- init ???? ?? ??? ??? ??? ???
- 26? proc_caches_init( ) ??
- kernel/fork.c
- signal_act, files_cache, fs_cache,
vm_area_struct, mm_struct? ?? slab ???? ?? - 27? vfs_caches_init( ) ??
- fs/dcache.c
- bh_cache, names_cache, filp_cache, dquot? ?? slab
??? ?? - dentry_cache? dentry_hashtable? ??
20start_kernel() ??
- 28? buffer_init( ) ??
- fs/buffer.c
- ?? ?? ?? ???? ???? ???
- buffer_head ???? ???
- ?? ??? LRU ???? ??
- 29? page_cache_init( ) ??
- mm/filemap.c
- ??? ?? ?? ???? ???? ???
- 30? signals_init( ) ??
- kernel/signal.c
- ??? ??? ??? sigqueue ?? ??? ??
- 31? proc_root_init( ) ??
- fs/proc/root.c
- /proc ????? ??
- /proc/net, /proc/fs, /proc/driver ?
21start_kernel() ??
- 32? check_bugs() ??
- linux/include/asm-i386/bugs.h
- ?? ?? ??, FPU ??, Halt ?? ? ???? ???? ??
- 33? acpi_early_init() ??
- ?????? ??? I/O ??? ??? ? ??? ??
- ?????? acpioff? ??? ???? skip
- 35? smp_init() ??
- init/main.c
- ?? SMP ?????? ????
- 36? rest_init( ) ??
- init ????? ??
- ??? ?? ??
- ??(idle) ??? ???(CPU_idle() ??, idle process, pid
0 )
22inittab ??
- inittab ??
- ???? ??? ?? ?? ? ??(run level)?? init ?????
???? ? ??? ??? ?? ??
??? ??
0 ??? ??
1 ?? ?? ??
2 NFS? ??? ?? ??? ???? ????? ???? ??? ? ?? 3? ??
3 ?(Full) ?? ??? ??
4 ???? ??(unused)
5 X ???
6 ??? ???
lt???? ??gt
23inittab ??
01 02 inittab This file describes how the
INIT process should set up 03 the system in
a certain run-level. 04 05 Author Miquel
van Smoorenburg,ltmiquels_at_drinkel.nl.mugnet.orggt 0
6 Modified for RHS Linux by Marc Ewingand
Donnie Barnes 07 08 09 Default runlevel.
The runlevels used byRHS are 10 0 - halt
(Do NOT set initdefault to this) 11 1 -
Single user mode 12 2 - Multiuser, without
NFS (The same as3, if you do not have
networking) 13 3 - Full multiuser mode 14
4 - unused 15 5 - X11 16 6 -
reboot (Do NOT set initdefault to this)
17 18 id5initdefault 19 20 System
initialization. 21 sisysinit/etc/rc.d/rc.sysi
nit 22 23 l00wait/etc/rc.d/rc 0 24
l11wait/etc/rc.d/rc 1 25 l22wait/etc/rc.d/
rc 2 26 l33wait/etc/rc.d/rc 3 27
l44wait/etc/rc.d/rc 4 28 l55wait/etc/rc.d/
rc 5 29 l66wait/etc/rc.d/rc 6 30 31
Trap CTRL-ALT-DELETE 32 cactrlaltdel/sbin/shu
tdown -t3 -r now 33 34 When our UPS tells
us power has failed, assume we have a few minutes
24inittab ??
35 of power left. Schedule a shutdown for 2
minutes from now. 36 This does, of course,
assume you have powerd installed and your 37
UPS connected and working correctly. 38
pfpowerfail/sbin/shutdown -f -h 2 "Power
Failure System Shutting Down" 39 40 If
power was restored before the shutdown kicked in,
cancel it. 41 pr12345powerokwait/sbin/shutdow
n -c "Power Restored Shutdown Cancelled"
42 43 Run gettys in standard runlevels 44
12345respawn/sbin/mingetty tty1 45
22345respawn/sbin/mingetty tty2 46
32345respawn/sbin/mingetty tty3 47
42345respawn/sbin/mingetty tty4 48
52345respawn/sbin/mingetty tty5 49
62345respawn/sbin/mingetty tty6 50 51
Run xdm in runlevel 5 52 x5respawn/etc/X11/pr
efdm -nodaemon
25inittab ??
- ? ????? ??
- ? identifier ? ???? ???? ?? ???
- (1? ?? ?? 1? ??? ???)
- ? run level ? ???? ?????? ? ?? ??
- ? action process ??? ??? ????? ??? ??? ?? ??
- ? process ?????? ?? ???? ? ??
26inittab ??
- action? ??
- initdefault ??? ? ??? ??
- init ????? ??? ? ?? ?? ???? ????? ? ?? 5? ???
? ??? ????? ?? - sysinit ??? ?? ?? ???? ? ?? ??? ??
- boot ?? bootwait ????? ???? ?? ???
- wait ????? ??? ? init ????? ??? ????? ??????
????? ?? - once ????? ??? ? wait?? ???? ??? ??
- ?? ????? ???? ????? ??
- ctrlaltdel init ????? SIGINT ???? ??? ???? ??
- ??? ?? ??? CTRLALTDEL ?? ??? ????.
- powerwait ??? ??? ?? ?? ??
- init? ????? ??? ??? ???
27inittab ??
- powerokwait ??? ???? ???
- powerfail powerwait ??? ?? ?? init? ????? ???
???? ???? ? - respawn ??? ????? ?? ?? ?? ????? ??
- ? getty ????? ??? ??
- kbrequest ??? ?????? init? ???? ??? ???? ??
- off ????? ?? ?? ?? ??? ???? ??
- ?? ? ???? ??? ????? ?? ?? ??? ?? ???? ??? ???? ??
20? ?? ?? - boot ??? ?? ?? ????? ??. ? ?? ??? ??
- bootwait boot? ?? ?? ????? ??? ??? ????? ?
28inittab ??
- 21? /etc/rc.d/rc.sysinit
- ?? ?? ???? ??????, ???? ????? ????
- ??? ? ??? ???? ???? ???? ??? ?? ?? ????? ? ???
?? ???? ???? ??? - ? ??? ???? ?? ? ??? ??
- ?? ??
- ???? ?? ??
- proc ????? ???
- ?? ???? ??
- ??? ?? ??
- ??? ?? ??
- USB ????, HID ???? ???
- ?? ?? ??? ????(Read-Write ??)
- LVM ???
- ?? ??? ???
- ?? ??
- ?? ??? ??
- ?? ?? ?? ??? ???
- ??? ?? ???
- ?? ??? ???
29inittab ??
- 23?29? l00wait/etc/rc.d/rc 0
l66wait/etc/rc.d/rc 6 - ??? ? ??? ?? ??? ?? ???? ??
- ? ??? 5? /etc/rc.d/rc5.d? ???? ????? ??
- ? ??? 0?? /etc/rc.d/rc0.d? ???? ???? ???
- ? ??? 6?? /etc/rc.d/rc6.d? ???? ???? ???
- ? ???? ??? ? ? ??? ?? ??? ? ?????? ??????
?????? ?? - K? S? ???? ???? ?? ?? ??? ??
- ???? K? ???? ??? ? ????, S? ???? ???? ? ????? ??
- K? S ?? ???? ?? ? ?? ??? ?? ??
- 32? cactrlaltdel/sbin/shutdown -t3 -r now
- CTRL ALT DEL ?? ??? ??? ? ???? ???
- -r ??? -h ???? ???? ???? ??
30inittab ??
- 38? pfpowerfail/sbin/shutdown -f -h 2
"Power Failure System Shutting Down" - UPS ?? ??? ??? ?? ??, 2? ?? ???? ???? ????? ??
- 41? pr12345powerokwait/sbin/shutdown -c
"Power Restored Shutdown Cancelled" - UPS? ???? ?? ??? ???? ??, ??? ??? ???? ?? ???
??? - 44?49? 12345respawn/sbin/mingetty
tty162345respawn/sbin/ mingetty tty6 - mingetty ??? ?? 6?? ?? ??? ??
- ??? ?? ???? ??? ???? ???? ?? ??? ???? ??? ??
?? ?? ?? - X ??? ???? ?? ?? 7? ??
- Alt F ?? ??? ??(?? CtrlAltF ?? ??)
- /sbin/mingetty
- login ????? ????
- ???? ???? ???? ?? login ????? ??? ???? ID? ?????
??? - ????? ????
- respawn
31Thank you!