Presentation is loading. Please wait.

Presentation is loading. Please wait.

ICOM 5007 - Noack Linux kernel structure Kernel code structure How it boots itself All the system calls are available System is configured Process handling.

Similar presentations


Presentation on theme: "ICOM 5007 - Noack Linux kernel structure Kernel code structure How it boots itself All the system calls are available System is configured Process handling."— Presentation transcript:

1 ICOM 5007 - Noack Linux kernel structure Kernel code structure How it boots itself All the system calls are available System is configured Process handling is available

2 ICOM 5007 - Noack The kernel code Obtaining it Information at www.kernel.orgwww.kernel.org ftp ftp.pr.kernel.orgftp.pr.kernel.org Usually it is in/usr/src – various directories Most recent stable version is 2.4.19 What it contains The source code that compiles and links into a bootable system The compressed version is vmlinuz It contains all the openly available device drivers Future drivers appear in future versions or can be compiled in the current version Makefiles for automated configuration

3 ICOM 5007 - Noack structure Major directories Arch – architecture-dependent Documentation – read these Drivers – all except network Fs – the file system Include – includes of multiple use Init – from boot to running kernel Ipc – IPC Kernel – the kernel structures Lib – libraries for the kernel Mm – memory management Net – the network code

4 ICOM 5007 - Noack More structure The auxiliary files Makefile and rules These explain quite a bit about kernel structure Note – this makefile activates the others in each subdirectory README How to compile Others Casual reading – how Linux gets developed

5 ICOM 5007 - Noack Linux is ported to these architectures

6 ICOM 5007 - Noack View of the i386 arch area

7 ICOM 5007 - Noack Contents of lib for the i386 Comments The.S are assembly language – GNU, not Microsoft Note the individual makefile General utilities, as you would expect

8 ICOM 5007 - Noack The makefile for lib Notes The CONFIG shell variables come from the make config step Rules.make is used The.S.o: rule does assembly instead of compilation because of the $(AFLAGS) argument # # Makefile for i386-specific library files.. #.S.o: $(CC) $(AFLAGS) -c $< -o $*.o L_TARGET = lib.a obj-y = checksum.o old-checksum.o delay.o \ usercopy.o getuser.o \ memcpy.o strstr.o obj-$(CONFIG_X86_USE_3DNOW) += mmx.o obj-$(CONFIG_HAVE_DEC_LOCK) += dec_and_lock.o obj-$(CONFIG_DEBUG_IOVIRT) += iodebug.o include $(TOPDIR)/Rules.make

9 ICOM 5007 - Noack A sample of GNU assembler /* unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum) */.text.align 4.globl csum_partial pushl %esi pushl %ebx movl 20(%esp),%eax# Function arg: unsigned int sum movl 16(%esp),%ecx# Function arg: int len movl 12(%esp),%esi# Function arg: unsigned char *buff testl $2, %esi# Check alignment. jz 2f# Jump if alignment is ok. subl $2, %ecx# Alignment uses up two bytes. jae 1f# Jump if we had at least two bytes. addl $2, %ecx# ecx was < 2. Deal with it. jmp 4f

10 ICOM 5007 - Noack Some recognizable parts of kernel Notes This is the i386- specific part of kernel Note semaphore.c smp.c signal.c Some of these files will show up in the arch-independent part also

11 ICOM 5007 - Noack Tiny piece of kernel code from mm #if CONFIG_HIGHMEM pte_t *kmap_pte; pgprot_t kmap_prot; #define kmap_get_fixmap_pte(vaddr)\ pte_offset(pmd_offset(pgd_offset_k(vaddr), (vaddr)), (vaddr)) void __init kmap_init(void) { unsigned long kmap_vstart; /* cache the first kmap pte */ kmap_vstart = __fix_to_virt(FIX_KMAP_BEGIN); kmap_pte = kmap_get_fixmap_pte(kmap_vstart); kmap_prot = PAGE_KERNEL; } #endif /* CONFIG_HIGHMEM */

12 ICOM 5007 - Noack The contents of fs This shows all the file systems supported by Linux

13 ICOM 5007 - Noack The non-architecture-dependent routines of the kernel

14 ICOM 5007 - Noack The driver repertoire in general

15 ICOM 5007 - Noack The block device drivers note: paride contains the IDE drivers

16 ICOM 5007 - Noack A few of the char drivers

17 ICOM 5007 - Noack Comments - drivers Block device drivers All the common block devices – these include disks and anything else that is block-oriented Character device drivers These include the character-by-character devices – also some pseudo-devices Note – these are architecture-independent

18 ICOM 5007 - Noack Some things that aren’t in the kernel Anything that isn’t in vmlinuz Examples: Init – it reads /etc/inittab and starts all those processes Startup scripts – these are called up by init using inittab Libraries and most network daemons The kernel and the distribution are different The distribution contains utilities and libraries for users It contains the system installation utilities Typical distributions are RedHat, Slackware, Suse X-windows is part of the distribution or separately downloadable

19 ICOM 5007 - Noack Some techniques for viewing the kernel This is W2K and WXP – Obviously the kernel won’t compile here, but it makes nice slides Open with permits viewing makefiles, etc. Documentation directory contains.txt files Set the.txt association to word, not notepad Viewing in Linux is a little easier The usual gui lets you view the filesystem treewise Clicking on individual.c,.h,.s, etc immediately displays the file in editor (emacs) Learn to use grep and fgrep to find out where structures, etc. are defined Learn to use du (disk usage) to get an idea of the size of the kernel


Download ppt "ICOM 5007 - Noack Linux kernel structure Kernel code structure How it boots itself All the system calls are available System is configured Process handling."

Similar presentations


Ads by Google