Last active
July 22, 2021 23:33
-
-
Save electrocucaracha/6fe62a91505ab8ff68ebd083aebe0519 to your computer and use it in GitHub Desktop.
E2E Tizen Build
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
############################################################################## | |
# Copyright (c) | |
# All rights reserved. This program and the accompanying materials | |
# are made available under the terms of the Apache License, Version 2.0 | |
# which accompanies this distribution, and is available at | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
############################################################################## | |
host = RbConfig::CONFIG['host_os'] | |
no_proxy = ENV['NO_PROXY'] || ENV['no_proxy'] || '127.0.0.1,localhost' | |
(1..254).each do |i| | |
no_proxy += ",10.0.2.#{i}" | |
end | |
case host | |
when /darwin/ | |
mem = `sysctl -n hw.memsize`.to_i / 1024 | |
when /linux/ | |
mem = `grep 'MemTotal' /proc/meminfo | sed -e 's/MemTotal://' -e 's/ kB//'`.to_i | |
when /mswin|mingw|cygwin/ | |
mem = `wmic computersystem Get TotalPhysicalMemory`.split[1].to_i / 1024 | |
end | |
Vagrant.configure("2") do |config| | |
config.vm.provider :libvirt | |
config.vm.provider :virtualbox | |
config.vm.box = "generic/ubuntu2004" | |
config.vm.box_check_update = false | |
config.vm.synced_folder './connectedhomeip', '/opt/connectedhomeip', create: true | |
config.vm.provision "shell", privileged: false do |sh| | |
sh.env = { | |
TIZEN_HOME: "/home/vagrant" | |
} | |
sh.inline = <<-SHELL | |
set -o errexit | |
sudo apt-get update | |
sudo apt-get install -y --no-install-recommends git gcc g++ python \ | |
pkg-config libssl-dev libdbus-1-dev libglib2.0-dev libavahi-client-dev \ | |
ninja-build python3-venv python3-dev python3-pip unzip \ | |
libgirepository1.0-dev libcairo2-dev | |
# Tizen build dependencies | |
sudo apt-get install -y --no-install-recommends obs-build | |
mkdir -p $TIZEN_HOME | |
pushd /opt/connectedhomeip | |
./config/tizen/scripts/install_sdk.sh $TIZEN_HOME | |
source scripts/activate.sh | |
./scripts/examples/gn_tizen_example.sh examples/lighting-app/linux ./out/lighting_app_tizen 'import("//with_tizen.gni")' | |
PKG_CONFIG_SYSROOT_DIR=$TIZEN_HOME \ | |
PKG_CONFIG_LIBDIR=${TIZEN_HOME}/usr/lib/pkgconfig \ | |
PKG_CONFIG_PATH=${TIZEN_HOME}/usr/lib/pkgconfig \ | |
gn gen out/tizen --args='target_os="tizen" target_cpu="arm" arm_arch="armv7-a" | |
import("//build_overrides/build.gni") | |
target_cflags=[ "--sysroot='$TIZEN_HOME'" ] | |
target_ldflags=[ "--sysroot='$TIZEN_HOME'" ] | |
custom_toolchain="${build_root}/toolchain/custom" | |
target_cc="'$TIZEN_HOME'/bin/arm-linux-gnueabi-gcc" | |
target_cxx="'$TIZEN_HOME'/bin/arm-linux-gnueabi-g++" | |
target_ar="'$TIZEN_HOME'/bin/arm-linux-gnueabi-ar"' | |
ninja -C ./out/tizen | |
popd | |
SHELL | |
end | |
%i[virtualbox libvirt].each do |provider| | |
config.vm.provider provider do |p| | |
p.cpus = ENV['CPUS'] || 2 | |
p.memory = ENV['MEMORY'] || mem / 1024 / 4 | |
end | |
end | |
config.vm.provider "virtualbox" do |v| | |
v.gui = false | |
v.customize ["modifyvm", :id, "--nictype1", "virtio", "--cableconnected1", "on"] | |
# https://bugs.launchpad.net/cloud-images/+bug/1829625/comments/2 | |
v.customize ["modifyvm", :id, "--uart1", "0x3F8", "4"] | |
v.customize ["modifyvm", :id, "--uartmode1", "file", File::NULL] | |
# Enable nested paging for memory management in hardware | |
v.customize ["modifyvm", :id, "--nestedpaging", "on"] | |
# Use large pages to reduce Translation Lookaside Buffers usage | |
v.customize ["modifyvm", :id, "--largepages", "on"] | |
# Use virtual processor identifiers to accelerate context switching | |
v.customize ["modifyvm", :id, "--vtxvpid", "on"] | |
end | |
config.vm.provider :libvirt do |v, override| | |
override.vm.synced_folder './connectedhomeip', '/opt/connectedhomeip', create: true, type: "nfs" | |
v.random_hostname = true | |
v.management_network_address = '10.0.2.0/24' | |
v.management_network_name = 'administration' | |
v.cpu_mode = 'host-passthrough' | |
end | |
if ENV['http_proxy'] != nil and ENV['https_proxy'] != nil | |
if Vagrant.has_plugin?('vagrant-proxyconf') | |
config.proxy.http = ENV['http_proxy'] || ENV['HTTP_PROXY'] || "" | |
config.proxy.https = ENV['https_proxy'] || ENV['HTTPS_PROXY'] || "" | |
config.proxy.no_proxy = no_proxy | |
config.proxy.enabled = { docker: false } | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment