-Linuxwangk@swnu.edu.cn20052RedHatLinux9.02.1•2.1.1•2.1.2•2.1.3•2.1.4•2.1.52.1.1•–––––SCSI––––––•IP•••••••2.1.2–CD-ROM/–NFS/FTP/HTTP)•2.1.3•2.1.4–PersonalDesktop–Workstation–Server–Custom–Upgrade•2.1.5PrimaryPartitionExtensionPartitionLogicalPartition)+PrimaryMaster:/dev/hda1PrimarySlave:/dev/hdb2SecondaryMaster:/dev/hdc3SecondarySlave:/dev/hdd5LinuxLinuxNativeLinuxSwap$mkdir/mnt/cdrom$mount–tauto/dev/hdb/mnt/cdrom•2.1.5VFSVirtualFileSystemext2/ext32.2RedHatLinux9.0•2.2.1•2.2.2•2.2.32.2.1•Bootboot:boot:textboot:expertboot:linuxddDriverDiskboot:rescue2.2.2•(VirtualConsole)1.2.3.4.5.6.*7.8.DiskDruid9.*GRUBLILO10.11.12.13.14.root15.16.17.18.19.20.21.*X-Window22.2.2.3•–GRUB–LILO–LOADLIN–SYSLINUX–SystemCommander–PartitionLogic•–/35MB/boot5MB/chroot10MB/home100MB/tmp30MB/usr232MB/var25MB•LBA(LogicalBlockAddressing):amethodusedwithSCSIandIDEdiskdrivestotranslatethecylinder,head,andsectorspecificationsofthedriveintoaddressesthatcanbeusedbyanenhancedBIOS.LBAisusedwithdrive'sthatarelargerthan504MB.LINUXLINUX•LinuxLILO--init/sbininit/etc/inittab•“init”“getty”gettyshell(bash)bash•CPULinuxKernel----•/lib/modules.o--FATISA.••(ext2)()--“”••BIOS•BootLoader••CS:IPBIOS•CS:=FFFF;IP:=0000BIOS•1MBR)BootLoader•BIOSBootLoader•••80386•LinuxBootLoader••3D(DiskGeometry).(Heads),(Cylinders),(Sectorspertrack),.•..,3D,,.•(MBR).•1.:-)2.BIOS(PowerOnSelfTest--POST)0ffff:00003.(001,BootSector)0000:7c00.4.(WORD)0000:7dfe0xaa55,,NoROMBASIC.5.0000:7c00MBR.6.MBR0000:0600,.7..,.8.0000:7c00.9.(WORD)0000:7dfe0xaa55,MissingOperatingSystem,.10.0000:7c00.11....•2,3,4,5BIOS.6,7,8,9,10MBR.BootLoader•MBRbootloaderbootloader•Ms-bootLoader:IBMBIO.COMIBMDOS.COM.IBMBIO•LILOlinuxbootloaderDOSDOS-MBRMS-DOSCOMMAND.COMDOSDOSLINUXDOS-MBRMS-DOSCOMMAND.COMLOADLINLinuxLOADLINDOSLinux•DOSDOSautoexec.batLOADINLILOOS......DOS-MBRLILOLINUXLILOLinux•linux•LILO•MS-DOSDOSDOS-MBRLILOLINUXLINUXLOADLINLINUXLILOLILO•LILOLILOlinuxLILOLILO•Mapinstaller:LILObootloadermapfile•Thebootloader:BIOSLILOOS•–mapinstallmapboot/map)LILO/etc/lilo.conf)•LILOlinuxlinuxLILO•BIOSL•I•LO•imagesetup.SSetup.S•OS•BIOS•32•Loadidtgdt••Head.S32Head.S•–linuxBIOS(start_kernel())•empty_zero_page•CPUHead.S•setup_paging–2swap_page_dir,pg0––empty_bad_page,empty_bad_page_table,empty_zero_pageHead.s•Empty_zero_page•0x0000GDT•GDTLDT•Lgdt,lidt()lldt•/init/main.Cstart_kernelStart_kernel()••Start_kernel()linux•Start_kernel(){Setup_arch();//cpu•Paging_init();//arch/i386/mm/init.cmemory_startÆmemory_end•Trap_init()///arch/i386/kernel/trap.c–set_trap_gate–80set_system_gate–init_taskldtTSSGDTTSSLDT•Init_irq()///arch/i386/kernel/irq.c–8259–Structirqaction{void(*handler)(int,void*,structpt_regs*);unsignedlongflags;unsignedlongmask;constchar*name;void*dev_id;structirqaction*next;}–Staticvoidmath_error_irq(intcpl,void*dev_id,structpt_regs*regs){outb(0,0xf0);if(ignore_irq13||!hard_math)return;math_error();}–Staticstructirqactionirq13={math_error_irq,0,0,”matherror”,NULL,NULL}–setup_x86_irq()•Sched_init()///kernel/sched.c–Init_bh//timer,tqueue,immediate•Time_init()///arch/i386/kernel/timer.c–•Parse_options()//main.c–•Console_init()///linux/drivers/char/tty_io.c–•Kmalloc_init//linux/mm/kmallo.c–•Inode_init()///linux/fs/inode.c–VfsIInode•Name_cache_init()//linux/fs/dcache.c–VFS•Buffer_init()//linux/fs/buffer.c–•Mem_init()//arch/i386/mm/init.c•initInit•Kernel_thread(init,NULL,0)–Init()dbflush,kswapd–tty1–init–•FILESYSTEM••getty•/etc/rcInit•shell•Etc/inittab–Init•Inittab•2.3•2.3.1•2.3.2•2.3.3Shellprompt•2.3.4/suuseradduserdelpasswd•2.3.5•2.3.6KDE—GNOME•2.3.7•2.3.8halthaltsysshutdownreboot2.3•2.3.1•2.3.2•2.3.3Shellprompt•2.3.4/suuseradduserdelpasswd•2.3.5tarxzvffile1.tar.gzrpm-Uvhfiel1.rpm•2.3.6KDE—GNOME•2.3.7•2.3.8halthaltsysshutdownrebootsync