SlideShare a Scribd company logo
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

PDF
Creación de máquinas virtuales basada en kernel usando qemu y virsh
PDF
Osis18_Cloud : DeepTorrent Stockage distribué perenne basé sur Bittorrent
PDF
NetBSD on Google Compute Engine (en)
PPT
الفصل السابع - التخزين الثانوي- د. خالد بكرو Secondary Storage - Dr. Khaled B...
PDF
最後の楽園の開発をちょこっとだけ手伝った話
ODP
Cluster filesystems
ODP
Fedora Virtualization Day: Linux Containers & CRIU
PPTX
Puppet - Instant Data Center
Creación de máquinas virtuales basada en kernel usando qemu y virsh
Osis18_Cloud : DeepTorrent Stockage distribué perenne basé sur Bittorrent
NetBSD on Google Compute Engine (en)
الفصل السابع - التخزين الثانوي- د. خالد بكرو Secondary Storage - Dr. Khaled B...
最後の楽園の開発をちょこっとだけ手伝った話
Cluster filesystems
Fedora Virtualization Day: Linux Containers & CRIU
Puppet - Instant Data Center

What's hot (20)

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

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

PDF
2013 Indiana LinuxFest - Getting Started With PC-BSD
PDF
Tlf2013
PDF
FreeBSD Portscamp, Kuala Lumpur 2016
PDF
2013 Ohio LinuxFest - Ports, Packages, and PBI's
PDF
Flourish11
PDF
Development platform virtualization using qemu
PDF
Scale9x sun
PDF
FreeBSD Jail Complete Example
PDF
Ilf2011
PDF
Dru lavigne servers-tutorial
PDF
Pc bsd-intro
PPTX
Linux
PDF
Lavigne bsdmag sept12
PDF
PDF
QEMU in Cross building
PDF
Lecture 6 Kernel Debugging + Ports Development
ZIP
Embedded Linux Odp
PPT
Msu free bsd
PDF
Startup guide for kvm on cent os 6
PDF
SELF 2014: PBI v10: Application Management Made Easy
2013 Indiana LinuxFest - Getting Started With PC-BSD
Tlf2013
FreeBSD Portscamp, Kuala Lumpur 2016
2013 Ohio LinuxFest - Ports, Packages, and PBI's
Flourish11
Development platform virtualization using qemu
Scale9x sun
FreeBSD Jail Complete Example
Ilf2011
Dru lavigne servers-tutorial
Pc bsd-intro
Linux
Lavigne bsdmag sept12
QEMU in Cross building
Lecture 6 Kernel Debugging + Ports Development
Embedded Linux Odp
Msu free bsd
Startup guide for kvm on cent os 6
SELF 2014: PBI v10: Application Management Made Easy
Ad

More from eurobsdcon (20)

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

Recently uploaded (20)

PDF
Architecture types and enterprise applications.pdf
PPTX
OMC Textile Division Presentation 2021.pptx
PDF
A novel scalable deep ensemble learning framework for big data classification...
PPTX
Tartificialntelligence_presentation.pptx
PDF
DP Operators-handbook-extract for the Mautical Institute
PPTX
Modernising the Digital Integration Hub
PPTX
O2C Customer Invoices to Receipt V15A.pptx
PDF
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
PPTX
observCloud-Native Containerability and monitoring.pptx
PDF
STKI Israel Market Study 2025 version august
PDF
Hindi spoken digit analysis for native and non-native speakers
PDF
1 - Historical Antecedents, Social Consideration.pdf
PDF
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
PPTX
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
PDF
Enhancing emotion recognition model for a student engagement use case through...
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
Getting started with AI Agents and Multi-Agent Systems
PDF
NewMind AI Weekly Chronicles – August ’25 Week III
PPTX
1. Introduction to Computer Programming.pptx
PDF
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
Architecture types and enterprise applications.pdf
OMC Textile Division Presentation 2021.pptx
A novel scalable deep ensemble learning framework for big data classification...
Tartificialntelligence_presentation.pptx
DP Operators-handbook-extract for the Mautical Institute
Modernising the Digital Integration Hub
O2C Customer Invoices to Receipt V15A.pptx
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
observCloud-Native Containerability and monitoring.pptx
STKI Israel Market Study 2025 version august
Hindi spoken digit analysis for native and non-native speakers
1 - Historical Antecedents, Social Consideration.pdf
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
Enhancing emotion recognition model for a student engagement use case through...
Assigned Numbers - 2025 - Bluetooth® Document
Getting started with AI Agents and Multi-Agent Systems
NewMind AI Weekly Chronicles – August ’25 Week III
1. Introduction to Computer Programming.pptx
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game

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?