summaryrefslogtreecommitdiff
path: root/system/easy-kernel/APKBUILD
blob: 8180307f5159e6c0c68598156b2e2560e98a8ba5 (plain) (blame)
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# Contributor: A. Wilcox <awilfox@adelielinux.org>
# Maintainer: Adelie Platform Group <adelie-devel@lists.adelielinux.org>
# KEEP THIS IN SYNC with the other easy-kernel packages.
_kflavour=""
_pkgname=easy-kernel$_kflavour
pkgver=4.14.88
pkgrel=13
pkgname=$_pkgname-$pkgver-mc$pkgrel
pkgdesc="The Linux kernel, packaged for your convenience"
url="https://kernel.org/"
arch="all"
options="!check !dbg !strip !tracedeps"
license="GPL-2.0-only"
depends=""
makedepends="bc gzip kmod lzop openssl-dev xz"
provides="easy-kernel$_kflavour=$pkgver-r$pkgrel"
subpackages="$_pkgname-modules-$pkgver-mc$pkgrel:modules
	$_pkgname-src-$pkgver-mc$pkgrel:src
	linux-headers:headers"
_pkgmajver=${pkgver%%.*}
_pkgminver=${pkgver%.*}
source="https://cdn.kernel.org/pub/linux/kernel/v${_pkgmajver}.x/linux-${_pkgminver}.tar.xz
	https://distfiles.adelielinux.org/source/linux-${_pkgminver}-mc$pkgrel.patch.xz
	0502-muqss-smt-fix.patch
	ast-endianness.patch
	config-ppc64
	config-ppc
	config-x86_64
	config-pmmx
	config-aarch64
	config-sparc64
	config-m68k
	futex-cmpxchg.patch
	kernel.h
	ppc64-epapr-gcc8.patch
	uapi-ether.patch
	"
builddir="$srcdir/linux-${_pkgminver}"

prepare() {
	cd "$srcdir"
	cat linux-${_pkgminver}-mc$pkgrel.patch.xz | unxz -> linux-${_pkgminver}-mc$pkgrel.patch
	patch -Np1 -d "$builddir" <linux-${_pkgminver}-mc$pkgrel.patch
	default_prepare
	cd "$srcdir"
	cp config-$CARCH linux-${_pkgminver}/.config
	cp -pr linux-${_pkgminver} linux-src
}

build() {
	cd "$builddir"
	make LDFLAGS=""

	cd "$srcdir/linux-src"
	make LDFLAGS="" modules_prepare clean
	cp "$builddir/Module.symvers" .

	# Kernel bug: crtsavres.o is required to build modules, but modules_prepare doesn't create it.
	if [ $CARCH = ppc ]; then
		cp "$builddir/arch/powerpc/lib/crtsavres.o" arch/powerpc/lib/
	fi
}

package() {
	cd "$builddir"
	mkdir -p "$pkgdir"/boot
	make INSTALL_PATH="$pkgdir"/boot \
		INSTALL_MOD_PATH="$pkgdir" \
		install modules_install

	if [ -f "$pkgdir"/boot/vmlinuz ]; then
		mv "$pkgdir"/boot/vmlinuz \
			"$pkgdir"/boot/vmlinuz-$pkgver-mc$pkgrel-easy$_kflavour
	fi
	if [ -f "$pkgdir"/boot/vmlinux ]; then
		mv "$pkgdir"/boot/vmlinux \
			"$pkgdir"/boot/vmlinux-$pkgver-mc$pkgrel-easy$_kflavour
	fi

	if [ -f "$pkgdir"/boot/System.map ]; then
		mv "$pkgdir"/boot/System.map \
			"$pkgdir"/boot/System.map-$pkgver-mc$pkgrel-easy$_kflavour
	fi

	case $CARCH in
	aarch64|arm*)	make INSTALL_PATH="$pkgdir"/boot dtbs_install ;;
	esac

	install -D "$builddir"/include/config/kernel.release \
		"$pkgdir"/usr/share/kernel/easy-$pkgver-mc$pkgrel$_kflavour/kernel.release
}

modules() {
	pkgdesc="Modules / device drivers for easy-kernel"
	provides="easy-kernel$_kflavour-modules=$pkgver-r$pkgrel"
	autodeps=0  # modules should not depend on src just for symlink
	mkdir -p "$subpkgdir"/lib
	mv "$pkgdir"/lib/modules "$subpkgdir"/lib/
	rm "$subpkgdir"/lib/modules/$pkgver-mc$pkgrel-easy$_kflavour/build
	rm "$subpkgdir"/lib/modules/$pkgver-mc$pkgrel-easy$_kflavour/source
	ln -s "../../../usr/src/linux-$pkgver-mc$pkgrel$_kflavour" \
		"$subpkgdir"/lib/modules/$pkgver-mc$pkgrel-easy$_kflavour/build
	ln -s "../../../usr/src/linux-$pkgver-mc$pkgrel$_kflavour" \
		"$subpkgdir"/lib/modules/$pkgver-mc$pkgrel-easy$_kflavour/source
}

headers() {
	pkgdesc="System headers provided by the Linux kernel"
	cd "$builddir"
	patch -Np1 -i "$srcdir"/../revert-broken-uapi.patch

	mkdir -p "$subpkgdir"/usr
	make headers_install INSTALL_HDR_PATH="$subpkgdir/usr"

	find "$subpkgdir/usr" \( -name .install -o -name ..install.cmd \) -exec \
		rm -f {} \;

	# provided by libdrm
	rm -rf "$subpkgdir"/usr/include/drm

	# needed for spl, VMware on x86, etc
	install -D -m644 "$builddir"/include/generated/utsrelease.h \
		"$subpkgdir"/usr/include/linux/utsrelease.h

	cp "$srcdir"/kernel.h "$subpkgdir"/usr/include/linux/
}

src() {
	pkgdesc="Kernel source code used to build the kernel"
	provides="easy-kernel$_kflavour-src=$pkgver-r$pkgrel"
	mkdir -p "$subpkgdir"/usr/src
	mv "$srcdir"/linux-src "$subpkgdir"/usr/src/linux-$pkgver-mc$pkgrel$_kflavour
}

sha512sums="77e43a02d766c3d73b7e25c4aafb2e931d6b16e870510c22cef0cdb05c3acb7952b8908ebad12b10ef982c6efbe286364b1544586e715cf38390e483927904d8  linux-4.14.tar.xz
bfe606f208894cc572fb98f323e26956c69b4f75febd4a9b500514cbb2aa70bddb2aba05b3f16a5fe52535236b215335f73974324065f80643265f17f281faa6  linux-4.14-mc13.patch.xz
6ede43cf169e79d8a08f7a9d79bb4bdf15618ec450b42a67a53a75bc5f5cb4d5a8c82d2b95c27a80567999876d103091bc104104f0494ca34707b5ccae5da725  0502-muqss-smt-fix.patch
e41d9111219342ad13367902242444ecdd847a93575c3f9709d6c6a075bc650f4a15be9db1a8798435fc0a0b56d41705829bfe0d2c2d88f8d1c28931e27ef5be  ast-endianness.patch
19be54c3f635cca893b668987e5db6931e48ea8ee55fe8ba2fc9103f3f116346f2227d3dadb9fbf13b3444c7085e5db5785d3161a1544d37254403ca90bc757a  config-ppc64
e9ad73259f2138c1c1506c1627b8f42a525505a1d16ca4cdc1dad4a381a462d9946f2a8191c40ee18fe5010fb8465316d665f60231fb79f0be9cc064eeb82b60  config-ppc
124baf02726630f8ad3c066cdcb5b0273b6c0ce796af70a0913cb447cd452f4dde34b2070c5fe87c312cbe019cb1c1b334ae3049f429cfb3bcdec7267aba89fd  config-x86_64
bb7debbed592c27fd6aceeeab0f92fb878740b34f3c65b7968008c3209924d0daf484509572d350ce2ec757d3a541c50812b30c1a8c3010eaeeac5e560546927  config-pmmx
20d0e09d339d534ce93c156e1e2c630da2bc55e88467481b8e89074773a3ebabba76503a05c51ad07ffa0219953b49f5849f0d9839bfe040dc006506c8adb3bb  config-aarch64
d9e6780c03ce82c7de63e3571d4b1530a2c078db86efb904281b497dae5e46c80696a85f6c82470e47eaafedaf4942c88e910b266dc7ea0be77b8bca25cafe9c  config-sparc64
3fcd139fae7835f8aeea89430e4fda8d93b803abdfeb937f07ce5437362340337849f56e40614e20dc21aa23d522c4702194054e4f6114b3b94685e3a98f0d19  config-m68k
64486a4f53046a69f727cecd8c39400b50c2d2b15e3b5ca8c18b8249d25990f3a872ec064800ba3d190f9d25b4518899b9ea3675920f487108102856d6beb51e  futex-cmpxchg.patch
fdd94b9de7b374f1812dec0f9971c05f5e52177ca4a16c8071daa620c18265b38f656f528e7045a24f30af01f05e53e54546fb0a9e93773cf191866e87de505d  kernel.h
0df4e823e19e8fc379b5ad66192eb3e890daa3dac8d7a9ebbab4cf3c60ce9f15fcc25a54b86b341db53db3d78c928ca5f55933e12eee75680e705cca8a7bdff4  ppc64-epapr-gcc8.patch
af093e91e8c8371629948e2e574f8764078564bc027ba5b2f87886f8827d9a63ba7a43717552fe7e3cc9212b2fd55b8633b12900c3d8cdc6c035d52b389c39e5  uapi-ether.patch"