Spring 2014 SILICON VALLEY UNIVERSITY CONFIDENTIAL 1 Introduction to Embedded Systems Dr. Jerry Shiao, Silicon Valley University.

Slides:



Advertisements
Similar presentations
Linux Boot Loaders. ♦ Overview A boot loader is a small program that exists in the system and loads the operating system into the system’s memory at system.
Advertisements

Booting and Shuting Down WeeSan Lee. Roadmap Bootstrapping Boot Loaders Startup/Init Scripts Reboot & Shutdown Q&A.
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.
Week 8 System Initialization and X Windows. Objectives  Summarize the major steps necessary to boot a Linux system  Configure the LILO and GRUB boot.
Linux+ Guide to Linux Certification Chapter Nine System Initialization.
Linux Booting Procedure
Linux can be generally divided into four major components: 1. KERNEL – OS, ultimate boss The kernel is the core program that runs programs and manages.
Booting the Linux Kernel Dr. Michael L. Collard 1.
Linux+ Guide to Linux Certification, Third Edition
Linux+ Guide to Linux Certification, Second Edition
Booting And Shutting Down. Bootstrapping  Bootstrapping is standard term for “starting up a computer”  During bootstrapping the kernel is loaded into.
Lab 4 Department of Computer Science and Information Engineering National Taiwan University Lab4 - Bootloader 2014/10/14/ 13 1.
7400 Samsung Confidential & Proprietary Information Copyright 2006, All Rights Reserved. 1/16 OfficeServ 7x00 Enterprise IP Solutions Quick Install Guide.
Linux+ Guide to Linux Certification, Second Edition Chapter 3 Linux Installation and Usage.
1 Web Server Administration Chapter 3 Installing the Server.
System initialisation
Lesson 4-Installing Network Operating Systems. Overview Installing and configuring Novell NetWare 6.0. Installing and configuring Windows 2000 Server.
CCNA 2 v3.1 Module 2.
COMPUTER SYSTEM LABORATORY Lab4 - Bootloader. Lab 4 Experimental Goal Learn how to build U-Boot bootloader for PXA /10/8/ 142.
What is Router? Router is a device which makes communication between two or more networks present in different geographical locations. Routers are data.
Routers A router is a computer Computers have four basic components:
Linux+ Guide to Linux Certification, Third Edition
CompTIA Linux+ Certification
Linux+ Guide to Linux Certification Chapter Three Linux Installation and Usage.
hardware and operating systems basics.
Linux Booting Procedure
Guide to Linux Installation and Administration, 2e1 Chapter 3 Installing Linux.
4 1 Operating System Activities  An operating system is a type of system software that acts as the master controller for all activities that take place.
AT91RM9200 Boot strategies This training module describes the boot strategies on the AT91RM9200 including the internal Boot ROM and the U-Boot program.
From UEFI Shell to Linux - UEFI Linux BootLoader Zhang Rui Software Engineer Sep 28 th 2011.
UNIX Startup and Shutdown CSCI N321 – System and Network Administration Copyright © 2000, 2010 by Scott Orr and the Trustees of Indiana University.
Guide to Linux Installation and Administration, 2e1 Chapter 2 Planning Your System.
Porting Operating Systems Phan Duy Hùng (PhD) ES Lecturer – Hanoi FPT University.
Linux Administration. Pre-Install Different distributions –Redhat, Caldera, mandrake, SuSE, FreeBSD Redhat Server Install –Check HCL –Significant issues.
7200 Samsung Confidential & Proprietary Information Copyright 2006, All Rights Reserved. 1/16 OfficeServ 7200 Enterprise IP Solutions Data Server S/W Upgrade.
Code : STM#561 Samsung Electronics Co., Ltd. OfficeServ SW Upgrade Distribution EnglishED01.
7200 Samsung Confidential & Proprietary Information Copyright 2006, All Rights Reserved. 1/7 OfficeServ 7200 Enterprise IP Solutions Data Server S/W Upgrade.
Chapter 8: Installing Linux The Complete Guide To Linux System Administration.
Genesis: From Raw Hardware to Processes Andy Wang Operating Systems COP 4610 / CGS 5765.
© 2006 Cisco Systems, Inc. All rights reserved.Cisco PublicITE I Chapter 6 1 Router Initialization steps.
UNIX Startup and Shutdown CSCI N321 – System and Network Administration Copyright © 2000, 2009 by Scott Orr and the Trustees of Indiana University.
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.
System initialization Unit objectives A.Outline steps necessary to boot a Linux system, configure LILO and GRUB boot loaders, and dual boot Linux with.
1 Setup and Compile Linux Kernel Speaker: Yi-Ji Jheng Date:
CHAPTER 3 Router CLI Command Line Interface. Router User Interface User and privileged modes User mode --Typical tasks include those that check the router.
Chap. 4 ARM Boot Loader Internals. 2 S3C2500 ARM940T Core module ARM9TDMI CoreIC.
1 © 2004, Cisco Systems, Inc. All rights reserved. CCNA 2 v3.1 Module 2 Introduction to Routers.
WP1- Documentation Booting Petalinux from TFTP and using Network file system Section for developers Zynq 7020 R. Assiro.
Overview A) Power on or reset B) 1st stage boot loader C) 2nd stage boot loader D) Operate system.
Chap- 2 BOOTING & SHUTDOWN LINUX SYSTEM Created by: Asst. Prof. Ashish Shah, J.M.PATEL COLLEGE, GOREGOAN W 1.
1 Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//free-electrons.com Embedded Linux system development.
1 Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//free-electrons.com The GRUB bootloader Michael.
1 Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//free-electrons.com The U-boot bootloader Michael.
Introduction to Operating Systems Concepts
The GRUB bootloader Michael Opdenacker Thomas Petazzoni Free Electrons
Operating System & Application Software
© 2002, Cisco Systems, Inc. All rights reserved.
Guide to Linux Installation and Administration, 2e
Download Image to EVB Board and Flash Programming
Data Server S/W Upgrade Samsung Electronics Co., Ltd.
Structure of Unix OS.
Booting Up 15-Nov-18 boot.ppt.
AT91RM9200 Boot strategies This training module describes the boot strategies on the AT91RM9200 including the internal Boot ROM and the U-Boot program.
SUSE Linux Enterprise Desktop Administration
Lecture9: Embedded Network Operating System: cisco IOS
Computer System Laboratory
Lecture9: Embedded Network Operating System: cisco IOS
Presentation transcript:

Spring 2014 SILICON VALLEY UNIVERSITY CONFIDENTIAL 1 Introduction to Embedded Systems Dr. Jerry Shiao, Silicon Valley University

SILICON VALLEY UNIVERSITY CONFIDENTIAL 2 Spring 2014 Section 10 Bootloader What is a Bootloader?  Responsible for loading an Operating System Kernel.  Responsible for loading Kernel infrastructure ( i.e. File System ). RAM-based File System to mount the root File System.  Start Kernel execution (init Process, System Daemons). Linux Server Bootloader  System Firmware ( BIOS ) Configuration of hardware devices. Program System Memory Controllers. Initialize Processor Caches. Enables Hardware Devices. Network Boot Infrastructure. Interrupt Routing details.  Load Kernel / Load File System / Start Kernel Embedded Linux Bootloader  Performs System Firmware tasks through Bootloader.  Load Kernel / Load File System / Start Kernel

SILICON VALLEY UNIVERSITY CONFIDENTIAL 3 Spring 2014 Section 10 Bootloader  Linux In Desktop PC – Power Up BIOS in host (X86 system)  Program core system components (RAM Controllers, CPU State / Registers), APIC Tables (Interrupt Routing), Flush Processor Cache.  POST (Power-On-Self-Test). BIOS access the hard drive Master Boot Record. In MBR is GRUB, Linux bootloader in Linux distributions.  Load Kernel Image, Load File System, Starts Kernel. GRUB provides choice to boot one of multiple OS (i.e. Linux or Windows).  /boot/grub/grub.conf contains GRUB configuration file with menu selection (i.e. which OS) and disk partition containing Linux Kernel and the root file system. GRUB loads Linux Kernel from /boot directory ( contains Linux Kernel(s), Kernel System Map(s), initrd (initial Ramdisk with drivers), Kernel config file(s) from Kernel build ).  Initrd is temporary root file system with executables (i.e. insmod) and drivers to mount the root file system on disk. After mounting, initrd is unmounted and memory freed.  NOTE: In embedded Linux systems, initrd is the final root file system. Linux Kernel starts init process. Init process is the root/parent process of all other process executing on Linux. Init process runs script, /etc/rc.d/rc.sysinit. Init process runs script, /etc/inittab, to execute scripts to start processes based on the runlevel.

SILICON VALLEY UNIVERSITY CONFIDENTIAL 4 Spring 2014 Section 10 Bootloader  Linux In Desktop PC – Power Up

SILICON VALLEY UNIVERSITY CONFIDENTIAL 5 Spring 2014 Section 10 Bootloader  Embedded Linux Boot Process – Bootloader First stage bootloader located in small ROM (2K or 4K Bytes). ROM bootloader loads second stage bootloader (i.e. Redboot) from fixed address from flash to RAM. ROM bootloader must have flash driver.  NAND Flash –large, less cost, cannot execute-in-place.  NOR Flash – smaller, execute-in-place (i.e. Second Stage Bootloader execute from NOR). Second stage bootloader will initializes CPU, MMU, on-chip devices, configures memory map.  POST ( Power-On-Self-Test ). Load the Linux Kernel and RAMDisk from flash to RAM:  Automatically decompress the Linux Kernel and RAMDisk.  Manually interrupt bootloader ( ) and use tftp to load Linux Kernel from server.  After Linux Kernel starts running, bootloader is no longer in RAM. Bootloader configuration (i.e. IP address, host system (server) IP address) saved in high address space in flash. Only for development and testing. Bootloader configured with the starting address space in flash where Linux is located and where RAMDisk is located. Bootloader executes a jump to the Kernel code to configure the microprocessor registers and start_kernel() function. Bootloader architecture specific. Bootloader has memory map for the flash and for loading Kernel and RAMDisk and will be different for another microcontroller.

SILICON VALLEY UNIVERSITY CONFIDENTIAL 6 Pro Linux Embedded Systems, Gene Sally Spring 2014 Section 10 Bootloader 

SILICON VALLEY UNIVERSITY CONFIDENTIAL 7 Spring 2014 Section 10 Bootloader  Embedded Linux: Execution Context  1 st Stage ROM Bootloader Assembly Code. Loads 2 nd Stage Bootloader into RAM.  2 nd Stage RAM Bootloader Lack of Execution Context: No Resources No RAM stack structure for C calling conventions.  Higher-level language, “C”, cannot run. Creates the Execution Context  Initialize RAM timings in the memory controller circuitry.  C Code can be used: Allow Bootloader to be written in C Code, instead of Assembly Language. Flush the processor caches. Program up the CPU registers with default values. Determine hardware installed within system and supply to Linux Kernel in architectual-dependent software tables. Built Independent from Linux Kernel.

SILICON VALLEY UNIVERSITY CONFIDENTIAL 8 Spring 2014 Section 10 Bootloader  Embedded Bootloaders First task is porting Bootloader to controller board. Diagnostic routines, system configuration options.  LILO (LInux LOader) Commercial Linux Distributions. Desktop PC (Intel x86) Architecture. lilo.conf: Used by lilo Configuration Utility when lilo image created. boot = /dev/hda timeout=50 default=linux image=/boot/myLinux label=linux initrd=/boot/myInitrd img read-only append="root=LABEL=/“ other=/dev/hda1 optional label=that_other_os MBR in first hard drive /dev/hda. Primary boot image. Initial RAMDisk. Linux command line passed to Linux Kernel. Dual boot, second boot image.

SILICON VALLEY UNIVERSITY CONFIDENTIAL 9 Spring 2014 Section 10 Bootloader  GRUB (Grand Unified Bootloader) Commercial Linux Distribution. Enhanced features not found in Lilo.  Understand File Systems and Kernel Image Formats. Read and Modify its configuration at boot time. Network boot. Kernel command line interface at boot time. default=0 timeout=3 splashimage=(hd0,1)/grub/splash.xpm.gz title Fedora Core 2 (2.6.9) root (hd0,1) kernel /bzImage ro root=LABEL=/ rhgb proto=imps quiet initrd /initrd img title Fedora Core ( ) root (hd0,1) kernel /vmlinuz ro root=LABEL=/ rhgb quiet title That Other OS rootnoverify (hd0,0) chainloader +1 Root Filesystem where all files are located. First partition of first drive. Kernel image with the Kernel command line. Initial RAMDisk.

SILICON VALLEY UNIVERSITY CONFIDENTIAL 10 Spring 2014 Section 10 Bootloader  Coreboot (LinuxBIOS) Used in x86 system without PC BIOS. Performs the function of PC BIOS (initial system bringup, interrupt-routing assignment, device initialization). Coreboot typically loads a Linux kernel, but it can load any other stand-alone ELF executable. Written for speed and reliability for boot process.  Boots Linux in seconds.  Yamon MIPs ROM Monitor.  Bootstrap program in ROM that initializes the hardware and boots the board Operating System during power on.

SILICON VALLEY UNIVERSITY CONFIDENTIAL 11 Spring 2014 Section 10 Bootloader  RedBoot Red Hat Embedded Debug and Bootstrap firmware. Open source application that uses the eCos real-time operating system Hardware Abstraction Layer to provide bootstrap firmware for embedded Linux systems.  eCos (embedded configurable operating system).  One process with multiple threads.  Customizable to precise application requirements of run-time performance and hardware needs.  Memory size in the tens to hundreds of kilobytes, or with real- time requirements.  Used on hardware with too little RAM to support embedded Linux (currently needs a minimum of about 2 MB of RAM, not including application and services). Provides an interactive command line interface to allow management of the Flash images, image download, RedBoot configuration, etc., accessible via serial or Ethernet. Boot scripts can be stored in Flash allowing loading of images from Flash or a TFTP server.

SILICON VALLEY UNIVERSITY CONFIDENTIAL 12 Spring 2014 Section 10 Bootloader  U-Boot Most actively developed open source embedded bootloader. Supports ARM, x86, Motorola 68K, MIPS, PowerPC, etc. TFTP Kernel over network connection, USB, and Flash. Supports filesystems: Cramfs (Linux), ext2 (Linux), FAT (Microsoft), JFF2 (Linux). U-boot and Linux Kernel retrieved to local storage (RAM).

SILICON VALLEY UNIVERSITY CONFIDENTIAL 13 Spring 2014 Section 10 Bootloader  Network File Server ( NFS ). Kernel can mount Root FileSystem from remote Network File System (NFS) Server. /etc/exports  Describes the directories that each host or set of hosts can access.  /data/root/virtex (rw, no_root_squash)  /data/root/virtex4: Directory of the Root FileSystem (same structure as Linux “/” directory.  : Remote system.  rw: Remote system has read and write privilege.  no_root_squash: Allows remote system to access directory with root privilege. /usr/sbin/exportfs –a  Maintain the current table of exported file systems for NFS.  List of all file systems named in /etc/exports. /sbin/service nfs restart  Restart the NFS daemons (portmap, lockd, mountd, rquotad, statd).  File containing exported file system are read by the mountd daemon.

SILICON VALLEY UNIVERSITY CONFIDENTIAL 14 Spring 2014 Section 10 Bootloader  Network File Server ( NFS ) Access Control Files control access to the NFS server.  Entry Format: daemon_list : client_list [ : shell_command ] /etc/hosts.deny  Access will be denied when a (daemon,client) pair matches an entry. /etc/hosts/allow  Access will be granted when a (daemon,client) pair matches an entry. Access Control Files Entries: portmap: ALL Converts TCP/IP port numbers to RPC program numbers. lockd: ALL A daemon that is not necessary with modern kernels. mountd: ALL Checks for access permission for the exported filesystem. rquotad: ALL An RPC server providing user quota information for remote users. statd: ALL Implements the Network Status Monitor (NSM) RPC protocol.

SILICON VALLEY UNIVERSITY CONFIDENTIAL 15 Spring 2014 Section 10 Bootloader  U-Boot Environment Variables  Similar to how environment variables are used in UNIX shells (i.e. bash), but used in U-Boot environment.  Saved in flash and copied to RAM when U-Boot starts. GTA01Bv4 # printenv bootargs= bootdelay=3 baudrate= usbtty=cdc_acm bootargs_base=rootfstype=jffs2 root=/dev/mtdblock4 console=ttySAC0, console=tty0 loglevel=8 stdin=serial stdout=serial stderr=serial dontask=y bootcmd=setenv bootargs ${bootargs_base} ${mtdparts}; bootm 0x menu_1=Set console to USB: setenv stdin usbtty; setenv stdout usbtty; se menu_2=Set console to serial: setenv stdin serial; setenv stdout serial; \ setenv stderr serial menu_3=Power off: neo1973 power-off... Environment size: 766/16380 bytes

SILICON VALLEY UNIVERSITY CONFIDENTIAL 16 Spring 2014 Section 10 Bootloader  U-boot Environment Variables for NFS. bootargs: Environment Variable automatically passed to Linux Kernel.  Display Boot Arguments used by the Kernel $ cat /proc/cmdline => setenv ipaddr => setenv serverip => setenv netmask => setenv hostname canyonlands => setenv rootpath /opt/eldk-4.2/ppc_4xx => saveenv => setenv ipaddr => setenv serverip => setenv netmask => setenv hostname canyonlands => setenv rootpath /opt/eldk-4.2/ppc_4xx => saveenv => setenv nfsargs 'root=/dev/nfs rw nfsroot=${serverip}:${rootpath}‘ => setenv bootargs ${nfsargs} ip=${ipaddr}:${serverip}:${serverip}:${netmask}:${hostname}::off Assigning variable “bootargs” without environment variables: => setenv bootargs root=/dev/nfs rw nfsroot= :/opt/eldk-4.2/ppc_4xx ip= : : : :canyonlands::off

SILICON VALLEY UNIVERSITY CONFIDENTIAL 17 Spring 2014 Section 10 Bootloader  Redboot  Command Set Structured around the Bootstrap Environment.  Designed to be Simple to Use and Remember.  Class of Commands: Program Loading and Execution. Flash image and Configuration Management. Miscellaneous Commands.  RedBoot> COMMAND [-S]... [-s val]... Operand -s: A boolean switch. The behavior of the command will differ depending on the presence of the switch. -s val: A qualified value. The letter “s” introduces the value, qualifying its meaning. Multiple commands may be entered on a single line, separated by the semi- colon “;” character. => setenv ipaddr => setenv serverip => setenv netmask => setenv hostname canyonlands => setenv rootpath /opt/eldk-4.2/ppc_4xx => saveenv

SILICON VALLEY UNIVERSITY CONFIDENTIAL 18 Spring 2014 Section 10 Bootloader  Redboot => setenv ipaddr => setenv serverip => setenv netmask => setenv hostname canyonlands => setenv rootpath /opt/eldk-4.2/ppc_4xx => saveenv RedBoot> help Manage aliases kept in FLASH memory alias name [value] Set/Query the system console baud rate baudrate [-b ] Manage machine caches cache [ON | OFF] Display/switch console channel channel [-1| ] Display disk partitions disks Display (hex dump) a range of memory dump -b [-l ] [-s] Execute an image - with MMU off exec [-w timeout] [-b [-l ]] [-r [-s ]] [-c "kernel command line"] [ ] Manage flash images fis {cmds} Manage configuration kept in FLASH memory fconfig [-i] [-l] [-n] [-f] [-d] | [-d] nickname [value].... Execute code at a location go [-w ] [-c] [-n] [entry] Help about help? help [ ] Set/change IP addresses ip_address [-l [/ ]] [-h ] Load a file load [-r] [-v] [-d] [-c ] [-h ] [-m {TFTP | HTTP | {x|y}MODEM | disk}] [-b ] Network connectivity test ping [-v] [-n ] [-t ] [-i <IP_addr] -h Reset the system reset Display RedBoot version information version Display (hex dump) a range of memory x -b [-l ] [-s]

SILICON VALLEY UNIVERSITY CONFIDENTIAL 19 Spring 2014 Section 10 Bootloader  Redboot RedBoot> fconfig -l Run script at boot: true Boot script:.. fis load ramdisk.. fis load zImage.. exec -r 0x s 0x Boot script timeout (1000ms resolution): 1 Use BOOTP for network configuration: false Gateway IP address: Local IP address: Local IP address mask: Default server IP address: DNS server IP address: Set eth0 network hardware address [MAC]: true eth0 network hardware address [MAC]: 0x00:0x00:0x00:0x00:0x4C:0x33 GDB connection port: 9000 Force console for special debug messages: false Network debug at boot time: false RedBoot> => setenv ipaddr => setenv serverip => setenv netmask => setenv hostname canyonlands => setenv rootpath /opt/eldk-4.2/ppc_4xx => saveenv

SILICON VALLEY UNIVERSITY CONFIDENTIAL 20 Spring 2014 Section 10 Bootloader  Redboot... Resetting. +Ethernet eth0: MAC address 00:00:00:00:4c:33 IP: / , Gateway: Default server: , DNS server IP: RedBoot(tm) bootstrap and debug environment [ROMRAM] Non-certified release, version v2_0 - built 23:18:18, Jan Platform: Cirrus Logic EDB9302 Board (ARM920T) Rev A Copyright (C) 2000, 2001, 2002, Red Hat, Inc. RAM: 0x x , 0x00041e48-0x01fdd000 available FLASH: 0x x , 32 blocks of 0x bytes each. == Executing boot script in seconds - enter ^C to abort RedBoot> fis load ramdisk RedBoot> fis load zImage RedBoot> exec -r 0x s 0x Using base address 0x and length 0x0017b380 Uncompressing Linux => setenv ipaddr => setenv serverip => setenv netmask => setenv hostname canyonlands => setenv rootpath /opt/eldk-4.2/ppc_4xx => saveenv

SILICON VALLEY UNIVERSITY CONFIDENTIAL 21 Spring 2014 Section 10 Bootloader  Redboot  NFS Configuration. fis load zImage exec -c "ip= : : : ::eth0:off ethaddr=00:00:00:00:4c:33 root=/dev/nfs rw nfsroot= :/tftpboot/initrd noinitrd rootdelay=2" => setenv ipaddr => setenv serverip => setenv netmask => setenv hostname canyonlands => setenv rootpath /opt/eldk-4.2/ppc_4xx => saveenv

SILICON VALLEY UNIVERSITY CONFIDENTIAL 22 Spring 2014 Section 10 Bootloader  Redboot  NFS Configuration.... eth0: generated random MAC address d2:21:b6:29:45:70. IP-Config: Complete: device=eth0, addr= , mask= , gw= , host= , domain=, nis-domain=(none), bootserver= , rootserver= , rootpath= Waiting 2sec before mounting root device... Looking up port of RPC /2 on Looking up port of RPC /1 on VFS: Mounted root (nfs filesystem). Freeing init memory: 112K init started: BusyBox v1.00 ( : ) multi-call binary Please press Enter to activate this console. BusyBox v1.00 ( : ) Built-in shell (ash) Enter 'help' for a list of built-in commands. ~ # => setenv ipaddr => setenv serverip => setenv netmask => setenv hostname canyonlands => setenv rootpath /opt/eldk-4.2/ppc_4xx => saveenv