Lecture 6 Linux System Startupnyx.skku.ac.kr/wp-content/uploads/2015/03/Lecture-6... ·...

12
29 1 Embedded Software Lab. Embedded Software Lab Daejun Park, Eunsoo Park Lecture 6 Linux System Startup

Transcript of Lecture 6 Linux System Startupnyx.skku.ac.kr/wp-content/uploads/2015/03/Lecture-6... ·...

Page 1: Lecture 6 Linux System Startupnyx.skku.ac.kr/wp-content/uploads/2015/03/Lecture-6... · 2015-04-17 · Bootloader), U-Boot (Universal Boot Loader) 3. Boot Loader: “Here is the Menu!

29

1

Embedded Software Lab.

Embedded Software Lab

Daejun Park, Eunsoo Park

Lecture 6 Linux System Startup

Page 2: Lecture 6 Linux System Startupnyx.skku.ac.kr/wp-content/uploads/2015/03/Lecture-6... · 2015-04-17 · Bootloader), U-Boot (Universal Boot Loader) 3. Boot Loader: “Here is the Menu!

29

2

Embedded Software Lab.

• Bootstrap – Power Button!

– BIOS

– Bootloader

– setup()

• Odroid Booting

• 실습 – Odroid SD Card로 MBR 확인 / 제거 / 복구하기

Agenda

Page 3: Lecture 6 Linux System Startupnyx.skku.ac.kr/wp-content/uploads/2015/03/Lecture-6... · 2015-04-17 · Bootloader), U-Boot (Universal Boot Loader) 3. Boot Loader: “Here is the Menu!

29

3

Embedded Software Lab.

Linux System Startup = Bootstrap

The BIOS

The Boot Loader

setup()

start_kernel()

Linux

Page 4: Lecture 6 Linux System Startupnyx.skku.ac.kr/wp-content/uploads/2015/03/Lecture-6... · 2015-04-17 · Bootloader), U-Boot (Universal Boot Loader) 3. Boot Loader: “Here is the Menu!

29

4

Embedded Software Lab.

1. 전원버튼을 클릭

2. CPU의 RESET pin의 logical value 값이 증가 (01)

3. CPU의 몇몇 register 값을 세팅 (CS = 0xF000, EIP = 0xFFF0)

4. 물리 주소 0xFFFF0에 접근 0xFFFF0 = BIOS on ROM (Top 64KB BIOS ROM)

1. 전원버튼 클릭!

Page 5: Lecture 6 Linux System Startupnyx.skku.ac.kr/wp-content/uploads/2015/03/Lecture-6... · 2015-04-17 · Bootloader), U-Boot (Universal Boot Loader) 3. Boot Loader: “Here is the Menu!

29

5

Embedded Software Lab.

• ROM에 올라가는 Code set이므로 한정된 작업만 가능

• 대개, 초기화 과정만을 수행하는 system – POST (Power-On Self Test)

– H/W device 초기화

– Bootloader를 검색하고 로드

– Kernel Image 로드

BIOS (Basic Input/Output System)

Page 6: Lecture 6 Linux System Startupnyx.skku.ac.kr/wp-content/uploads/2015/03/Lecture-6... · 2015-04-17 · Bootloader), U-Boot (Universal Boot Loader) 3. Boot Loader: “Here is the Menu!

29

6

Embedded Software Lab.

1. BIOS는 부팅을 할 OS를 검색 – 디스크의 첫 번째 섹터

– MBR (Mater Boot Record) – 파티션 정보 저장

– Boot Loader

2. Boot Loader 실행

2. BIOS에 의해 Boot Loader가 실행!

Page 7: Lecture 6 Linux System Startupnyx.skku.ac.kr/wp-content/uploads/2015/03/Lecture-6... · 2015-04-17 · Bootloader), U-Boot (Universal Boot Loader) 3. Boot Loader: “Here is the Menu!

29

7

Embedded Software Lab.

• LILO (Linux Loader), GRUB (Grand Unified Bootloader), U-Boot (Universal Boot Loader)

3. Boot Loader: “Here is the Menu!”

Page 8: Lecture 6 Linux System Startupnyx.skku.ac.kr/wp-content/uploads/2015/03/Lecture-6... · 2015-04-17 · Bootloader), U-Boot (Universal Boot Loader) 3. Boot Loader: “Here is the Menu!

29

8

Embedded Software Lab.

1. H/W 초기화 (BIOS Routine) – 물리 메모리 배치, 사용가능한 HDD 검색

– 비디오 카드, 디스크 컨트롤러, …

2. Paging 사용을 위한 Page Table 생성

3. start_kernel() 동작

4. setup()

Page 9: Lecture 6 Linux System Startupnyx.skku.ac.kr/wp-content/uploads/2015/03/Lecture-6... · 2015-04-17 · Bootloader), U-Boot (Universal Boot Loader) 3. Boot Loader: “Here is the Menu!

29

9

Embedded Software Lab.

Odroid Startup!

BIOS를 올리기에 제약이 있는 Odroid는 Booting device의 u-boot위치를 Fixed location에 저장해놓고 ROM에 해당 위치 저장.

Need Bl1.bin / bl2.bin

Page 10: Lecture 6 Linux System Startupnyx.skku.ac.kr/wp-content/uploads/2015/03/Lecture-6... · 2015-04-17 · Bootloader), U-Boot (Universal Boot Loader) 3. Boot Loader: “Here is the Menu!

29

10

Embedded Software Lab.

• MBR 확인하기! – dd 명령어 (disk dump)

: input file로부터 output file로 binary 복사하는 명령어 bs: 한번에 read할 block size, count: 몇 개의 block을 복사할지

– file 명령어 : 파일에 포함된 data 종류를 인식하고 알려주는 명령어

실습: Master Boot Record

Page 11: Lecture 6 Linux System Startupnyx.skku.ac.kr/wp-content/uploads/2015/03/Lecture-6... · 2015-04-17 · Bootloader), U-Boot (Universal Boot Loader) 3. Boot Loader: “Here is the Menu!

29

11

Embedded Software Lab.

• MBR 제거하기! – input file: /dev/zero – 전부 0으로 채워진 파일

– 결과! – partition table을 찾지 못하는 것을 알 수 있음.

실습: Master Boot Record

Page 12: Lecture 6 Linux System Startupnyx.skku.ac.kr/wp-content/uploads/2015/03/Lecture-6... · 2015-04-17 · Bootloader), U-Boot (Universal Boot Loader) 3. Boot Loader: “Here is the Menu!

29

12

Embedded Software Lab.

• 복구는 각자 하세요.

실습: Master Boot Record