PKGBUILD 16.6 KB
Newer Older
Dan Johansen's avatar
Dan Johansen committed
1
# AArch64 multi-platform
Dan Johansen's avatar
Dan Johansen committed
2
# Maintainer: Dan Johansen <strit@manjaro.org>
Dan Johansen's avatar
Dan Johansen committed
3
# Contributor: Kevin Mihelich <kevin@archlinuxarm.org>
Dan Johansen's avatar
Dan Johansen committed
4

Dan Johansen's avatar
Dan Johansen committed
5
pkgbase=linux
Dan Johansen's avatar
Dan Johansen committed
6
_srcname=linux-5.14
Dan Johansen's avatar
Dan Johansen committed
7
8
_kernelname=${pkgbase#linux}
_desc="AArch64 multi-platform"
Dan Johansen's avatar
Dan Johansen committed
9
pkgver=5.14.0
Dan Johansen's avatar
Dan Johansen committed
10
pkgrel=3
Dan Johansen's avatar
Dan Johansen committed
11
12
13
arch=('aarch64')
url="http://www.kernel.org/"
license=('GPL2')
14
makedepends=('xmlto' 'docbook-xsl' 'kmod' 'inetutils' 'bc' 'git' 'dtc')
Dan Johansen's avatar
Dan Johansen committed
15
options=('!strip')
16
source=("http://www.kernel.org/pub/linux/kernel/v5.x/${_srcname}.tar.xz"
Dan Johansen's avatar
Dan Johansen committed
17
        #"http://www.kernel.org/pub/linux/kernel/v5.x/patch-${pkgver}.xz"
Dan Johansen's avatar
Dan Johansen committed
18
        '0001-net-smsc95xx-Allow-mac-address-to-be-set-as-a-parame.patch'
Dan Johansen's avatar
Dan Johansen committed
19
        '0002-arm64-dts-amlogic-add-support-for-Radxa-Zero.patch'
Dan Johansen's avatar
Dan Johansen committed
20
21
22
23
24
25
        '0003-arm64-dts-allwinner-add-hdmi-sound-to-pine-devices.patch'
        '0004-arm64-dts-allwinner-add-ohci-ehci-to-h5-nanopi.patch'
        '0005-drm-bridge-analogix_dp-Add-enable_psr-param.patch'
        '0006-gpu-drm-add-new-display-resolution-2560x1440.patch'
        '0007-nuumio-panfrost-Silence-Panfrost-gem-shrinker-loggin.patch'
        '0008-arm64-dts-rockchip-Add-Firefly-Station-p1-support.patch'
Dan Johansen's avatar
Dan Johansen committed
26
27
28
        '0009-typec-displayport-some-devices-have-pin-assignments-reversed.patch' #Not upstreamable
        '0010-usb-typec-add-extcon-to-tcpm.patch' #Not upstreamable #requires cdn_dp to be enabled
        '0011-arm64-rockchip-add-DP-ALT-rockpro64.patch' #Not upstreamable
Dan Johansen's avatar
Dan Johansen committed
29
30
        '0012-ayufan-drm-rockchip-add-support-for-modeline-32MHz-e.patch'
        '0013-rk3399-rp64-pcie-Reimplement-rockchip-PCIe-bus-scan-delay.patch'
Dan Johansen's avatar
Dan Johansen committed
31
32
33
34
35
36
37
38
        '0014-phy-rockchip-typec-Set-extcon-capabilities.patch' #Needs tcpm patch 0012 #Not upstreamable
        '0015-usb-typec-altmodes-displayport-Add-hacky-generic-altmode.patch' #Not upstreamable
        '0016-arm64-dts-rockchip-add-typec-extcon-hack.patch' #Not upstreamable
        '0017-arm64-dts-rockchip-setup-USB-type-c-port-as-dual-data-role.patch' #Applied in linux-next
        '0018-drm-meson-add-YUV422-output-support.patch'
        '0019-arm64-dts-meson-add-initial-Beelink-GT1-Ultimate-dev.patch'
        '0020-add-ugoos-device.patch'
        '0021-drm-panfrost-Handle-failure-in-panfrost_job_hw_submit.patch'
39
        '0022-arm64-dts-rockchip-Add-pcie-bus-scan-delay-to-rockpr.patch'
Dan Johansen's avatar
Dan Johansen committed
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
        '0001-Bluetooth-Add-new-quirk-for-broken-local-ext-features.patch'
        '0002-Bluetooth-btrtl-add-support-for-the-RTL8723CS.patch'
        '0003-arm64-allwinner-a64-enable-Bluetooth-On-Pinebook.patch'
        '0004-arm64-dts-allwinner-enable-bluetooth-pinetab-pinepho.patch' #Pinephone part is in linux-next
        '0005-staging-add-rtl8723cs-driver.patch' #Not upstreamable
        '0006-pinetab-accelerometer.patch'
        '0007-enable-jack-detection-pinetab.patch'
        '0008-enable-hdmi-output-pinetab.patch'
        '0009-drm-panel-Adjust-sync-values-for-Feixin-K101-IM2BYL02-panel.patch' #Submitted upstream https://patchwork.kernel.org/project/dri-devel/patch/20210818214818.298089-1-strit@manjaro.org/
        '0001-arm64-dts-rockchip-Add-quartz64-a-dts-from-linux-nex.patch' #Applied in linux-next
        '0002-fixes-and-enablement-for-rk356x.patch' #Applied in linux-next
        '0003-Rockchip-I2S-TDM-controller.patch'
        '0004-Patches-to-update-for-rockchip-spdif.patch' #Applied in linux-next
        '0005-gpio-rockchip-driver.patch' #Applied in linux-next
        '0006-PCI-rockchip-Add-Rockchip-RK356X-host-controller-driver.patch' #Applied in linux-next
        '0007-rockchip-io-domain.patch' #Applied in linux-next
        '0008-dt-bindings-iio-adc-rockchip-saradc-add-description-for-rk3568.patch' #Applied in linux-next
        '0009-power-supply-Add-Support-for-RK817-Charger.patch'
        '0010-dt-bindings-pwm-rockchip-add-description-for-rk3568.patch'
        '0011-phy-rockchip-inno-usb2-support-rk356x-usb2phy.patch'
60
61
62
        'config'
        'linux.preset'
        '60-linux.hook'
Dan Johansen's avatar
Dan Johansen committed
63
        '90-linux.hook')
Dan Johansen's avatar
Dan Johansen committed
64
md5sums=('a082ef5748b813abca0649dab8be5f52'
65
         '9e6b7f44db105fef525d715213dce7cf'
Dan Johansen's avatar
Dan Johansen committed
66
67
         '754cf09a858498e1d98b44baa043a196'
         '0d47dea87f03bf36262171e01889f832'
68
         'e6fe272dc95a1c0a8f871924699fea16'
69
         '9f27b2a05eaeb1995fc0fcf6a8b923c4'
70
         '6f592c11f6adc1de0f06e5d18f8c2862'
71
         'f8f0b124c741be61d86bea8d44e875f9'
72
         '073296b5eba7daf6d707c21abbfc49ce'
Dan Johansen's avatar
Dan Johansen committed
73
         'a033be22c23afb1d5daeeeb21353185d'
Dan Johansen's avatar
Dan Johansen committed
74
         'c02e0fbd88085970a667e86c15fdf364'
75
76
         '09fc19ac5c51e2839ca56248ccf6323a'
         '66fae3fc96f0a478a56ff11632f3ef70'
77
         '245858f26512dfc48adbf509b6fc8364'
78
79
80
         '252b4dbd2d0f560b6d254f29dd5b0f5f'
         'ab9c0c25e2b7272fca3caf491b7dc89c'
         'c706ccdf118f4146e7ca35808d819b8a'
81
         'bb500ee93275583d5ba3d11842e09735'
Dan Johansen's avatar
Dan Johansen committed
82
83
84
85
         '469417b64e6a2bf65bd74c6d9cad2040'
         'c41b101c033ac487c15298bc5a9e95cd'
         '1b92d7617e60d3c525a4b18ab4351185'
         'a90a366662357233db7022f8a1e7ac46'
86
         '6bb2d84857359016b5e0878cf2fc50cc'
87
         'cf64831f27bb47da29e708b7243bb340'
88
         'e3f53e07612939729afaa4dd7ef7f7ce'
Dan Johansen's avatar
Dan Johansen committed
89
         '9510821113c122f91f47b9d0f7ca7264'
90
         'a74fcfa1e085a3a99dcf4f214c1ca65a'
Dan Johansen's avatar
Dan Johansen committed
91
         '4d3adc0015b0e6a9ff88e170e96d3d06'
Dan Johansen's avatar
Dan Johansen committed
92
93
94
         'd0fd6bd627223d4c9fc001ffff9df401'
         'f79300740a7350d2d24ab5e120831b52'
         '979a787cf84bef9c60da78e72ec96550'
Dan Johansen's avatar
Dan Johansen committed
95
96
97
         'b05068c0ae9edbdb39d6678117e8cb05'
         'bae82c4f8f8ee360df7695537d542e0e'
         'a1c29fc4c7ea01af094a5a90c675620b'
98
         'e8adada273680ff94b3f2c5a0e8dce31'
Dan Johansen's avatar
Dan Johansen committed
99
100
101
102
103
104
105
106
         'ea47c01b9dd9a10c1d3332108f6a4868'
         '6338a3a993e86692e1817e1f498bd210'
         'f2203a951a7c3f2444e6618e49da0b93'
         'bca5c0228958767b018b612fb10a6a6d'
         'dec0be99fe374fad3a8650aaf672596e'
         '7659fe53cc58b9a7ed615b49719f7066'
         'ae85e433bc4fd787c20a4df0d07d528b'
         '15b2d6fd96df0a070a8f1b4fc5399b8b'
Dan Johansen's avatar
Dan Johansen committed
107
         'f60bae6f01fcbe2e5ec95580bf46f8e2'
108
109
         '86d4a35722b5410e3b29fc92dae15d4b'
         'ce6c81ad1ad1f8b333fd6077d47abdaf'
Dan Johansen's avatar
Dan Johansen committed
110
         '3dc88030a8f2f5a5f97266d99b149f77')
Dan Johansen's avatar
Dan Johansen committed
111
112

prepare() {
113
  cd ${_srcname}
Dan Johansen's avatar
Dan Johansen committed
114
115

  # add upstream patch
Dan Johansen's avatar
Dan Johansen committed
116
  #patch -Np1 -i "${srcdir}/patch-${pkgver}"
Dan Johansen's avatar
Dan Johansen committed
117
118

  # ALARM patches
119
  patch -Np1 -i "${srcdir}/0001-net-smsc95xx-Allow-mac-address-to-be-set-as-a-parame.patch"             #All
Dan Johansen's avatar
Dan Johansen committed
120
  
121
  # Manjaro ARM Patches
Dan Johansen's avatar
Dan Johansen committed
122
  patch -Np1 -i "${srcdir}/0002-arm64-dts-amlogic-add-support-for-Radxa-Zero.patch"                     #Radxa Zero
Dan Johansen's avatar
Dan Johansen committed
123
124
125
126
127
128
129
130
131
132
133
  patch -Np1 -i "${srcdir}/0003-arm64-dts-allwinner-add-hdmi-sound-to-pine-devices.patch"               #Pine64
  patch -Np1 -i "${srcdir}/0004-arm64-dts-allwinner-add-ohci-ehci-to-h5-nanopi.patch"                   #Nanopi Neo Plus 2
  patch -Np1 -i "${srcdir}/0005-drm-bridge-analogix_dp-Add-enable_psr-param.patch"                      #Pinebook Pro
  patch -Np1 -i "${srcdir}/0006-gpu-drm-add-new-display-resolution-2560x1440.patch"                     #Odroid
  patch -Np1 -i "${srcdir}/0007-nuumio-panfrost-Silence-Panfrost-gem-shrinker-loggin.patch"             #Panfrost
  patch -Np1 -i "${srcdir}/0008-arm64-dts-rockchip-Add-Firefly-Station-p1-support.patch"                #Firelfy Station P1
  patch -Np1 -i "${srcdir}/0009-typec-displayport-some-devices-have-pin-assignments-reversed.patch"     #DP Alt Mode
  patch -Np1 -i "${srcdir}/0010-usb-typec-add-extcon-to-tcpm.patch"                                     #DP Alt Mode
  patch -Np1 -i "${srcdir}/0011-arm64-rockchip-add-DP-ALT-rockpro64.patch"                              #DP Alt mode - RockPro64
  patch -Np1 -i "${srcdir}/0012-ayufan-drm-rockchip-add-support-for-modeline-32MHz-e.patch"             #DP Alt mode
  patch -Np1 -i "${srcdir}/0013-rk3399-rp64-pcie-Reimplement-rockchip-PCIe-bus-scan-delay.patch"        #RockPro64
Dan Johansen's avatar
Dan Johansen committed
134
135
136
137
138
139
  patch -Np1 -i "${srcdir}/0014-phy-rockchip-typec-Set-extcon-capabilities.patch"                       #DP Alt mode
  patch -Np1 -i "${srcdir}/0015-usb-typec-altmodes-displayport-Add-hacky-generic-altmode.patch"         #DP Alt mode
  patch -Np1 -i "${srcdir}/0018-drm-meson-add-YUV422-output-support.patch"                              #G12B
  patch -Np1 -i "${srcdir}/0019-arm64-dts-meson-add-initial-Beelink-GT1-Ultimate-dev.patch"             #Beelink
  patch -Np1 -i "${srcdir}/0020-add-ugoos-device.patch"                                                 #Ugoos
  patch -Np1 -i "${srcdir}/0021-drm-panfrost-Handle-failure-in-panfrost_job_hw_submit.patch"            #AMLogic
140
  patch -Np1 -i "${srcdir}/0022-arm64-dts-rockchip-Add-pcie-bus-scan-delay-to-rockpr.patch"             #RockPro64
Dan Johansen's avatar
Dan Johansen committed
141
  
142
  # Pinebook Pro patches
Dan Johansen's avatar
Dan Johansen committed
143
144
145
  patch -Np1 -i "${srcdir}/0016-arm64-dts-rockchip-add-typec-extcon-hack.patch"                         #DP Alt mode
  patch -Np1 -i "${srcdir}/0017-arm64-dts-rockchip-setup-USB-type-c-port-as-dual-data-role.patch"       #USB-C charging
  
146
  # Pinebook, PinePhone and PineTab patches
Dan Johansen's avatar
Dan Johansen committed
147
148
149
150
151
152
153
154
155
156
157
  patch -Np1 -i "${srcdir}/0001-Bluetooth-Add-new-quirk-for-broken-local-ext-features.patch"            #Bluetooth
  patch -Np1 -i "${srcdir}/0002-Bluetooth-btrtl-add-support-for-the-RTL8723CS.patch"                    #Bluetooth
  patch -Np1 -i "${srcdir}/0003-arm64-allwinner-a64-enable-Bluetooth-On-Pinebook.patch"                 #Bluetooth
  patch -Np1 -i "${srcdir}/0004-arm64-dts-allwinner-enable-bluetooth-pinetab-pinepho.patch"             #Bluetooth
  patch -Np1 -i "${srcdir}/0005-staging-add-rtl8723cs-driver.patch"                                     #Wifi
  patch -Np1 -i "${srcdir}/0006-pinetab-accelerometer.patch"                                            #accelerometer
  patch -Np1 -i "${srcdir}/0007-enable-jack-detection-pinetab.patch"                                    #Audio
  patch -Np1 -i "${srcdir}/0008-enable-hdmi-output-pinetab.patch"                                       #HDMI
  patch -Np1 -i "${srcdir}/0009-drm-panel-Adjust-sync-values-for-Feixin-K101-IM2BYL02-panel.patch"      #Display
  
  # Quartz64 development patches, will probably change alot
Dan Johansen's avatar
Dan Johansen committed
158
159
160
161
162
163
164
165
166
167
168
  #patch -Np1 -i "${srcdir}/0001-arm64-dts-rockchip-Add-quartz64-a-dts-from-linux-nex.patch"             #Main DTS
  #patch -Np1 -i "${srcdir}/0002-fixes-and-enablement-for-rk356x.patch"                                  #Fixes to DTS's
  #patch -Np1 -i "${srcdir}/0003-Rockchip-I2S-TDM-controller.patch"                                      #Analog audio
  #patch -Np1 -i "${srcdir}/0004-Patches-to-update-for-rockchip-spdif.patch"                             #Digital audio
  #patch -Np1 -i "${srcdir}/0005-gpio-rockchip-driver.patch"                                             #GPIO V8
  #patch -Np1 -i "${srcdir}/0006-PCI-rockchip-Add-Rockchip-RK356X-host-controller-driver.patch"          #PCIe
  #patch -Np1 -i "${srcdir}/0007-rockchip-io-domain.patch"                                               #IO Domain
  #patch -Np1 -i "${srcdir}/0008-dt-bindings-iio-adc-rockchip-saradc-add-description-for-rk3568.patch"   #Microphone
  #patch -Np1 -i "${srcdir}/0009-power-supply-Add-Support-for-RK817-Charger.patch"                       #Charger
  #patch -Np1 -i "${srcdir}/0010-dt-bindings-pwm-rockchip-add-description-for-rk3568.patch"              #PWM
  #patch -Np1 -i "${srcdir}/0011-phy-rockchip-inno-usb2-support-rk356x-usb2phy.patch"                    #USB2PHY
Dan Johansen's avatar
Dan Johansen committed
169
  
Dan Johansen's avatar
Dan Johansen committed
170
171
172
173
174
175
176
177
178
179
  cat "${srcdir}/config" > ./.config

  # add pkgrel to extraversion
  sed -ri "s|^(EXTRAVERSION =)(.*)|\1 \2-${pkgrel}|" Makefile

  # don't run depmod on 'make install'. We'll do this ourselves in packaging
  sed -i '2iexit 0' scripts/depmod.sh
}

build() {
180
  cd ${_srcname}
Dan Johansen's avatar
Dan Johansen committed
181
182

  # get kernel version
183
  make prepare
Dan Johansen's avatar
Dan Johansen committed
184
185
186

  # load configuration
  # Configure the kernel. Replace the line below with one of your choice.
187
  #make menuconfig # CLI menu for configuration
Dan Johansen's avatar
Dan Johansen committed
188
189
190
191
192
193
  #make nconfig # new CLI menu for configuration
  #make xconfig # X-based configuration
  #make oldconfig # using old config from previous kernel version
  # ... or manually edit .config

  # Copy back our configuration (use with new kernel version)
194
  #cp ./.config /var/tmp/${pkgbase}.config
Dan Johansen's avatar
Dan Johansen committed
195
196
197
198

  ####################
  # stop here
  # this is useful to configure the kernel
199
200
  #msg "Stopping build"
  #return 1
Dan Johansen's avatar
Dan Johansen committed
201
202
203
204
205
206
  ####################

  #yes "" | make config

  # build!
  unset LDFLAGS
207
  make ${MAKEFLAGS} Image modules
Dan Johansen's avatar
Dan Johansen committed
208
209
  # Generate device tree blobs with symbols to support applying device tree overlays in U-Boot
  make ${MAKEFLAGS} DTC_FLAGS="-@" dtbs
Dan Johansen's avatar
Dan Johansen committed
210
211
212
213
214
215
216
}

_package() {
  pkgdesc="The Linux Kernel and modules - ${_desc}"
  depends=('coreutils' 'linux-firmware' 'kmod' 'mkinitcpio>=0.7')
  optdepends=('crda: to set the correct wireless channels of your country')
  provides=('kernel26' "linux=${pkgver}")
Dan Johansen's avatar
Dan Johansen committed
217
  conflicts=('kernel26' 'linux')
218
  replaces=('linux-armv8' 'linux-aarch64')
Dan Johansen's avatar
Dan Johansen committed
219
220
221
  backup=("etc/mkinitcpio.d/${pkgbase}.preset")
  install=${pkgname}.install

222
  cd ${_srcname}
Dan Johansen's avatar
Dan Johansen committed
223
224
225
226
227
228
229
230

  KARCH=arm64

  # get kernel version
  _kernver="$(make kernelrelease)"
  _basekernel=${_kernver%%-*}
  _basekernel=${_basekernel%.*}

231
232
  mkdir -p "${pkgdir}"/{boot,usr/lib/modules}
  make INSTALL_MOD_PATH="${pkgdir}/usr" modules_install
Dan Johansen's avatar
Dan Johansen committed
233
  make INSTALL_DTBS_PATH="${pkgdir}/boot/dtbs" dtbs_install
234
  cp arch/$KARCH/boot/Image "${pkgdir}/boot"
Dan Johansen's avatar
Dan Johansen committed
235

236
237
238
  # make room for external modules
  local _extramodules="extramodules-${_basekernel}${_kernelname}"
  ln -s "../${_extramodules}" "${pkgdir}/usr/lib/modules/${_kernver}/extramodules"
Dan Johansen's avatar
Dan Johansen committed
239

240
241
242
  # add real version for building modules and running depmod from hook
  echo "${_kernver}" |
    install -Dm644 /dev/stdin "${pkgdir}/usr/lib/modules/${_extramodules}/version"
Dan Johansen's avatar
Dan Johansen committed
243
244

  # remove build and source links
245
  rm "${pkgdir}"/usr/lib/modules/${_kernver}/{source,build}
Dan Johansen's avatar
Dan Johansen committed
246

247
248
  # now we call depmod...
  depmod -b "${pkgdir}/usr" -F System.map "${_kernver}"
Dan Johansen's avatar
Dan Johansen committed
249

250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266

  # sed expression for following substitutions
  local _subst="
    s|%PKGBASE%|${pkgbase}|g
    s|%KERNVER%|${_kernver}|g
    s|%EXTRAMODULES%|${_extramodules}|g
  "

  # install mkinitcpio preset file
  sed "${_subst}" ../linux.preset |
    install -Dm644 /dev/stdin "${pkgdir}/etc/mkinitcpio.d/${pkgbase}.preset"

  # install pacman hooks
  sed "${_subst}" ../60-linux.hook |
    install -Dm644 /dev/stdin "${pkgdir}/usr/share/libalpm/hooks/60-${pkgbase}.hook"
  sed "${_subst}" ../90-linux.hook |
    install -Dm644 /dev/stdin "${pkgdir}/usr/share/libalpm/hooks/90-${pkgbase}.hook"
Dan Johansen's avatar
Dan Johansen committed
267
268
269
270
271
}

_package-headers() {
  pkgdesc="Header files and scripts for building modules for linux kernel - ${_desc}"
  provides=("linux-headers=${pkgver}")
Dan Johansen's avatar
Dan Johansen committed
272
  conflicts=('linux-headers')
273
  replaces=('linux-aarch64-headers')
Dan Johansen's avatar
Dan Johansen committed
274

275
276
  cd ${_srcname}
  local _builddir="${pkgdir}/usr/lib/modules/${_kernver}/build"
Dan Johansen's avatar
Dan Johansen committed
277

278
279
  install -Dt "${_builddir}" -m644 Makefile .config Module.symvers
  install -Dt "${_builddir}/kernel" -m644 kernel/Makefile
Dan Johansen's avatar
Dan Johansen committed
280

281
  mkdir "${_builddir}/.tmp_versions"
Dan Johansen's avatar
Dan Johansen committed
282

283
  cp -t "${_builddir}" -a include scripts
Dan Johansen's avatar
Dan Johansen committed
284

285
  install -Dt "${_builddir}/arch/${KARCH}" -m644 arch/${KARCH}/Makefile
Dan Johansen's avatar
Dan Johansen committed
286
  install -Dt "${_builddir}/arch/${KARCH}/kernel" -m644 arch/${KARCH}/kernel/asm-offsets.s
287
  install -Dt "${_builddir}" -m644 vmlinux 
Dan Johansen's avatar
Dan Johansen committed
288

289
290
291
  cp -t "${_builddir}/arch/${KARCH}" -a arch/${KARCH}/include
  mkdir -p "${_builddir}/arch/arm"
  cp -t "${_builddir}/arch/arm" -a arch/arm/include
Dan Johansen's avatar
Dan Johansen committed
292

293
294
  install -Dt "${_builddir}/drivers/md" -m644 drivers/md/*.h
  install -Dt "${_builddir}/net/mac80211" -m644 net/mac80211/*.h
Dan Johansen's avatar
Dan Johansen committed
295
296

  # http://bugs.archlinux.org/task/13146
297
  install -Dt "${_builddir}/drivers/media/i2c" -m644 drivers/media/i2c/msp3400-driver.h
Dan Johansen's avatar
Dan Johansen committed
298
299

  # http://bugs.archlinux.org/task/20402
300
301
302
  install -Dt "${_builddir}/drivers/media/usb/dvb-usb" -m644 drivers/media/usb/dvb-usb/*.h
  install -Dt "${_builddir}/drivers/media/dvb-frontends" -m644 drivers/media/dvb-frontends/*.h
  install -Dt "${_builddir}/drivers/media/tuners" -m644 drivers/media/tuners/*.h
Dan Johansen's avatar
Dan Johansen committed
303
304

  # add xfs and shmem for aufs building
305
  mkdir -p "${_builddir}"/{fs/xfs,mm}
Dan Johansen's avatar
Dan Johansen committed
306
307

  # copy in Kconfig files
308
309
310
311
312
313
314
  find . -name Kconfig\* -exec install -Dm644 {} "${_builddir}/{}" \;

  # remove unneeded architectures
  local _arch
  for _arch in "${_builddir}"/arch/*/; do
    [[ ${_arch} == */${KARCH}/ || ${_arch} == */arm/ ]] && continue
    rm -r "${_arch}"
Dan Johansen's avatar
Dan Johansen committed
315
316
  done

317
  # remove documentation files
318
319
320
321
322
  rm -r "${_builddir}/Documentation"

  # remove now broken symlinks
  find -L "${_builddir}" -type l -printf 'Removing %P\n' -delete

Dan Johansen's avatar
Dan Johansen committed
323
  # strip scripts directory
324
325
326
327
328
329
330
331
332
333
334
  local file
  while read -rd '' file; do
    case "$(file -bi "$file")" in
      application/x-sharedlib\;*)      # Libraries (.so)
        strip $STRIP_SHARED "$file" ;;
      application/x-archive\;*)        # Libraries (.a)
        strip $STRIP_STATIC "$file" ;;
      application/x-executable\;*)     # Binaries
        strip $STRIP_BINARIES "$file" ;;
      application/x-pie-executable\;*) # Relocatable binaries
        strip $STRIP_SHARED "$file" ;;
Dan Johansen's avatar
Dan Johansen committed
335
    esac
336
337
338
339
340
341
342
343
  done < <(find "${_builddir}" -type f -perm -u+x ! -name vmlinux -print0 2>/dev/null)
  strip $STRIP_STATIC "${_builddir}/vmlinux"
  
  # remove unwanted files
  find ${_builddir} -name '*.orig' -delete

  # Fix permissions
  chmod -R u=rwX,go=rX "${_builddir}" 
Dan Johansen's avatar
Dan Johansen committed
344
345
}

346
pkgname=("${pkgbase}" "${pkgbase}-headers")
Dan Johansen's avatar
Dan Johansen committed
347
348
349
350
351
for _p in ${pkgname[@]}; do
  eval "package_${_p}() {
    _package${_p#${pkgbase}}
  }"
done