process 1 process 2 process 3 process n

  • Slides: 77
Download presentation

리눅스 운영체제 구조 process 1 process 2 process 3 process n User Space System

리눅스 운영체제 구조 process 1 process 2 process 3 process n User Space System Call Interface Filesystem Manager Ext 2 fs proc xiafs Process Manager Memory Manager Paging/Segmentation nfs msdos ntfs Task Management Scheduler Signaling IPC Kernel Space Buffer Cache Device Manager block Network Manager character socket Ir. DA Console KBD SCSI CD-ROM PCI ethernet Ipv 6 Bluetooth Hardware Interface dev 1 dev 2 dev 3 dev 4 devn (Source : Linux Kernel Internals) 3

Bootloader: LILO (1) l l bootloader: 부팅에 사용될 커널을 선택하고 실행한다. /etc/lilo. conf timeout=60

Bootloader: LILO (1) l l bootloader: 부팅에 사용될 커널을 선택하고 실행한다. /etc/lilo. conf timeout=60 default=linux image=/boot/vmlinuz-2. 4. 18 -50 label=linux read-only root=/dev/hda 1 image=/boot/vmlinuz-2. 4. 19 label=linux_2_4 read-only root=/dev/hda 1 other=/dev/hda 1 label=dos 60초 후에는 자동으로 label=linux인 리눅스 커널이미지를 실행한다. label=linux인 리눅스 커널이미지에 대한 정보 label=linux_2_4인 리눅스 커널이미 지에 대한 정보 label=dos인 커널이미지에 대한 정보 (리눅스 이외의 다른 운영체제) 6

Bootloader: LILO (2) l 부팅시 다음과 같은 메세지가 나타난다. (label=linux인 커널을 선택하여 실행하는 예)

Bootloader: LILO (2) l 부팅시 다음과 같은 메세지가 나타난다. (label=linux인 커널을 선택하여 실행하는 예) LILO: [TAB] linux_2_4 LILO: linux [Enter] Booting Linux. . . dos 7

리눅스 파일 시스템 전체 구조 task 1 task 2 …. task n User mode

리눅스 파일 시스템 전체 구조 task 1 task 2 …. task n User mode System call interface Virtual File System ext 2 nfs coda dosfs buffer cache …. ntfs procfs File System device driver 10

Shell (3) l Bash 설정 방법 l l Bash와 관련된 파일들 -. bashrc, .

Shell (3) l Bash 설정 방법 l l Bash와 관련된 파일들 -. bashrc, . bash_logout, . bash_profile. bashrc l l 자주 사용하는 명령어의 alias 설정 . bash_profile l program이나 library에 대한 path 설정 #. bashrc # User specific aliases and functions alias ifc=‘ifconfig’ # Source global definitions if [ -f /etc/bashrc ]; then. /etc/bashrc fi export v ifconfig 에 대한 alias 설정 #. bash_profile # Get the aliases and functions if [ -f ~/. bashrc ]; then ~/. bashrc fi # User specific environment and startup programs PATH=$PATH: $HOME/bin: /usr/local/arm-linux/bin: BASH_ENV=$HOME/. bashrc USERNAME="" export USERNAME BASH_ENV PATH v arm-linux 관련 명령어 path 설정 (/usr/local/arm-linux/bin) 16

Shell Script Programming l shell script l l Shell 명령들을 포함하는 실행 가능 상태의

Shell Script Programming l shell script l l Shell 명령들을 포함하는 실행 가능 상태의 파일 Shell script 예제 프로그램 l 파일 확장자 바꾸기 shell script의 첫 줄에 사용 shell 명시 #!/bin/bash # rfe old_extension new_extension # 예제: # 현재 디렉토리의 모든 *. gif 파일을 *. jpg로 바꾸기 # rfe gif jpg if [ $# -ne 2 ] then echo "사용법: `basename $0` old_file_suffix new_file_suffix" exit 1 fi for filename in *. $1 # 첫 번째 인자로 끝나는 파일들을 찾아서 do mv $filename ${filename%$1}$2 # 파일 이름에서 첫 번째 인자 부분을 떼어내고 두 번째 인자를 붙인다. done 17

Make(3) l makefiles 작성 및 규칙 target. List : dependency. List [TAB] command. List

Make(3) l makefiles 작성 및 규칙 target. List : dependency. List [TAB] command. List target. List dependency. List command. List : 목적 파일 목록 : 의존 파일 목록 : 명령어 목록 (예) master : master. o pirami. o gcc master. o pirami. o -o master. o : master. c pirami. h gcc -c main. c pirami. o : pirami. c pirami. h gcc -c pirami. c 69

Makefile 작성 예 OBJECTS = main. o helloworld: $(OBJECTS) [TAB]gcc –o helloworld ($OBJECTS) main.

Makefile 작성 예 OBJECTS = main. o helloworld: $(OBJECTS) [TAB]gcc –o helloworld ($OBJECTS) main. o: main. c [TAB]gcc –c main. c helloworld. o: helloworld. h helloworld. c [TAB]gcc –c helloworld. c clean: [TAB]rm $(OBJECTS) helloworld. SUFFIXES: . c. o OBJECTS = main. o helloworld. o CC = gcc CFLAGS = -g -c TARGET = helloworld $(TARGET): $(OBJECTS) $(CC) -o $(TARGET) $(OBJECTS) clean: rm $(TARGET) $(OBJECTS) core main. o: main. c helloworld. o: helloworld. h helloworld. c 72

리눅스 커널 소스 트리 구조 ipc kernel lib mm scripts Doc cdrom /usr/src/linux driver

리눅스 커널 소스 트리 구조 ipc kernel lib mm scripts Doc cdrom /usr/src/linux driver arch alpha fs init block net include i 386 char 802 pci m 68 k coda asm-alpha appletalk pnp mips ext 2 asm-arm decnet sbus hpfs . . . ethernet scsi ppc sparc kernel lib math-emu asm-i 386 ipv 4 sound nfs linux unix video isofs net sunrpc ntfs scsi x 25 video . . . mm msdos . . . arm boot 임베디드 시스템 소프트웨어의 주 관심 영역을 노란색으로 표식 73