SlideShare uma empresa Scribd logo
1 de 25
Baixar para ler offline
Cross Building Factory & ALP
Using git, pbuild or OBS
openSUSE Conference
adrian@opensuse.org
Cross Architecture Building
●
No Emulator necessary (mostly)
●
Build Host + Build Target environment
needed
●
Cross Compiler toolchain needed
Current State in Factory & ALP
●
aarch64 and riscv64 toolchain exists
●
kiwi live image creation works
(via kiwi-crossprepare-plugin)
●
Some(!) packages are working, eg. the
kernel
●
cross-aaa_base provides helper tooling
Example Setup
using an ALP prototype
Project setup in devel:ALP
●
NOTE: devel:ALP is a prototype only
# osc meta prj devel:ALP
….
<scmsync>https://gitea.opensuse.org/adrianSuSE/Alp#factory</scmsync>
….
<repository name="cross" rebuild="local" block="local">
<path project="openSUSE:Factory:ARM" repository="standard"/>
<path project="openSUSE:Factory:RISCV" repository="standard"/>
<hostsystem project="openSUSE:Factory" repository="standard"/>
<arch>aarch64</arch>
<arch>riscv64</arch>
<arch>x86_64</arch>
</repository>
The git-way specials
●
package centric organisation
One git repo per package for all official revisions
●
Package sources come via submodules usually
Seperation of package source review and project aggregation
binary rpm *is* reporting git resource via VCS header
binary rpm *will be* reporting project source as well
●
Build config (prjconf) is part of git as _config file
●
Only project meta is not part of git atm
project meta in OBS
_pbuild in git for local builds using pbuild
pbuild 1/2
●
part of build tool, install it via
●
zypper in build
●
git clone https://github.com/openSUSE/obs-build
●
Works on
●
OBS project checkouts
●
Any other directory, eg. managed via git
pbuild 2/2
●
It is a small OBS on your system
●
The sources can be exchanged via OBS or any SCM
●
Additional sources may get downloaded via the
“Assets” mechanic
●
Uses KVM when running as non-root
Cross Build using git & pbuild
●
Build a single rpm cross arch out of the
large ALP project fast…
●
Only one package source downloaded
# git clone https://gitea.opensuse.org/adrianSuSE/Alp.git
# cd Alp
# git submodule init
# git submodule update xz
# cd xz
# pbuild –preset riscv64
Cross Build using git & pbuild
●
For the brave ones … building entire
ALP also works...
# git clone https://gitea.opensuse.org/adrianSuSE/Alp.git
# cd Alp
# git submodule init
# git submodule update
# pbuild –preset riscv64
Example Setup
Based on Leap and Factory
Cross Build using git & pbuild
●
It works across build types, eg. mixing
rpm and kiwi build
Note: kiwi runs on x86_64, but uses
qemu for executing rpm scripts
# git clone https://github.com/geckito/image-RaspBerryPi4-pi-hole
# cd image-RaspBerryPi4-pi-hole
# pbuild
Build using osc & pbuild
●
How it almost already works ….
# osc co openSUSE:Factory:ARM zstd
# cd openSUSE:Factory:ARM
# osc create-pbuild-config standard aarch64
WARNING: lacks still cross definition!
# pbuild –preset cross_aarch64
create-pbuild-config
Adding cross build support
to sources
On the example of spec files
Every package source is different...
cross-aaa_base-$arch provide generic helpers
●
ENV: CC and CXX points to cross compiler
●
rpm macros:
%cross_sysroot directory
%is_cross set to 1
%_build %{_target_cpu}-suse-linux-gnu
(also affects %configure and %cmake)
●
Provides check for correct binary arch in build result
Add build config hints
Give OBS and pbuild a hint where a package is
needed. Otherwise they get installed in target env.
only. Eg:
#!OnlyNative: make
#!AlsoNative: Qt6
(also works via build config)
How to create an own setup
Building for a new device
Typical Requirements
1)Initialize new git repository
2)Create _pbuild
3)Pick to-be-rebuild or adapted source
4)Add own sources, eg. image description
5)Optional: add _config
Setup an own build - sources
# mkdir image-MyHardware
# cd image-MyHardware
# git init
# git submodule add https://gitea.opensuse.org/pool/kernel-source
# ln -sf kernel-source kernel-default
And steal a kiwi config as close as possible for your device
Also you most likely need to modify the kernel config
create-pbuild-config
dd https://gitea.opensuse.org/pool/kernel-source
Setup an own build – build config
# cat > _pbuild <<EOF
<pbuild>
<preset name="aarch64" default>
<config>cross_aarch64</config>
<config>tumbleweed</config>
<hostrepo>https://download.opensuse.org/factory/repo/oss</hostrepo>
<hostrepo>config:</hostrepo>
<repo>https://download.opensuse.org/ports/aarch64/factory/repo/oss/</
repo>
<arch>aarch64</arch>
</preset>
</pbuild>
EOF
# pbuild
create-pbuild-config
dd https://gitea.opensuse.org/pool/kernel-source
The pitfalls
pbuild hints
●
Use latest version from openSUSE:Tools
●
Results and logfiles are in _build.*/
●
pbuild --single $package
for live log debugging
Documentation: http://opensuse.github.io/obs-build/pbuild.html
Only aarch64 and riscv64 atm
●
The other cross-*-gcc* do not support
building against glibc atm!
Naming definitions
●
No common understanding of host,
build and target...
pbuild host target -/-
cmake HOST default -/-
GNU build host target
rpm* build target -/-
* Current state, older rpm versions have different definitions
Links
http://opensuse.github.io/obs-build/pbuild.html

Mais conteúdo relacionado

Semelhante a oSC-2023-Cross-Build.pdf

Introduction to Docker and Containers
Introduction to Docker and ContainersIntroduction to Docker and Containers
Introduction to Docker and Containers
Docker, Inc.
 

Semelhante a oSC-2023-Cross-Build.pdf (20)

Build optimization mechanisms in GitLab and Docker
Build optimization mechanisms in GitLab and DockerBuild optimization mechanisms in GitLab and Docker
Build optimization mechanisms in GitLab and Docker
 
Deploying Kubernetes on GCP with Kubespray
Deploying Kubernetes on GCP with KubesprayDeploying Kubernetes on GCP with Kubespray
Deploying Kubernetes on GCP with Kubespray
 
Beyond Puppet
Beyond PuppetBeyond Puppet
Beyond Puppet
 
CI-CD WITH GITLAB WORKFLOW
CI-CD WITH GITLAB WORKFLOWCI-CD WITH GITLAB WORKFLOW
CI-CD WITH GITLAB WORKFLOW
 
ASP.NET 5 auf Raspberry PI & docker
ASP.NET 5 auf Raspberry PI & dockerASP.NET 5 auf Raspberry PI & docker
ASP.NET 5 auf Raspberry PI & docker
 
OpenCV Workshop
OpenCV WorkshopOpenCV Workshop
OpenCV Workshop
 
[HKOSCon x COSCUP 2020][20200801][Ansible: From VM to Kubernetes]
[HKOSCon x COSCUP 2020][20200801][Ansible: From VM to Kubernetes][HKOSCon x COSCUP 2020][20200801][Ansible: From VM to Kubernetes]
[HKOSCon x COSCUP 2020][20200801][Ansible: From VM to Kubernetes]
 
Kubernetes: training micro-dragons for a serious battle
Kubernetes: training micro-dragons for a serious battleKubernetes: training micro-dragons for a serious battle
Kubernetes: training micro-dragons for a serious battle
 
GDG-ANDROID-ATHENS Meetup: Build in Docker with Jenkins
GDG-ANDROID-ATHENS Meetup: Build in Docker with Jenkins GDG-ANDROID-ATHENS Meetup: Build in Docker with Jenkins
GDG-ANDROID-ATHENS Meetup: Build in Docker with Jenkins
 
Continuous Deployment with Kubernetes, Docker and GitLab CI
Continuous Deployment with Kubernetes, Docker and GitLab CIContinuous Deployment with Kubernetes, Docker and GitLab CI
Continuous Deployment with Kubernetes, Docker and GitLab CI
 
Ansible is the simplest way to automate. SymfonyCafe, 2015
Ansible is the simplest way to automate. SymfonyCafe, 2015Ansible is the simplest way to automate. SymfonyCafe, 2015
Ansible is the simplest way to automate. SymfonyCafe, 2015
 
Serverless Container with Source2Image
Serverless Container with Source2ImageServerless Container with Source2Image
Serverless Container with Source2Image
 
Serverless containers … with source-to-image
Serverless containers  … with source-to-imageServerless containers  … with source-to-image
Serverless containers … with source-to-image
 
Docker to the Rescue of an Ops Team
Docker to the Rescue of an Ops TeamDocker to the Rescue of an Ops Team
Docker to the Rescue of an Ops Team
 
Docker to the Rescue of an Ops Team
Docker to the Rescue of an Ops TeamDocker to the Rescue of an Ops Team
Docker to the Rescue of an Ops Team
 
Developing with-devstack
Developing with-devstackDeveloping with-devstack
Developing with-devstack
 
DevFest 2022 - Cloud Workstation Introduction TaiChung
DevFest 2022 - Cloud Workstation Introduction TaiChungDevFest 2022 - Cloud Workstation Introduction TaiChung
DevFest 2022 - Cloud Workstation Introduction TaiChung
 
Introduction to Docker and Containers
Introduction to Docker and ContainersIntroduction to Docker and Containers
Introduction to Docker and Containers
 
Qt native built for raspberry zero
Qt native built for  raspberry zeroQt native built for  raspberry zero
Qt native built for raspberry zero
 
Start tracking your ruby infrastructure
Start tracking your ruby infrastructureStart tracking your ruby infrastructure
Start tracking your ruby infrastructure
 

Último

Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
amitlee9823
 

Último (20)

Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdf
 
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
 
NFPA 5000 2024 standard .
NFPA 5000 2024 standard                                  .NFPA 5000 2024 standard                                  .
NFPA 5000 2024 standard .
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
Intro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdfIntro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdf
 

oSC-2023-Cross-Build.pdf

  • 1. Cross Building Factory & ALP Using git, pbuild or OBS openSUSE Conference adrian@opensuse.org
  • 2. Cross Architecture Building ● No Emulator necessary (mostly) ● Build Host + Build Target environment needed ● Cross Compiler toolchain needed
  • 3. Current State in Factory & ALP ● aarch64 and riscv64 toolchain exists ● kiwi live image creation works (via kiwi-crossprepare-plugin) ● Some(!) packages are working, eg. the kernel ● cross-aaa_base provides helper tooling
  • 4. Example Setup using an ALP prototype
  • 5. Project setup in devel:ALP ● NOTE: devel:ALP is a prototype only # osc meta prj devel:ALP …. <scmsync>https://gitea.opensuse.org/adrianSuSE/Alp#factory</scmsync> …. <repository name="cross" rebuild="local" block="local"> <path project="openSUSE:Factory:ARM" repository="standard"/> <path project="openSUSE:Factory:RISCV" repository="standard"/> <hostsystem project="openSUSE:Factory" repository="standard"/> <arch>aarch64</arch> <arch>riscv64</arch> <arch>x86_64</arch> </repository>
  • 6. The git-way specials ● package centric organisation One git repo per package for all official revisions ● Package sources come via submodules usually Seperation of package source review and project aggregation binary rpm *is* reporting git resource via VCS header binary rpm *will be* reporting project source as well ● Build config (prjconf) is part of git as _config file ● Only project meta is not part of git atm project meta in OBS _pbuild in git for local builds using pbuild
  • 7. pbuild 1/2 ● part of build tool, install it via ● zypper in build ● git clone https://github.com/openSUSE/obs-build ● Works on ● OBS project checkouts ● Any other directory, eg. managed via git
  • 8. pbuild 2/2 ● It is a small OBS on your system ● The sources can be exchanged via OBS or any SCM ● Additional sources may get downloaded via the “Assets” mechanic ● Uses KVM when running as non-root
  • 9. Cross Build using git & pbuild ● Build a single rpm cross arch out of the large ALP project fast… ● Only one package source downloaded # git clone https://gitea.opensuse.org/adrianSuSE/Alp.git # cd Alp # git submodule init # git submodule update xz # cd xz # pbuild –preset riscv64
  • 10. Cross Build using git & pbuild ● For the brave ones … building entire ALP also works... # git clone https://gitea.opensuse.org/adrianSuSE/Alp.git # cd Alp # git submodule init # git submodule update # pbuild –preset riscv64
  • 11. Example Setup Based on Leap and Factory
  • 12. Cross Build using git & pbuild ● It works across build types, eg. mixing rpm and kiwi build Note: kiwi runs on x86_64, but uses qemu for executing rpm scripts # git clone https://github.com/geckito/image-RaspBerryPi4-pi-hole # cd image-RaspBerryPi4-pi-hole # pbuild
  • 13. Build using osc & pbuild ● How it almost already works …. # osc co openSUSE:Factory:ARM zstd # cd openSUSE:Factory:ARM # osc create-pbuild-config standard aarch64 WARNING: lacks still cross definition! # pbuild –preset cross_aarch64 create-pbuild-config
  • 14. Adding cross build support to sources On the example of spec files
  • 15. Every package source is different... cross-aaa_base-$arch provide generic helpers ● ENV: CC and CXX points to cross compiler ● rpm macros: %cross_sysroot directory %is_cross set to 1 %_build %{_target_cpu}-suse-linux-gnu (also affects %configure and %cmake) ● Provides check for correct binary arch in build result
  • 16. Add build config hints Give OBS and pbuild a hint where a package is needed. Otherwise they get installed in target env. only. Eg: #!OnlyNative: make #!AlsoNative: Qt6 (also works via build config)
  • 17. How to create an own setup Building for a new device
  • 18. Typical Requirements 1)Initialize new git repository 2)Create _pbuild 3)Pick to-be-rebuild or adapted source 4)Add own sources, eg. image description 5)Optional: add _config
  • 19. Setup an own build - sources # mkdir image-MyHardware # cd image-MyHardware # git init # git submodule add https://gitea.opensuse.org/pool/kernel-source # ln -sf kernel-source kernel-default And steal a kiwi config as close as possible for your device Also you most likely need to modify the kernel config create-pbuild-config dd https://gitea.opensuse.org/pool/kernel-source
  • 20. Setup an own build – build config # cat > _pbuild <<EOF <pbuild> <preset name="aarch64" default> <config>cross_aarch64</config> <config>tumbleweed</config> <hostrepo>https://download.opensuse.org/factory/repo/oss</hostrepo> <hostrepo>config:</hostrepo> <repo>https://download.opensuse.org/ports/aarch64/factory/repo/oss/</ repo> <arch>aarch64</arch> </preset> </pbuild> EOF # pbuild create-pbuild-config dd https://gitea.opensuse.org/pool/kernel-source
  • 22. pbuild hints ● Use latest version from openSUSE:Tools ● Results and logfiles are in _build.*/ ● pbuild --single $package for live log debugging Documentation: http://opensuse.github.io/obs-build/pbuild.html
  • 23. Only aarch64 and riscv64 atm ● The other cross-*-gcc* do not support building against glibc atm!
  • 24. Naming definitions ● No common understanding of host, build and target... pbuild host target -/- cmake HOST default -/- GNU build host target rpm* build target -/- * Current state, older rpm versions have different definitions