summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: eee9f0c0957d5d4251378ca6bb84ec71f6aa04b8 (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
# Maintainer: Jack Chen <redchenjs@live.com>

pkgbase=linux-rockchip
pkgname=('linux-rockchip' 'linux-rockchip-headers')
pkgver=5.8.18
pkgrel=1
pkgdesc="Rockchip Linux kernel and modules from Armbian"
arch=('armv7h')
url="https://github.com/redchenjs/armbian-ci"
license=('GPL2')
makedepends=('curl')
options=('!strip')
_armbian=20.11.0
source=(
    'mkinitcpio.preset'
    "https://github.com/redchenjs/armbian-ci/releases/download/v$pkgver-rockchip/linux-dtb-current-rockchip_$_armbian-trunk_armhf.deb"
    "https://github.com/redchenjs/armbian-ci/releases/download/v$pkgver-rockchip/linux-image-current-rockchip_$_armbian-trunk_armhf.deb"
    "https://github.com/redchenjs/armbian-ci/releases/download/v$pkgver-rockchip/linux-headers-current-rockchip_$_armbian-trunk_armhf.deb"
)
sha512sums=(
    '4e479e5c010c5cd6105b104419bbf1886a60174535d17a34ae457f2744598d0f1c4e2b24dc989c038fa2c51b3d076e0acd3210e1492a87db68b1d43840e11e8a'
    "$(curl -s -L https://github.com/redchenjs/armbian-ci/releases/download/v$pkgver-rockchip/linux-dtb-current-rockchip_$_armbian-trunk_armhf.deb.sha512sum)"
    "$(curl -s -L https://github.com/redchenjs/armbian-ci/releases/download/v$pkgver-rockchip/linux-image-current-rockchip_$_armbian-trunk_armhf.deb.sha512sum)"
    "$(curl -s -L https://github.com/redchenjs/armbian-ci/releases/download/v$pkgver-rockchip/linux-headers-current-rockchip_$_armbian-trunk_armhf.deb.sha512sum)"
)
noextract=("${source[@]##*/}")

prepare() {
    cd "$srcdir"

    rm -rf $(find -mindepth 1 -maxdepth 1 -type d)
}

package_linux-rockchip() {
    optdepends=('mkinitcpio: initramfs support')
    provides=('linux' 'linux-rockchip')

    cd "$srcdir"

    ar x "linux-dtb-current-rockchip_$_armbian-trunk_armhf.deb"
    tar -xf data.tar.xz
    ar x "linux-image-current-rockchip_$_armbian-trunk_armhf.deb"
    tar -xf data.tar.xz

    mkdir -p "$pkgdir/usr"
    mv lib "$pkgdir/usr/lib"

    mkdir -p "$pkgdir/boot"
    mv "boot/dtb-$pkgver-rockchip" "$pkgdir/boot/dtb"

    echo "$pkgbase" > "$pkgdir/usr/lib/modules/$pkgver-rockchip/pkgbase"
    install -Dm644 "boot/vmlinuz-$pkgver-rockchip" "$pkgdir/usr/lib/modules/$pkgver-rockchip/vmlinuz"

    install -Dm644 "mkinitcpio.preset" "$pkgdir/etc/mkinitcpio.d/$pkgbase.preset"
    sed -r -i "s#\\\$pkgbase#$pkgbase#g" "$pkgdir/etc/mkinitcpio.d/$pkgbase.preset"
}

package_linux-rockchip-headers() {
    pkgdesc="Headers and scripts for building modules for the $pkgbase kernel"
    provides=('linux-headers' 'linux-headers-rockchip')

    cd "$srcdir"

    ar x "linux-image-current-rockchip_$_armbian-trunk_armhf.deb"
    tar -xf data.tar.xz
    ar x "linux-headers-current-rockchip_$_armbian-trunk_armhf.deb"
    tar -xf data.tar.xz

    mkdir -p "$pkgdir/usr/lib/modules/$pkgver-rockchip"
    mv "usr/src/linux-headers-$pkgver-rockchip" "$pkgdir/usr/lib/modules/$pkgver-rockchip/build"

    install -Dm644 "boot/config-$pkgver-rockchip" "$pkgdir/usr/lib/modules/$pkgver-rockchip/build/.config"
    install -Dm644 "boot/System.map-$pkgver-rockchip" "$pkgdir/usr/lib/modules/$pkgver-rockchip/build/System.map"

    mkdir -p "$pkgdir/usr/src"
    ln -s "../lib/modules/$pkgver-rockchip/build" "$pkgdir/usr/src/$pkgbase"
}