Linux?????? - PowerPoint PPT Presentation

About This Presentation
Title:

Linux??????

Description:

Title: i386 Linux Author: salmon Last modified by: salmon Created Date: 5/31/2006 1:05:29 PM Document presentation format – PowerPoint PPT presentation

Number of Views:129
Avg rating:3.0/5.0
Slides: 46
Provided by: salm45
Category:
Tags: kernel | linux

less

Transcript and Presenter's Notes

Title: Linux??????


1
Linux??????
  • ?????
  • ?????????
  • xlanchen_at_ustc.edu.cn
  • 3606864-83(????421)
  • Autumn 2007

2
???????
  • Linux??
  • Linux???????????
  • ????????
  • ??
  • ???/???
  • ????

3
??i386?????Linux??????
  • xlanchen_at_2007.9.13

4
????
  • ?????
  • ??????
  • Linux????????
  • Linux?????
  • Linux?????

5
?????
  • ??Understanding the Linux Kernel(2nd
    Edition),????Linux-2.4.18
  • ????
  • ????ftp//ftp.kernel.org/pub/linux/kernel/v2.6/li
    nux-2.4.18.tar.gz
  • ????,??Source Insight??

6
Source Insight
  • ??????????
  • ?http//www.sourceinsight.com/???????????,??????30
    ???

7
Linux-2.6.11
  • ??linux????README
  • ??Linux???
  • ????????????
  • ??????????

8
Linux????????????
  • Documentation ??????????
  • arch ???????????????? ???????,???????? ?i386?a
    rm?alpha??????? ???????????????
  • kernel ????????????
  • mm ??????????????
  • lib ???????????
  • include ???????????????? ????????
  • init ????????

9
  • kernel ???????
  • mm ???????
  • ipc ????????
  • net ???????
  • lib ??????????????
  • drivers ???????????????? ??,?char?block?net?
  • fs ???????????????? ??????,?ext2?proc??
  • modules ?????????
  • Scripts ??????????

10
??Arch?i386
  • ?arch/i386???????

I386??????????
I386??????????
I386?????????
I386????????????
I386????????????
I386?????
I386????????Makefile
I386?Linux?????????
11
I386???????
  • ?arch/i386/boot???
  • ?arch/i386/boot/compressed???

I386?????????????? ????????
??????????, ???????512??
I386???
?????
12
  • ?arch/i386/kernel????.S??
  • ?init???

32?????
??????????,i386???????????, ???????main.c??start_k
ernel???
13
??documentation/i386/boot.txt
  • ??i386??,?????????,??Linux???????
  • ??????????
  • 1?Linux/i386?????(4?)
  • 2??????
  • 3???????????
  • 4???????(command line)

14
  • 5???????
  • 6???Linux?????
  • 7?????????
  • 8?????
  • 9?????????
  • ?????????,???????????

15
????????Makefile
  • ??????

??
16
  • ??vmlinux
  • ??vmlinux????????????
  • ????vmlinux??????
  • i386/kernel/head.S
  • init/main.c init/version.o
  • CORE_FILES DRIVERS
  • NETWORKS LIBS

17
  • ?make install
  • ?i386?Makefile??install??
  • ?make boot/bzImage/zImage??,?????????????
  • make boot????Makefile?????boot??
  • bzImage/zImage???i386?Makefile???????
  • ???zXXX/bzXXX?????boot??zImage/bzImage
  • ???????i386/boot?Makefile

18
i386/boot?Makefile
  • ?i386/boot?Makefile
  • z????b?????
  • ??compressed??vmlinux/bvmlinux?
  • compressed/head.S ??????????vmlinux
  • zImage?bootsect setup compressed/vmlinux
  • bzImage?bbootsect bsetup compressed/bvmlinux

19
  • ?????bzImage/zImage????,??????????????????
  • arch/i386/boot/bootsect.S
  • arch/i386/boot/setup.S
  • arch/i386/boot/compressed/head.S
  • arch/i386/kernel/head.S
  • ????kernel/main.C

20
I386???????
  • BIOS (Basic I/O System)
  • Boot loader
  • ?????????
  • Linux kernel

21
BIOS
  • ??,RESET??
  • ??????CSIP 0xfffffff0, in ROM
  • ROM?BIOS
  • BIOS????
  • POST(????)
  • ???????
  • ???????????
  • ????,?????????/??/CD_ROM?
  • ??????????????(boot loader???)???RAM(0x7c00)?
  • ???0x7c00???

22
Boot loader(??????)
  • BIOS??Boot loader??????????????RAM?
  • ??IBM PC???
  • ????BIOS??????????(bootsect)?RAM(0x7c00)?
  • ????
  • ?????????????MBR, Master Boot Record,MBR?????????
    ???????
  • ??????????OS??????????(boot loader)????RAM?
  • ????????????

23
Linux?Boot Loader
  • ????LILO?Grub
  • LILO(Linux Loader)
  • ??????OS????????(????)
  • ?????MBR??????
  • ???,LILO???????????,?????????
  • MBR???????
  • ????
  • ??????BIOS???RAM?0x7c00???
  • ?????????????????RAM?

24
Linux?Boot Loader
  • ??LILO?GRUB???????????????
  • ???????(???????)??????????
  • ?????????????????
  • ???????????????

25
LILO?OS????
  • ??Loading
  • ?????512(??????,bootsect)???????RAM?0x90000
  • ??????(setup)????0x90200
  • ????????????
  • ?????0x10000(?64K?),?????
  • ?????0x100000(?1M?),?????
  • ???setup???

26
I386?????
  • ????
  • ?????bootsect????
  • ?????setup????
  • ???bootsect.S????????,????????i386????????

27
????I386??????????
RAM
ROM-BIOS
0xF0000
VIDEO-BIOS
0xC0000
VRAM
0xA0000
1-MB
0x00000
28
I386????????????
  • ???????????
  • ???????????CPU????
  • i386?????????
  • ????
  • ????20?
  • ????01MB
  • ???? ??? ????
  • ??? ???????16 (???4?)
  • ??????16bit

29
??I386????????
  • zImage/Image?????????????????(1M0x100000)

?????
30
????,bootsect.S
  • 0x7c00?0x90000
  • 0x7c00, BIOS
  • 0x90000, lilo
  • ??,0x3ff4(0x4000-12), ????
  • ?????,12Bytes,0x3ff40x4000
  • ??Loading
  • Setup?0x90200
  • ??
  • ???,0x10000(64KB?),???
  • ???,0x100000(1MB?),???
  • setup

31
????,?????
  • ??LILO(LInuxLOader)
  • ?????
  • ??LINUX
  • Bootsect.S?0x90000
  • Setup.S?0x90200
  • ??
  • 0x10000
  • 0x100000
  • ???setup

32
?????,??
  • ??,????setup???,??????????
  • 0x90000bootsect
  • 0x90200setup
  • ???0x10000????vmlinux
  • ???0x100000????bvmlinux
  • ??????????
  • ??bootsect????setup?????
  • ?bootsect???0x1F1??,??????documentation/i386/boot.
    txt

33
Setup0x90200
  • ????????????????????
  • ????
  • ??
  • ??
  • ?????
  • IBM?????MCA
  • PS/2??(????)
  • APM BIOS
  • ????,??????0x1000?(4KB?)??,??
  • ??IDT???GDT
  • FPU
  • PIC, 16??????????3247
  • ????????
  • Startup_32

34
  • ?compressed/head.S?head.S?????startup_32
  • ??head.S?,????vmlinux???????
  • ??compressed/head.S?startup_32????
  • zImage?,?0x1000?
  • bzImage?,?0x100000?

35
Compressed/head.S
  • Startup_32
  • ??????????????
  • ???BSS?
  • ???
  • ????????????0x100000(1MB)
  • ???0x100000?

36
  • ????,vmlinux?0x100000?
  • ??vmlinux.lds,vmlinux???????0xc00000000x100000?
  • ????????
  • ????????,????????????????
  • ?????,???????????????

37
Head.S
  • Startup_32
  • ???????
  • ????0?????
  • Setup_idt
  • ??????
  • ?????
  • GDT?IDT
  • Start_kernel

38
??????????
  • ?????,????20?,?????1MB,
  • ???????????????
  • ??????????,?????
  • cs/ds/es/fs/gs
  • 16????,????16?,???????2160x1000064KB
  • ???? ????16??

39
  • ?????,????32?,?????4GB
  • ????????????????,?GDT?????
  • GDT??gdtr????????
  • ???????????sgdt/lgdt

40
??
41
  • ??setup.S?head.S??gdt/ldt
  • ????gdt?idt??,?????????
  • cs?ds?es?fs?gs
  • cs?????????????
  • ????????????

42
?????(Control Registers)
  • CR0
  • CR1
  • CR2
  • CR3
  • ?????

43
CR0
  • CR0, MSW register (Machine Status Word, 32-bit
    version)
  • ???????,???????????
  • Instruction lmsw
  • LINUX setup.S
  • movw 1, ax
  • lmsw ax
  • jmp flush_instr // why?
  • flush_instr
  • To turn on the PE-bit (enables protected-mode),

PE-bit (Protection Enabled) 0? CPU is in
real-mode, 1? CPU is in protected-mode
44
CR1?CR2?CR3
  • CR1??
  • CR2????????,??????
  • CR3?????????????????(PCD PWT)

45
??2
  • i386?????????20??????16???????????????
  • i386??????????????????????????????????
  • ??????Linux?bzImage???????
Write a Comment
User Comments (0)
About PowerShow.com