Skip to content

Commit

Permalink
Implement config driven BSP package modification to set last good ker…
Browse files Browse the repository at this point in the history
…nel for a single device

This will prevent upgrading to higher kernels which are known to be broken.
  • Loading branch information
igorpecovnik committed Aug 24, 2024
1 parent 8f01eea commit 0795847
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tools/repository/repo
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,24 @@ adding_packages() {
return 0
fi
for f in "${4}${2}"/*.deb; do
# If we have a list of last known working kernels, repack BSP files to prevent upgrade to kernel that breaks
if [[ -f userpatches/last-known-good.map ]]; then
PACKAGE_NAME=$(dpkg-deb -W $f | awk '{ print $1 }')
for g in $(cat userpatches/last-known-good-kernel-pkg.map); do
# Read values from file
BOARD=$(echo $g | cut -d"|" -f1);
BRANCH=$(echo $g | cut -d"|" -f2);
LINUXFAMILY=$(echo $g | cut -d"|" -f3)
LASTKERNEL=$(echo $g | cut -d"|" -f4);
if [[ ${PACKAGE_NAME} == "armbian-bsp-cli-${BOARD}-${BRANCH}" ]]; then
echo "Setting last kernel upgrade for $BOARD to linux-image-$BRANCH-$BOARD=${LASTKERNEL}"
tempdir=$(mktemp -d)
dpkg-deb -R $f $tempdir
sed -i '/^Replaces:/ s/$/, linux-image-'$BRANCH'-'$LINUXFAMILY' (>> '$LASTKERNEL'), linux-dtb-'$BRANCH'-'$LINUXFAMILY' (>> '$LASTKERNEL')/' $tempdir/DEBIAN/control
dpkg-deb -b $tempdir ${f} >/dev/null
fi
done
fi
aptly repo add -remove-files -force-replace -config="${CONFIG}" "${1}" "${f}"
done
}
Expand Down

0 comments on commit 0795847

Please sign in to comment.