Skip to content

Latest commit

 

History

History
493 lines (333 loc) · 14.5 KB

PITCHME.md

File metadata and controls

493 lines (333 loc) · 14.5 KB

---?image=assets/images/gitpitch-audience.jpg @title[Platform Build Lab]




UEFI & EDK II Training

UEFI Shell Lab - OVMF with QEMU or MinnowBoard MAX/Turbot


tianocore.org Note: PITCHME.md for UEFI / EDK II Training UEFI Shell Application

Copyright (c) 2018, Intel Corporation. All rights reserved.

Redistribution and use in source (original document form) and 'compiled' forms (converted to PDF, epub, HTML and other formats) with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code (original document form) must retain the above copyright notice, this list of conditions and the following disclaimer as the first lines of this file unmodified.

  2. Redistributions in compiled form (transformed to other DTDs, converted to PDF, epub, HTML and other formats) must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS DOCUMENTATION IS PROVIDED BY TIANOCORE PROJECT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL TIANOCORE PROJECT BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


@title[Lesson Objective]

<p align="center"Lesson Objective


@fa[certificate gp-bullet-green]  Run UEFI Shell (QEMU or MAX/Turbot)

@fa[certificate gp-bullet-cyan]  Run UEFI Shell Commands

@fa[certificate gp-bullet-yellow]  Run UEFI Shell Scripts

---?image=assets/images/binary-strings-black2.jpg @title[UEFI Shell Lab QEMU Section]




     UEFI Shell Lab w/ QEMU

         Skip if continuing with  MinnowBoard MAX / Turbot @fa[angle-right gp-bullet-cream]

---?image=/assets/images/slides/Slide4.JPG @title[QEMU Running OVMF]

QEMU Running OVMF










See Platform Build lab for "RunQemu.sh" script

Note:

see Platform Build lab for "RunQemu.sh" script

RunQemu.sh:

  • Create a Linux shell script to run the QEMU from the run-ovmf directory

bash$ gedit RunQemu.sh
qemu-system-x86_64 -pflash bios.bin -hda fat:rw:hda-contents -net none -debugcon file:debug.log -global isa-debugcon.iobase=0x402
Save and Exit

---?image=/assets/images/slides/Slide6.JPG @title[QEMU Running OVMF cont]

QEMU Running OVMF

Note:

---?image=/assets/images/slides/Slide8.JPG @title[QEMU boot to UEFI Shell]

QEMU boot to UEFI Shell













skip to UEFI Shell Commands :    @fa[angle-right gp-bullet-cream]

Note:

---?image=assets/images/binary-strings-black2.jpg @title[UEFI Shell Lab Max/Turbot Section]




     UEFI Shell Lab w/ Max/Turbot

         Skip if continuing with QEMU Shell Commands  @fa[angle-right gp-bullet-cream]

---?image=/assets/images/slides/Slide11.JPG @title[Max Test System 02]

Setup MinnowBoard Max Test System











See Platform Build lab for Minnowboard MAX/Turbot HW setup

Note:

  • Open Terminal Prompt (Cnt-Alt-T)
bash$ dmesg                     	#(to check which USB port is assigned)
bash$ sudo chmod 666 /dev/ttyUSBn	#(where n is the FTDI number)
  • dmesg command shows which - ttyUSBn

---?image=/assets/images/slides/Slide13.JPG @title[Power on MinnowBoard MAX]

Power on MinnowBoard MAX

Note:

  • Connect the Power supply cable to the MinnowBoard MAX
bash$ screen /dev/ttyUSBn 115200
  • MinnowBoard MAX should boot to the UEFI Shell in the Terminal – Screen .

  • While in screen Cnt-A then D goes back to terminal

 bash$ screen –r #(returns to screen)
  • Note: Cnt-H for Backspace

**Warning do not use any other power supply than 5V or the board will Fry

---?image=assets/images/binary-strings-black2.jpg @title[UEFI Shell Lab Commands Section]




     UEFI Shell Commands

         Commands from the Command Line Interface

---?image=/assets/images/slides2/Slide11.JPG @title[Common Shell Commands ]

Common Shell Commands For Debugging

Note:

Next for this lab there are a few shell commands that will help us with debugging. For example if you are writing a driver, you would want to get familiar with these shell commands. Each of these commands will have a help option to give you further information about these commands.

We are not going to go all were these in detail but just to make you aware of the shell commands.

---?image=/assets/images/slides2/Slide12.JPG @title[Shell Help Command ]

Shell Help

Note:

Next let’s just try the help shell command. So once you reach the shell go ahead and type: “help –b” And what you will see is the list of all the shell commands built into this platform followed by a one liner information about each command. To exit, this emulation simply type: “reset”

---?image=/assets/images/slides2/Slide14.JPG @title[Shell mm Command ]

Shell "mm"

Note:

---?image=/assets/images/slides2/Slide13.JPG @title[Shell mm -? Command ]

Shell "mm"

Note:

---?image=/assets/images/slides/Slide24.JPG @title[Shell mem Command ]

Shell "mem"

Note:

---?image=/assets/images/slides/Slide26.JPG @title[Shell memmap Command ]

Shell "memmap"

Note:

---?image=/assets/images/slides/Slide28.JPG @title[Shell drivers Command ]

Shell "drivers"

Note:

---?image=/assets/images/slides/Slide30.JPG @title[Shell devices Command ]

Shell "devices"

Note:

---?image=/assets/images/slides/Slide32.JPG @title[Shell devtree Command ]

Shell "devtree"

Note:

---?image=/assets/images/slides/Slide34.JPG @title[Shell handle Database Command ]

Shell handle database - "dh"

Note:

---?image=/assets/images/slides/Slide36.JPG @title[Shell Load Command ]

Shell "load"

Note:

---?image=/assets/images/slides2/Slide21.JPG @title[Shell Load Command ]

Shell "Dmpstore"

Note:

---?image=/assets/images/slides/Slide38.JPG @title[Shell Stall Command ]

Shell "stall"

Note:

---?image=assets/images/binary-strings-black2.jpg @title[UEFI Shell Lab Scripts Section]




     UEFI Shell Scripts

         Use Scripting with UEFI Shell


@title[UEFI Shell Scripts ]

UEFI Shell Scripts


The UEFI Shell can execute commands from a file, which is called a batch script file (.nsh files).

Benefits: These files allow users to simplify routine or repetitive tasks.
- Perform basic flow control. - Allow branching and looping in a script. - Allow users to control input and output and call other batch programs (known as script nesting).

Note: The UEFI Shell can execute commands from a file, which is called a batch script file (.nsh files).
Benefits: These files allow users to simplify routine or repetitive tasks.

  • Perform basic flow control.
  • Allow branching and looping in a script.
  • Allow users to control input and output and call other batch programs (known as script nesting).

---?image=/assets/images/slides2/Slide26.JPG @title[Writing UEFI Shell Scripts]

Writing UEFI Shell Scripts

Note:

With the UEFI shell There is an editor included. This is a very simple editor but can help if running on the target system without an OS "Nice" editor available.

SHell editor help menu - Cnt W

At the shell prompt

Shell> fs0:

FS0:> edit HelloScript.nsh

Type : echo “Hello World“

Press “F2”- Enter Press “F3” to exit

---?image=/assets/images/slides/Slide44.JPG @title[Hello World Script]

Hello World Script

Note:

In the shell, type HelloScript for the following result:

HelloScript.nsh

Close the QEMU (not necessary on MAX/ Turbot)

---?image=/assets/images/slides/Slide46.JPG @title[UEFI Shell Nested Scripts ]

UEFI Shell Nested Scripts

Note:

QEMU: Copy the Scripts from the ~/FW/LabSampleCode/ShellScripts to the run-ovmf directory ~/run-ovmf/hda-contents

MAX/Turbot: Copy the Scripts from the ~/FW/LabSampleCode/ShellScripts to USB Thumb Drive


@title[UEFI Shell Script Example]

UEFI Shell Script Example

Script1.nsh

# Simple UEFI Shell script file
echo  -off
script2.nsh
if exist %cwd%Mytime.log then
     type Mytime.log
endif
echo "%HThank you.” “%VByeBye:) %N"

Script2.nsh

# Show nested scripts
time > Mytime.log
for %a run (3 1 -1)
    echo %a counting down
endfor

Note: walk through the script calling the second script

  • if
  • for loop
    • %a counting down...

---?image=/assets/images/slides/Slide49.JPG @title[Run UEFI Shell Scripts ]

Run UEFI Shell Scripts

Note: QEMU: Run the RunQemu.sh from the terminal (Cnt-Alt-T)
bash$ cd ~run-ovmf
bash$ . RunQemu.sh


BOTH: At the Shell prompt Type
`Shell> fs0:`
`FS0:\> Script1`
`FS0:\> Edit Script1.nsh`

---?image=/assets/images/slides/Slide51.JPG @title[Run UEFI Shell Scripts cont ]

Run UEFI Shell Scripts

Note:

  • Remove the “#” on the first line

  • Press “F2”

  • Enter

  • Press “F3” to exit

  • Type

  • FS0:> Script1


@title[Summary]

Summary


@fa[certificate gp-bullet-green]  Run UEFI Shell (QEMU or MAX/Turbot)

@fa[certificate gp-bullet-cyan]  Run UEFI Shell Commands

@fa[certificate gp-bullet-yellow]  Run UEFI Shell Scripts

---?image=assets/images/gitpitch-audience.jpg @title[Questions]
![Questions](/assets/images/questions.JPG =10x)

---?image=assets/images/gitpitch-audience.jpg @title[Logo Slide]


![Logo Slide](/assets/images/TianocoreLogo.png =10x)


@title[Acknowledgements]

Acknowledgements

/**
Redistribution and use in source (original document form) and 'compiled' forms (converted
to PDF, epub, HTML and other formats) with or without modification, are permitted provided
that the following conditions are met:

Redistributions of source code (original document form) must retain the above copyright 
notice, this list of conditions and the following disclaimer as the first lines of this 
file unmodified.

Redistributions in compiled form (transformed to other DTDs, converted to PDF, epub, HTML
and other formats) must reproduce the above copyright notice, this list of conditions and 
the following disclaimer in the documentation and/or other materials provided with the 
distribution.

THIS DOCUMENTATION IS PROVIDED BY TIANOCORE PROJECT "AS IS" AND ANY EXPRESS OR IMPLIED 
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL TIANOCORE PROJECT BE 
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
ARISING IN ANY WAY OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF ADVISED OF THE POSSIBILITY 
OF SUCH DAMAGE.

Copyright (c) 2018, Intel Corporation. All rights reserved.
**/