computer system laboratory

14
COMPUTER SYSTEM LABORATORY Lab4 - Bootloader

Upload: salome

Post on 22-Feb-2016

30 views

Category:

Documents


1 download

DESCRIPTION

Computer System Laboratory. Lab4 - Bootloader. Experimental Goal. Learn how to build U-Boot bootloader for PXA270. Environment. Host System Windows XP Build System VirtualBox + Ubuntu 8.04 Target System Creator XScale PXA270 Software DENX U-Boot - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Computer System Laboratory

COMPUTER SYSTEM

LABORATORYLab4 - Bootloader

Page 2: Computer System Laboratory

/ 142Lab 4

Experimental Goal•Learn how to build U-Boot bootloader for PXA270.

2013/10/8

Page 3: Computer System Laboratory

/ 143Lab 4

Environment•Host System

• Windows XP

•Build System• VirtualBox + Ubuntu 8.04

•Target System• Creator XScale PXA270

•Software• DENX U-Boot

•You can download all software from RSWiki CSL Course Software

2013/10/8

Page 4: Computer System Laboratory

/ 144Lab 4

Bootloader Concept (1/2)•A typical flow when booting a computer.

• Load BIOS and self check.• Execute bootloader.• Initialize hardware.• Load kernel and filesystem.• …

•Bootloader• Initialize hardware.• Load kernel and filesystem.

2013/10/8

Page 5: Computer System Laboratory

/ 145Lab 4

Bootloader Concept (2/2)•When a computer is powered on, CPU will execute the first instruction from a specified address:• ROM, EEPROM, Flash memory, etc..• In ARM system, the address usually is 0x00000000.

• In other words, bootloader is usually located at 0x00000000.

•Typical space allocation

2013/10/8

Page 6: Computer System Laboratory

/ 146Lab 4

Memory Layout of PXA270

2013/10/8

0x000000000x00080000

0x00480000

0x01380000

0x02000000

U-BootLinux kernel

Root Filesystem

Flash

0xa0000000

0xa1080000

0xa3f80000

0xa4000000

U-Boot (TFTP)

RAM

U-Boot (Domingo)

Page 7: Computer System Laboratory

/ 147Lab 4

Bootloader Examples•Bootloader highly depends on architecture.•Some popular bootloaders:

• LILO, GRUB, GRUB2• You can see /boot/grub/menu.lst for the settings in Ubuntu 8.04.

• Windows Boot Manager• You can see the settings in C:\boot.init in Windows XP.

• U-Boot• We will use U-Boot for PXA270 (ARM architecture).

2013/10/8

Page 8: Computer System Laboratory

/ 148Lab 4

Introduction to U-Boot•Das U-Boot (Universal Bootloader) is an open source, primary bootloader used in embedded systems.

• It is available for a number of different computer architectures, including PPC, ARM, MIPS, x86, etc..

•The current name Das U-Boot adds a German definite article as a pun to the German word for “submarine”.

2013/10/8

reference: wikipedia – Das U-Boot, http://en.wikipedia.org/wiki/Das_U-Boot

Page 9: Computer System Laboratory

/ 149Lab 4

U-Boot Compilation (1/2)•Step1: download patched source codes of U-Boot (mt-u-boot-1.1.2.tar.gz).

•Step2: extract source codes.•Step3: please refer to Lab3 to check arm-elf-* toolchain path in PATH.

•Tips:• The include/configs/ directory under U-Boot source directory contains

configuration files for supported boards.• It defines the CPU type, the peripherals and their configuration, the

memory mapping, the U-Boot features that should be compiled in, etc..

2013/10/8

Page 10: Computer System Laboratory

/ 1410Lab 4

U-Boot Compilation (2/2)•Step4: compile U-Boot.

• U-Boot must be configured before being compiled, i.e. make <target board>_config, where <target board> is the name of the configuration file in include/configs/, without the .h.• E.g. Create_XScale_PXA270 is for our target board.

• % cd u-boot-1.1.2• % ./mt-crpxa270_config.sh

• You can read the script to understand how to compile U-Boot for PXA270.

•The resulting u-boot.bin is the bootloader we want.• Then, you can refer Lab2 to copy

the u-boot.bin to PXA270.2013/10/8

Page 11: Computer System Laboratory

/ 1411Lab 4

Configure U-Boot• If you want to change default configuration for PXA270, you can

modify the specified file and recompile U-Boot.• % cd u-boot-1.1.2• % vim include/configs/Create_XScale_PXA270.h

• CONFIG_SERVERIP: host system IP.• CONFIG_IPADDR: target system IP.• CONFIG_BOOTARGS: boot arguments.• CONFIG_BOOTCOMMAND: boot command.• CONFIG_BOOTDELAY: U-Boot delay (do not set to 0!).• CONFIG_LINUX: Linux kernel start command.

• Tip:• The U-Boot environment variable bootargs is used to hold the parameter options

passed to the Linux kernel, as the kernel’s command line parameters.2013/10/8

Page 12: Computer System Laboratory

/ 1412Lab 4

Build Your Own U-Boot (1/2)•Step1: please modify the configuration in U-Boot.

• CONFIG_BOOTCOMMAND = “run linux”• CONFIG_LINUX = “bootm 80000”

•Step2: recompile your U-Boot.•Step3: please refer to Lab2 to transfer your u-boot.bin to PXA270.

•Step4: please refer to Lab2 to copy the u-boot.bin to flash.

2013/10/8

Page 13: Computer System Laboratory

/ 1413Lab 4

Build Your Own U-Boot (2/2)•Step5: reset PXA270 and then you will see new configuration.

• If you have copied Linux (uImage) to flash 0x80000 in Lab2, you can boot Linux by new U-Boot.

2013/10/8

Page 14: Computer System Laboratory

/ 1414Lab 4

Lab Requirement & Bonus•Show what parameters you have modified for your U-Boot.

•Bonus:Answer the question of lab4 on RSWiki CSL course website.Write it in your report.

•Please send your report to both TAs.• [email protected], [email protected]• Please use this title format: [CSL] G# Lab# Ver#• E.g., [CSL] G13 Lab4 Ver1

2013/10/8