SlideShare uma empresa Scribd logo
1 de 14
Copyright@Embedkari
QEMU
BIOS
U-Boot
UEFI
Agenda
●
QEMU or Quick EMUlator
●
Bootloader overview
●
X86 booting mechanism
●
BIOS to boot sector code transfer demo
●
U-Boot demo for x86 using QEMU
Disclaimer
●
Presenter will not be responsible for for any
damage to USB or HDD due to experiments
followed.
●
Take a note of all the instructions carefully
●
Don’t use your hard disk for bootloader
experiments.
●
Presenter will use either QEMU or old x86
based system
QEMU
●
QEMU is a generic open source machine emulator and
virtualizer
●
Emulates program written for one architecture in another
●
It can run virtual machines like KVM in host CPU
●
Installation
–
sudo apt install qemu-system
–
If error
–
sudo apt install qemu-system --fix-missing
Bootloader
●
BIOS →UEFI
●
8xxROM→PPCboot—Armboot merged--→U-boot
●
TianoCore
–
open source implementation of UEFI
●
LinuxBIOS-->Coreboot
●
Libreboot
●
Both Coreboot and Libreboot are aimed to replace
proprietary boot firmware
X86 booting mechanism
●
Hardware Reset
●
BIOS(Basic Input/Output System) or Platform Firmware in ASM
–
Resides in non-volatile memory and prepares all POST procedures
–
Interactive hardware configuration
–
Boot mode
●
UEFI / CSM(Compatibility Support Mode)/BIOS
●
Boot Loader
–
Extensible Firmware Interface (EFI)
–
Unified Extensible Firmware Interface(UEFI) written in C
●
Boot Partition Format
–
Boot loader support also depends on type of partition
●
MBR(Master Boot Record) disk partition
●
GPT(GUID Partion Table) disk partition
Custom boot.asm●
org 0x7C00 ;BIOS loads program here
●
bits 16 ;16-bit mode
●
start:
●
cli ;Disable Interrupts
●
mov si, welcm ;SI points to custom data
●
mov ah, 0x0E ; Tell BIOS to print characters
●
.loop lodsb ;load byte into AL
–
or al, al
–
jz halt
–
jmp .loop
●
halt: hlt
●
welcm: db “Embedkari Welcomes You! “
●
times 510 - ($ - $$) db 0 ;Fills remaining bytes except last two
●
dw 0xAA55
Custom boot sector
Experiment
●
nasm(Netwide Assembler) Open source s/w for x86
–
sudo apt update
–
Check and install build-essential if not present
–
sudo apt list | grep build | grep essential
–
sudo apt install nasm
●
nasm boot.asm -f bin -o boot.bin
●
You may verify assembly listing using
–
nasm boot.asm -l boot.lst
●
Check the binary in QEMU
●
qemu-system-i386 -fda boot.bin
Program boot.bin to USB
●
USB data can be
verified if required
●
Start Cygwin as
adminstrator
●
dd if=/dev/sdb bs=512
count=4 of=test.bin
U-Boot-x86 @QEMU
●
git clone git://git.denx.de/u-boot-x86.git
●
cd u-boot-x86
●
export BUILD_ROM=y
●
make qemu-x86_defconfig
●
make all
●
Test U-boot in QEMU
●
qemu-system-i386 -nographic -bios u-
boot.rom -net nic -net user,tftp=/tftpboot
U-Boot build issue
●
You may get error due to absence of required
Libraries and this may lead to following additional
installation
●
For missing swig
–
sudo apt install swig
●
For Python 2
–
sudo apt install python-dev
●
For Python 3
–
sudo apt install python3-dev
Reference
●
https://firmware.intel.com/learn/uefi/about-uefi
●
http://www.uefi.org/
●
https://www.qemu.org/
●
https://manpages.debian.org/stretch/qemu-system-
●
https://pci-ids.ucw.cz/read/PC/8086
●
THANKS
If you found this information usefule < Please
like this video AND subscribe to
www.youtube.com/c/embedkari
Embedded Career Information :
www.facebook.com/embedkari
Blog:www.embedkari.com

Mais conteúdo relacionado

Mais procurados

NetBSD on Google Compute Engine (en)
NetBSD on Google Compute Engine (en)NetBSD on Google Compute Engine (en)
NetBSD on Google Compute Engine (en)Ryo ONODERA
 
Linux fundamental - Chap 16 System Rescue
Linux fundamental - Chap 16 System RescueLinux fundamental - Chap 16 System Rescue
Linux fundamental - Chap 16 System RescueKenny (netman)
 
Androidx86 Installation For Virtualbox
Androidx86 Installation For VirtualboxAndroidx86 Installation For Virtualbox
Androidx86 Installation For VirtualboxPingLun Liao
 
Programming OpenRISC on Altera De0_nano
Programming OpenRISC on Altera De0_nanoProgramming OpenRISC on Altera De0_nano
Programming OpenRISC on Altera De0_nanoYi-Chiao
 
Creación de máquinas virtuales basada en kernel usando qemu y virsh
Creación de máquinas virtuales basada en kernel usando qemu y virshCreación de máquinas virtuales basada en kernel usando qemu y virsh
Creación de máquinas virtuales basada en kernel usando qemu y virshJonathan Franchesco Torres Baca
 
Server Room Configuration
Server Room ConfigurationServer Room Configuration
Server Room ConfigurationChandler Morgan
 
1. openvpn simple
1. openvpn simple1. openvpn simple
1. openvpn simplekhanh02l1
 
Grabbing the PostgreSQL Elephant by the Trunk
Grabbing the PostgreSQL Elephant by the TrunkGrabbing the PostgreSQL Elephant by the Trunk
Grabbing the PostgreSQL Elephant by the TrunkHarold Giménez
 
Control-M 800 - Infrastructure Example
Control-M 800 - Infrastructure ExampleControl-M 800 - Infrastructure Example
Control-M 800 - Infrastructure ExampleOhio University
 
Dave Gilbert - KVM and QEMU
Dave Gilbert - KVM and QEMUDave Gilbert - KVM and QEMU
Dave Gilbert - KVM and QEMUDanny Abukalam
 

Mais procurados (18)

coreboot@Budapest 10.2009 Meetup
coreboot@Budapest 10.2009 Meetupcoreboot@Budapest 10.2009 Meetup
coreboot@Budapest 10.2009 Meetup
 
NetBSD on Google Compute Engine (en)
NetBSD on Google Compute Engine (en)NetBSD on Google Compute Engine (en)
NetBSD on Google Compute Engine (en)
 
Linux fundamental - Chap 16 System Rescue
Linux fundamental - Chap 16 System RescueLinux fundamental - Chap 16 System Rescue
Linux fundamental - Chap 16 System Rescue
 
Androidx86 Installation For Virtualbox
Androidx86 Installation For VirtualboxAndroidx86 Installation For Virtualbox
Androidx86 Installation For Virtualbox
 
My First BCC
My First BCCMy First BCC
My First BCC
 
Programming OpenRISC on Altera De0_nano
Programming OpenRISC on Altera De0_nanoProgramming OpenRISC on Altera De0_nano
Programming OpenRISC on Altera De0_nano
 
Creación de máquinas virtuales basada en kernel usando qemu y virsh
Creación de máquinas virtuales basada en kernel usando qemu y virshCreación de máquinas virtuales basada en kernel usando qemu y virsh
Creación de máquinas virtuales basada en kernel usando qemu y virsh
 
Quickly Debug VM Failures in OpenStack
Quickly Debug VM Failures in OpenStackQuickly Debug VM Failures in OpenStack
Quickly Debug VM Failures in OpenStack
 
Wowza project
Wowza   projectWowza   project
Wowza project
 
OpenBTS AirPutih
OpenBTS AirPutihOpenBTS AirPutih
OpenBTS AirPutih
 
Server Room Configuration
Server Room ConfigurationServer Room Configuration
Server Room Configuration
 
VM - Talk
VM - TalkVM - Talk
VM - Talk
 
1. openvpn simple
1. openvpn simple1. openvpn simple
1. openvpn simple
 
Grabbing the PostgreSQL Elephant by the Trunk
Grabbing the PostgreSQL Elephant by the TrunkGrabbing the PostgreSQL Elephant by the Trunk
Grabbing the PostgreSQL Elephant by the Trunk
 
Control-M 800 - Infrastructure Example
Control-M 800 - Infrastructure ExampleControl-M 800 - Infrastructure Example
Control-M 800 - Infrastructure Example
 
Look Into Libvirt Osier Yang
Look Into Libvirt Osier YangLook Into Libvirt Osier Yang
Look Into Libvirt Osier Yang
 
Dave Gilbert - KVM and QEMU
Dave Gilbert - KVM and QEMUDave Gilbert - KVM and QEMU
Dave Gilbert - KVM and QEMU
 
Ansible & Vagrant
Ansible & VagrantAnsible & Vagrant
Ansible & Vagrant
 

Semelhante a Qemu x86 BIOS @ https://youtu.be/F71LGSrj9cc

3. configuring a compute node for nfv
3. configuring a compute node for nfv3. configuring a compute node for nfv
3. configuring a compute node for nfvvideos
 
Launch the First Process in Linux System
Launch the First Process in Linux SystemLaunch the First Process in Linux System
Launch the First Process in Linux SystemJian-Hong Pan
 
U-Boot Porting on New Hardware
U-Boot Porting on New HardwareU-Boot Porting on New Hardware
U-Boot Porting on New HardwareRuggedBoardGroup
 
Install power linux through cdrom and network redhat and suse
Install power linux through cdrom and network   redhat and suseInstall power linux through cdrom and network   redhat and suse
Install power linux through cdrom and network redhat and susezhangjunli
 
Grub and dracut ii
Grub and dracut iiGrub and dracut ii
Grub and dracut iiplarsen67
 
NFD9 - Matt Peterson, Data Center Operations
NFD9 - Matt Peterson, Data Center OperationsNFD9 - Matt Peterson, Data Center Operations
NFD9 - Matt Peterson, Data Center OperationsCumulus Networks
 
Study on Android Emulator
Study on Android EmulatorStudy on Android Emulator
Study on Android EmulatorSamael Wang
 
syzkaller: the next gen kernel fuzzer
syzkaller: the next gen kernel fuzzersyzkaller: the next gen kernel fuzzer
syzkaller: the next gen kernel fuzzerDmitry Vyukov
 
Linux: the first second
Linux: the first secondLinux: the first second
Linux: the first secondAlison Chaiken
 
The Deck by Phil Polstra GrrCON2012
The Deck by Phil Polstra GrrCON2012The Deck by Phil Polstra GrrCON2012
The Deck by Phil Polstra GrrCON2012Philip Polstra
 
Jagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratchJagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratchlinuxlab_conf
 
U Boot or Universal Bootloader
U Boot or Universal BootloaderU Boot or Universal Bootloader
U Boot or Universal BootloaderSatpal Parmar
 
Uboot startup sequence
Uboot startup sequenceUboot startup sequence
Uboot startup sequenceHoucheng Lin
 
Linux Containers From Scratch
Linux Containers From ScratchLinux Containers From Scratch
Linux Containers From Scratchjoshuasoundcloud
 
Introduction of unit test on android kernel
Introduction of unit test on android kernelIntroduction of unit test on android kernel
Introduction of unit test on android kernelJohnson Chou
 
Bootloaders (U-Boot)
Bootloaders (U-Boot) Bootloaders (U-Boot)
Bootloaders (U-Boot) Omkar Rane
 

Semelhante a Qemu x86 BIOS @ https://youtu.be/F71LGSrj9cc (20)

U-Boot - An universal bootloader
U-Boot - An universal bootloader U-Boot - An universal bootloader
U-Boot - An universal bootloader
 
3. configuring a compute node for nfv
3. configuring a compute node for nfv3. configuring a compute node for nfv
3. configuring a compute node for nfv
 
Launch the First Process in Linux System
Launch the First Process in Linux SystemLaunch the First Process in Linux System
Launch the First Process in Linux System
 
U-Boot Porting on New Hardware
U-Boot Porting on New HardwareU-Boot Porting on New Hardware
U-Boot Porting on New Hardware
 
Install power linux through cdrom and network redhat and suse
Install power linux through cdrom and network   redhat and suseInstall power linux through cdrom and network   redhat and suse
Install power linux through cdrom and network redhat and suse
 
Grub and dracut ii
Grub and dracut iiGrub and dracut ii
Grub and dracut ii
 
NFD9 - Matt Peterson, Data Center Operations
NFD9 - Matt Peterson, Data Center OperationsNFD9 - Matt Peterson, Data Center Operations
NFD9 - Matt Peterson, Data Center Operations
 
101 1.2 boot the system
101 1.2 boot the system101 1.2 boot the system
101 1.2 boot the system
 
Study on Android Emulator
Study on Android EmulatorStudy on Android Emulator
Study on Android Emulator
 
syzkaller: the next gen kernel fuzzer
syzkaller: the next gen kernel fuzzersyzkaller: the next gen kernel fuzzer
syzkaller: the next gen kernel fuzzer
 
Linux: the first second
Linux: the first secondLinux: the first second
Linux: the first second
 
The Deck by Phil Polstra GrrCON2012
The Deck by Phil Polstra GrrCON2012The Deck by Phil Polstra GrrCON2012
The Deck by Phil Polstra GrrCON2012
 
Jagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratchJagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratch
 
U Boot or Universal Bootloader
U Boot or Universal BootloaderU Boot or Universal Bootloader
U Boot or Universal Bootloader
 
XS Boston 2008 Self IO Emulation
XS Boston 2008 Self IO EmulationXS Boston 2008 Self IO Emulation
XS Boston 2008 Self IO Emulation
 
Uboot startup sequence
Uboot startup sequenceUboot startup sequence
Uboot startup sequence
 
Linux Containers From Scratch
Linux Containers From ScratchLinux Containers From Scratch
Linux Containers From Scratch
 
Introduction of unit test on android kernel
Introduction of unit test on android kernelIntroduction of unit test on android kernel
Introduction of unit test on android kernel
 
5. boot process
5. boot process5. boot process
5. boot process
 
Bootloaders (U-Boot)
Bootloaders (U-Boot) Bootloaders (U-Boot)
Bootloaders (U-Boot)
 

Último

Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjMohammed Sikander
 
MichaelStarkes_UncutGemsProjectSummary.pdf
MichaelStarkes_UncutGemsProjectSummary.pdfMichaelStarkes_UncutGemsProjectSummary.pdf
MichaelStarkes_UncutGemsProjectSummary.pdfmstarkes24
 
Financial Accounting IFRS, 3rd Edition-dikompresi.pdf
Financial Accounting IFRS, 3rd Edition-dikompresi.pdfFinancial Accounting IFRS, 3rd Edition-dikompresi.pdf
Financial Accounting IFRS, 3rd Edition-dikompresi.pdfMinawBelay
 
Basic Civil Engineering notes on Transportation Engineering, Modes of Transpo...
Basic Civil Engineering notes on Transportation Engineering, Modes of Transpo...Basic Civil Engineering notes on Transportation Engineering, Modes of Transpo...
Basic Civil Engineering notes on Transportation Engineering, Modes of Transpo...Denish Jangid
 
Dementia (Alzheimer & vasular dementia).
Dementia (Alzheimer & vasular dementia).Dementia (Alzheimer & vasular dementia).
Dementia (Alzheimer & vasular dementia).Mohamed Rizk Khodair
 
philosophy and it's principles based on the life
philosophy and it's principles based on the lifephilosophy and it's principles based on the life
philosophy and it's principles based on the lifeNitinDeodare
 
size separation d pharm 1st year pharmaceutics
size separation d pharm 1st year pharmaceuticssize separation d pharm 1st year pharmaceutics
size separation d pharm 1st year pharmaceuticspragatimahajan3
 
ANTI PARKISON DRUGS.pptx
ANTI         PARKISON          DRUGS.pptxANTI         PARKISON          DRUGS.pptx
ANTI PARKISON DRUGS.pptxPoojaSen20
 
HVAC System | Audit of HVAC System | Audit and regulatory Comploance.pptx
HVAC System | Audit of HVAC System | Audit and regulatory Comploance.pptxHVAC System | Audit of HVAC System | Audit and regulatory Comploance.pptx
HVAC System | Audit of HVAC System | Audit and regulatory Comploance.pptxKunal10679
 
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...Nguyen Thanh Tu Collection
 
Capitol Tech Univ Doctoral Presentation -May 2024
Capitol Tech Univ Doctoral Presentation -May 2024Capitol Tech Univ Doctoral Presentation -May 2024
Capitol Tech Univ Doctoral Presentation -May 2024CapitolTechU
 
II BIOSENSOR PRINCIPLE APPLICATIONS AND WORKING II
II BIOSENSOR PRINCIPLE APPLICATIONS AND WORKING IIII BIOSENSOR PRINCIPLE APPLICATIONS AND WORKING II
II BIOSENSOR PRINCIPLE APPLICATIONS AND WORKING IIagpharmacy11
 
REPRODUCTIVE TOXICITY STUDIE OF MALE AND FEMALEpptx
REPRODUCTIVE TOXICITY  STUDIE OF MALE AND FEMALEpptxREPRODUCTIVE TOXICITY  STUDIE OF MALE AND FEMALEpptx
REPRODUCTIVE TOXICITY STUDIE OF MALE AND FEMALEpptxmanishaJyala2
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project researchCaitlinCummins3
 
The Last Leaf, a short story by O. Henry
The Last Leaf, a short story by O. HenryThe Last Leaf, a short story by O. Henry
The Last Leaf, a short story by O. HenryEugene Lysak
 
UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024Borja Sotomayor
 
An Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppAn Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppCeline George
 
An Overview of the Odoo 17 Discuss App.pptx
An Overview of the Odoo 17 Discuss App.pptxAn Overview of the Odoo 17 Discuss App.pptx
An Overview of the Odoo 17 Discuss App.pptxCeline George
 

Último (20)

Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
 
MichaelStarkes_UncutGemsProjectSummary.pdf
MichaelStarkes_UncutGemsProjectSummary.pdfMichaelStarkes_UncutGemsProjectSummary.pdf
MichaelStarkes_UncutGemsProjectSummary.pdf
 
Financial Accounting IFRS, 3rd Edition-dikompresi.pdf
Financial Accounting IFRS, 3rd Edition-dikompresi.pdfFinancial Accounting IFRS, 3rd Edition-dikompresi.pdf
Financial Accounting IFRS, 3rd Edition-dikompresi.pdf
 
Basic Civil Engineering notes on Transportation Engineering, Modes of Transpo...
Basic Civil Engineering notes on Transportation Engineering, Modes of Transpo...Basic Civil Engineering notes on Transportation Engineering, Modes of Transpo...
Basic Civil Engineering notes on Transportation Engineering, Modes of Transpo...
 
Dementia (Alzheimer & vasular dementia).
Dementia (Alzheimer & vasular dementia).Dementia (Alzheimer & vasular dementia).
Dementia (Alzheimer & vasular dementia).
 
philosophy and it's principles based on the life
philosophy and it's principles based on the lifephilosophy and it's principles based on the life
philosophy and it's principles based on the life
 
size separation d pharm 1st year pharmaceutics
size separation d pharm 1st year pharmaceuticssize separation d pharm 1st year pharmaceutics
size separation d pharm 1st year pharmaceutics
 
ANTI PARKISON DRUGS.pptx
ANTI         PARKISON          DRUGS.pptxANTI         PARKISON          DRUGS.pptx
ANTI PARKISON DRUGS.pptx
 
HVAC System | Audit of HVAC System | Audit and regulatory Comploance.pptx
HVAC System | Audit of HVAC System | Audit and regulatory Comploance.pptxHVAC System | Audit of HVAC System | Audit and regulatory Comploance.pptx
HVAC System | Audit of HVAC System | Audit and regulatory Comploance.pptx
 
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
 
Capitol Tech Univ Doctoral Presentation -May 2024
Capitol Tech Univ Doctoral Presentation -May 2024Capitol Tech Univ Doctoral Presentation -May 2024
Capitol Tech Univ Doctoral Presentation -May 2024
 
II BIOSENSOR PRINCIPLE APPLICATIONS AND WORKING II
II BIOSENSOR PRINCIPLE APPLICATIONS AND WORKING IIII BIOSENSOR PRINCIPLE APPLICATIONS AND WORKING II
II BIOSENSOR PRINCIPLE APPLICATIONS AND WORKING II
 
REPRODUCTIVE TOXICITY STUDIE OF MALE AND FEMALEpptx
REPRODUCTIVE TOXICITY  STUDIE OF MALE AND FEMALEpptxREPRODUCTIVE TOXICITY  STUDIE OF MALE AND FEMALEpptx
REPRODUCTIVE TOXICITY STUDIE OF MALE AND FEMALEpptx
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
 
The Last Leaf, a short story by O. Henry
The Last Leaf, a short story by O. HenryThe Last Leaf, a short story by O. Henry
The Last Leaf, a short story by O. Henry
 
Word Stress rules esl .pptx
Word Stress rules esl               .pptxWord Stress rules esl               .pptx
Word Stress rules esl .pptx
 
UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024
 
An Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppAn Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge App
 
An Overview of the Odoo 17 Discuss App.pptx
An Overview of the Odoo 17 Discuss App.pptxAn Overview of the Odoo 17 Discuss App.pptx
An Overview of the Odoo 17 Discuss App.pptx
 
“O BEIJO” EM ARTE .
“O BEIJO” EM ARTE                       .“O BEIJO” EM ARTE                       .
“O BEIJO” EM ARTE .
 

Qemu x86 BIOS @ https://youtu.be/F71LGSrj9cc

  • 2. Agenda ● QEMU or Quick EMUlator ● Bootloader overview ● X86 booting mechanism ● BIOS to boot sector code transfer demo ● U-Boot demo for x86 using QEMU
  • 3. Disclaimer ● Presenter will not be responsible for for any damage to USB or HDD due to experiments followed. ● Take a note of all the instructions carefully ● Don’t use your hard disk for bootloader experiments. ● Presenter will use either QEMU or old x86 based system
  • 4. QEMU ● QEMU is a generic open source machine emulator and virtualizer ● Emulates program written for one architecture in another ● It can run virtual machines like KVM in host CPU ● Installation – sudo apt install qemu-system – If error – sudo apt install qemu-system --fix-missing
  • 5. Bootloader ● BIOS →UEFI ● 8xxROM→PPCboot—Armboot merged--→U-boot ● TianoCore – open source implementation of UEFI ● LinuxBIOS-->Coreboot ● Libreboot ● Both Coreboot and Libreboot are aimed to replace proprietary boot firmware
  • 6. X86 booting mechanism ● Hardware Reset ● BIOS(Basic Input/Output System) or Platform Firmware in ASM – Resides in non-volatile memory and prepares all POST procedures – Interactive hardware configuration – Boot mode ● UEFI / CSM(Compatibility Support Mode)/BIOS ● Boot Loader – Extensible Firmware Interface (EFI) – Unified Extensible Firmware Interface(UEFI) written in C ● Boot Partition Format – Boot loader support also depends on type of partition ● MBR(Master Boot Record) disk partition ● GPT(GUID Partion Table) disk partition
  • 7. Custom boot.asm● org 0x7C00 ;BIOS loads program here ● bits 16 ;16-bit mode ● start: ● cli ;Disable Interrupts ● mov si, welcm ;SI points to custom data ● mov ah, 0x0E ; Tell BIOS to print characters ● .loop lodsb ;load byte into AL – or al, al – jz halt – jmp .loop ● halt: hlt ● welcm: db “Embedkari Welcomes You! “ ● times 510 - ($ - $$) db 0 ;Fills remaining bytes except last two ● dw 0xAA55
  • 8. Custom boot sector Experiment ● nasm(Netwide Assembler) Open source s/w for x86 – sudo apt update – Check and install build-essential if not present – sudo apt list | grep build | grep essential – sudo apt install nasm ● nasm boot.asm -f bin -o boot.bin ● You may verify assembly listing using – nasm boot.asm -l boot.lst ● Check the binary in QEMU ● qemu-system-i386 -fda boot.bin
  • 9.
  • 10. Program boot.bin to USB ● USB data can be verified if required ● Start Cygwin as adminstrator ● dd if=/dev/sdb bs=512 count=4 of=test.bin
  • 11. U-Boot-x86 @QEMU ● git clone git://git.denx.de/u-boot-x86.git ● cd u-boot-x86 ● export BUILD_ROM=y ● make qemu-x86_defconfig ● make all ● Test U-boot in QEMU ● qemu-system-i386 -nographic -bios u- boot.rom -net nic -net user,tftp=/tftpboot
  • 12. U-Boot build issue ● You may get error due to absence of required Libraries and this may lead to following additional installation ● For missing swig – sudo apt install swig ● For Python 2 – sudo apt install python-dev ● For Python 3 – sudo apt install python3-dev
  • 14. THANKS If you found this information usefule < Please like this video AND subscribe to www.youtube.com/c/embedkari Embedded Career Information : www.facebook.com/embedkari Blog:www.embedkari.com