aboutsummaryrefslogtreecommitdiffstats
path: root/main/alpine-conf/0003-update-kernel-improve-dtb-handling.patch
blob: a39c95a1fa1a7f943bd9879f19831aeb017e089d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
From 824237dd105fd91bf3bdbe860c8a1908f30937d7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
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