You are not logged in.

#1 2023-02-16 21:15:05

Les_Grenouilles_Gays
Member
Registered: 2023-02-16
Posts: 2

Kernel Compiling error v5.9.9-arch1 - Load BTF Error -22

Reaching out for help, I cannot seem to compile v5.9.9-arch1 with the linux-macbook kernel additions:
https://aur.archlinux.org/packages/linux-macbook-docs

This is a fresh install of arch:

archlinux-linux]$ cat /etc/os-release
NAME="Arch Linux"
PRETTY_NAME="Arch Linux"
ID=arch
BUILD_ID=rolling
ANSI_COLOR="38;2;23;147;209"
HOME_URL="https://archlinux.org/"
DOCUMENTATION_URL="https://wiki.archlinux.org/"
SUPPORT_URL="https://bbs.archlinux.org/"
BUG_REPORT_URL="https://bugs.archlinux.org/"
PRIVACY_POLICY_URL="https://terms.archlinux.org/docs/privacy-policy/"
LOGO=archlinux-logo

archlinux-linux]$ uname -r
6.1.7-arch1-1

I do not mind running an older kernel until the package updates, but i can't seem to build it.

I keep getting an unknown error -22

CompileError wrote:

FAILED: load BTF from vmlinux: Unknown error -22make: *** [Makefile:1162: vmlinux] Error 255

  AR      init/built-in.a
  LD      vmlinux.o
  MODPOST vmlinux.symvers
  MODINFO modules.builtin.modinfo
  GEN     modules.builtin
  LD      .tmp_vmlinux.btf
ld: warning: .tmp_vmlinux.btf has a LOAD segment with RWX permissions
  BTF     .btf.vmlinux.bin.o
  LD      .tmp_vmlinux.kallsyms1
ld: warning: .tmp_vmlinux.kallsyms1 has a LOAD segment with RWX permissions
  KSYM    .tmp_vmlinux.kallsyms1.o
  LD      .tmp_vmlinux.kallsyms2
ld: warning: .tmp_vmlinux.kallsyms2 has a LOAD segment with RWX permissions
  KSYM    .tmp_vmlinux.kallsyms2.o
  LD      vmlinux
ld: warning: vmlinux has a LOAD segment with RWX permissions
  BTFIDS  vmlinux
FAILED: load BTF from vmlinux: Unknown error -22make: *** [Makefile:1162: vmlinux] Error 255
==> ERROR: A failure occurred in build().
    Aborting...

My pahole version is a stable one that doesn't seem to be crashing:

archlinux-linux]$ pahole --version
v1.24

I have already downgraded my version of gcc to avoid warnings as error failures

archlinux-linux]$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc11/src/gcc/configure --enable-languages=c,c++,fortran,lto --enable-bootstrap --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --with-linker-hash-style=gnu --with-system-zlib --enable-__cxa_atexit --enable-cet=auto --enable-checking=release --enable-clocale=gnu --enable-default-pie --enable-default-ssp --enable-gnu-indirect-function --enable-gnu-unique-object --enable-linker-build-id --enable-lto --enable-plugin --enable-shared --enable-threads=posix --disable-libssp --disable-libstdcxx-pch --disable-werror --with-build-config=bootstrap-lto --enable-link-serialization=1 --program-suffix=-11 --enable-version-specific-runtime-libs --disable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.3.0 (GCC) 

Anyone have any idea what I can do? Unknown error -22 returns nothing in google, and I can't find an answer in the forums.

Last edited by Les_Grenouilles_Gays (2023-02-16 21:23:24)

Offline

#2 2023-02-16 23:02:55

loqs
Member
Registered: 2014-03-06
Posts: 18,887

Re: Kernel Compiling error v5.9.9-arch1 - Load BTF Error -22

I would suspect it is pahole.  Try rebuilding after performing a full system update so pahole is on version 1:1.24+r29+g02d67c5-1.
Edit:
Have you tried building the standard linux package with RFC-PCI-Workaround-to-enable-poweroff-on-Mac-Pro-11.patch applied?  The kernel config from linux-macbook was the standard config for 5.9.4.arch1-1 so apart from the patch the only other change you would need to make would be for macbook-wakeup.service.

Last edited by loqs (2023-02-16 23:36:58)

Offline

#3 2023-02-17 03:56:48

Les_Grenouilles_Gays
Member
Registered: 2023-02-16
Posts: 2

Re: Kernel Compiling error v5.9.9-arch1 - Load BTF Error -22

As suggested I fully updated my system, and no dice...

  BTFIDS  vmlinux
FAILED: load BTF from vmlinux: Unknown error -22make: *** [Makefile:1162: vmlinux] Error 255
==> ERROR: A failure occurred in build().
    Aborting...

It's a newer macbook, and I need the Macbook enhancements to stop it from crashing when I close the lid etc. I appreciate your help.

Last edited by Les_Grenouilles_Gays (2023-02-17 03:58:05)

Offline

#4 2023-02-17 11:21:34

loqs
Member
Registered: 2014-03-06
Posts: 18,887

Re: Kernel Compiling error v5.9.9-arch1 - Load BTF Error -22

Les_Grenouilles_Gays wrote:

It's a newer macbook, and I need the Macbook enhancements to stop it from crashing when I close the lid etc.

The enhancements would be the service file for the lid close issue and the kernel patch for shutdown?
If so see my previous suggestion of patching the current kernel,  changes as below with link to generated kernel.  Note this does not include the service file.

diff --git a/trunk/PKGBUILD b/trunk/PKGBUILD
index 6904cd4..b12693f 100644
--- a/trunk/PKGBUILD
+++ b/trunk/PKGBUILD
@@ -2,7 +2,7 @@
 
 pkgbase=linux
 pkgver=6.1.12.arch1
-pkgrel=1
+pkgrel=1.1
 pkgdesc='Linux'
 _srctag=v${pkgver%.*}-${pkgver##*.}
 url="https://github.com/archlinux/linux/commits/$_srctag"
@@ -10,13 +10,13 @@ arch=(x86_64)
 license=(GPL2)
 makedepends=(
   bc libelf pahole cpio perl tar xz gettext
-  xmlto python-sphinx python-sphinx_rtd_theme graphviz imagemagick texlive-latexextra
   git
 )
 options=('!strip')
 _srcname=archlinux-linux
 source=(
   "$_srcname::git+https://github.com/archlinux/linux?signed#tag=$_srctag"
+  RFC-PCI-Workaround-to-enable-poweroff-on-Mac-Pro-11.patch
   config         # the main kernel config file
 )
 validpgpkeys=(
@@ -26,6 +26,7 @@ validpgpkeys=(
   'C7E7849466FE2358343588377258734B41C31549'  # David Runge <dvzrv@archlinux.org>
 )
 sha256sums=('SKIP'
+            'fa2a395409a3db0abcf726ad4b8033ce3cc54903f9a1e72b1d71431054152f7d'
             '81a9379fd2eac51bb2dc69d83737d7fbdd41fcaca5af4873e3666d3c706760d1')
 
 export KBUILD_BUILD_HOST=archlinux
@@ -60,7 +61,7 @@ prepare() {
 
 build() {
   cd $_srcname
-  make htmldocs all
+  make all
 }
 
 _package() {
@@ -173,26 +174,7 @@ _package-headers() {
   ln -sr "$builddir" "$pkgdir/usr/src/$pkgbase"
 }
 
-_package-docs() {
-  pkgdesc="Documentation for the $pkgdesc kernel"
-
-  cd $_srcname
-  local builddir="$pkgdir/usr/lib/modules/$(<version)/build"
-
-  echo "Installing documentation..."
-  local src dst
-  while read -rd '' src; do
-    dst="${src#Documentation/}"
-    dst="$builddir/Documentation/${dst#output/}"
-    install -Dm644 "$src" "$dst"
-  done < <(find Documentation -name '.*' -prune -o ! -type d -print0)
-
-  echo "Adding symlink..."
-  mkdir -p "$pkgdir/usr/share/doc"
-  ln -sr "$builddir/Documentation" "$pkgdir/usr/share/doc/$pkgbase"
-}
-
-pkgname=("$pkgbase" "$pkgbase-headers" "$pkgbase-docs")
+pkgname=("$pkgbase" "$pkgbase-headers")
 for _p in "${pkgname[@]}"; do
   eval "package_$_p() {
     $(declare -f "_package${_p#$pkgbase}")
diff --git a/trunk/RFC-PCI-Workaround-to-enable-poweroff-on-Mac-Pro-11.patch b/trunk/RFC-PCI-Workaround-to-enable-poweroff-on-Mac-Pro-11.patch
new file mode 100644
index 0000000..ec7874a
--- /dev/null
+++ b/trunk/RFC-PCI-Workaround-to-enable-poweroff-on-Mac-Pro-11.patch
@@ -0,0 +1,138 @@
+diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
+index ee72ebe..e347047 100644
+--- a/drivers/pci/quirks.c
++++ b/drivers/pci/quirks.c
+@@ -3370,6 +3370,8 @@ extern struct pci_fixup __start_pci_fixups_header[];
+ extern struct pci_fixup __end_pci_fixups_header[];
+ extern struct pci_fixup __start_pci_fixups_final[];
+ extern struct pci_fixup __end_pci_fixups_final[];
++extern struct pci_fixup __start_pci_fixups_assign[];
++extern struct pci_fixup __end_pci_fixups_assign[];
+ extern struct pci_fixup __start_pci_fixups_enable[];
+ extern struct pci_fixup __end_pci_fixups_enable[];
+ extern struct pci_fixup __start_pci_fixups_resume[];
+@@ -3405,6 +3407,11 @@ void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev)
+ 		end = __end_pci_fixups_final;
+ 		break;
+
++	case pci_fixup_assign:
++		start = __start_pci_fixups_assign;
++		end = __end_pci_fixups_assign;
++		break;
++
+ 	case pci_fixup_enable:
+ 		start = __start_pci_fixups_enable;
+ 		end = __end_pci_fixups_enable;
+@@ -2886,6 +2893,27 @@ static void quirk_hotplug_bridge(struct pci_dev *dev)
+ }
+ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_HINT, 0x0020, quirk_hotplug_bridge);
+ 
++/*
++ * Apple: Avoid programming the memory/io aperture of 00:1c.0
++ *
++ * BIOS does not declare any resource for 00:1c.0, but with
++ * hotplug flag set, thus OS allocate:
++ * [mem 0x7fa00000 - 0x7fbfffff]
++ * [mem 0x7fc00000-0x7fdfffff 64bit pref]
++ * which is conflict with an unreported device, which
++ * causes unpredictable result such as accessing io port.
++ * So clear the hotplug flag to work around it.
++ */
++static void quirk_apple_mbp_poweroff(struct pci_dev *dev)
++{
++	if (dmi_match(DMI_BOARD_VENDOR, "Apple Inc.") &&
++	    dmi_match(DMI_PRODUCT_NAME, "MacBookPro11,4") ||
++	    dmi_match(DMI_PRODUCT_NAME, "MacBookPro11,5"))
++		dev->is_hotplug_bridge = 0;
++}
++
++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x8c10, quirk_apple_mbp_poweroff);
++
+ /*
+  * This is a quirk for the Ricoh MMC controller found as a part of some
+  * multifunction chips.
+@@ -5099,6 +5106,24 @@ static void quirk_intel_qat_vf_cap(struct pci_dev *pdev)
+ }
+ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x443, quirk_intel_qat_vf_cap);
+ 
++/*
++ * On Mac Pro 11, the allocation of pci bridge memory resource
++ * broke ACPI Sleep Type register region.
++ */
++static void quirk_mac_disable_mmio_bar(struct pci_dev *dev)
++{
++	struct resource *b_res;
++
++	dev_info(&dev->dev, "[Quirk] Disable mmio on Mac Pro 11\n");
++	if ((dev->class >> 8) != PCI_CLASS_BRIDGE_PCI)
++		return;
++
++	b_res = &dev->resource[PCI_BRIDGE_RESOURCES];
++	b_res[1].flags = 0;
++	b_res[2].flags = 0;
++}
++DECLARE_PCI_FIXUP_ASSIGN(PCI_VENDOR_ID_INTEL, 0x8c10, quirk_mac_disable_mmio_bar);
++
+ /*
+  * FLR may cause the following to devices to hang:
+  *
+diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
+index 55641a3..730d6fd 100644
+--- a/drivers/pci/setup-bus.c
++++ b/drivers/pci/setup-bus.c
+@@ -1256,6 +1256,8 @@ void __pci_bus_size_bridges(struct pci_bus *bus, struct list_head *realloc_head)
+			additional_mmio_size = pci_hotplug_mmio_size;
+			additional_mmio_pref_size = pci_hotplug_mmio_pref_size;
+ 		}
++
++		pci_fixup_device(pci_fixup_assign, bus->self);
+ 		fallthrough;
+ 	default:
+ 		pbus_size_io(bus, realloc_head ? 0 : additional_io_size,
+diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
+index e373e2e10f6a..8ec44c7450e0 100644
+--- a/include/asm-generic/vmlinux.lds.h
++++ b/include/asm-generic/vmlinux.lds.h
+@@ -346,6 +346,9 @@
+ 		__start_pci_fixups_final = .;				\
+ 		KEEP(*(.pci_fixup_final))				\
+ 		__end_pci_fixups_final = .;				\
++		__start_pci_fixups_assign = .;				\
++		KEEP(*(.pci_fixup_assign))				\
++		__end_pci_fixups_assign = .;				\
+ 		__start_pci_fixups_enable = .;				\
+ 		KEEP(*(.pci_fixup_enable))				\
+ 		__end_pci_fixups_enable = .;				\
+diff --git a/include/linux/pci.h b/include/linux/pci.h
+index b67e4df..14a35bb 100644
+--- a/include/linux/pci.h
++++ b/include/linux/pci.h
+@@ -1584,6 +1584,7 @@ enum pci_fixup_pass {
+ 	pci_fixup_early,	/* Before probing BARs */
+ 	pci_fixup_header,	/* After reading configuration header */
+ 	pci_fixup_final,	/* Final phase of device fixups */
++	pci_fixup_assign,	/* Before resource assignment */
+ 	pci_fixup_enable,	/* pci_enable_device() time */
+ 	pci_fixup_resume,	/* pci_device_resume() */
+ 	pci_fixup_suspend,	/* pci_device_suspend() */
+@@ -1644,6 +1645,9 @@ enum pci_fixup_pass {
+ #define DECLARE_PCI_FIXUP_FINAL(vendor, device, hook)			\
+ 	DECLARE_PCI_FIXUP_SECTION(.pci_fixup_final,			\
+ 		hook, vendor, device, PCI_ANY_ID, 0, hook)
++#define DECLARE_PCI_FIXUP_ASSIGN(vendor, device, hook)			\
++	DECLARE_PCI_FIXUP_SECTION(.pci_fixup_assign,			\
++		hook, vendor, device, PCI_ANY_ID, 0, hook)
+ #define DECLARE_PCI_FIXUP_ENABLE(vendor, device, hook)			\
+ 	DECLARE_PCI_FIXUP_SECTION(.pci_fixup_enable,			\
+ 		hook, vendor, device, PCI_ANY_ID, 0, hook)
+diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
+index 48958d3..248acdb 100644
+--- a/scripts/mod/modpost.c
++++ b/scripts/mod/modpost.c
+@@ -877,6 +877,7 @@ static void check_section(const char *modname, struct elf_info *elf,
+
+ #define ALL_PCI_INIT_SECTIONS	\
+ 	".pci_fixup_early", ".pci_fixup_header", ".pci_fixup_final", \
++	".pci_fixup_assign", \
+ 	".pci_fixup_enable", ".pci_fixup_resume", \
+ 	".pci_fixup_resume_early", ".pci_fixup_suspend"

https://drive.google.com/file/d/1WBFvyu … share_link linux-6.1.12.arch1-1.1-x86_64.pkg.tar.zst
https://drive.google.com/file/d/1T-I5Py … share_link linux-headers-6.1.12.arch1-1.1-x86_64.pkg.tar.zst

Offline

Board footer

Powered by FluxBB