PKGBUILDs/core/linux-armv7/PKGBUILD

252 lines
8.6 KiB
Bash
Raw Normal View History

2013-07-24 22:35:43 +00:00
# ARMv7 multi-platform
2013-05-31 22:02:36 +00:00
# Maintainer: Kevin Mihelich <kevin@archlinuxarm.org>
buildarch=4
pkgbase=linux-armv7
2024-09-17 18:43:59 +00:00
_srcname=linux-6.11
2013-07-24 22:35:43 +00:00
_kernelname=${pkgbase#linux}
_desc="ARMv7 multi-platform"
2024-11-08 19:38:19 +00:00
pkgver=6.11.7
pkgrel=1
2024-09-17 18:43:59 +00:00
rcnver=6.11.0
rcnrel=multiv7-r1
2013-05-31 22:02:36 +00:00
arch=('armv7h')
url="http://www.kernel.org/"
license=('GPL2')
2015-09-30 03:10:27 +00:00
makedepends=('xmlto' 'docbook-xsl' 'kmod' 'inetutils' 'bc' 'git' 'uboot-tools' 'vboot-utils' 'dtc')
2013-05-31 22:02:36 +00:00
options=('!strip')
2023-02-23 03:12:50 +00:00
source=("https://www.kernel.org/pub/linux/kernel/v6.x/${_srcname}.tar.xz"
2024-09-19 09:49:02 +00:00
"https://www.kernel.org/pub/linux/kernel/v6.x/patch-${pkgver}.xz"
2022-01-18 00:12:17 +00:00
"https://rcn-ee.com/deb/sid-armhf/v${rcnver}-${rcnrel}/patch-${rcnver%.0}-${rcnrel}.diff.gz"
2014-10-07 06:07:09 +00:00
'0001-ARM-atags-add-support-for-Marvell-s-u-boot.patch'
'0002-ARM-atags-fdt-retrieve-MAC-addresses-from-Marvell-bo.patch'
2022-03-25 02:10:16 +00:00
'0003-fix-mvsdio-eMMC-timing.patch'
'0004-net-smsc95xx-Allow-mac-address-to-be-set-as-a-parame.patch'
'0005-set-default-cubietruck-led-triggers.patch'
'0006-exynos4412-odroid-set-higher-minimum-buck2-regulator.patch'
'0007-USB-Armory-MkII-support.patch'
2015-09-30 03:10:27 +00:00
'config'
'kernel.its'
'kernel.keyblock'
2017-02-22 01:37:50 +00:00
'kernel_data_key.vbprivk'
'linux.preset')
2024-09-17 18:43:59 +00:00
md5sums=('612a9feef07be8663098a0a58cddf7a6'
2024-11-08 19:38:19 +00:00
'b53937e19176a3ed2061020198adc559'
2024-09-17 18:43:59 +00:00
'a8fee8d94b748323e10b256c3589dd10'
'f531ad638bb6dd9d8e9e2e880c97ea12'
'e3b3f3fa4ccd1f63b24fb6985c8052f3'
'006341e2f82759330ed09c666cdb6462'
'6a94aa34059489c4c83fce97395fa2b0'
'74f514abbd92de3368e3d4cf11165317'
'8782b146a24e043a1da5e437f689e864'
'527b0497440d97de53ee1e31fd51bdbc'
2024-11-08 19:38:19 +00:00
'd27cca9b0be9d51007f4d97146041885'
'9e4fc0be1094c64af6f127e5be9ceb50'
2015-09-30 03:10:27 +00:00
'61c5ff73c136ed07a7aadbf58db3d96a'
2017-02-22 01:37:50 +00:00
'584777ae88bce2c5659960151b64c7d8'
2024-08-15 21:09:07 +00:00
'8b93b6ca167f70c60277f352f7b78024')
2013-05-31 22:02:36 +00:00
2013-07-24 22:35:43 +00:00
prepare() {
2024-08-17 02:08:53 +00:00
cd $_srcname
echo "Setting version..."
echo "-$pkgrel" > localversion.10-pkgrel
echo "${pkgbase#linux}" > localversion.20-pkgname
2013-05-31 22:02:36 +00:00
2013-11-21 02:30:51 +00:00
# add upstream patch
2024-10-01 16:46:13 +00:00
git apply --whitespace=nowarn ../patch-${pkgver}
2014-04-08 20:37:08 +00:00
2013-11-21 02:30:51 +00:00
# RCN patch
2019-07-31 23:55:31 +00:00
git apply ../patch-${rcnver%.0}-${rcnrel}.diff
2014-01-15 19:49:50 +00:00
2014-04-08 20:37:08 +00:00
# ALARM patches
2014-10-07 06:07:09 +00:00
git apply ../0001-ARM-atags-add-support-for-Marvell-s-u-boot.patch
git apply ../0002-ARM-atags-fdt-retrieve-MAC-addresses-from-Marvell-bo.patch
2022-03-25 02:10:16 +00:00
git apply ../0003-fix-mvsdio-eMMC-timing.patch
git apply ../0004-net-smsc95xx-Allow-mac-address-to-be-set-as-a-parame.patch
git apply ../0005-set-default-cubietruck-led-triggers.patch
git apply ../0006-exynos4412-odroid-set-higher-minimum-buck2-regulator.patch
2024-08-06 13:06:17 +00:00
git apply ../0007-USB-Armory-MkII-support.patch
2013-11-21 02:30:51 +00:00
2013-05-31 22:02:36 +00:00
cat "${srcdir}/config" > ./.config
2013-07-24 22:35:43 +00:00
}
build() {
2024-08-17 02:08:53 +00:00
cd $_srcname
2013-05-31 22:02:36 +00:00
# get kernel version
make prepare
make -s kernelrelease > version
2013-05-31 22:02:36 +00:00
# build!
make ${MAKEFLAGS} zImage modules
# Generate device tree blobs with symbols to support applying device tree overlays in U-Boot
make ${MAKEFLAGS} DTC_FLAGS="-@" dtbs
2013-05-31 22:02:36 +00:00
}
2013-07-24 22:35:43 +00:00
_package() {
pkgdesc="The Linux Kernel and modules - ${_desc}"
depends=('coreutils' 'linux-firmware' 'kmod' 'mkinitcpio>=0.7')
2022-08-27 22:07:51 +00:00
optdepends=('wireless-regdb: to set the correct wireless channels of your country')
2024-07-08 10:27:35 +00:00
provides=("linux=${pkgver}" "KSMBD-MODULE" "WIREGUARD-MODULE")
2014-04-08 20:37:08 +00:00
conflicts=('linux')
2017-06-23 01:45:38 +00:00
replaces=('linux-mvebu' 'linux-udoo' 'linux-sun4i' 'linux-sun5i' 'linux-sun7i' 'linux-usbarmory' 'linux-wandboard' 'linux-clearfog')
2013-05-31 22:02:36 +00:00
install=${pkgname}.install
2024-08-17 02:08:53 +00:00
cd $_srcname
local kernver="$(<version)"
local modulesdir="$pkgdir/usr/lib/modules/$kernver"
2013-05-31 22:02:36 +00:00
2024-08-17 02:08:53 +00:00
echo "Installing boot image and dtbs..."
install -Dm644 arch/arm/boot/zImage -t "${pkgdir}/boot"
2015-09-30 03:10:27 +00:00
make INSTALL_DTBS_PATH="${pkgdir}/boot/dtbs" dtbs_install
2013-05-31 22:02:36 +00:00
2024-08-17 02:08:53 +00:00
echo "Installing modules..."
make INSTALL_MOD_PATH="$pkgdir/usr" INSTALL_MOD_STRIP=1 DEPMOD=/doesnt/exist modules_install
2013-05-31 22:02:36 +00:00
2024-08-17 02:08:53 +00:00
# remove build link
rm "$modulesdir"/build
2018-12-27 18:20:00 +00:00
# sed expression for following substitutions
local _subst="
s|%PKGBASE%|${pkgbase}|g
2024-08-17 02:08:53 +00:00
s|%KERNVER%|${kernver}|g
2018-12-27 18:20:00 +00:00
"
# install mkinitcpio preset file
sed "${_subst}" ../linux.preset |
install -Dm644 /dev/stdin "${pkgdir}/etc/mkinitcpio.d/${pkgbase}.preset"
# rather than use another hook (90-linux.hook) rely on mkinitcpio's 90-mkinitcpio-install.hook
# which avoids a double run of mkinitcpio that can occur
install -d "${pkgdir}/usr/lib/initcpio/"
echo "dummy file to trigger mkinitcpio to run" > "${pkgdir}/usr/lib/initcpio/$(<version)"
2013-05-31 22:02:36 +00:00
}
2013-07-24 22:35:43 +00:00
_package-headers() {
pkgdesc="Header files and scripts for building modules for linux kernel - ${_desc}"
2014-01-15 19:49:50 +00:00
provides=("linux-headers=${pkgver}")
2014-04-08 20:37:08 +00:00
conflicts=('linux-headers')
2017-06-23 01:45:38 +00:00
replaces=('linux-mvebu-headers' 'linux-sun4i-headers' 'linux-sun5i-headers' 'linux-sun7i-headers' 'linux-usbarmory-headers' 'linux-wandboard-headers' 'linux-clearfog-headers')
2013-05-31 22:02:36 +00:00
2024-08-17 02:08:53 +00:00
cd $_srcname
local builddir="$pkgdir/usr/lib/modules/$(<version)/build"
2013-05-31 22:02:36 +00:00
2024-08-17 02:08:53 +00:00
echo "Installing build files..."
install -Dt "$builddir" -m644 .config Makefile Module.symvers System.map \
localversion.* version vmlinux
install -Dt "$builddir/kernel" -m644 kernel/Makefile
install -Dt "$builddir/arch/arm" -m644 arch/arm/Makefile
cp -t "$builddir" -a scripts
2013-05-31 22:02:36 +00:00
# add xfs and shmem for aufs building
2024-08-17 02:08:53 +00:00
mkdir -p "$builddir"/{fs/xfs,mm}
echo "Installing headers..."
cp -t "$builddir" -a include
cp -t "$builddir/arch/arm" -a arch/arm/include
install -Dt "$builddir/arch/arm/kernel" -m644 arch/arm/kernel/asm-offsets.s
mkdir -p "$builddir/arch/arm"
cp -t "$builddir/arch/arm" -a arch/arm/include
install -Dt "$builddir/drivers/md" -m644 drivers/md/*.h
install -Dt "$builddir/net/mac80211" -m644 net/mac80211/*.h
# https://bugs.archlinux.org/task/13146
install -Dt "$builddir/drivers/media/i2c" -m644 drivers/media/i2c/msp3400-driver.h
# https://bugs.archlinux.org/task/20402
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
# https://bugs.archlinux.org/task/71392
install -Dt "$builddir/drivers/iio/common/hid-sensors" -m644 drivers/iio/common/hid-sensors/*.h
echo "Installing KConfig files..."
find . -name 'Kconfig*' -exec install -Dm644 {} "$builddir/{}" \;
echo "Removing unneeded architectures..."
local arch
for arch in "$builddir"/arch/*/; do
[[ $arch == */arm/ ]] && continue
echo "Removing $(basename "$arch")"
rm -r "$arch"
2013-05-31 22:02:36 +00:00
done
2024-08-17 02:08:53 +00:00
echo "Removing documentation..."
rm -r "$builddir/Documentation"
echo "Removing broken symlinks..."
find -L "$builddir" -type l -printf 'Removing %P\n' -delete
echo "Removing loose objects..."
find "$builddir" -type f -name '*.o' -printf 'Removing %P\n' -delete
echo "Stripping build tools..."
local file
while read -rd '' file; do
case "$(file -bi "$file")" in
application/x-sharedlib\;*) # Libraries (.so)
strip -v $STRIP_SHARED "$file" ;;
application/x-archive\;*) # Libraries (.a)
strip -v $STRIP_STATIC "$file" ;;
application/x-executable\;*) # Binaries
strip -v $STRIP_BINARIES "$file" ;;
application/x-pie-executable\;*) # Relocatable binaries
strip -v $STRIP_SHARED "$file" ;;
2013-05-31 22:02:36 +00:00
esac
2024-08-17 02:08:53 +00:00
done < <(find "$builddir" -type f -perm -u+x ! -name vmlinux -print0)
echo "Adding symlink..."
mkdir -p "$pkgdir/usr/src"
ln -sr "$builddir" "$pkgdir/usr/src/$pkgbase"
2013-05-31 22:02:36 +00:00
}
2013-07-24 22:35:43 +00:00
2015-09-30 03:10:27 +00:00
_package-chromebook() {
2015-11-19 03:59:09 +00:00
pkgdesc="The Linux Kernel - ${_desc} - Chromebooks"
2015-09-30 03:10:27 +00:00
depends=('linux-armv7')
2018-04-06 01:44:19 +00:00
conflicts=('linux-armv7-rc-chromebook')
2016-01-20 02:33:42 +00:00
install=${pkgname}.install
2015-09-30 03:10:27 +00:00
cd "${srcdir}/${_srcname}"
cp ../kernel.its .
mkimage -D "-I dts -O dtb -p 2048" -f kernel.its vmlinux.uimg
dd if=/dev/zero of=bootloader.bin bs=512 count=1
2017-02-22 01:37:50 +00:00
echo 'console=tty0 init=/sbin/init root=PARTUUID=%U/PARTNROFF=1 rootwait rw noinitrd' > cmdline
2015-09-30 03:10:27 +00:00
vbutil_kernel \
--pack vmlinux.kpart \
--version 1 \
--vmlinuz vmlinux.uimg \
--arch arm \
--keyblock ../kernel.keyblock \
--signprivate ../kernel_data_key.vbprivk \
2017-02-22 01:37:50 +00:00
--config cmdline \
2015-09-30 03:10:27 +00:00
--bootloader bootloader.bin
mkdir -p "${pkgdir}/boot"
cp vmlinux.kpart "${pkgdir}/boot"
}
2018-04-06 01:44:19 +00:00
_package-odroidc1() {
pkgdesc="The Linux Kernel - ${_desc} - ODROID-C1"
depends=('linux-armv7')
provides=('linux-armv7-uimage')
conflicts=('linux-armv7-uimage' 'linux-armv7-rc-uimage')
cd "${srcdir}/${_srcname}"
mkdir -p "${pkgdir}/boot"
2024-08-17 02:08:53 +00:00
mkimage -A arm -O linux -T kernel -C none -a 0x00208000 -e 0x00208000 -n "${pkgname}" -d arch/arm/boot/zImage "${pkgdir}/boot/uImage"
2018-04-06 01:44:19 +00:00
}
2022-02-16 16:12:45 +00:00
pkgname=("${pkgbase}" "${pkgbase}-headers" "${pkgbase}-chromebook" "${pkgbase}-odroidc1")
2013-07-24 22:35:43 +00:00
for _p in ${pkgname[@]}; do
eval "package_${_p}() {
_package${_p#${pkgbase}}
}"
done