Commit 824237dd authored by Timo Teräs's avatar Timo Teräs

update-kernel: improve dtb handling

- install dtbs to right place from kernel source trees
- install rpi dtbs to root of boot media (fixes #5884)
- support aarch64
parent 37f3d524
......@@ -153,7 +153,6 @@ if [ -z "$FLAVOR" ]; then
fi
[ "$ARCH" ] || ARCH=$(apk --print-arch)
ARM=$(echo "$ARCH" | grep ^arm || :)
TMPDIR=$(mktemp -d /tmp/$SCRIPT.XXXXXX)
ROOT=$TMPDIR/root
......@@ -195,9 +194,17 @@ extra_pkgs() {
_apk add --initdb --update-cache
if [ "$BUILDDIR" ]; then
local _install
case "$ARCH" in
arm*|aarch64*) _install="zinstall dtbs_install" ;;
*) _install="install" ;;
esac
mkdir -p $BOOT
make -C "$BUILDDIR" ${ARM:+z}install firmware_install modules_install \
INSTALL_MOD_PATH=$ROOT INSTALL_PATH=$BOOT
make -C "$BUILDDIR" $_install firmware_install modules_install \
INSTALL_MOD_PATH=$ROOT \
INSTALL_PATH=$BOOT \
INSTALL_DTBS_PATH='$ROOT/usr/lib/linux-$(KERNELRELEASE)' \
else
if [ -z "$PACKAGES" ]; then
PACKAGES="$(extra_pkgs "dahdi-linux-$FLAVOR" dahdi-linux)
......@@ -211,6 +218,7 @@ _apk add --no-scripts alpine-base $PACKAGES
KVER_FLAVOR=
[ "$FLAVOR" = vanilla ] || KVER_FLAVOR=-$FLAVOR
KVER=$(basename $(ls -d $ROOT/lib/modules/*"$KVER_FLAVOR"))
DTBDIR=$ROOT/usr/lib/linux-$KVER
depmod -b $ROOT "$KVER"
......@@ -236,14 +244,6 @@ for file in System.map config vmlinuz; do
cp "$BOOT/$file$KVER_FLAVOR" $STAGING
done
if [ "$ARM" ]; then
DTBDIR=$ROOT/usr/lib/linux-$KVER
[ "$BUILDDIR" ] && DTBDIR=$BUILDDIR/source/arch/arm/boot/dts
cp -a "$DTBDIR"/* $DTB_STAGING
find "$DTB_STAGING" -type f \! \( -name "*.dtb" -o -name "*.dtbo" \) -delete
fi
if [ "$MNTDIR" ]; then
ignore_sigs
umount /.modloop
......@@ -252,10 +252,18 @@ fi
mv $STAGING/* "$DESTDIR"
if [ "$ARM" ]; then
DTBDIR=$DESTDIR/dtbs
mkdir -p "$DTBDIR"
mv $DTB_STAGING/* "$DTBDIR"
if [ -d "$DTBDIR" ]; then
local _opwd=$PWD
local _dtb
case "$FLAVOR" in
rpi*) _dtb="$DESTDIR" ;;
*) _dtb="$DESTDIR/dtbs" ;;
esac
mkdir -p "$_dtb"
_dtb=$(realpath "$_dtb")
cd "$DTBDIR"
find -type f \( -name "*.dtb" -o -name "*.dtbo" \) | cpio -pudm "$_dtb" 2> /dev/null
cd "$_opwd"
fi
if [ "$MNTDIR" ]; then
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment