SlideShare a Scribd company logo
1 of 16
Download to read offline
QEMU Assisted Jails
for Ports and
Packages
Sean Bruno, sbruno@freebsd.org
Overview and Presentation Goals
● Kernel Components (11-Current)
○ Image Activators
● Userland Components (11-Current)
○ binmiscctl(8)
○ qemu-static-user
○ poudriere-devel
● Nullfs and Chroot
○ Treat the environments as normal jails.
Contributors and Generally Awesome
People
Stacey Son - binmiscctl(8) and imgact_binmisc(4) author
Juergen Lock - QEMU maintainer for BSD, many, many patches
Ed Maste - QEMU patches and cat herder
Peter Wemm - Sigtramp patch, because wow.
Alexander Kabaev - QEMU patches
Adrian Chadd - Ignored my pleading for help with kern_imgact.c
Baptiste Daroussin - Inflicting me with a ports commit bit
Contributors and Generally Awesome
People
Dimitry Andric - CLANG Help and Updates
Andrew Turner - GCC and Ports Patches
Mikael Urankar - Mysql Patches
Bryan Drewery - Taking me on a journey through poudriere
Warner Losh - Created the native-xtools target (doubled speed)
Ian Lapore - ARMv6 Assembly Help
Brooks Davis - Inspiration and initial guidance
Kernel Components (11-Current)
imgact_binmisc.ko
● Kernel Hook to redirect execution
● Examines ELF Header
● If match on preconfigured setting, modifes
ARGV[0] with emulator helper
Kernel Components - Continued
binmiscctl(8) will load and configure settings, e.
g.
binmiscctl add armv6 --interpreter "/usr/local/bin/qemu-arm" --magic
"x7fx45x4cx46x01x01x01x00x00x00x00x00x00x00x00x00x02x00x28x00"
--mask "xffxffxffxffxffxffxffx00xffxffxffxffxffxffxffxffxfexffxffxff"
--size 20 --set-enabled
binmiscctl add mips --interpreter "/usr/local/bin/qemu-mips" --magic
"x7fx45x4cx46x01x02x01x00x00x00x00x00x00x00x00x00x00x02x00x08"
--mask "xffxffxffxffxffxffxffx00xffxffxffxffxffxffxffxffxffxfexffxff"
--size 20 --set-enabled
Kernel Components - Continued
binmisctl list
name: mips
interpreter: /usr/local/bin/qemu-mips
flags: ENABLED USE_MASK
magic size: 20
magic offset: 0
magic: 0x7f 0x45 0x4c 0x46 0x01 0x02 0x01 0x00 0x00 0x00 0x00 0x00
0x00 0x00 0x00 0x00 0x00 0x02 0x00 0x08
mask: 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0x00 0xff 0xff 0xff 0xff
0xff 0xff 0xff 0xff 0xff 0xfe 0xff 0xff
Userland Components (11-Current)
QEMU
● Use emulators/qemu-static-user
● Installs statically linked binaries
● Emulation is a journey not a destination
● IOCTL emulation is still in progress
Userland Components - Continued
Poudriere-devel
● Easiest way to get started building jails
● Knows how to to understand binmiscctl(8)
● Knows to copy QEMU into jails
● Creates clean backup, in case of accident
● Use ZFS, save yourself some pain
Build the jail -- poudriere-devel
● poudriere jail -c -j 11armv632 -m svn -v head -a arm.
armv6 -x
● poudriere jail -c -j 11mips32 -m svn -v head -a mips.
mips -x
● poudirere jail -c -j 11mips64 -m svn -v head -a mips.
mips64 -x
● poudriere ports -c -m svn (so you have something to
build)
Configure the jail and mount
poudriere will create:
zroot/poudriere/jails/11armv632 112176079 1096098 111079980 1%
/usr/local/poudriere/jails/11armv632
zroot/poudriere/ports/default 118616467 7536487 111079980 6% /usr/local/poudriere/ports/default
Manually mount devfs/ports:
mount -t devfs devfs <path to jail/dev
mount -t nullfs /usr/local/poudriere/ports/default <path to jail>/usr/ports
Chroot and enjoy
root@dirty.ysv:/home/sbruno/fbsd_head # uname -a
FreeBSD dirty.ysv.freebsd.org 11.0-CURRENT FreeBSD 11.0-CURRENT #0 r271414: Thu Sep 11
02:48:22 UTC 2014 sbruno@dirty.ysv.freebsd.org:/usr/obj/usr/src/sys/DIRTY amd64
root@dirty.ysv:~ # chroot /usr/local/poudriere/jails/11armv632
root@dirty:/ # uname -a
FreeBSD dirty.ysv.freebsd.org 11.0-CURRENT FreeBSD 11.0-CURRENT #0 r271414: Thu Sep 11
02:48:22 UTC 2014 sbruno@dirty.ysv.freebsd.org:/usr/obj/usr/src/sys/DIRTY arm
Poudriere Demo
● poudriere bulk -a -j 11armv632
● nginx rendering of status
● sharp edges remain, signal handling
Building and testing - DEMO
● chroot and build, its magic
● needs better documentation
● man page updates
● binmiscctl(8) syntax is precise and you will
always copy/paste it from somewhere
Future Development
● CLANG for MIPS will make more ports build
● AARCH64 (ARM64) support will start soon,
or send me patches for QEMU now.
● IOCTL debug handling, human readable
format
Questions?
There’s plenty of things that I’ve probably
skipped, what do you want to do with this
feature?

More Related Content

What's hot

Asus WL500gP USB Serial
Asus WL500gP USB SerialAsus WL500gP USB Serial
Asus WL500gP USB Serial
guestac21b8
 
Instal vnc in cent os
Instal vnc in cent osInstal vnc in cent os
Instal vnc in cent os
Manusia Tenan
 

What's hot (20)

System Capa Planning_DBA oracle edu
System Capa Planning_DBA oracle eduSystem Capa Planning_DBA oracle edu
System Capa Planning_DBA oracle edu
 
Puppet Camp Tokyo 2014: Puppet Is Most of Your Documentation
Puppet Camp Tokyo 2014: Puppet Is Most of Your DocumentationPuppet Camp Tokyo 2014: Puppet Is Most of Your Documentation
Puppet Camp Tokyo 2014: Puppet Is Most of Your Documentation
 
NetBSDworkshop
NetBSDworkshopNetBSDworkshop
NetBSDworkshop
 
NetBSD workshop
NetBSD workshopNetBSD workshop
NetBSD workshop
 
My First BCC
My First BCCMy First BCC
My First BCC
 
Asus WL500gP USB Serial
Asus WL500gP USB SerialAsus WL500gP USB Serial
Asus WL500gP USB Serial
 
Surf iOS版 中文用户指南
Surf iOS版 中文用户指南Surf iOS版 中文用户指南
Surf iOS版 中文用户指南
 
망고100 보드로 놀아보자 10
망고100 보드로 놀아보자 10망고100 보드로 놀아보자 10
망고100 보드로 놀아보자 10
 
Local incident response
Local incident responseLocal incident response
Local incident response
 
OSBConf 2015 | Scale out backups with bareos and gluster by niels de vos
OSBConf 2015 | Scale out backups with bareos and gluster by niels de vosOSBConf 2015 | Scale out backups with bareos and gluster by niels de vos
OSBConf 2015 | Scale out backups with bareos and gluster by niels de vos
 
Scaling IO-bound microservices
Scaling IO-bound microservicesScaling IO-bound microservices
Scaling IO-bound microservices
 
Optimization_of_Virtual_Machines_for_High_Performance
Optimization_of_Virtual_Machines_for_High_PerformanceOptimization_of_Virtual_Machines_for_High_Performance
Optimization_of_Virtual_Machines_for_High_Performance
 
Integrating GlusterFS with iSCSI Target
Integrating GlusterFS with iSCSI TargetIntegrating GlusterFS with iSCSI Target
Integrating GlusterFS with iSCSI Target
 
Instal vnc in cent os
Instal vnc in cent osInstal vnc in cent os
Instal vnc in cent os
 
Great Hiroshima with Python 170830
Great Hiroshima with Python 170830Great Hiroshima with Python 170830
Great Hiroshima with Python 170830
 
Building an ethereum miner workshop
Building an ethereum miner workshopBuilding an ethereum miner workshop
Building an ethereum miner workshop
 
Ether Mining 101
Ether Mining 101Ether Mining 101
Ether Mining 101
 
Ether mining 101 v2
Ether mining 101 v2Ether mining 101 v2
Ether mining 101 v2
 
Storage based snapshots for KVM VMs in CloudStack
Storage based snapshots for KVM VMs in CloudStackStorage based snapshots for KVM VMs in CloudStack
Storage based snapshots for KVM VMs in CloudStack
 
Ovirt and gluster_hyperconvergence_devconf-2016
Ovirt and gluster_hyperconvergence_devconf-2016Ovirt and gluster_hyperconvergence_devconf-2016
Ovirt and gluster_hyperconvergence_devconf-2016
 

Similar to Building packages through emulation by Sean Bruno

OpenNebulaConf 2013 - Hands-on Tutorial: 2. Installing and Basic Usage
OpenNebulaConf 2013 - Hands-on Tutorial: 2. Installing and Basic UsageOpenNebulaConf 2013 - Hands-on Tutorial: 2. Installing and Basic Usage
OpenNebulaConf 2013 - Hands-on Tutorial: 2. Installing and Basic Usage
OpenNebula Project
 
Lightweight Virtualization with Linux Containers and Docker I YaC 2013
Lightweight Virtualization with Linux Containers and Docker I YaC 2013Lightweight Virtualization with Linux Containers and Docker I YaC 2013
Lightweight Virtualization with Linux Containers and Docker I YaC 2013
Docker, Inc.
 

Similar to Building packages through emulation by Sean Bruno (20)

Kdump
KdumpKdump
Kdump
 
NFD9 - Matt Peterson, Data Center Operations
NFD9 - Matt Peterson, Data Center OperationsNFD9 - Matt Peterson, Data Center Operations
NFD9 - Matt Peterson, Data Center Operations
 
Containers with systemd-nspawn
Containers with systemd-nspawnContainers with systemd-nspawn
Containers with systemd-nspawn
 
OpenNebulaConf 2013 - Hands-on Tutorial: 2. Installing and Basic Usage
OpenNebulaConf 2013 - Hands-on Tutorial: 2. Installing and Basic UsageOpenNebulaConf 2013 - Hands-on Tutorial: 2. Installing and Basic Usage
OpenNebulaConf 2013 - Hands-on Tutorial: 2. Installing and Basic Usage
 
Linux Kernel Platform Development: Challenges and Insights
 Linux Kernel Platform Development: Challenges and Insights Linux Kernel Platform Development: Challenges and Insights
Linux Kernel Platform Development: Challenges and Insights
 
SiteGround Tech TeamBuilding
SiteGround Tech TeamBuildingSiteGround Tech TeamBuilding
SiteGround Tech TeamBuilding
 
Bringing up Android on your favorite X86 Workstation or VM (AnDevCon Boston, ...
Bringing up Android on your favorite X86 Workstation or VM (AnDevCon Boston, ...Bringing up Android on your favorite X86 Workstation or VM (AnDevCon Boston, ...
Bringing up Android on your favorite X86 Workstation or VM (AnDevCon Boston, ...
 
HKG15-409: ARM Hibernation enablement on SoCs - a case study
HKG15-409: ARM Hibernation enablement on SoCs - a case studyHKG15-409: ARM Hibernation enablement on SoCs - a case study
HKG15-409: ARM Hibernation enablement on SoCs - a case study
 
Kernel Recipes 2015 - Kernel dump analysis
Kernel Recipes 2015 - Kernel dump analysisKernel Recipes 2015 - Kernel dump analysis
Kernel Recipes 2015 - Kernel dump analysis
 
OpenNebulaConf 2016 - Storage Hands-on Workshop by Javier Fontán, OpenNebula
OpenNebulaConf 2016 - Storage Hands-on Workshop by Javier Fontán, OpenNebulaOpenNebulaConf 2016 - Storage Hands-on Workshop by Javier Fontán, OpenNebula
OpenNebulaConf 2016 - Storage Hands-on Workshop by Javier Fontán, OpenNebula
 
Tuning systemd for embedded
Tuning systemd for embeddedTuning systemd for embedded
Tuning systemd for embedded
 
A million ways to provision embedded linux devices
A million ways to provision embedded linux devicesA million ways to provision embedded linux devices
A million ways to provision embedded linux devices
 
Open nebula is evolving paris techday 2015
Open nebula is evolving   paris techday 2015Open nebula is evolving   paris techday 2015
Open nebula is evolving paris techday 2015
 
Android Custom Kernel/ROM design
Android Custom Kernel/ROM designAndroid Custom Kernel/ROM design
Android Custom Kernel/ROM design
 
OpenStack Cinder Project Update - Shanghai 2019
OpenStack Cinder Project Update - Shanghai 2019OpenStack Cinder Project Update - Shanghai 2019
OpenStack Cinder Project Update - Shanghai 2019
 
建構嵌入式Linux系統於SD Card
建構嵌入式Linux系統於SD Card建構嵌入式Linux系統於SD Card
建構嵌入式Linux系統於SD Card
 
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
 
Lightweight Virtualization with Linux Containers and Docker | YaC 2013
Lightweight Virtualization with Linux Containers and Docker | YaC 2013Lightweight Virtualization with Linux Containers and Docker | YaC 2013
Lightweight Virtualization with Linux Containers and Docker | YaC 2013
 
Lightweight Virtualization with Linux Containers and Docker I YaC 2013
Lightweight Virtualization with Linux Containers and Docker I YaC 2013Lightweight Virtualization with Linux Containers and Docker I YaC 2013
Lightweight Virtualization with Linux Containers and Docker I YaC 2013
 
[KubeCon NA 2020] containerd: Rootless Containers 2020
[KubeCon NA 2020] containerd: Rootless Containers 2020[KubeCon NA 2020] containerd: Rootless Containers 2020
[KubeCon NA 2020] containerd: Rootless Containers 2020
 

More from eurobsdcon

OpenStack and OpenContrail for FreeBSD platform by Michał Dubiel
OpenStack and OpenContrail for FreeBSD platform by Michał DubielOpenStack and OpenContrail for FreeBSD platform by Michał Dubiel
OpenStack and OpenContrail for FreeBSD platform by Michał Dubiel
eurobsdcon
 
Porting NetBSD to the LatticeMico32 open source CPU by Yann Sionneau
Porting NetBSD to the LatticeMico32 open source CPU by Yann SionneauPorting NetBSD to the LatticeMico32 open source CPU by Yann Sionneau
Porting NetBSD to the LatticeMico32 open source CPU by Yann Sionneau
eurobsdcon
 
Bugs Ex Ante by Kristaps Dzonsons
Bugs Ex Ante by Kristaps DzonsonsBugs Ex Ante by Kristaps Dzonsons
Bugs Ex Ante by Kristaps Dzonsons
eurobsdcon
 

More from eurobsdcon (20)

EuroBSDCon 2014 Program Front
EuroBSDCon 2014 Program FrontEuroBSDCon 2014 Program Front
EuroBSDCon 2014 Program Front
 
EuroBSDCon 2014 tutorials program Thursday & Friday
EuroBSDCon 2014 tutorials program Thursday & FridayEuroBSDCon 2014 tutorials program Thursday & Friday
EuroBSDCon 2014 tutorials program Thursday & Friday
 
EuroBSDCon 2014 Sofia Welcome
EuroBSDCon 2014 Sofia WelcomeEuroBSDCon 2014 Sofia Welcome
EuroBSDCon 2014 Sofia Welcome
 
EuroBSDCon 2014 Sofia Closing talk
EuroBSDCon 2014 Sofia Closing talkEuroBSDCon 2014 Sofia Closing talk
EuroBSDCon 2014 Sofia Closing talk
 
Submitting documents anonymously by Atanas Chobanov
Submitting documents anonymously by Atanas ChobanovSubmitting documents anonymously by Atanas Chobanov
Submitting documents anonymously by Atanas Chobanov
 
Porting the drm/kms graphic drivers to DragonFlyBSD by Francois Tigeot
Porting the drm/kms graphic drivers to DragonFlyBSD by Francois TigeotPorting the drm/kms graphic drivers to DragonFlyBSD by Francois Tigeot
Porting the drm/kms graphic drivers to DragonFlyBSD by Francois Tigeot
 
University of Oslo's TSD service - storing sensitive & restricted data by D...
  University of Oslo's TSD service - storing sensitive & restricted data by D...  University of Oslo's TSD service - storing sensitive & restricted data by D...
University of Oslo's TSD service - storing sensitive & restricted data by D...
 
secure lazy binding, and the 64bit time_t development process by Philip Guenther
secure lazy binding, and the 64bit time_t development process by Philip Guenthersecure lazy binding, and the 64bit time_t development process by Philip Guenther
secure lazy binding, and the 64bit time_t development process by Philip Guenther
 
The entropic principle: /dev/u?random and NetBSD by Taylor R Campbell
  The entropic principle: /dev/u?random and NetBSD by Taylor R Campbell  The entropic principle: /dev/u?random and NetBSD by Taylor R Campbell
The entropic principle: /dev/u?random and NetBSD by Taylor R Campbell
 
The LLDB Debugger in FreeBSD by Ed Maste
The LLDB Debugger in FreeBSD by Ed MasteThe LLDB Debugger in FreeBSD by Ed Maste
The LLDB Debugger in FreeBSD by Ed Maste
 
Porting Valgrind to NetBSD and OpenBSD by Masao Uebayashi
Porting Valgrind to NetBSD and OpenBSD by Masao UebayashiPorting Valgrind to NetBSD and OpenBSD by Masao Uebayashi
Porting Valgrind to NetBSD and OpenBSD by Masao Uebayashi
 
Multiplatform JIT Code Generator for NetBSD by Alexander Nasonov
Multiplatform JIT Code Generator for NetBSD by Alexander NasonovMultiplatform JIT Code Generator for NetBSD by Alexander Nasonov
Multiplatform JIT Code Generator for NetBSD by Alexander Nasonov
 
OpenStack and OpenContrail for FreeBSD platform by Michał Dubiel
OpenStack and OpenContrail for FreeBSD platform by Michał DubielOpenStack and OpenContrail for FreeBSD platform by Michał Dubiel
OpenStack and OpenContrail for FreeBSD platform by Michał Dubiel
 
Porting NetBSD to the LatticeMico32 open source CPU by Yann Sionneau
Porting NetBSD to the LatticeMico32 open source CPU by Yann SionneauPorting NetBSD to the LatticeMico32 open source CPU by Yann Sionneau
Porting NetBSD to the LatticeMico32 open source CPU by Yann Sionneau
 
Smartcom's control plane software, a customized version of FreeBSD by Boris A...
Smartcom's control plane software, a customized version of FreeBSD by Boris A...Smartcom's control plane software, a customized version of FreeBSD by Boris A...
Smartcom's control plane software, a customized version of FreeBSD by Boris A...
 
Bugs Ex Ante by Kristaps Dzonsons
Bugs Ex Ante by Kristaps DzonsonsBugs Ex Ante by Kristaps Dzonsons
Bugs Ex Ante by Kristaps Dzonsons
 
Cross Building the FreeBSD ports tree by Baptiste Daroussin
Cross Building the FreeBSD ports tree by Baptiste DaroussinCross Building the FreeBSD ports tree by Baptiste Daroussin
Cross Building the FreeBSD ports tree by Baptiste Daroussin
 
Making OpenBSD Useful on the Octeon Network Gear by Paul Irofti
Making OpenBSD Useful on the Octeon Network Gear by Paul IroftiMaking OpenBSD Useful on the Octeon Network Gear by Paul Irofti
Making OpenBSD Useful on the Octeon Network Gear by Paul Irofti
 
A Reimplementation of NetBSD Based on a Microkernel by Andrew S. Tanenbaum
A Reimplementation of NetBSD Based on a Microkernel by Andrew S. TanenbaumA Reimplementation of NetBSD Based on a Microkernel by Andrew S. Tanenbaum
A Reimplementation of NetBSD Based on a Microkernel by Andrew S. Tanenbaum
 
Using routing domains / routing tables in a production network by Peter Hessler
Using routing domains / routing tables in a production network by Peter HesslerUsing routing domains / routing tables in a production network by Peter Hessler
Using routing domains / routing tables in a production network by Peter Hessler
 

Recently uploaded

Recently uploaded (20)

Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 

Building packages through emulation by Sean Bruno

  • 1. QEMU Assisted Jails for Ports and Packages Sean Bruno, sbruno@freebsd.org
  • 2. Overview and Presentation Goals ● Kernel Components (11-Current) ○ Image Activators ● Userland Components (11-Current) ○ binmiscctl(8) ○ qemu-static-user ○ poudriere-devel ● Nullfs and Chroot ○ Treat the environments as normal jails.
  • 3. Contributors and Generally Awesome People Stacey Son - binmiscctl(8) and imgact_binmisc(4) author Juergen Lock - QEMU maintainer for BSD, many, many patches Ed Maste - QEMU patches and cat herder Peter Wemm - Sigtramp patch, because wow. Alexander Kabaev - QEMU patches Adrian Chadd - Ignored my pleading for help with kern_imgact.c Baptiste Daroussin - Inflicting me with a ports commit bit
  • 4. Contributors and Generally Awesome People Dimitry Andric - CLANG Help and Updates Andrew Turner - GCC and Ports Patches Mikael Urankar - Mysql Patches Bryan Drewery - Taking me on a journey through poudriere Warner Losh - Created the native-xtools target (doubled speed) Ian Lapore - ARMv6 Assembly Help Brooks Davis - Inspiration and initial guidance
  • 5. Kernel Components (11-Current) imgact_binmisc.ko ● Kernel Hook to redirect execution ● Examines ELF Header ● If match on preconfigured setting, modifes ARGV[0] with emulator helper
  • 6. Kernel Components - Continued binmiscctl(8) will load and configure settings, e. g. binmiscctl add armv6 --interpreter "/usr/local/bin/qemu-arm" --magic "x7fx45x4cx46x01x01x01x00x00x00x00x00x00x00x00x00x02x00x28x00" --mask "xffxffxffxffxffxffxffx00xffxffxffxffxffxffxffxffxfexffxffxff" --size 20 --set-enabled binmiscctl add mips --interpreter "/usr/local/bin/qemu-mips" --magic "x7fx45x4cx46x01x02x01x00x00x00x00x00x00x00x00x00x00x02x00x08" --mask "xffxffxffxffxffxffxffx00xffxffxffxffxffxffxffxffxffxfexffxff" --size 20 --set-enabled
  • 7. Kernel Components - Continued binmisctl list name: mips interpreter: /usr/local/bin/qemu-mips flags: ENABLED USE_MASK magic size: 20 magic offset: 0 magic: 0x7f 0x45 0x4c 0x46 0x01 0x02 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x02 0x00 0x08 mask: 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0x00 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xfe 0xff 0xff
  • 8. Userland Components (11-Current) QEMU ● Use emulators/qemu-static-user ● Installs statically linked binaries ● Emulation is a journey not a destination ● IOCTL emulation is still in progress
  • 9. Userland Components - Continued Poudriere-devel ● Easiest way to get started building jails ● Knows how to to understand binmiscctl(8) ● Knows to copy QEMU into jails ● Creates clean backup, in case of accident ● Use ZFS, save yourself some pain
  • 10. Build the jail -- poudriere-devel ● poudriere jail -c -j 11armv632 -m svn -v head -a arm. armv6 -x ● poudriere jail -c -j 11mips32 -m svn -v head -a mips. mips -x ● poudirere jail -c -j 11mips64 -m svn -v head -a mips. mips64 -x ● poudriere ports -c -m svn (so you have something to build)
  • 11. Configure the jail and mount poudriere will create: zroot/poudriere/jails/11armv632 112176079 1096098 111079980 1% /usr/local/poudriere/jails/11armv632 zroot/poudriere/ports/default 118616467 7536487 111079980 6% /usr/local/poudriere/ports/default Manually mount devfs/ports: mount -t devfs devfs <path to jail/dev mount -t nullfs /usr/local/poudriere/ports/default <path to jail>/usr/ports
  • 12. Chroot and enjoy root@dirty.ysv:/home/sbruno/fbsd_head # uname -a FreeBSD dirty.ysv.freebsd.org 11.0-CURRENT FreeBSD 11.0-CURRENT #0 r271414: Thu Sep 11 02:48:22 UTC 2014 sbruno@dirty.ysv.freebsd.org:/usr/obj/usr/src/sys/DIRTY amd64 root@dirty.ysv:~ # chroot /usr/local/poudriere/jails/11armv632 root@dirty:/ # uname -a FreeBSD dirty.ysv.freebsd.org 11.0-CURRENT FreeBSD 11.0-CURRENT #0 r271414: Thu Sep 11 02:48:22 UTC 2014 sbruno@dirty.ysv.freebsd.org:/usr/obj/usr/src/sys/DIRTY arm
  • 13. Poudriere Demo ● poudriere bulk -a -j 11armv632 ● nginx rendering of status ● sharp edges remain, signal handling
  • 14. Building and testing - DEMO ● chroot and build, its magic ● needs better documentation ● man page updates ● binmiscctl(8) syntax is precise and you will always copy/paste it from somewhere
  • 15. Future Development ● CLANG for MIPS will make more ports build ● AARCH64 (ARM64) support will start soon, or send me patches for QEMU now. ● IOCTL debug handling, human readable format
  • 16. Questions? There’s plenty of things that I’ve probably skipped, what do you want to do with this feature?