mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-11 21:02:34 +00:00
Merge pull request #3420 from fidencio/wip/remove-non-tested-rootfs
Remove all the non-tested rootfs
This commit is contained in:
commit
e10fd32a88
@ -9,7 +9,7 @@ ROOTFS_BUILDER := $(MK_DIR)/rootfs-builder/rootfs.sh
|
|||||||
INITRD_BUILDER := $(MK_DIR)/initrd-builder/initrd_builder.sh
|
INITRD_BUILDER := $(MK_DIR)/initrd-builder/initrd_builder.sh
|
||||||
IMAGE_BUILDER := $(MK_DIR)/image-builder/image_builder.sh
|
IMAGE_BUILDER := $(MK_DIR)/image-builder/image_builder.sh
|
||||||
|
|
||||||
DISTRO ?= centos
|
DISTRO ?= ubuntu
|
||||||
BUILD_METHOD := distro
|
BUILD_METHOD := distro
|
||||||
BUILD_METHOD_LIST := distro dracut
|
BUILD_METHOD_LIST := distro dracut
|
||||||
AGENT_INIT ?= no
|
AGENT_INIT ?= no
|
||||||
|
@ -80,8 +80,8 @@ filesystem components to generate an initrd.
|
|||||||
3. When generating an image, the initrd is extracted to obtain the base rootfs for
|
3. When generating an image, the initrd is extracted to obtain the base rootfs for
|
||||||
the image.
|
the image.
|
||||||
|
|
||||||
CentOS is the default distro for building the rootfs, to use a different one, you can set `DISTRO=<your_distro>`.
|
Ubuntu is the default distro for building the rootfs, to use a different one, you can set `DISTRO=alpine|clearlinux|debian|ubuntu`.
|
||||||
For example `make USE_DOCKER=true DISTRO=ubuntu rootfs` will make Ubuntu rootfs using Docker.
|
For example `make USE_DOCKER=true DISTRO=alpine rootfs` will make an Alpine rootfs using Docker.
|
||||||
|
|
||||||
### Rootfs creation
|
### Rootfs creation
|
||||||
|
|
||||||
@ -209,9 +209,9 @@ of the the osbuilder distributions.
|
|||||||
> Note: this table is not relevant for the dracut build method, since it supports
|
> Note: this table is not relevant for the dracut build method, since it supports
|
||||||
any Linux distribution and architecture where dracut is available.
|
any Linux distribution and architecture where dracut is available.
|
||||||
|
|
||||||
| |Alpine |CentOS |Clear Linux |Debian/Ubuntu |Fedora |openSUSE |
|
| |Alpine |Clear Linux |Debian/Ubuntu |
|
||||||
|-- |-- |-- |-- |-- |-- |-- |
|
|-- |-- |-- |-- |
|
||||||
|**ARM64** |:heavy_check_mark:|:heavy_check_mark:| | |:heavy_check_mark:|:heavy_check_mark:|
|
|**ARM64** |:heavy_check_mark:| | |
|
||||||
|**PPC64le**|:heavy_check_mark:|:heavy_check_mark:| |:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|
|
|**PPC64le**|:heavy_check_mark:| |:heavy_check_mark:|
|
||||||
|**s390x** | | | |:heavy_check_mark:|:heavy_check_mark:| |
|
|**s390x** | | |:heavy_check_mark:|
|
||||||
|**x86_64** |:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|
|
|**x86_64** |:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|
|
||||||
|
@ -8,10 +8,8 @@ To properly load the driver modules, systemd init must be used. It is not adequa
|
|||||||
to use the agent as the init. Because of this, alpine is not a valid base OS image
|
to use the agent as the init. Because of this, alpine is not a valid base OS image
|
||||||
to use. The following rootfs OS's have been tested with this Dockerfile.
|
to use. The following rootfs OS's have been tested with this Dockerfile.
|
||||||
|
|
||||||
* CentOS
|
|
||||||
* Clear Linux
|
* Clear Linux
|
||||||
* Fedora
|
* Debian
|
||||||
* SUSE
|
|
||||||
* Ubuntu
|
* Ubuntu
|
||||||
|
|
||||||
The generated files will need to be copied and configured into your Kata Containers
|
The generated files will need to be copied and configured into your Kata Containers
|
||||||
|
@ -99,10 +99,10 @@ must be met:
|
|||||||
Example:
|
Example:
|
||||||
```
|
```
|
||||||
$ export USE_DOCKER=true
|
$ export USE_DOCKER=true
|
||||||
$ # build guest O/S rootfs based on fedora
|
$ # build guest O/S rootfs based on debian
|
||||||
$ ./rootfs-builder/rootfs.sh -r "${PWD}/fedora_rootfs" fedora
|
$ ./rootfs-builder/rootfs.sh -r "${PWD}/debian_rootfs" debian
|
||||||
$ # build image based rootfs created above
|
$ # build image based rootfs created above
|
||||||
$ ./image-builder/image_builder.sh "${PWD}/fedora_rootfs"
|
$ ./image-builder/image_builder.sh "${PWD}/debian_rootfs"
|
||||||
```
|
```
|
||||||
|
|
||||||
## Adding support for a new guest OS
|
## Adding support for a new guest OS
|
||||||
@ -180,7 +180,7 @@ To add additional packages, use one of the following methods:
|
|||||||
Example:
|
Example:
|
||||||
|
|
||||||
```
|
```
|
||||||
$ EXTRA_PKGS="vim emacs" ./rootfs-builder/rootfs.sh -r ${PWD}/myrootfs fedora
|
$ EXTRA_PKGS="vim emacs" ./rootfs-builder/rootfs.sh -r ${PWD}/myrootfs debian
|
||||||
```
|
```
|
||||||
|
|
||||||
- Modify the variable `PACKAGES` in `rootfs-builder/<distro>/config.sh`.
|
- Modify the variable `PACKAGES` in `rootfs-builder/<distro>/config.sh`.
|
||||||
|
@ -1,40 +0,0 @@
|
|||||||
#
|
|
||||||
# Copyright (c) 2018 Intel Corporation
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
|
||||||
|
|
||||||
ARG IMAGE_REGISTRY=registry.centos.org
|
|
||||||
FROM ${IMAGE_REGISTRY}/centos:@OS_VERSION@
|
|
||||||
|
|
||||||
@SET_PROXY@
|
|
||||||
|
|
||||||
RUN yum -y update && yum install -y \
|
|
||||||
autoconf \
|
|
||||||
automake \
|
|
||||||
binutils \
|
|
||||||
chrony \
|
|
||||||
coreutils \
|
|
||||||
curl \
|
|
||||||
gcc \
|
|
||||||
gcc-c++ \
|
|
||||||
git \
|
|
||||||
glibc-common \
|
|
||||||
glibc-devel \
|
|
||||||
glibc-headers \
|
|
||||||
glibc-static \
|
|
||||||
glibc-utils \
|
|
||||||
libseccomp \
|
|
||||||
libseccomp-devel \
|
|
||||||
libstdc++-devel \
|
|
||||||
libstdc++-static \
|
|
||||||
m4 \
|
|
||||||
make \
|
|
||||||
sed \
|
|
||||||
tar \
|
|
||||||
vim \
|
|
||||||
which && \
|
|
||||||
yum clean all
|
|
||||||
|
|
||||||
# This will install the proper packages to build Kata components
|
|
||||||
@INSTALL_MUSL@
|
|
||||||
@INSTALL_RUST@
|
|
@ -1,38 +0,0 @@
|
|||||||
#
|
|
||||||
# Copyright (c) 2018 Intel Corporation
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
|
||||||
|
|
||||||
OS_NAME="Centos"
|
|
||||||
|
|
||||||
OS_VERSION=${OS_VERSION:-7}
|
|
||||||
|
|
||||||
LOG_FILE="/var/log/yum-centos.log"
|
|
||||||
|
|
||||||
MIRROR_LIST="http://mirrorlist.centos.org/?release=${OS_VERSION}&arch=${ARCH}&repo=os&container=container"
|
|
||||||
|
|
||||||
# Aditional Repos
|
|
||||||
CENTOS_UPDATES_MIRROR_LIST="http://mirrorlist.centos.org/?release=${OS_VERSION}&arch=${ARCH}&repo=updates&container=container"
|
|
||||||
|
|
||||||
CENTOS_EXTRAS_MIRROR_LIST="http://mirrorlist.centos.org/?release=${OS_VERSION}&arch=${ARCH}&repo=extras&container=container"
|
|
||||||
|
|
||||||
CENTOS_PLUS_MIRROR_LIST="http://mirrorlist.centos.org/?release=${OS_VERSION}&arch=${ARCH}&repo=centosplus&container=container"
|
|
||||||
|
|
||||||
GPG_KEY_URL="https://www.centos.org/keys/RPM-GPG-KEY-CentOS-7"
|
|
||||||
|
|
||||||
GPG_KEY_FILE="RPM-GPG-KEY-CentOS-7"
|
|
||||||
|
|
||||||
PACKAGES="coreutils chrony"
|
|
||||||
|
|
||||||
#Optional packages:
|
|
||||||
# systemd: An init system that will start kata-agent if kata-agent
|
|
||||||
# itself is not configured as init process.
|
|
||||||
[ "$AGENT_INIT" = "no" ] && PACKAGES+=" systemd" || true
|
|
||||||
|
|
||||||
# Init process must be one of {systemd,kata-agent}
|
|
||||||
INIT_PROCESS=systemd
|
|
||||||
# List of zero or more architectures to exclude from build,
|
|
||||||
# as reported by `uname -m`
|
|
||||||
ARCH_EXCLUDE_LIST=()
|
|
||||||
|
|
||||||
[ "$SECCOMP" = "yes" ] && PACKAGES+=" libseccomp" || true
|
|
@ -1,18 +0,0 @@
|
|||||||
#
|
|
||||||
# Copyright (c) 2018 ARM Limited
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
|
||||||
|
|
||||||
# Base Repos
|
|
||||||
BASE_URL="http://mirror.centos.org/altarch/${OS_VERSION}/os/${ARCH}/"
|
|
||||||
|
|
||||||
# Additional Repos
|
|
||||||
CENTOS_UPDATES_URL="http://mirror.centos.org/altarch/${OS_VERSION}/updates/${ARCH}/"
|
|
||||||
|
|
||||||
CENTOS_EXTRAS_URL="http://mirror.centos.org/altarch/${OS_VERSION}/extras/${ARCH}/"
|
|
||||||
|
|
||||||
CENTOS_PLUS_URL="http://mirror.centos.org/altarch/${OS_VERSION}/centosplus/${ARCH}/"
|
|
||||||
|
|
||||||
GPG_KEY_ARCH_URL="http://mirror.centos.org/altarch/7/os/aarch64/RPM-GPG-KEY-CentOS-7"
|
|
||||||
|
|
||||||
GPG_KEY_ARCH_FILE="RPM-GPG-KEY-CentOS-7-aarch64"
|
|
@ -1,18 +0,0 @@
|
|||||||
#
|
|
||||||
# Copyright (c) 2018 IBM
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
|
||||||
|
|
||||||
# Base Repos
|
|
||||||
BASE_URL="http://mirror.centos.org/altarch/${OS_VERSION}/os/${ARCH}/"
|
|
||||||
|
|
||||||
# Additional Repos
|
|
||||||
CENTOS_UPDATES_URL="http://mirror.centos.org/altarch/${OS_VERSION}/updates/${ARCH}/"
|
|
||||||
|
|
||||||
CENTOS_EXTRAS_URL="http://mirror.centos.org/altarch/${OS_VERSION}/extras/${ARCH}/"
|
|
||||||
|
|
||||||
CENTOS_PLUS_URL="http://mirror.centos.org/altarch/${OS_VERSION}/centosplus/${ARCH}/"
|
|
||||||
|
|
||||||
GPG_KEY_ARCH_URL="https://raw.githubusercontent.com/CentOS/sig-core-AltArch/master/centos-release-repo/centos-release-7/ppc/RPM-GPG-KEY-CentOS-SIG-AltArch-7-ppc64le"
|
|
||||||
|
|
||||||
GPG_KEY_ARCH_FILE="RPM-GPG-KEY-CentOS-SIG-AltArch-7-ppc64le"
|
|
@ -1,43 +0,0 @@
|
|||||||
#
|
|
||||||
# Copyright (c) 2018 Intel Corporation
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
|
||||||
ARG IMAGE_REGISTRY=registry.fedoraproject.org
|
|
||||||
FROM ${IMAGE_REGISTRY}/fedora:@OS_VERSION@
|
|
||||||
|
|
||||||
@SET_PROXY@
|
|
||||||
|
|
||||||
RUN dnf -y update && dnf install -y \
|
|
||||||
autoconf \
|
|
||||||
automake \
|
|
||||||
binutils \
|
|
||||||
chrony \
|
|
||||||
coreutils \
|
|
||||||
curl \
|
|
||||||
gcc \
|
|
||||||
gcc-c++ \
|
|
||||||
git \
|
|
||||||
glibc-common \
|
|
||||||
glibc-devel \
|
|
||||||
glibc-headers \
|
|
||||||
glibc-static \
|
|
||||||
glibc-utils \
|
|
||||||
libseccomp \
|
|
||||||
libseccomp-devel \
|
|
||||||
libstdc++-devel \
|
|
||||||
libstdc++-static \
|
|
||||||
protobuf-compiler \
|
|
||||||
m4 \
|
|
||||||
make \
|
|
||||||
pkgconfig \
|
|
||||||
redhat-release \
|
|
||||||
sed \
|
|
||||||
systemd \
|
|
||||||
tar \
|
|
||||||
vim \
|
|
||||||
which && \
|
|
||||||
dnf clean all
|
|
||||||
|
|
||||||
# This will install the proper packages to build Kata components
|
|
||||||
@INSTALL_MUSL@
|
|
||||||
@INSTALL_RUST@
|
|
@ -1,23 +0,0 @@
|
|||||||
#
|
|
||||||
# Copyright (c) 2018 Intel Corporation
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
|
||||||
|
|
||||||
OS_NAME="Fedora"
|
|
||||||
|
|
||||||
OS_VERSION=${OS_VERSION:-30}
|
|
||||||
|
|
||||||
MIRROR_LIST="https://mirrors.fedoraproject.org/metalink?repo=fedora-${OS_VERSION}&arch=\$basearch"
|
|
||||||
|
|
||||||
PACKAGES="coreutils chrony"
|
|
||||||
|
|
||||||
#Optional packages:
|
|
||||||
# systemd: An init system that will start kata-agent if kata-agent
|
|
||||||
# itself is not configured as init process.
|
|
||||||
[ "$AGENT_INIT" = "no" ] && PACKAGES+=" systemd" || true
|
|
||||||
|
|
||||||
# Init process must be one of {systemd,kata-agent}
|
|
||||||
INIT_PROCESS=systemd
|
|
||||||
ARCH_EXCLUDE_LIST=()
|
|
||||||
|
|
||||||
[ "$SECCOMP" = "yes" ] && PACKAGES+=" libseccomp" || true
|
|
@ -1,10 +0,0 @@
|
|||||||
#
|
|
||||||
# Copyright (c) 2019 ARM Limited
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
|
||||||
|
|
||||||
# image busybox will fail on fedora 30 rootfs image
|
|
||||||
# see https://github.com/kata-containers/osbuilder/issues/334 for detailed info
|
|
||||||
OS_VERSION="29"
|
|
||||||
|
|
||||||
MIRROR_LIST="https://mirrors.fedoraproject.org/metalink?repo=fedora-${OS_VERSION}&arch=\$basearch"
|
|
@ -1,15 +0,0 @@
|
|||||||
#
|
|
||||||
# Copyright (c) 2020 Intel Corporation
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
|
||||||
|
|
||||||
ARG IMAGE_REGISTRY=docker.io
|
|
||||||
# stage3-amd64 image has only 'latest' tag so ignore DL3006 rule.
|
|
||||||
# hadolint ignore=DL3007
|
|
||||||
FROM ${IMAGE_REGISTRY}/gentoo/stage3-amd64:latest
|
|
||||||
|
|
||||||
# This dockerfile needs to provide all the componets need to build a rootfs
|
|
||||||
# Install any package need to create a rootfs (package manager, extra tools)
|
|
||||||
|
|
||||||
# This will install the proper rust to build Kata components
|
|
||||||
@INSTALL_RUST@
|
|
@ -1,22 +0,0 @@
|
|||||||
# This is a configuration file add extra variables to
|
|
||||||
#
|
|
||||||
# Copyright (c) 2020 Intel Corporation
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
|
||||||
# be used by build_rootfs() from rootfs_lib.sh the variables will be
|
|
||||||
# loaded just before call the function. For more information see the
|
|
||||||
# rootfs-builder/README.md file.
|
|
||||||
|
|
||||||
OS_VERSION=${OS_VERSION:-latest}
|
|
||||||
OS_NAME=${OS_NAME:-"gentoo"}
|
|
||||||
|
|
||||||
# packages to be installed by default
|
|
||||||
PACKAGES="sys-apps/systemd sys-apps/coreutils net-misc/chrony"
|
|
||||||
|
|
||||||
# Init process must be one of {systemd,kata-agent}
|
|
||||||
INIT_PROCESS=systemd
|
|
||||||
# List of zero or more architectures to exclude from build,
|
|
||||||
# as reported by `uname -m`
|
|
||||||
ARCH_EXCLUDE_LIST=( aarch64 ppc64le s390x )
|
|
||||||
|
|
||||||
[ "$SECCOMP" = "yes" ] && PACKAGES+=" sys-libs/libseccomp" || true
|
|
@ -1,210 +0,0 @@
|
|||||||
# Copyright (c) 2020 Intel Corporation
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
|
||||||
#
|
|
||||||
# - Arguments
|
|
||||||
# rootfs_dir=$1
|
|
||||||
#
|
|
||||||
# - Optional environment variables
|
|
||||||
#
|
|
||||||
# EXTRA_PKGS: Variable to add extra PKGS provided by the user
|
|
||||||
#
|
|
||||||
# BIN_AGENT: Name of the Kata-Agent binary
|
|
||||||
#
|
|
||||||
# REPO_URL: URL to distribution repository ( should be configured in
|
|
||||||
# config.sh file)
|
|
||||||
#
|
|
||||||
# Any other configuration variable for a specific distro must be added
|
|
||||||
# and documented on its own config.sh
|
|
||||||
#
|
|
||||||
# - Expected result
|
|
||||||
#
|
|
||||||
# rootfs_dir populated with rootfs pkgs
|
|
||||||
# It must provide a binary in /sbin/init
|
|
||||||
#
|
|
||||||
gentoo_portage_container=gentoo_portage
|
|
||||||
gentoo_local_portage_dir="${HOME}/gentoo-$(date +%s)"
|
|
||||||
|
|
||||||
build_rootfs() {
|
|
||||||
# Mandatory
|
|
||||||
local ROOTFS_DIR=$1
|
|
||||||
|
|
||||||
# In case of support EXTRA packages, use it to allow
|
|
||||||
# users to add more packages to the base rootfs
|
|
||||||
local EXTRA_PKGS=${EXTRA_PKGS:-}
|
|
||||||
|
|
||||||
# Populate ROOTFS_DIR
|
|
||||||
# Must provide /sbin/init and /bin/${BIN_AGENT}
|
|
||||||
check_root
|
|
||||||
mkdir -p "${ROOTFS_DIR}"
|
|
||||||
|
|
||||||
# trim whitespace
|
|
||||||
PACKAGES=$(echo $PACKAGES |xargs )
|
|
||||||
EXTRA_PKGS=$(echo $EXTRA_PKGS |xargs)
|
|
||||||
|
|
||||||
# extra packages are added to packages and finally passed to debootstrap
|
|
||||||
if [ "${EXTRA_PKGS}" = "" ]; then
|
|
||||||
echo "no extra packages"
|
|
||||||
else
|
|
||||||
PACKAGES="${PACKAGES} ${EXTRA_PKGS}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
local packageuseconf="/etc/portage/package.use/user"
|
|
||||||
local makeconf="/etc/portage/make.conf"
|
|
||||||
local systemd_optimizations=(
|
|
||||||
acl
|
|
||||||
-apparmor
|
|
||||||
-audit
|
|
||||||
cgroup-hybrid
|
|
||||||
-cryptsetup
|
|
||||||
-curl
|
|
||||||
-dns-over-tls
|
|
||||||
-gcrypt
|
|
||||||
-gnuefi
|
|
||||||
-homed
|
|
||||||
-http
|
|
||||||
-hwdb
|
|
||||||
-idn
|
|
||||||
-importd
|
|
||||||
kmod
|
|
||||||
-lz4
|
|
||||||
-lzma
|
|
||||||
-nat
|
|
||||||
-pkcs11
|
|
||||||
-policykit
|
|
||||||
-pwquality
|
|
||||||
-qrcode
|
|
||||||
-repart
|
|
||||||
-resolvconf
|
|
||||||
sysv-utils
|
|
||||||
-test
|
|
||||||
-xkb
|
|
||||||
-zstd
|
|
||||||
)
|
|
||||||
|
|
||||||
local packages_optimizations=(
|
|
||||||
-abi_x86_32
|
|
||||||
-abi_x86_x32
|
|
||||||
-debug
|
|
||||||
-doc
|
|
||||||
-examples
|
|
||||||
multicall
|
|
||||||
-ncurses
|
|
||||||
-nls
|
|
||||||
-selinux
|
|
||||||
systemd
|
|
||||||
-udev
|
|
||||||
-unicode
|
|
||||||
-X
|
|
||||||
)
|
|
||||||
|
|
||||||
local compiler_optimizations=(
|
|
||||||
-O3
|
|
||||||
-fassociative-math
|
|
||||||
-fasynchronous-unwind-tables
|
|
||||||
-feliminate-unused-debug-types
|
|
||||||
-fexceptions
|
|
||||||
-ffat-lto-objects
|
|
||||||
-fno-semantic-interposition
|
|
||||||
-fno-signed-zeros
|
|
||||||
-fno-trapping-math
|
|
||||||
-fstack-protector
|
|
||||||
-ftree-loop-distribute-patterns
|
|
||||||
-m64
|
|
||||||
-mtune=skylake
|
|
||||||
--param=ssp-buffer-size=32
|
|
||||||
-pipe
|
|
||||||
-Wl,--copy-dt-needed-entries
|
|
||||||
-Wp,-D_REENTRANT
|
|
||||||
-Wl,--enable-new-dtags
|
|
||||||
-Wl,-sort-common
|
|
||||||
-Wl,-z -Wl,now
|
|
||||||
-Wl,-z -Wl,relro
|
|
||||||
)
|
|
||||||
|
|
||||||
local build_dependencies=(
|
|
||||||
dev-vcs/git
|
|
||||||
)
|
|
||||||
|
|
||||||
local conflicting_packages=(
|
|
||||||
net-misc/netifrc sys-apps/sysvinit
|
|
||||||
sys-fs/eudev sys-apps/openrc
|
|
||||||
virtual/service-manager
|
|
||||||
)
|
|
||||||
|
|
||||||
# systemd optimizations
|
|
||||||
echo "sys-apps/systemd ${systemd_optimizations[*]}" >> ${packageuseconf}
|
|
||||||
echo "MAKEOPTS=\"-j$(nproc)\"" >> ${makeconf}
|
|
||||||
|
|
||||||
# Packages optimizations
|
|
||||||
echo "USE=\"${packages_optimizations[*]}\"" >> ${makeconf}
|
|
||||||
|
|
||||||
# compiler optimizations
|
|
||||||
echo "CFLAGS=\"${compiler_optimizations[*]}\"" >> ${makeconf}
|
|
||||||
echo 'CXXFLAGS="${CFLAGS}"' >> ${makeconf}
|
|
||||||
|
|
||||||
# remove conflicting packages
|
|
||||||
emerge -Cv $(echo "${conflicting_packages[*]}")
|
|
||||||
|
|
||||||
# Get the latest systemd portage profile and set it
|
|
||||||
systemd_profile=$(profile-config list | grep stable | grep -E "[[:digit:]]/systemd" | xargs | cut -d' ' -f2)
|
|
||||||
profile-config set "${systemd_profile}"
|
|
||||||
|
|
||||||
# Install build dependencies
|
|
||||||
emerge --newuse $(echo "${build_dependencies[*]}")
|
|
||||||
|
|
||||||
quickpkg --include-unmodified-config=y "*/*"
|
|
||||||
|
|
||||||
# Install needed packages excluding conflicting packages
|
|
||||||
ROOT=${ROOTFS_DIR} emerge --exclude "$(echo "${conflicting_packages[*]}")" --newuse -k ${PACKAGES}
|
|
||||||
|
|
||||||
pushd ${ROOTFS_DIR}
|
|
||||||
|
|
||||||
# systemd will need this library
|
|
||||||
cp /usr/lib/gcc/x86_64-pc-linux-gnu/*/libgcc_s.so* lib64/
|
|
||||||
|
|
||||||
# Clean up the rootfs. there are things that we don't need
|
|
||||||
rm -rf etc/{udev,X11,kernel,runlevels,terminfo,init.d}
|
|
||||||
rm -rf var/lib/{gentoo,portage}
|
|
||||||
rm -rf var/{db,cache}
|
|
||||||
rm -rf usr/share/*
|
|
||||||
rm -rf usr/lib/{udev,gconv,kernel}
|
|
||||||
rm -rf usr/{include,local}
|
|
||||||
rm -rf usr/lib64/gconv
|
|
||||||
rm -rf lib/{udev,gentoo}
|
|
||||||
|
|
||||||
# Make sure important directories exist in the rootfs
|
|
||||||
ln -s ../run var/run
|
|
||||||
mkdir -p proc opt sys dev home root
|
|
||||||
|
|
||||||
popd
|
|
||||||
}
|
|
||||||
|
|
||||||
before_starting_container() {
|
|
||||||
gentoo_portage_image="gentoo/portage"
|
|
||||||
|
|
||||||
if [ "${OS_VERSION}" = "latest" ];then
|
|
||||||
${container_engine} pull "${gentoo_portage_image}:latest"
|
|
||||||
OS_VERSION=$(docker image inspect -f {{.Created}} ${gentoo_portage_image} | cut -dT -f1 | sed 's|-||g')
|
|
||||||
else
|
|
||||||
${container_engine} pull "${gentoo_portage_image}:${OS_VERSION}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# create portage volume and container
|
|
||||||
${container_engine} create -v /usr/portage --name "${gentoo_portage_container}" "${gentoo_portage_image}" /bin/true
|
|
||||||
}
|
|
||||||
|
|
||||||
after_stopping_container() {
|
|
||||||
# Get the list of volumes
|
|
||||||
volumes=""
|
|
||||||
for i in $(seq $(${container_engine} inspect -f "{{len .Mounts}}" "${gentoo_portage_container}")); do
|
|
||||||
volumes+="$(${container_engine} inspect -f "{{(index .Mounts $((i-1))).Name}}" "${gentoo_portage_container}") "
|
|
||||||
done
|
|
||||||
|
|
||||||
# remove portage container
|
|
||||||
${container_engine} rm -f "${gentoo_portage_container}"
|
|
||||||
sudo rm -rf "${gentoo_local_portage_dir}"
|
|
||||||
|
|
||||||
# remove portage volumes
|
|
||||||
${container_engine} volume rm -f ${volumes}
|
|
||||||
}
|
|
@ -516,10 +516,6 @@ EOT
|
|||||||
mkdir -p "${ROOTFS_DIR}/etc"
|
mkdir -p "${ROOTFS_DIR}/etc"
|
||||||
|
|
||||||
case "${distro}" in
|
case "${distro}" in
|
||||||
"gentoo")
|
|
||||||
chrony_conf_file="${ROOTFS_DIR}/etc/chrony/chrony.conf"
|
|
||||||
chrony_systemd_service="${ROOTFS_DIR}/lib/systemd/system/chronyd.service"
|
|
||||||
;;
|
|
||||||
"ubuntu" | "debian")
|
"ubuntu" | "debian")
|
||||||
echo "I am ubuntu or debian"
|
echo "I am ubuntu or debian"
|
||||||
chrony_conf_file="${ROOTFS_DIR}/etc/chrony/chrony.conf"
|
chrony_conf_file="${ROOTFS_DIR}/etc/chrony/chrony.conf"
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
#
|
|
||||||
# Copyright (c) 2018 SUSE LLC
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
|
||||||
|
|
||||||
ARG IMAGE_REGISTRY=docker.io
|
|
||||||
#suse: docker image to be used to create a rootfs
|
|
||||||
#@OS_VERSION@: Docker image version to build this dockerfile
|
|
||||||
FROM ${IMAGE_REGISTRY}/opensuse/leap:15.0
|
|
||||||
|
|
||||||
# This dockerfile needs to provide all the componets need to build a rootfs
|
|
||||||
# Install any package need to create a rootfs (package manager, extra tools)
|
|
||||||
|
|
||||||
COPY install-packages.sh config.sh /
|
|
||||||
# RUN commands
|
|
||||||
RUN chmod +x /install-packages.sh; /install-packages.sh
|
|
||||||
|
|
||||||
# This will install the proper packages to build Kata components
|
|
||||||
@INSTALL_MUSL@
|
|
||||||
@INSTALL_RUST@
|
|
@ -1,58 +0,0 @@
|
|||||||
#
|
|
||||||
# Copyright (c) 2018 SUSE LLC
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
|
||||||
|
|
||||||
# May also be "Tumbleweed"
|
|
||||||
OS_DISTRO="Leap"
|
|
||||||
|
|
||||||
# Leave this empty for distro "Tumbleweed"
|
|
||||||
OS_VERSION=${OS_VERSION:-15.0}
|
|
||||||
|
|
||||||
OS_IDENTIFIER="$OS_DISTRO${OS_VERSION:+:$OS_VERSION}"
|
|
||||||
|
|
||||||
# Extra packages to install in the rootfs
|
|
||||||
PACKAGES="systemd coreutils libudev1"
|
|
||||||
|
|
||||||
# http or https
|
|
||||||
REPO_TRANSPORT="https"
|
|
||||||
|
|
||||||
# Can specify an alternative domain
|
|
||||||
REPO_DOMAIN="download.opensuse.org"
|
|
||||||
|
|
||||||
# Init process must be one of {systemd,kata-agent}
|
|
||||||
INIT_PROCESS=systemd
|
|
||||||
# List of zero or more architectures to exclude from build,
|
|
||||||
# as reported by `uname -m`
|
|
||||||
ARCH_EXCLUDE_LIST=()
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
#
|
|
||||||
# NOTE: you probably dont need to edit things below this
|
|
||||||
#
|
|
||||||
|
|
||||||
SUSE_URL_BASE="${REPO_TRANSPORT}://${REPO_DOMAIN}"
|
|
||||||
SUSE_PATH_OSS="/distribution/${OS_DISTRO,,}/$OS_VERSION/repo/oss"
|
|
||||||
SUSE_PATH_UPDATE="/update/${OS_DISTRO,,}/$OS_VERSION/oss"
|
|
||||||
|
|
||||||
arch="$(uname -m)"
|
|
||||||
case "$arch" in
|
|
||||||
x86_64)
|
|
||||||
REPO_URL_PORT=""
|
|
||||||
;;
|
|
||||||
ppc|ppc64le)
|
|
||||||
REPO_URL_PORT="/ports/ppc"
|
|
||||||
;;
|
|
||||||
aarch64)
|
|
||||||
REPO_URL_PORT="/ports/aarch64"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
die "Unsupported architecture: $arch"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
SUSE_FULLURL_OSS="${SUSE_URL_BASE}${REPO_URL_PORT}${SUSE_PATH_OSS}"
|
|
||||||
SUSE_FULLURL_UPDATE="${SUSE_URL_BASE}${SUSE_PATH_UPDATE}"
|
|
||||||
|
|
||||||
if [ -z "${REPO_URL:-}" ]; then
|
|
||||||
REPO_URL="$SUSE_FULLURL_OSS"
|
|
||||||
fi
|
|
@ -1,40 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!--
|
|
||||||
Copyright (c) 2018 SUSE LLC
|
|
||||||
|
|
||||||
SPDX-License-Identifier: Apache-2.0
|
|
||||||
-->
|
|
||||||
<image schemaversion="6.8" name="openSUSE-rootfs-for-Kata-vm">
|
|
||||||
<description type="system">
|
|
||||||
<author>SUSE</author>
|
|
||||||
<contact>mvedovati@suse.com</contact>
|
|
||||||
<specification>openSUSE rootfs for Kata Containers guest vm</specification>
|
|
||||||
</description>
|
|
||||||
<preferences>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<packagemanager>zypper</packagemanager>
|
|
||||||
<locale>en_US</locale>
|
|
||||||
<keytable>us</keytable>
|
|
||||||
<rpm-excludedocs>true</rpm-excludedocs>
|
|
||||||
<type image="vmx" filesystem="ext4" />
|
|
||||||
</preferences>
|
|
||||||
<repository type="rpm-md">
|
|
||||||
<!-- NOTE: the following is a placeholder, specify the actual path with kiwi option set-repo=... -->
|
|
||||||
<source path="obs://"/>
|
|
||||||
</repository>
|
|
||||||
<packages type="image">
|
|
||||||
<package name=""/>
|
|
||||||
</packages>
|
|
||||||
<packages type="delete">
|
|
||||||
<package name="zypper"/>
|
|
||||||
<package name="rpm"/>
|
|
||||||
</packages>
|
|
||||||
<packages type="bootstrap" patternType="onlyRequired">
|
|
||||||
<package name="udev"/>
|
|
||||||
<package name="filesystem"/>
|
|
||||||
<package name="ca-certificates"/>
|
|
||||||
<package name="ca-certificates-mozilla"/>
|
|
||||||
<package name="openSUSE-release"/>
|
|
||||||
</packages>
|
|
||||||
|
|
||||||
</image>
|
|
@ -1,49 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
#
|
|
||||||
# Copyright (c) 2018 SUSE LLC
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
|
||||||
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
source config.sh
|
|
||||||
|
|
||||||
removeRepos=(repo-non-oss repo-update-non-oss repo-oss repo-update)
|
|
||||||
|
|
||||||
for r in ${removeRepos[@]}; do
|
|
||||||
zypper --non-interactive removerepo $r
|
|
||||||
done
|
|
||||||
|
|
||||||
zypper --non-interactive addrepo ${SUSE_FULLURL_OSS} osbuilder-oss
|
|
||||||
zypper --non-interactive addrepo ${SUSE_FULLURL_UPDATE} osbuilder-update
|
|
||||||
|
|
||||||
|
|
||||||
# Workaround for zypper slowdowns observed when running inside
|
|
||||||
# a container: see https://github.com/openSUSE/zypper/pull/209
|
|
||||||
# The fix is upstream but it will take a while before landing
|
|
||||||
# in Leap
|
|
||||||
ulimit -n 1024
|
|
||||||
zypper --non-interactive refresh
|
|
||||||
zypper --non-interactive install --no-recommends --force-resolution \
|
|
||||||
autoconf \
|
|
||||||
automake \
|
|
||||||
binutils \
|
|
||||||
coreutils \
|
|
||||||
curl \
|
|
||||||
gcc \
|
|
||||||
gcc-c++ \
|
|
||||||
git \
|
|
||||||
glibc-devel \
|
|
||||||
glibc-devel-static \
|
|
||||||
glibc-utils \
|
|
||||||
libstdc++-devel \
|
|
||||||
linux-glibc-devel \
|
|
||||||
m4 \
|
|
||||||
make \
|
|
||||||
python3-kiwi \
|
|
||||||
sed \
|
|
||||||
tar \
|
|
||||||
vim \
|
|
||||||
which
|
|
||||||
zypper --non-interactive clean --all
|
|
||||||
|
|
@ -1,76 +0,0 @@
|
|||||||
#
|
|
||||||
# Copyright (c) 2018 SUSE LLC
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
|
||||||
|
|
||||||
# - Arguments
|
|
||||||
# rootfs_dir=$1
|
|
||||||
#
|
|
||||||
# - Optional environment variables
|
|
||||||
#
|
|
||||||
# EXTRA_PKGS: Variable to add extra PKGS provided by the user
|
|
||||||
#
|
|
||||||
# BIN_AGENT: Name of the Kata-Agent binary
|
|
||||||
#
|
|
||||||
# REPO_URL: URL to distribution repository ( should be configured in
|
|
||||||
# config.sh file)
|
|
||||||
#
|
|
||||||
# Any other configuration variable for a specific distro must be added
|
|
||||||
# and documented on its own config.sh
|
|
||||||
#
|
|
||||||
# - Expected result
|
|
||||||
#
|
|
||||||
# rootfs_dir populated with rootfs pkgs
|
|
||||||
# It must provide a binary in /sbin/init
|
|
||||||
#
|
|
||||||
# Note: For some distros, the build_rootfs() function provided in scripts/lib.sh
|
|
||||||
# will suffice. If a new distro is introduced with a special requirement,
|
|
||||||
# then, a rootfs_builder/<distro>/rootfs_lib.sh file should be created
|
|
||||||
# using this template.
|
|
||||||
|
|
||||||
build_rootfs() {
|
|
||||||
# Mandatory
|
|
||||||
local ROOTFS_DIR=$1
|
|
||||||
|
|
||||||
#Name of the Kata-Agent binary
|
|
||||||
local BIN_AGENT=${BIN_AGENT}
|
|
||||||
|
|
||||||
# In case of support EXTRA packages, use it to allow
|
|
||||||
# users add more packages to the base rootfs
|
|
||||||
local EXTRA_PKGS=${EXTRA_PKGS:-}
|
|
||||||
|
|
||||||
#PATH where files this script is placed
|
|
||||||
#Use it to refer to files in the same directory
|
|
||||||
#Exmaple: ${CONFIG_DIR}/foo
|
|
||||||
local CONFIG_DIR=${CONFIG_DIR}
|
|
||||||
|
|
||||||
# Populate ROOTFS_DIR
|
|
||||||
# Must provide /sbin/init and /bin/${BIN_AGENT}
|
|
||||||
if [ -e "$ROOTFS_DIR" ] && ! [ -z "$(ls -A $ROOTFS_DIR)" ]; then
|
|
||||||
echo "ERROR: $ROOTFS_DIR is not empty"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
local addPackages=""
|
|
||||||
for p in $PACKAGES $EXTRA_PKGS; do
|
|
||||||
addPackages+=" --add-package=$p"
|
|
||||||
done
|
|
||||||
|
|
||||||
# set-repo format: <source,type,alias,priority,imageinclude,package_gpgcheck>
|
|
||||||
# man kiwi::system::build for details
|
|
||||||
local setRepo=" --set-repo $REPO_URL,rpm-md,$OS_IDENTIFIER,99,false,false"
|
|
||||||
|
|
||||||
# Workaround for zypper slowdowns observed when running inside
|
|
||||||
# a container: see https://github.com/openSUSE/zypper/pull/209
|
|
||||||
# The fix is upstream but it will take a while before landing
|
|
||||||
# in Leap
|
|
||||||
ulimit -n 1024
|
|
||||||
kiwi system prepare \
|
|
||||||
--description $CONFIG_DIR \
|
|
||||||
--allow-existing-root \
|
|
||||||
--root $ROOTFS_DIR \
|
|
||||||
$addPackages \
|
|
||||||
$setRepo
|
|
||||||
install -d $ROOTFS_DIR/lib/systemd
|
|
||||||
ln -s /usr/lib/systemd/systemd $ROOTFS_DIR/lib/systemd/systemd
|
|
||||||
}
|
|
@ -120,7 +120,7 @@ assets:
|
|||||||
name: "ubuntu"
|
name: "ubuntu"
|
||||||
version: "latest"
|
version: "latest"
|
||||||
ppc64le:
|
ppc64le:
|
||||||
name: "centos"
|
name: "ubuntu"
|
||||||
version: "latest"
|
version: "latest"
|
||||||
s390x:
|
s390x:
|
||||||
name: "ubuntu"
|
name: "ubuntu"
|
||||||
|
Loading…
Reference in New Issue
Block a user