From 824237dd105fd91bf3bdbe860c8a1908f30937d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20Ter=C3=A4s?= Date: Thu, 14 Jul 2016 06:12:30 +0000 Subject: [PATCH 3/6] 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 --- update-kernel.in | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/update-kernel.in b/update-kernel.in index 5b8f6f3..57f51de 100644 --- a/update-kernel.in +++ b/update-kernel.in @@ -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 -- 2.9.3