You are not logged in.
Hello, I have a kernel driver problem and need to bisect the kernel.
As explained in the Wiki, I’ve downloaded the PKGBUILD of linux-git, run updpkgsums and make oldconfig and was about to use "git tag" to bisect my problematic minor kernel version. But it just shows major kernel versions with their RCs (v5.15, v5.15-rc1, v5.15-rc2…) I need 5.15.3, so this is not enough. How to get the minor versions too?
Last edited by frumble (2021-12-08 13:56:32)
Offline
The stable kernel repo is https://git.kernel.org/pub/scm/linux/ke … /linux.git
You only need the stable kernel if the issue was introduced between 5.15 and 5.15.3 otherwise use 5.14 as good and 5.15 as bad.
Offline
Yes, it was introduced in 5.15.3. OK, now I have the stable kernel git source, moved in into the former "archlinux-linux" folder and now I can select "git bisect good v5.15.2" and "git bisect bad v5.15.3".
Next I have to run makepkg in the folders above. But will it really build the bisect-version I have chosen in git before?
And this seems to just build a regular "linux" package replacing my running kernel which doesn’t seems to be wise?
I’m new to this, just want to find the cause for a terrible kernel panic with usbreset.
Offline
makepkg -ei
-e use the existing source tree which contains the git bisect status and the current checkout
-i install the newly built package
The package should be named linux-git based on pkgbase from line 5 of the PKGBUILD.
Edit:
Do check 5.13.2 and 5.15.3 you built locally, to confirm your local build works as expected and the issue was not caused by additional patches Arch added on top of 5.15.3.
Last edited by loqs (2021-12-07 00:13:46)
Offline
Ah, now I have to use the PKGBUILD of the linux-git AUR again? OK.
This is the error log:
rm: removing of '/git/pkg/linux-git/usr/lib/modules//source' not possible: file or folder not found [translated]
rm: removing of '/git/pkg/linux-git/usr/lib/modules//build' not possible: file or folder not found
==> ERROR: A failure occurred in package_linux-git().
Aborting...
There is a folder /git/pkg/linux-git/usr/lib/modules/ with a vmlinuz file and a folder /git/pkg/linux-git/usr/lib/modules/5.15.2+/. (Yes, I’m doing this on my rootfs because my home is out of capacity).
Offline
What is the contents of src/linux/version ?
Offline
There is just a .version file with content "2". No "versions" folder.
Offline
In the src/linux directory what is the output of:
make kernelrelease
make LOCALVERSION= kernelrelease
Offline
5.15.2+
5.15.2
Offline
The PKGBUILD needed some changes to work smoothly with bisection. Please also use the config from https://raw.githubusercontent.com/archl … unk/config which is the config used in the Arch 5.15.3 release.
I would suggest `makepkg -Crsi` to clean the src directory then build and install 5.15.3. Then you can check 5.15.2 and after that start the bisect.
# Maintainer: Jonathan Wright <jon@than.io>
# Contributor: Boohbah <boohbah at gmail.com>
# Contributor: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
pkgbase=linux-git
pkgver=5.15.3.r0.g3b17187f5ca1
pkgrel=1
pkgdesc='Linux (Git)'
url="https://www.kernel.org"
arch=(x86_64)
license=(GPL2)
makedepends=(
bc kmod libelf git pahole
)
options=('!strip')
_srcname=linux
source=(
'git+https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git#tag=v5.15.3'
config # the main kernel config file
)
sha256sums=('SKIP'
'e2d8d59ee965f5fabcb9dd15b70074798e168ccdbd75a9540390c281279f113d')
export KBUILD_BUILD_HOST=archlinux
export KBUILD_BUILD_USER=$pkgbase
export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})"
pkgver() {
cd $_srcname
git describe --long | sed -E 's/^v//;s/([^-]*-g)/r\1/;s/-/./g;s/\.rc/rc/'
}
prepare() {
cd $_srcname
echo "Setting version..."
# scripts/setlocalversion --save-scmversion
echo "-$pkgrel" > localversion.10-pkgrel
echo "${pkgbase#linux}" > localversion.20-pkgname
local src
for src in "${source[@]}"; do
src="${src%%::*}"
src="${src##*/}"
[[ $src = *.patch ]] || continue
echo "Applying patch $src..."
patch -Np1 < "../$src"
done
echo "Setting config..."
cp ../config .config
make olddefconfig
# make -s kernelrelease > version
# echo "Prepared $pkgbase version $(<version)"
}
build() {
cd $_srcname
make LOCALVERSION= bzImage modules
}
_package() {
pkgdesc="The $pkgdesc kernel and modules"
depends=(coreutils kmod initramfs)
optdepends=('crda: to set the correct wireless channels of your country'
'linux-firmware: firmware images needed for some devices')
provides=(WIREGUARD-MODULE)
replaces=(wireguard-arch)
cd $_srcname
# get kernel version
_kernver="$(make LOCALVERSION= kernelrelease)"
_basekernel=${_kernver%%-*}
_basekernel=${_basekernel%.*}
local modulesdir="$pkgdir/usr/lib/modules/$_kernver"
install -Dm644 "$(make -s image_name)" "$modulesdir/vmlinuz"
# Used by mkinitcpio to name the kernel
echo "$pkgbase" | install -Dm644 /dev/stdin "$modulesdir/pkgbase"
echo "Installing modules..."
make INSTALL_MOD_PATH="$pkgdir/usr" INSTALL_MOD_STRIP=1 modules_install
# remove build and source links
rm "$modulesdir"/{source,build}
}
_package-headers() {
pkgdesc="Headers and scripts for building modules for the $pkgdesc kernel"
cd $_srcname
local builddir="${pkgdir}/usr/lib/modules/${_kernver}/build"
echo "Installing build files..."
install -Dt "$builddir" -m644 .config Makefile Module.symvers System.map \
localversion.* vmlinux
install -Dt "$builddir/kernel" -m644 kernel/Makefile
install -Dt "$builddir/arch/x86" -m644 arch/x86/Makefile
cp -t "$builddir" -a scripts
# add objtool for external module building and enabled VALIDATION_STACK option
install -Dt "$builddir/tools/objtool" tools/objtool/objtool
# add xfs and shmem for aufs building
mkdir -p "$builddir"/{fs/xfs,mm}
echo "Installing headers..."
cp -t "$builddir" -a include
cp -t "$builddir/arch/x86" -a arch/x86/include
install -Dt "$builddir/arch/x86/kernel" -m644 arch/x86/kernel/asm-offsets.s
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 KConfig files..."
find . -name 'Kconfig*' -exec install -Dm644 {} "$builddir/{}" \;
echo "Removing unneeded architectures..."
local arch
for arch in "$builddir"/arch/*/; do
[[ $arch = */x86/ ]] && continue
echo "Removing $(basename "$arch")"
rm -r "$arch"
done
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" ;;
esac
done < <(find "$builddir" -type f -perm -u+x ! -name vmlinux -print0)
echo "Stripping vmlinux..."
strip -v $STRIP_STATIC "$builddir/vmlinux"
echo "Adding symlink..."
mkdir -p "$pkgdir/usr/src"
ln -sr "$builddir" "$pkgdir/usr/src/$pkgbase"
}
pkgname=("$pkgbase" "$pkgbase-headers")
for _p in "${pkgname[@]}"; do
eval "package_$_p() {
$(declare -f "_package${_p#$pkgbase}")
_package${_p#$pkgbase}
}"
done
# vim:set ts=8 sts=2 sw=2 et:
Offline
Hey, just want to post a quick update: It works with your altered PKGBUILD file, thank you! I’m on the task now. But why is this procedure so poorly documented? One would assume that kernel bisecting were a common demand.
Offline
The -git package uses the same version pinning code as the none -git package. This stops the version string changing if the code is patched, by default a + would be added to the version indicating uncommitted changes.
This breaks bisection where the version has changed but the PKGBUILD is using the version recorded from prepare() so paths do not match.
Offline