The GRUB bootloader Michael Opdenacker Thomas Petazzoni Free Electrons

Slides:



Advertisements
Similar presentations
Booting and Shuting Down WeeSan Lee. Roadmap Bootstrapping Boot Loaders Startup/Init Scripts Reboot & Shutdown Q&A.
Advertisements

Genesis: from raw hardware to processes System booting sequence: how does a machine come into life.
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.
Booting And Shutting Down. Bootstrapping  Bootstrapping is standard term for “starting up a computer”  During bootstrapping the kernel is loaded into.
Linux+ Guide to Linux Certification, Second Edition Chapter 3 Linux Installation and Usage.
ESE Einführung in Software Engineering N. XXX Prof. O. Nierstrasz Fall Semester 2009.
S.Ha.R.K. Workshop28/02/05 S.Ha.R.K. Installation HowTo Tullio Facchinetti University of Pavia - Italy.
Metamodeling Seminar X. CHAPTER Prof. O. Nierstrasz Spring Semester 2008.
1 Web Server Administration Chapter 3 Installing the Server.
GNU/Linux Filesystem 1 st AUT GNU/Linux Festival Computer Engineering & IT Department Bahador Bakhshi.
ESE Einführung in Software Engineering X. CHAPTER Prof. O. Nierstrasz Wintersemester 2005 / 2006.
Bootloader / multi-boot
Lesson 4-Installing Network Operating Systems. Overview Installing and configuring Novell NetWare 6.0. Installing and configuring Windows 2000 Server.
CP — Concurrent Programming X. CHAPTER Prof. O. Nierstrasz Wintersemester 2005 / 2006.
Linux Install. Resources Guide to Linux Installation and Administration, Nicholas Wells, Course Technology, 2000.
12. eToys. © O. Nierstrasz PS — eToys 12.2 Denotational Semantics Overview:  … References:  …
Linux+ Guide to Linux Certification, Third Edition
CompTIA Linux+ Certification
Linux+ Guide to Linux Certification Chapter Three Linux Installation and Usage.
Chapter Three OPERATING SYSTEMS.
Linux Booting Procedure
Guide to Linux Installation and Administration, 2e1 Chapter 3 Installing Linux.
CIS 191 – Lesson 2 System Administration. CIS 191 – Lesson 2 System Architecture Component Architecture –The OS provides the simple components from which.
Chapter Fourteen Windows XP Professional Fault Tolerance.
COSC 4750 Customizing and maintenance. Installing software Redhat/Fedora (and linux in general) has a package installer, called rpm Many programs will.
Internet of Things with Intel Edison Compiling and running Pierre Collet Intel Software.
Guide to Linux Installation and Administration, 2e1 Chapter 2 Planning Your System.
File System Management File system management encompasses the provision of a way to store your data in a computer, as well as a way for you to find and.
Linux Administration. Pre-Install Different distributions –Redhat, Caldera, mandrake, SuSE, FreeBSD Redhat Server Install –Check HCL –Significant issues.
CIS Lesson 5 Lesson 5 New Skills Boot time GRUB edits (review) Changing BIOS boot order on a VM (review) Mounting CD ISO and floppy Image files on.
Linux Startup Process Presenter: Dipu Gupta.
PTA Linux Series Copyright Professional Training Academy, CSIS, University of Limerick, 2006 © Workshop V Files and the File System Part B – File System.
Chapter 9: Networking with Unix and Linux. Objectives: Describe the origins and history of the UNIX operating system Identify similarities and differences.
Page 1 of 38 Lenovo Confidential Lenovo Confidential Lenovo Confidential Lenovo Confidential Lenovo Confidential Please Note: Information contained in.
UNIX Startup and Shutdown CSCI N321 – System and Network Administration Copyright © 2000, 2009 by Scott Orr and the Trustees of Indiana University.
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.
System initialization Unit objectives A.Outline steps necessary to boot a Linux system, configure LILO and GRUB boot loaders, and dual boot Linux with.
This courseware is copyrighted © 2016 gtslearning. No part of this courseware or any training material supplied by gtslearning International Limited to.
Implementation Method Linux-USB Gadget Framework –The Linux-USB Gadget Framework makes it easy for peripherals and other devices embedding GNU/Linux system.
Windows Vista Configuration MCTS : NTFS Security Features and File Sharing.
Linux Filesystem Administration
Linux Introduction Linux was developed in the early 1990’s by Linus Torvald computer science student at the University of Helsinki Linux is distributed.
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.
Day 1 Tasks How do you backup the MBR (Master Boot Record) of a hard disk? How do you backup the primary partition table of an MBR type hard disk? How.
1 Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//free-electrons.com Scratchbox The Scratchbox.
1 Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//free-electrons.com Block filesystems Michael.
1 Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//free-electrons.com SSH Thomas Petazzoni Free.
1 Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//free-electrons.com Embedded Linux Training System.
1 Kernel development with VirtualBox © Copyright 2009, Marco Stornelli Creative Commons Attribution-ShareAlike 3.0 license 9/30/2016 Linux development.
1 Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//free-electrons.com Block filesystems Michael.
Boot Diskettes, Bootable USB Keys and Live CDs Used when the computer can't start for some reason, as a diagnostic, repair and recovery tool. Boot diskettes.
1 Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//free-electrons.com The U-boot bootloader Michael.
GRUB 2 Dave Soergel.
Discovering Computers 2012: Chapter 8
Guide to Linux Installation and Administration, 2e
Computer System Laboratory
Using USB gadget drivers
Porting U-boot Michael Opdenacker Free Electrons
Introduction to Operating Systems
Structure of Unix OS.
The blob bootloader Thomas Petazzoni Free Electrons
Embedded Linux Conference - April 2009
IS3440 Linux Security Unit 4 Securing the Linux Filesystem
SUSE Linux Enterprise Desktop Administration
Presentation transcript:

The GRUB bootloader Michael Opdenacker Thomas Petazzoni Free Electrons

Rights to copy © Copyright 2006-2009, Free Electrons feedback@free-electrons.com Document sources, updates and translations: http://free-electrons.com/docs/grub Corrections, suggestions, contributions and translations are welcome! Latest update: 10/16/2017 Attribution – ShareAlike 3.0 You are free to copy, distribute, display, and perform the work to make derivative works to make commercial use of the work Under the following conditions Attribution. You must give the original author credit. Share Alike. If you alter, transform, or build upon this work, you may distribute the resulting work only under a license identical to this one. For any reuse or distribution, you must make clear to others the license terms of this work. Any of these conditions can be waived if you get permission from the copyright holder. Your fair use and other rights are in no way affected by the above. License text: http://creativecommons.org/licenses/by-sa/3.0/legalcode

Grub features (1) Many features and a lot of flexibility! Supports booting many operating systems: Linux, Hurd, *BSD, Windows, DOS, OS/2... Support for different boot devices: hard disk (of course), cdrom (El Torito), network (tftp) Support for many filesystems (unlike LILO, it doesn't need to store the physical location of each kernel): ext2/3, xfs, jfs, reiserfs, dos, fat16, fat32... Configuration file: unlike LILO, no need to update the MBR after making changes to the configuration file.

Grub features (2) Support for many network cards (reusing drivers from the Etherboot bootloader). Menu interface for regular users. Advanced command line interface for advanced users. Remote control from a serial console. Supports multiple executable formats: ELF by also a.out variants. Can uncompress compressed files Small: possible to remove features and drivers which are not used (./configure --help). Without recompiling: remove unused filesystem stages.

Grub size Example from grub 0.97-1ubuntu9 (Ubuntu Dapper): Stage 1: /lib/grub/i386-pc/stage1: 512 bytes Stage 1.5: /lib/grub/i386-pc/e2fs_stage1_5: 7508 bytes Stage 2: /lib/grub/i386-pc/stage2: 105428 bytes Total: only 113448 bytes!

Installing grub (1) Install Grub on an embedded target with a blank disk. Do it from a GNU/Linux host with Grub installed. Access the disk for the embedded target as external storage: Compact Flash disk: use a USB CF card reader. Hard disk drive: use a USB hard disk drive enclosure. Create a partition on this disk (useful, but not mandatory): fdisk /dev/sda (type m for a menu of commands) Format and mount this partition: mkfs.ext3 /dev/sda1 sudo mount /dev/sda1 /mnt/sda1

Installing grub (2) Install Grub: grub-install --root-directory=/mnt/sda1 /dev/sda /dev/sda: the physical disk. Grub is installed on its Master Boot Record. /mnt/sda1: the directory under which grub-install creates a boot/ directory containing the upper stage and configuration file. Of course, you could have used another partition. Grub now needs a kernel to boot. Copy a kernel image to /mnt/sda1/boot/ (for example) and describe this kernel in /mnt/sda1/boot/grub/menu.lst. Once you also copied root filesystem files, you can put your storage device back to the embedded target and boot from it.

Naming files Grub names partitions as follows: (hdn,p) n: nth disk on the system p: pth partition on this disk Files are described with the partition they belong to. Example: (hd0,2)/boot/vmlinuz-2.6.18 You can specify a default partition with the root command: Example: root (hd0,0) kernel /boot/vmlinuz-2.6.18

Sample configuration file /boot/grub/menu.lst default 0 timeout 10 title Ubuntu, kernel 2.6.15-27-386 root (hd0,2) kernel /boot/vmlinuz-2.6.15-27-386 root=/dev/hda3 ro quiet splash initrd /boot/initrd.img-2.6.15-27-386 boot title Ubuntu, kernel 2.6.15-27-386 (recovery mode) root (hd0,2) kernel /boot/vmlinuz-2.6.15-27-386 root=/dev/hda3 ro single initrd /boot/initrd.img-2.6.15-27-386 boot

Network support Grub can use the network in several ways Grub running from disk (floppy, hard drive, cdrom), and downloading kernel images from a tftp server on the network. Diskless system: A first stage bootloader (typically Etherboot) is booted from ROM. It then downloads a second stage from Grub: pxegrub for a PXE ROM, or nbgrub for a NBI loader). Grub can then get kernel images from the network.

Grub security (1) Caution: the Grub shell can be used to display any of your files! Example: Boot your system Type the c command to enter command line mode. find /etc/passwd Grub displays all partitions containing such a file. cat (hd0,2)/etc/passwd You can see the names of users on the system! Of course, you can access any file. Permissions are ignored.

Grub security (2) Interactive commands can be protected with a password. Otherwise, people would even be able to view the contents of files from the Grub shell! You can also protect menu entries with a password. Useful to restrict failsafe modes to admin users.

Grub resources Grub home page: http://www.gnu.org/software/grub/ Grub manual: http://www.gnu.org/software/grub/manual/