Lab 5 Department of Computer Science and Information Engineering National Taiwan University Lab5 – Bootloader + OS Kernel 2015/10/27/ 25 1.

Slides:



Advertisements
Similar presentations
Computer System Laboratory
Advertisements

Genesis: from raw hardware to processes System booting sequence: how does a machine come into life.
Chapter 9: Understanding System Initialization The Complete Guide To Linux System Administration.
Linux+ Guide to Linux Certification Chapter Nine System Initialization.
Linux Booting Procedure
Booting the Linux Kernel Dr. Michael L. Collard 1.
Linux+ Guide to Linux Certification, Second Edition
CCNA2 MODULE 5.
LINUX-WINDOWS INTERACTION. One software allowing interaction between Linux and Windows is WINE. Wine allows Linux users to load Windows programs while.
Lab 4 Department of Computer Science and Information Engineering National Taiwan University Lab4 - Bootloader 2014/10/14/ 13 1.
Linux+ Guide to Linux Certification, Second Edition Chapter 3 Linux Installation and Usage.
1 Web Server Administration Chapter 3 Installing the Server.
Lesson 4-Installing Network Operating Systems. Overview Installing and configuring Novell NetWare 6.0. Installing and configuring Windows 2000 Server.
Institute of Technology Sligo - Dept of Computing Cisco IOS & Router Config Semester 2V2 Chapter 7 Chapter 8.
Computer System Laboratory
COMPUTER SYSTEM LABORATORY Lab8 - Debugging II. Lab 8 Experimental Goal Learn how to debug Linux in source-level by Domingo and diagnose target boards.
COMPUTER SYSTEM LABORATORY Lab4 - Bootloader. Lab 4 Experimental Goal Learn how to build U-Boot bootloader for PXA /10/8/ 142.
Introduction to The Linaro Toolchain Embedded Processors Training Multicore Software Applications Literature Number: SPRPXXX 1.
1 Introduction to Tool chains. 2 Tool chain for the Sitara Family (but it is true for other ARM based devices as well) A tool chain is a collection of.
Cisco IOS & Router Config Semester 2V2 Chapter 6.
Lab 3 Department of Computer Science and Information Engineering National Taiwan University Lab3 - Cross Tools 2014/10/7/ 20 1.
Linux+ Guide to Linux Certification Chapter Three Linux Installation and Usage.
Basic Input Output System
Linux Booting Procedure
Computer System Laboratory
Guide to Linux Installation and Administration, 2e1 Chapter 3 Installing Linux.
Tutorial 11 Installing, Updating, and Configuring Software
Embedded Linux porting Kernel
Computer System Laboratory
Lab 11 Department of Computer Science and Information Engineering National Taiwan University Lab11 - Porting 2014/12/9/ 26 1.
From UEFI Shell to Linux - UEFI Linux BootLoader Zhang Rui Software Engineer Sep 28 th 2011.
Lab 1 Department of Computer Science and Information Engineering National Taiwan University Lab1 - Sensor 2014/9/23/ 13 1.
Porting Operating Systems Phan Duy Hùng (PhD) ES Lecturer – Hanoi FPT University.
Installation Overview Lab#2 1Hanin Abdulrahman. Installing Ubuntu Linux is the process of copying operating system files from a CD, DVD, or USB flash.
Conventions Department of Computer Science and Information Engineering National Taiwan University Conventions 2014/9/16/ 3 1.
Linux Administration. Pre-Install Different distributions –Redhat, Caldera, mandrake, SuSE, FreeBSD Redhat Server Install –Check HCL –Significant issues.
Lab 10 Department of Computer Science and Information Engineering National Taiwan University Lab10 – Debugging II 2014/12/2 1 /16.
COMPUTER SYSTEM LABORATORY Lab6 - Root Filesystem.
Guide to Linux Installation and Administration1 Chapter 4 Running a Linux System.
Lab 14 Department of Computer Science and Information Engineering National Taiwan University Lab14 – Camera 2014/12/30 1 /14.
Lab 12 Department of Computer Science and Information Engineering National Taiwan University Lab12 – Driver 2014/12/16 1 /21.
Implementation of Embedded OS Lab3 Porting μC/OS-II.
Linux Kernel Programming (LKP). LKP New sub-course New sub-course We will learn together We will learn together Evaluation of this part of course will.
The Linux Operating System R.Bigelow. What is an Operating System An operating system is a collection of programs that manage a computer's resources.
Lab 8 Department of Computer Science and Information Engineering National Taiwan University Lab8 - Root Filesystem 2015/11/10/ 22 1.
 Contents 1.Introduction about operating system. 2. Minimum requirement for Windows 7 operating system. 3. Procedure to install Window 7 operating system.
Lab 9 Department of Computer Science and Information Engineering National Taiwan University Lab9 - Debugging I 2014/11/4/ 28 1.
Lab 3 Department of Computer Science and Information Engineering National Taiwan University Lab3 – μC/OS 2015/10/13/ 13 1.
Implementation of Embedded OS
Lab 7 Department of Computer Science and Information Engineering National Taiwan University Lab7 – uCOS Application 2015/11/10/ 10 1.
Lab 5 Department of Computer Science and Information Engineering National Taiwan University Lab5 - OS Kernel 2014/10/21/ 16 1.
System initialization Unit objectives A.Outline steps necessary to boot a Linux system, configure LILO and GRUB boot loaders, and dual boot Linux with.
Embedded Software Design Week II Linux Intro Linux Kernel.
WP1- Documentation Booting Petalinux from TFTP and using Network file system Section for developers Zynq 7020 R. Assiro.
Rebuilding Linux Kernel Dedicated to penguin lovers everywhere 26 September 20161Rebuilding kernel by Visakh M R.
1 Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//free-electrons.com The U-boot bootloader Michael.
Computer System Laboratory
Implementation of Embedded OS
Guide to Linux Installation and Administration, 2e
Computer System Laboratory
Implementation of Embedded OS
Operating System Kernel Compilation
Operating System Module 1: Linux Installation
AT91RM9200 Boot strategies This training module describes the boot strategies on the AT91RM9200 including the internal Boot ROM and the U-Boot program.
IS3440 Linux Security Unit 7 Securing the Linux Kernel
SUSE Linux Enterprise Desktop Administration
Computer System Laboratory
Computer System Laboratory
Computer System Laboratory
Presentation transcript:

Lab 5 Department of Computer Science and Information Engineering National Taiwan University Lab5 – Bootloader + OS Kernel 2015/10/27/ 25 1

Lab 5 Department of Computer Science and Information Engineering National Taiwan University  Learn how to build U-Boot bootloader for PXA270.  Learn how to build Linux kernel image for PXA /10/27/ 25 2

Lab 5 Department of Computer Science and Information Engineering National Taiwan University  Host System  Windows XP  Build System  VirtualBox + Ubuntu 8.04  Target System  Creator XScale PXA270  Software  DENX U-Boot  Linux for PXA270  linux creator-pxa270.patch  mkimage utility  Root filesystem image (15M)  You can find all software on CSL Course Software.CSL Course Software 2015/10/27/ 25 3

Lab 5 Department of Computer Science and Information Engineering National Taiwan University  A typical flow when booting a computer.  Load BIOS and do hardware self-test.  Execute bootloader in master boot record (MBR) which is the first sector of disk.  Load kernel and root filesystem.  Initialize hardware.  …  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 0x  In other words, bootloader is usually located at 0x  Typical space allocation: 2015/10/27/ 25 4

Lab 5 Department of Computer Science and Information Engineering National Taiwan University  Bootloader highly depends on architecture.  Some popular bootloaders:  LILO, GRUB, GRUB2  You can see /boot/grub/menu.lst for the settings in Ubuntu  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). 2015/10/27/ 25 5

Lab 5 Department of Computer Science and Information Engineering National Taiwan University  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”. 2015/10/27/ 25 6 Reference: Das U-Boot,

Lab 5 Department of Computer Science and Information Engineering National Taiwan University  Step 1: download the patched source codes of U-Boot (mt-u-boot tar.gz) in Ubuntu  Step 2: extract source codes.  Step 3: please check the path of toolchain arm-elf-* is in PATH.  The toolchain arm-elf-* will be used in the compilation.  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.  For instance of PXA270, U-boot will be copied to 0xA3F80000 when it is loaded by CPU and it uses 0x to 0x0003FFFF as the boot parameters. 2015/10/27/ 25 7

Lab 5 Department of Computer Science and Information Engineering National Taiwan University  Step 4: compile U-Boot.  U-Boot must be configured for the target board before being compiled, i.e., make _config, where 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  % make mrproper  This command often uses to clean all the object files and configurations.  You can see Makefile and check what it has done.  % make Create_XScale_PXA270_config  % make  The resulting u-boot.bin is the bootloader we want so that we can copy it to PXA /10/27/ 25 8

Lab 5 Department of Computer Science and Information Engineering National Taiwan University 2015/10/27/ xA xA RAM U-Boot Flash 0x x x diag 0x x Linux kernel 1 Root Filesystem 0x U-Boot parameters 0x x01C00000 Linux kernel 2U-Boot 0xA3F80000

Lab 5 Department of Computer Science and Information Engineering National Taiwan University  If you want to change default configuration for PXA270, you can modify the specified files and recompile U-Boot.  % cd u-boot  % nano 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.  etc.  Tips:  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. 2015/10/27/ 25 10

Lab 5 Department of Computer Science and Information Engineering National Taiwan University  Step 1: please modify the boot command in U-Boot.  CONFIG_BOOTCOMMAND = “ run linux ”  CONFIG_LINUX = “ bootm ”  Step 2: please try to change the command prompt and display with your group id. 2015/10/27/ 25 11

Lab 5 Department of Computer Science and Information Engineering National Taiwan University  Step 3: copy the uImage provided in lab4 to flash address 0x01C  The erased end address is 0x1FFFFFF (32 sectors).  Step 4: compile your U-Boot and copy to flash address 0x  Make sure you also erase the boot parameters sector ( 0x to 0x0003FFFF ), or your modified settings could not work.  Step 5: reset PXA270 and then you will see new configuration.  Try to do some settings so that you can choose which to boot on, the two Linux kernels,or the program diag. 2015/10/27/ 25 12

Lab 5 Department of Computer Science and Information Engineering National Taiwan University  After the 1.0 release and prior to version 2.6, the number was composed as “A.B.C”, where the number A denoted the kernel version, the number B denoted the major revision of the kernel and the number C indicated the minor revision of the kernel.  In 2004, after version was released, the kernel developers no longer uses this system, instead now simply incrementing the third number, using a fourth number as necessary.  In 2011, the kernel version was bumped to 3.0 for the release following , to commemorate the 20th anniversary of Linux. 2015/10/27/ Reference: wikipedia – Linux kernel

Lab 5 Department of Computer Science and Information Engineering National Taiwan University  Step 1: download Linux source codes (mt-linux tar.gz) for PXA270.  Step 2: extract the source codes.  Step 3: apply the patch.  % cd pxa270/create-pxa270  % Link to downloadhttp:// :5000/fbsharing/nq8uCcwT patch file  % patch -p0 < linux creator-pxa270.patch 2015/10/27/ 25 14

Lab 5 Department of Computer Science and Information Engineering National Taiwan University  Step 4: configure the Linux kernel (check Lab4’s arm-unknown-linux-gnu- * toolchain path in PATH).  % cd../linux  % make mrproper  % make creator_pxa270_defconfig  The “ make _defconfig ” command will create.config by the default symbol values from arch/ /configs/ _defconfig.  Step 5: compile Linux kernel.  % make  The resulting zImage in arch/arm/boot is the compressed kernel image we want. 2015/10/27/ 25 15

Lab 5 Department of Computer Science and Information Engineering National Taiwan University  The Linux kernel build system (Kbuild) includes support for a variety of configuration methods, the most commonly used method is:  % make menuconfig  Please install libncurses5-dev package in Ubuntu.  Make sure your screen is large enough to display the configuration. 2015/10/27/ 25 16

Lab 5 Department of Computer Science and Information Engineering National Taiwan University  Many features and drivers are available as modules, and they are possible to choose whether to build features into the kernel.  Please always build into the kernel, i.e.,, in our Labs.  Once the kernel has been configured, you can quit the kernel configuration menu via Esc key or the Exit menu item.  Choose “Yes” to save the new configuration into a new.config file.  You can use “ ls -a ” to check the file. 2015/10/27/ built-in module

Lab 5 Department of Computer Science and Information Engineering National Taiwan University  The Creator XScale PXA270 board has 32MB flash and 64MB SDRAM.  Flash memory address range: 0x to 0x  SDRAM address range: 0xA to 0xA  Recall that U-Boot has determined the location of kernel image. CONFIG_BOOTCOMMAND "run linux" CONFIG_LINUX bootm  The locations and sizes of kernel image and root filesystem are also determined by Linux kernel (in arch/arm/mach-pxa/mach-creator- pxa270.c ). 2015/10/27/ 25 18

Lab 5 Department of Computer Science and Information Engineering National Taiwan University 2015/10/27/ xA xA RAM U-Boot Flash 0x x x diag 0x x Linux kernel 1 Root Filesystem 0x U-Boot parameters 0x x01C00000 Linux kernel 2U-Boot 0xA3F80000

Lab 5 Department of Computer Science and Information Engineering National Taiwan University  Based on the memory layout, we can configure our Linux kernel. static struct mtd_partition creator_pxa270_partitions[] = {... },{ name: "Kernel", offset: 0x , size: 0x , // 4M mask_flags: MTD_WRITEABLE },{ name: "Filesystem", offset: 0x , size: 0x00F00000, // 15M } /10/27/ 25 20

Lab 5 Department of Computer Science and Information Engineering National Taiwan University  We use U-Boot as the bootloader on PXA270, we need to convert the OS kernel image vmlinux (which zImage is compressed by) to U-Boot bootable image ( uImage ).  Step 1: get raw binary file.  % arm-unknown-linux-gnu-objcopy -O binary -R.note -R.comment -S arch/arm/boot/compressed/vmlinux linux.bin  Step 2: compress kernel image (optional).  % gzip -9 linux.bin 2015/10/27/ 25 21

Lab 5 Department of Computer Science and Information Engineering National Taiwan University  Step 3: download mkimage.  Step 4: add header.  % chmod +x mkimage  %./mkimage -A arm -O linux -T kernel -C gzip -a 0xa e 0xa n "CSL Lab5 Kernel" -d linux.bin.gz uImage  If you skip step2, please use -C none and -d linux.bin.  mkimage is in the tools folder of U-Boot source codes.  You can see the mkimage usage by executing without arguments.  The resulting uImage is the U-Boot image we want. 2015/10/27/ 25 22

Lab 5 Department of Computer Science and Information Engineering National Taiwan University  Please refer to Lab1 to copy new Linux kernel and root filesystem to flash.  Step 1: download new 15M rootfs (root filesystem).  Step 2: copy your uImage to flash.  Step 3: copy new rootfs to flash. (take about 7 minutes)  Step 4: reset PXA270, now you can see your own Linux kernel is booted (the message “CSL Lab5 Kernel”).  Please use “ df -h ” to check the size of filesystem. 2015/10/27/ 25 23

Lab 5 Department of Computer Science and Information Engineering National Taiwan University  However, the driver of the network card on PXA270 does not be configured in default Linux configuration.  Please try to configure the driver and build it into your kernel.  Please use “ ifconfig eth0 ” to check that your network card works. 2015/10/27/ 25 24

Lab 5 Department of Computer Science and Information Engineering National Taiwan University  Show your own command prompt in U-Boot.  Show that you can choose what to boot on, and it is as simple as possible.  Show that you can use “ tftp ” on your Linux kernel which has a 15M filesystem.  Please hand in your lab report to the FTP.  Server:  Username: csl2015  Password: csl2015HomeWork  Directory: lab5,6  Please use this format for filename: “G# Ver#”, where G# is your group id and Ver# is revision version number.  E.g., G1 Ver2 2015/10/27/ 25 25