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.
 
 
 
 

66 lines
2.5 KiB

# Real life SD cards typically have less than they advertise. First off, they
# often use a base of 1000 instead of 1024, and even then they are often smaller
# than advertised. The number below is based on a conservative target of 7.9GB
# (that's mathematical GB, base 1000), converted to MiB, rounding down.
MENDER_STORAGE_TOTAL_SIZE_MB=7534
# Use all there is, which gets us almost, but not quite, to 500MiB free space
# (about 480MiB at the time of writing).
IMAGE_ROOTFS_SIZE=-1
IMAGE_ROOTFS_EXTRA_SPACE=0
IMAGE_OVERHEAD_FACTOR=1.0
# Best compression there is!
MENDER_COMPRESS_DISK_IMAGE=lzma
# MEN-4256: Do not install the mender-client by default in our images
MENDER_CLIENT_INSTALL="n"
#
# Resize the data partition to fill the remaining space, using parted, with systemd
#
function grow_data_partition() {
log_info "Adding systemd init script to run parted and resize the data partition on boot"
log_info "to fill all the available space on the storage media"
run_and_log_cmd "sudo mkdir -p work/rpi/etc/systemd/system/"
run_and_log_cmd "sudo mkdir -p work/rootfs/etc/systemd/system/data.mount.wants/"
cat <<- EOF > work/rpi/etc/systemd/system/mender-grow-data.service
[Unit]
Description=Mender service to grow data partition size
DefaultDependencies=no
Before=data.mount
Before=systemd-growfs@data.service
[Service]
Type=oneshot
User=root
Group=root
ExecStart=/sbin/parted --script /dev/mmcblk0 resizepart ${MENDER_DATA_PART_NUMBER} 100%
[Install]
WantedBy=data.mount
EOF
# Install
run_and_log_cmd "cp work/rpi/etc/systemd/system/mender-grow-data.service \
work/rootfs/etc/systemd/system/"
run_and_log_cmd "ln -sf work/rootfs/etc/systemd/system/mender-grow-data.service \
work/rootfs/etc/systemd/system/data.mount.wants/"
}
PLATFORM_MODIFY_HOOKS+=(grow_data_partition)
#
# Allow APT Suite change in the release info
#
# Upstream repository http://raspbian.raspberrypi.org/raspbian has changed buster
# release suite from "stable" to "oldstable". The following configuration option
# allows APT to update without user interaction.
# This is the default un newer versions of apt, see:
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=931566
#
function apt_allow_release_change_suite() {
run_and_log_cmd "echo 'Acquire::AllowReleaseInfoChange::Suite \"true\";' \
| sudo tee work/rootfs/etc/apt/apt.conf.d/99release-change-suite"
}
PLATFORM_MODIFY_HOOKS+=(apt_allow_release_change_suite)