core/linux-armv7: fixes

This commit is contained in:
Kevin Mihelich 2024-08-17 02:08:53 +00:00
parent 57212b440c
commit 204cff23b2

View file

@ -48,7 +48,11 @@ md5sums=('c0ce046a9a0d041e13cf222f81eae574'
'8b93b6ca167f70c60277f352f7b78024')
prepare() {
cd "${srcdir}/${_srcname}"
cd $_srcname
echo "Setting version..."
echo "-$pkgrel" > localversion.10-pkgrel
echo "${pkgbase#linux}" > localversion.20-pkgname
# add upstream patch
git apply --whitespace=nowarn ../patch-${pkgver}
@ -66,41 +70,15 @@ prepare() {
git apply ../0007-USB-Armory-MkII-support.patch
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() {
cd "${srcdir}/${_srcname}"
cd $_srcname
# get kernel version
make prepare
make -s kernelrelease > version
# load configuration
# Configure the kernel. Replace the line below with one of your choice.
#make menuconfig # CLI menu for configuration
#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)
#cp ./.config ../${pkgbase}.config
####################
# stop here
# this is useful to configure the kernel
#msg "Stopping build"
#return 1
####################
#yes "" | make config
# build!
make ${MAKEFLAGS} zImage modules
@ -117,39 +95,24 @@ _package() {
replaces=('linux-mvebu' 'linux-udoo' 'linux-sun4i' 'linux-sun5i' 'linux-sun7i' 'linux-usbarmory' 'linux-wandboard' 'linux-clearfog')
install=${pkgname}.install
cd "${srcdir}/${_srcname}"
cd $_srcname
local kernver="$(<version)"
local modulesdir="$pkgdir/usr/lib/modules/$kernver"
KARCH=arm
# get kernel version
_kernver="$(make kernelrelease)"
_basekernel=${_kernver%%-*}
_basekernel=${_basekernel%.*}
mkdir -p "${pkgdir}"/{boot,usr/lib/modules}
make INSTALL_MOD_PATH="${pkgdir}/usr" modules_install
echo "Installing boot image and dtbs..."
install -Dm644 arch/arm/boot/zImage -t "${pkgdir}/boot"
make INSTALL_DTBS_PATH="${pkgdir}/boot/dtbs" dtbs_install
cp arch/$KARCH/boot/zImage "${pkgdir}/boot/zImage"
# make room for external modules
local _extramodules="extramodules-${_basekernel}${_kernelname}"
ln -s "../${_extramodules}" "${pkgdir}/usr/lib/modules/${_kernver}/extramodules"
echo "Installing modules..."
make INSTALL_MOD_PATH="$pkgdir/usr" INSTALL_MOD_STRIP=1 DEPMOD=/doesnt/exist modules_install
# add real version for building modules and running depmod from hook
echo "${_kernver}" |
install -Dm644 /dev/stdin "${pkgdir}/usr/lib/modules/${_extramodules}/version"
# remove build and source links
rm -f "${pkgdir}"/usr/lib/modules/${_kernver}/{source,build}
# now we call depmod...
depmod -b "${pkgdir}/usr" -F System.map "${_kernver}"
# remove build link
rm "$modulesdir"/build
# sed expression for following substitutions
local _subst="
s|%PKGBASE%|${pkgbase}|g
s|%KERNVER%|${_kernver}|g
s|%EXTRAMODULES%|${_extramodules}|g
s|%KERNVER%|${kernver}|g
"
# install mkinitcpio preset file
@ -168,65 +131,78 @@ _package-headers() {
conflicts=('linux-headers')
replaces=('linux-mvebu-headers' 'linux-sun4i-headers' 'linux-sun5i-headers' 'linux-sun7i-headers' 'linux-usbarmory-headers' 'linux-wandboard-headers' 'linux-clearfog-headers')
cd ${_srcname}
local _builddir="${pkgdir}/usr/lib/modules/${_kernver}/build"
cd $_srcname
local builddir="$pkgdir/usr/lib/modules/$(<version)/build"
install -Dt "${_builddir}" -m644 Makefile .config Module.symvers
install -Dt "${_builddir}/kernel" -m644 kernel/Makefile
mkdir "${_builddir}/.tmp_versions"
cp -t "${_builddir}" -a include scripts
install -Dt "${_builddir}/arch/${KARCH}" -m644 arch/${KARCH}/Makefile
install -Dt "${_builddir}/arch/${KARCH}/kernel" -m644 arch/${KARCH}/kernel/asm-offsets.s
cp -t "${_builddir}/arch/${KARCH}" -a arch/${KARCH}/include
install -Dt "${_builddir}/drivers/md" -m644 drivers/md/*.h
install -Dt "${_builddir}/net/mac80211" -m644 net/mac80211/*.h
# http://bugs.archlinux.org/task/13146
install -Dt "${_builddir}/drivers/media/i2c" -m644 drivers/media/i2c/msp3400-driver.h
# http://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
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
# add xfs and shmem for aufs building
mkdir -p "${_builddir}"/{fs/xfs,mm}
mkdir -p "$builddir"/{fs/xfs,mm}
# copy in Kconfig files
find . -name Kconfig\* -exec install -Dm644 {} "${_builddir}/{}" \;
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
# remove unneeded architectures
local _arch
for _arch in "${_builddir}"/arch/*/; do
[[ ${_arch} == */${KARCH}/ ]] && continue
rm -r "${_arch}"
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"
done
# remove files already in linux-docs package
rm -r "${_builddir}/Documentation"
echo "Removing documentation..."
rm -r "$builddir/Documentation"
# remove now broken symlinks
find -L "${_builddir}" -type l -printf 'Removing %P\n' -delete
echo "Removing broken symlinks..."
find -L "$builddir" -type l -printf 'Removing %P\n' -delete
# Fix permissions
chmod -R u=rwX,go=rX "${_builddir}"
echo "Removing loose objects..."
find "$builddir" -type f -name '*.o' -printf 'Removing %P\n' -delete
# strip scripts directory
local _binary _strip
while read -rd '' _binary; do
case "$(file -bi "${_binary}")" in
*application/x-sharedlib*) _strip="${STRIP_SHARED}" ;; # Libraries (.so)
*application/x-archive*) _strip="${STRIP_STATIC}" ;; # Libraries (.a)
*application/x-executable*) _strip="${STRIP_BINARIES}" ;; # Binaries
*) continue ;;
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" ;;
esac
/usr/bin/strip ${_strip} "${_binary}"
done < <(find "${_builddir}/scripts" -type f -perm -u+w -print0 2>/dev/null)
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"
}
_package-chromebook() {
@ -264,7 +240,7 @@ _package-odroidc1() {
cd "${srcdir}/${_srcname}"
mkdir -p "${pkgdir}/boot"
mkimage -A arm -O linux -T kernel -C none -a 0x00208000 -e 0x00208000 -n "${pkgname}" -d arch/$KARCH/boot/zImage "${pkgdir}/boot/uImage"
mkimage -A arm -O linux -T kernel -C none -a 0x00208000 -e 0x00208000 -n "${pkgname}" -d arch/arm/boot/zImage "${pkgdir}/boot/uImage"
}
pkgname=("${pkgbase}" "${pkgbase}-headers" "${pkgbase}-chromebook" "${pkgbase}-odroidc1")