#!/bin/bash # # Copyright (c) 2021 The Flatcar Maintainers. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # This script will generate an SDK container image from an SDK tarball # (which in turn is generated by bootstrap_sdk[_container]). # # It uses a number of intermediate build steps: # 1. Import the SDK tarball into a "tarball" container image. # 2. Build a "plain" SDK container image which creates the "sdk" user # and runs "update_chroot" to initialise the x86 and aarch64 SDK cross env. # This step uses sdk_lib/Dockerfile.sdk-import. # 3. Using the "plain" SDK image, start a temporary "toolchain" container # to build toolchain binary packages. # 4. Inheriting from the "plain" SDK image and using the toolchain packages, # build a "full" SDK container image, with board support for both amd64-usr and arm64-usr. # A temporary HTTP server on the Docker interface IP is spun up in this step # to serve the toolchain binpkgs to the build container. # This step uses sdk_lib/Dockerfile.sdk-build. # 5. In a last step, all unnecessary binaries are removed from the "full" image and 3 # output SDK images are produced: # - "all", with both amd64 and arm64 target support, and # - "amd64" and "arm64, with only amd64 or arm64 target support respectively. # This step uses sdk_lib/Dockerfile.lean-arch. set -eu cd $(dirname "$0") source sdk_lib/sdk_container_common.sh arch="amd64" official="0" tarball="" os_version="" keep="false" cleanup="" usage() { echo " $0 - Create SDK container image from an SDK tarball" echo " This script will set up a new SDK container from a tarball." echo " The resulting container comes in 3 flavours:" echo " 1. flatcar-sdk-all - includes both ARM64 and AMD64 support" echo " 2.+3. flatcar-sdk-(amd64|arm64) - only includes suport for one target." echo " Usage:" echo " $0 ] [-k] [-v ] [-x