blob: 9a34030fb0515b899f411591b75d7a52a2c43818 (
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
# Maintainer: Vladimir Stoiakin <VStoiakin at lavabit dot com>
pkgbase=linux-librem5
pkgname=(
"$pkgbase"
"$pkgbase-docs"
)
pkgver=6.6.57
pkgrel=1
pkgdesc='The Linux kernel for Purism Librem 5'
url='https://source.puri.sm/Librem5/linux'
arch=('aarch64')
license=(GPL-2.0-only)
makedepends=(
bc
cpio
gettext
libelf
pahole
perl
python
tar
xz
# htmldocs
graphviz
imagemagick
python-sphinx
python-yaml
texlive-latexextra
)
options=(
!debug
!strip
)
_purismver=6.6.57pureos1
source=(
https://source.puri.sm/Librem5/linux/-/archive/pureos/$_purismver/linux-pureos-$_purismver.tar.gz
config
)
sha256sums=(
'8fd29740f6c83e11de585dd30b90a45a61ad7af2688263ad79c88aec366794ac'
'SKIP'
)
b2sums=(
'd40784d312ff5da95136828a257d937b77985df936cf72e3c73e5cbda558c29b53db3acca6b7fd9cee0d973eb695e999c836ea78d9d144b681ac85b6af749d8b'
'SKIP'
)
export ARCH=arm64
export KBUILD_BUILD_HOST=archlinux
export KBUILD_BUILD_USER=$pkgbase
if [[ $(uname -m) != 'aarch64' ]]; then
makedepends+=( aarch64-linux-gnu-gcc )
export CARCH=aarch64
export CROSS_COMPILE=aarch64-linux-gnu-
fi
export KCFLAGS="-mtune=cortex-a53"
prepare() {
cd linux-pureos-$_purismver
echo "Setting version..."
echo "-$pkgrel" > localversion.10-pkgrel
echo "Setting config..."
diff -u ../config arch/arm64/configs/librem5_defconfig || :
cp ../config arch/arm64/configs/librem5_defconfig
make librem5_defconfig
make -s kernelrelease > version
echo "Prepared $pkgbase version $(<version)"
}
build() {
cd linux-pureos-$_purismver
make all
make htmldocs
}
package_linux-librem5() {
depends=(
coreutils
initramfs
kmod
)
optdepends=(
'wireless-regdb: to set the correct wireless channels of your country'
'linux-firmware: firmware images needed for some devices'
)
cd linux-pureos-$_purismver
local modulesdir="$pkgdir/usr/lib/modules/$(<version)"
echo "Installing boot image..."
# systemd expects to find the kernel here to allow hibernation
# https://github.com/systemd/systemd/commit/edda44605f06a41fb86b7ab8128dcf99161d2344
install -Dm644 "$(make -s image_name)" "$modulesdir/vmlinuz"
# Used by mkinitcpio to name the kernel
echo "$pkgbase" | install -Dm644 /dev/stdin "$modulesdir/pkgbase"
echo "Installing modules..."
ZSTD_CLEVEL=19 make INSTALL_MOD_PATH="$pkgdir/usr" INSTALL_MOD_STRIP=1 \
DEPMOD=/doesnt/exist modules_install # Suppress depmod
echo "Installing DTBs..."
install -Dm644 -t "$pkgdir/boot" "arch/arm64/boot/dts/freescale/imx8mq-librem5-r"*".dtb"
# remove build link
rm "$modulesdir"/build
}
package_linux-librem5-docs() {
pkgdesc="$pkgdesc (documentation)"
cd linux-pureos-$_purismver
local builddir="$pkgdir/usr/lib/modules/$(<version)/build"
echo "Installing documentation..."
local src dst
while read -rd '' src; do
dst="${src#Documentation/}"
dst="$builddir/Documentation/${dst#output/}"
install -Dm644 "$src" "$dst"
done < <(find Documentation -name '.*' -prune -o ! -type d -print0)
echo "Adding symlink..."
mkdir -p "$pkgdir/usr/share/doc"
ln -sr "$builddir/Documentation" "$pkgdir/usr/share/doc/$pkgbase"
}
|