Bump buildroot to 2020.11-rc1 (#985)

* Update buildroot-patches for 2020.11-rc1 buildroot

* Update buildroot to 2020.11-rc1

Signed-off-by: Stefan Agner <stefan@agner.ch>

* Don't rely on sfdisk --list-free output

The --list-free (-F) argument does not allow machine readable mode. And
it seems that the output format changes over time (different spacing,
using size postfixes instead of raw blocks).

Use sfdisk json output and calculate free partition space ourselfs. This
works for 2.35 and 2.36 and is more robust since we rely on output which
is meant for scripts to parse.

* Migrate defconfigs for Buildroot 2020.11-rc1

In particular, rename BR2_TARGET_UBOOT_BOOT_SCRIPT(_SOURCE) to
BR2_PACKAGE_HOST_UBOOT_TOOLS_BOOT_SCRIPT(_SOURCE).

* Rebase/remove systemd patches for systemd 246

* Drop apparmor/libapparmor from buildroot-external

* hassos-persists: use /run as directory for lockfiles

The U-Boot tools use /var/lock by default which is not created any more
by systemd by default (it is under tmpfiles legacy.conf, which we no
longer install).

* Disable systemd-update-done.service

The service is not suited for pure read-only systems. In particular the
service needs to be able to write a file in /etc and /var. Remove the
service. Note: This is a static service and cannot be removed using
systemd-preset.

* Disable apparmor.service for now

The service loads all default profiles. Some might actually cause
problems. E.g. the profile for ping seems not to match our setup for
/etc/resolv.conf:
[85503.634653] audit: type=1400 audit(1605286002.684:236): apparmor="DENIED" operation="open" profile="ping" name="/run/resolv.conf" pid=27585 comm="ping" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
This commit is contained in:
Stefan Agner
2020-11-13 18:25:44 +01:00
committed by GitHub
parent 25a0dd3082
commit a0871be6c0
4024 changed files with 68095 additions and 47900 deletions

View File

@@ -0,0 +1 @@
disable apparmor.service

View File

@@ -1,23 +1,44 @@
#!/bin/sh
# shellcheck disable=SC2039
# ==============================================================================
# HassOS partition expander
# ==============================================================================
set -e
DEVICE_CHILD="$(findfs LABEL="hassos-data")"
DEVICE_ROOT="/dev/$(lsblk -no pkname "${DEVICE_CHILD}")"
PART_NUM="${DEVICE_CHILD: -1}"
DEVICE_CHILD_NAME="$(basename "${DEVICE_CHILD}")"
DEVICE_ROOT_NAME="$(lsblk -no pkname "${DEVICE_CHILD}")"
DEVICE_ROOT="/dev/${DEVICE_ROOT_NAME}"
PART_NUM="$(cat "/sys/class/block/${DEVICE_CHILD_NAME}/partition")"
# Need resize
UNUSED=$(sfdisk -Fq "${DEVICE_ROOT}" | cut -d " " -f 3 | tail -1)
if [ -z "${UNUSED}" ] || [ "${UNUSED}" -le "16384" ]; then
# Get partition label type
PART_TABLE="$(sfdisk -lqJ "${DEVICE_ROOT}")"
PART_LABEL="$(echo "${PART_TABLE}" | jq -r '.partitiontable.label')"
if [ "${PART_LABEL}" = "gpt" ]; then
echo "[INFO] Detected GPT partition label"
# We cannot use .partitiontable.lastlba from the json output as we might
# still have the backup GPT not at the end of the disk. Calculate last
# usable LBA using disk size
LAST_USABLE_LBA=$(( $(cat "/sys/class/block/${DEVICE_ROOT_NAME}/size") - 34 ))
else
echo "[INFO] Detected MBR partition label"
LAST_USABLE_LBA=$(cat "/sys/class/block/${DEVICE_ROOT_NAME}/size")
fi
# Calculate end of data partition
JQ_FILTER=".partitiontable.partitions[] | select ( .node == \"${DEVICE_CHILD}\" ) | .start + .size"
DATA_PARTITION_END="$(echo "${PART_TABLE}" | jq "${JQ_FILTER}")"
# Need resize? Ignore everything less than 8MB since that could be partition
# alignment rounding...
UNUSED_BLOCKS=$(( LAST_USABLE_LBA - DATA_PARTITION_END ))
if [ "${UNUSED_BLOCKS}" -le "16384" ]; then
echo "[INFO] No resize of data partition needed"
exit 0
fi
echo "[INFO] Update hassos-data partition ${PART_NUM}"
if sfdisk -dq "${DEVICE_ROOT}" | grep -q 'label: gpt'; then
if [ "${PART_LABEL}" = "gpt" ]; then
sgdisk -e "${DEVICE_ROOT}"
sgdisk -d "${PART_NUM}" \
-n "${PART_NUM}:0:0" \

View File

@@ -8,9 +8,9 @@ MACHINE_ID=$(cat /etc/machine-id)
if [ -e /usr/sbin/fw_setenv ]; then
# machine-id
if [ "$(fw_printenv -n MACHINE_ID)" != "${MACHINE_ID}" ]; then
if [ "$(fw_printenv -l /run -n MACHINE_ID)" != "${MACHINE_ID}" ]; then
echo "[INFO] set machine-id to ${MACHINE_ID}"
fw_setenv MACHINE_ID "${MACHINE_ID}"
fw_setenv -l /run MACHINE_ID "${MACHINE_ID}"
else
echo "[INFO] machine-id is okay"
fi