LINUX BOOT PROCEDURE AND BOOTLOADER - PowerPoint PPT Presentation

1 / 30
About This Presentation
Title:

LINUX BOOT PROCEDURE AND BOOTLOADER

Description:

Department of Computer Science and Information Engineering ... http://u-boot.sourceforge.net/ Portable and easy to port and to debug ... – PowerPoint PPT presentation

Number of Views:498
Avg rating:3.0/5.0
Slides: 31
Provided by: chungpi
Category:

less

Transcript and Presenter's Notes

Title: LINUX BOOT PROCEDURE AND BOOTLOADER


1
LINUX BOOT PROCEDURE AND BOOTLOADER
  • LAB 6

2
OUTLINE
  • Introduction
  • Boot loader
  • U-Boot
  • Kernel
  • INIT
  • Lab

3
Introduction
  • An embedded linux system is typically consist of
    some software below
  • Boot loader
  • Kernel
  • Init program
  • Your application

4
BOOT LOADER
  • Boot loader is a program that
  • Execute when board power on
  • Detect hareware (if necessary)
  • Initialize hardware
  • Copy first program, might be
  • A simple program
  • Bootloader stage N
  • OS kernel
  • Transfer control to it and go
  • Boot loader is varied from different CPU,
    different board.

5
BOOT LOADER Execute when board power on
  • Any CPU will execute a program at specified
    address when power on
  • Boot loader always be placed there

6
BOOT LOADER Detect Hardware
  • Search for attached device
  • Filesystem on storage
  • Mouse on USB
  • etc
  • Use detected device if need
  • Read configure file in filesystem

7
BOOT LOADER Initialize Hardware
  • Some hardware require default value
  • Stop interrupt
  • Set CPU clock
  • Configure RAM or MMU
  • Reset other processor such as DSP

8
BOOT LOADER Copy First Program
  • A simple program
  • Non-OS program
  • Bootloader stage N
  • Boot loader might have multiple stages, multiple
    modes
  • OS kernel
  • Linux
  • WinCE
  • etc

9
BOOT LOADER Copy First ProgramStage N
  • Typical 2 stages in embedded system
  • Stage 1
  • Write in assembly language to speed up
  • Initialize hardware
  • Copy Stage 2 to RAM
  • Prepare stack for Stage 2
  • Jump to Stage 2
  • Stage 2
  • Write in C for more feature
  • Initialize hardware
  • Load kernel
  • Send parameter to kernel
  • Start kernel

10
BOOT LOADER Copy First ProgramMultiple modes
  • In order to provide more feature, boot loader
    might have multiple modes
  • Mode 1 Boot program or kernel
  • Copy program only
  • Mode 2 Update utility
  • Read filesystem or kernel via
  • RS232 xmodem protocol (Very Slow)
  • Network FTP protocol
  • Earse flash and overwrite it with new data

11
BOOT LOADER Example
12
BOOT LOADER Transfer Control to It and Go
  • Copy next program to RAM
  • Sometimes might execute on ROM
  • Setup stack for it
  • Set PC (or jump) to its start address

13
U-Boot
  • U-Boot Universal Bootloader
  • http//u-boot.sourceforge.net/
  • Portable and easy to port and to debug
  • Support many architectures PPC, ARMs, MIPS, x86,
    m68k, NIOS, Microblaze

14
U-BootSupport list
15
U-Boot Instructions
  • help print online help
  • help ltcommandgt show usage
  • flinfo print FLASH memory information
  • protect enable or disable FLASH write protection
  • erase erase FLASH memory
  • loadb loadb binary file over serial line (kermit
    mode)
  • md memory display
  • cp memory copy

16
KERNEL
  • After kernel is loaded and started, kernel will
    detect and initialize hardware
  • After everything is done, find root filesystem
    for VFS (Virtual File System)
  • Then, search for init, which is the first program
    in OS
  • Init will be the parent of all other process

17
INIT
  • The first process in OS
  • PID 1
  • Enter ps aux to show all process
  • Typical operation
  • Fork shell and execute a script
  • Mount all filesystem
  • Start all deamon
  • Wait for user login
  • In embedded system, there are few task to do.

18
LAB
19
LAB
  • LAB 1 Boot loader
  • LAB 2 Boot procedure

20
LAB 1Boot loader
  • Install board
  • Install arm tool-train
  • Compile U-Boot
  • Install JTAG driver
  • Install U-Boot

21
LAB 1Install board
  • Install J-TAG and COM1

1 Pin
22
LAB 1 Install arm tool-train Compile U-Boot
  • In Linux
  • Download cross-3.2.tar.bz2 and
  • u-boot-1.1.4.zip
  • Install cross-3.2 to /usr/local/arm
  • Extract U-Boot and compile it
  • After completed, copy u-boot.bin to Windows

make innokom_config make CROSS_COMPILE/usr/local/
arm/bin/arm-linux-
23
LAB 1 Install JTAG driver
  • In Windows
  • Copy GIVEIO.SYS under CgiveIO folder to
    C\WINDOWS\system32\drivers
  • Click ???? in ???
  • Select ?,??????
  • Select ??????
  • Select ????
  • Select (COM / LPT)
  • Click ?????, select giveio.inf

24
LAB 1 Install U-Boot
  • Place u-boot.bin in the folder where Jen255.exe
    existed
  • Execute Jen255.exe and enter
  • u-boot.bin
  • Open ????? with baud rate 19200 bps, no flow
    control
  • Reset board and see if success

25
LAB 2
  • Re-install origin I-Boot
  • Modify boot procedure
  • Install kernel and filesystem

26
LAB 2 Re-install origin I-Boot
  • In Windows
  • Execute Jen255.exe again, but enter bootldr
    insteaded

27
LAB 2 Modify boot procedure
  • Setup kernel and filesystem
  • Use compiled kernel
  • Modify existed filesystem

28
LAB 2 Modify boot procedure(cont)
  • In Linux, modify boot procedure

gzip -d ramdisk.gz mount filesystem sudo mount
-o loop ramdisk fs go to init procedure
folder cd fs/etc/init.d/ sudo mv rcS rcS.bak
edit boot procedure sudo vi rcS enter content
as below !/bin/sh while 1 do echo
AHHHHHHHHHHH done mark it as executable sudo
chmod x rcS cd ../../../ sudo umount fs pack
it again gzip -9 ramdisk ramdisk.gz
29
LAB 2 Install kernel and filesystem
  • In Windows
  • Open ????? with baud rate 115200 bps, no flow
    control

setup kernel download xmodem 0xa0020000 flashver
ify 0x040c0000 0xa0020000 0x100000 setup root
filesystem download xmodem 0xa0020000 flashverify
0x041c0000 0xa0020000 0x3D5000
30
LAB 2
  • Result
Write a Comment
User Comments (0)
About PowerShow.com