You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

260 lines
9.0 KiB

# This is the default configuration used by mender-convert. You can override
# any option specified here by providing your own configuration file using the
# '--config' argument.
#
# NOTE! This file will always be sourced.
# Compress generated disk image
#
# This is useful when you have large disk images, compressing them
# makes it easier to transfer them between e.g an build server and a local
# machine, and obviously saves space.
#
# Possible values are:
# 'none' - No compression
# 'gzip' - Compress with gzip
# 'lzma' - Compress with xz (LZMA)
MENDER_COMPRESS_DISK_IMAGE=gzip
# Compression algorithm for Mender Artifact
#
# Supported values are: lzma, gzip (default), none
#
# LZMA will produce a smaller Mender Artifact (2-3x) but will significantly
# increase time spent generating the Mender Artifact (10x)
MENDER_ARTIFACT_COMPRESSION="gzip"
# Enable Mender systemd server
#
# You want this enabled if you want the Mender client to operate in managed mode
# and connect to a server. If you are not interested connecting to a server
# and will only be running standalone mode updates, then you can safely disable
# this.
MENDER_ENABLE_SYSTEMD=y
# Custom mkfs options for creating the rootfs partition
MENDER_ROOT_PART_MKFS_OPTS=""
# Set the fstab options for mounting the root partition
MENDER_ROOT_PART_FSTAB_OPTS="defaults"
# Set to 0 to disable fsck; recommended for read-only rootfs
MENDER_ROOT_PART_FS_PASSNO="1"
# Set the fstab options for mounting the data partition
MENDER_DATA_PART_FSTAB_OPTS="defaults"
# Custom mkfs options for creating the data partition
MENDER_DATA_PART_MKFS_OPTS=""
# The file system will be grown to occupy the full block device. If the file
# system is already at maximum size, no action will be performed.
#
# This feature is utilizing x−systemd.growfs and will only work on systemd 242
# and newer and nothing will be done if an older systemd version is used.
MENDER_DATA_PART_GROWFS=y
# The name of the image or update that will be built. This is what the device
# will report that it is running, and different updates must have different
# names.
#
# This variable must be defined or the build will fail, but you should not
# set it in a configuration file and instead it should be an input to the
# mender-convert tool, e.g
#
# MENDER_ARTIFACT_NAME="release-1" ./mender-convert
#
#MENDER_ARTIFACT_NAME=""
# A string that defines the type of device this image will be installed on and
# this value is used for compatibility checks between Mender Artifact and
# what the device is reporting.
#
# You can define multiple types by providing a space separated string of device
# types.
#
# It defaults to the content of '/etc/hostname', which is extracted from the
# input disk image
MENDER_DEVICE_TYPE=""
# A string that defines the filenames of the deployed files.This is optional.
# If no DEPLOY_IMAGE_NAME is defined the filenames will be a combination off
# the date and the names of all DEVICE_TYPES.
# These will be seperated with a +.
DEPLOY_IMAGE_NAME=""
# The partition scheme to use for the converted image.
# To override set this to "gpt" or "dos" (the scheme names used by fdisk and partx).
# By default mender-convert will use the partition scheme from the input image.
MENDER_PARTITION_SCHEME=""
# Total size of the physical storage medium that mender partitioned images
# will be written to, expressed in MiB. The size of rootfs partition will be
# calculated automatically by subtracting the sizes of boot
# (see MENDER_BOOT_PART_SIZE_MB) and data partitions
# (see MENDER_DATA_PART_SIZE_MB).
#
MENDER_STORAGE_TOTAL_SIZE_MB="8192"
# The size of the boot partition in the generated .biosimg, .sdimg or .uefiimg
# file.
MENDER_BOOT_PART_SIZE_MB="40"
# The size of the persistent data partition in the generated .biosimg, .sdimg
# or .uefiimg file.
#
# You rarely need to increase this number as this partition will be expanded
# on first boot to occupy the renaming free blocks on the physical storage.
MENDER_DATA_PART_SIZE_MB="128"
# Alignment of partitions used when building partitioned images, expressed in
# bytes
#
# Default is 8MB
MENDER_PARTITION_ALIGNMENT="8388608"
# Mender client version
#
# This is used to fetch the correct binaries
#
# Valid values are "latest" (default), "master" or a specific version
MENDER_CLIENT_VERSION="latest"
# Install Mender Connect addon
#
MENDER_ADDON_CONNECT_INSTALL="n"
# Mender Connect addon version
#
# Valid values are "latest" (default), "master" or a specific version
MENDER_ADDON_CONNECT_VERSION="latest"
# Install Mender Connect addon
#
MENDER_ADDON_CONFIGURE_INSTALL="n"
# Mender Configure addon version
#
# Valid values are "latest" (default), "master" or a specific version
#MENDER_ADDON_CONFIGURE_VERSION="latest"
MENDER_ADDON_CONFIGURE_VERSION="master"
# File storage, containing binary files, do not modify this unless you know
# what you are doing.
MENDER_STORAGE_URL="https://downloads.mender.io"
# Mender APT repo, containing binary files, do not modify this unless you know
# what you are doing.
MENDER_APT_REPO_URL="${MENDER_STORAGE_URL}/repos/debian"
# Mender GitHub organization URL prefix
MENDER_GITHUB_ORG="https://github.com/mendersoftware"
# Device file corresponding to the root filesystem partitions, without number.
MENDER_STORAGE_DEVICE_BASE=/dev/mmcblk0p
# Partition number of boot partition
MENDER_BOOT_PART_NUMBER="1"
# Partition number of root filesystem A
MENDER_ROOTFS_PART_A_NUMBER="2"
# Partition number of root filesystem B
MENDER_ROOTFS_PART_B_NUMBER="3"
# Partition number of persistent data partition
MENDER_DATA_PART_NUMBER="4"
# Use partition uuids rather than device and partition numbers
MENDER_ENABLE_PARTUUID="n"
# Partition used as the boot partition.
MENDER_BOOT_PART=""
# Partition used as the first (A) rootfs partition.
MENDER_ROOTFS_PART_A=""
# Partition used as the first (B) rootfs partition.
MENDER_ROOTFS_PART_B=""
# Partition used as the persistent data partition.
MENDER_DATA_PART=""
# Basename of DTB that should be loaded by the bootloader.
MENDER_DTB_NAME=kernel.dtb
# Generate bmap index files
#
# https://github.com/intel/bmap-tools
MENDER_USE_BMAP="n"
# Copy the boot gap, which is the area from sector 1 until first parition,
# this is done because some images might contain the bootloader embedded here
# and we need to copy the bootloader to the output image.
#
# In most cases you would like this enabled.
MENDER_COPY_BOOT_GAP="y"
# The size of each of the two rootfs filesystems, in KiB. If this is 0,
# mender-convert will use the size of the filesystem content as a basis. If the
# value is -1, mender-convert will use the maximum size that will fit inside the
# created partition. The size is further modified by IMAGE_ROOTFS_EXTRA_SPACE
# and IMAGE_OVERHEAD_FACTOR.
#
# This variable directly mirrors the variable from the Yocto Project, which is
# why it is missing a "MENDER_" prefix.
IMAGE_ROOTFS_SIZE="0"
# The amount of extra free space requested on the rootfs, in KiB. This is added
# to the value of IMAGE_ROOTFS_SIZE. The size is further modified by
# IMAGE_OVERHEAD_FACTOR.
#
# Note that due to reserved space for the root user on the filesystem, "df" may
# report a significantly lower number than requested. A more accurate number can
# be fetched using for example "dumpe2fs" and looking for the "Free blocks"
# field, but even this value is usually going to be lower than requested due to
# meta data on the filesystem.
#
# This variable directly mirrors the variable from the Yocto Project, which is
# why it is missing a "MENDER_" prefix.
IMAGE_ROOTFS_EXTRA_SPACE="0"
# This factor is multiplied by the used space value for the generated rootfs,
# and if the result is larger than IMAGE_ROOTFS_SIZE + IMAGE_ROOTFS_EXTRA_SPACE,
# it will be used as the size of the rootfs instead of the other two variables.
#
# The actual free space will usually be lower than requested. See comment for
# IMAGE_ROOTFS_EXTRA_SPACE.
#
# This variable directly mirrors the variable from the Yocto Project, which is
# why it is missing a "MENDER_" prefix.
IMAGE_OVERHEAD_FACTOR="1.5"
source configs/mender_grub_config
# Function to create Mender Artifact
#
# This function is defined here, to allow it to be overridden which can be
# achieved by providing this function in a custom configuration file which will
# take precedence of this one.
#
# You might want to override this to e.g provide state-scripts or providing
# a private key to sign your artifact.
mender_create_artifact() {
local -r device_types="${1}"
local -r artifact_name="${2}"
local -r image_name="${3}"
local -r all_device_types="$(for device_type in $device_types; do echo " --device-type $device_type"; done)"
mender_artifact=deploy/${image_name}.mender
log_info "Writing Mender artifact to: ${mender_artifact}"
log_info "This can take up to 20 minutes depending on which compression method is used"
run_and_log_cmd "mender-artifact --compression ${MENDER_ARTIFACT_COMPRESSION} \
write rootfs-image \
--file work/rootfs.img \
--output-path ${mender_artifact} \
--artifact-name ${artifact_name} \
${all_device_types}"
}