You are not logged in.

#1 2023-04-14 07:49:19

YAOMTC
Member
Registered: 2010-02-23
Posts: 204

Trying to patch the kernel with an AMDGPU color format fix [SOLVED]

This is the issue:

https://gitlab.freedesktop.org/drm/amd/-/issues/476

There's a patch linked towards the end. When I try to apply it, this happens:

$ makepkg
==> Making package: linux 6.2.11.arch1-1 (Fri 14 Apr 2023 01:14:40 AM CDT)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
  -> Cloning archlinux-linux git repo...
Cloning into bare repository '/home/yaomtc/Software/linux/archlinux-linux'...
remote: Enumerating objects: 9675842, done.
remote: Total 9675842 (delta 0), reused 0 (delta 0), pack-reused 9675842
Receiving objects: 100% (9675842/9675842), 4.29 GiB | 24.92 MiB/s, done.
Resolving deltas: 100% (7943283/7943283), done.
  -> Found 0001-dark_sylinc-AMD-RGB-Patch-5.18.11.patch
  -> Found config
==> Validating source files with sha256sums...
    archlinux-linux ... Skipped
    0001-dark_sylinc-AMD-RGB-Patch-5.18.11.patch ... Passed
    config ... Passed
==> Verifying source file signatures with gpg...
    archlinux-linux git repo ... Passed
==> Extracting sources...
  -> Creating working copy of archlinux-linux git repo...
Cloning into 'archlinux-linux'...
done.
Updating files: 100% (79616/79616), done.
Updating files: 100% (13187/13187), done.
Switched to a new branch 'makepkg'
==> Starting prepare()...
patching file drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
patching file drivers/gpu/drm/amd/amdgpu/amdgpu_display.h
patching file drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
patching file drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
Hunk #1 succeeded at 5259 (offset 9 lines).
Hunk #2 succeeded at 5389 (offset 9 lines).
Hunk #3 succeeded at 5469 (offset 9 lines).
Hunk #4 succeeded at 6135 (offset 9 lines).
Hunk #5 succeeded at 6183 (offset 9 lines).
Hunk #6 succeeded at 6266 (offset 9 lines).
Hunk #7 succeeded at 6306 (offset 9 lines).
Hunk #8 succeeded at 7275 (offset 9 lines).
Hunk #9 succeeded at 8277 (offset 9 lines).
Hunk #10 succeeded at 8530 (offset 9 lines).
Hunk #11 succeeded at 8556 (offset 9 lines).
Hunk #12 succeeded at 8582 (offset 9 lines).
Hunk #13 succeeded at 9759 (offset 9 lines).
patching file drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
patching file drivers/gpu/drm/amd/display/dc/core/dc.c
Hunk #1 succeeded at 2579 (offset 1 line).
Hunk #2 succeeded at 2995 (offset 1 line).
Hunk #3 succeeded at 3163 (offset 1 line).
patching file drivers/gpu/drm/amd/display/dc/dc_stream.h
patching file drivers/gpu/drm/drm_modes.c
patching file include/drm/drm_connector.h
Setting version...
Applying patch 0001-dark_sylinc-AMD-RGB-Patch-5.18.11.patch...
patching file drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
Reversed (or previously applied) patch detected!  Skipping patch.
2 out of 2 hunks ignored -- saving rejects to file drivers/gpu/drm/amd/amdgpu/amdgpu_display.c.rej
patching file drivers/gpu/drm/amd/amdgpu/amdgpu_display.h
Reversed (or previously applied) patch detected!  Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file drivers/gpu/drm/amd/amdgpu/amdgpu_display.h.rej
patching file drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
Reversed (or previously applied) patch detected!  Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h.rej
patching file drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
Reversed (or previously applied) patch detected!  Skipping patch.
13 out of 13 hunks ignored -- saving rejects to file drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c.rej
patching file drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
Reversed (or previously applied) patch detected!  Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h.rej
patching file drivers/gpu/drm/amd/display/dc/core/dc.c
Reversed (or previously applied) patch detected!  Skipping patch.
3 out of 3 hunks ignored -- saving rejects to file drivers/gpu/drm/amd/display/dc/core/dc.c.rej
patching file drivers/gpu/drm/amd/display/dc/dc_stream.h
Reversed (or previously applied) patch detected!  Skipping patch.
2 out of 2 hunks ignored -- saving rejects to file drivers/gpu/drm/amd/display/dc/dc_stream.h.rej
patching file drivers/gpu/drm/drm_modes.c
Hunk #1 succeeded at 1686 (offset 27 lines).
Hunk #2 succeeded at 1785 with fuzz 2 (offset 30 lines).
patching file include/drm/drm_connector.h
Reversed (or previously applied) patch detected!  Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file include/drm/drm_connector.h.rej
==> ERROR: A failure occurred in prepare().
    Aborting...

Is this patch already applied to the archlinux kernel? Or am I doing something wrong?

EDIT: Here's the PKGBUILD, the only changes from default is adding this one patch.

# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>

pkgbase=linux
pkgver=6.2.11.arch1
pkgrel=1
pkgdesc='Linux'
_srctag=v${pkgver%.*}-${pkgver##*.}
url="https://github.com/archlinux/linux/commits/$_srctag"
arch=(x86_64)
license=(GPL2)
makedepends=(
  bc libelf pahole cpio perl tar xz gettext
  xmlto python-sphinx graphviz imagemagick texlive-latexextra
  git
)
options=('!strip')
_srcname=archlinux-linux
source=(
  "$_srcname::git+https://github.com/archlinux/linux?signed#tag=$_srctag"
  "https://gitlab.freedesktop.org/drm/amd/uploads/df16aa51bd6de4ec4fc56301bcf15085/0001-dark_sylinc-AMD-RGB-Patch-5.18.11.patch"
  config         # the main kernel config file
)
validpgpkeys=(
  'ABAF11C65A2970B130ABE3C479BE3E4300411886'  # Linus Torvalds
  '647F28654894E3BD457199BE38DBBDC86092693E'  # Greg Kroah-Hartman
  'A2FF3A36AAA56654109064AB19802F8B0D70FC30'  # Jan Alexander Steffens (heftig)
  'C7E7849466FE2358343588377258734B41C31549'  # David Runge <dvzrv@archlinux.org>
)
sha256sums=('SKIP'
            'c8b3fbb7664801bebc2d2d1fdf624524865a7817d0021c55c98523cb58dee201')

export KBUILD_BUILD_HOST=archlinux
export KBUILD_BUILD_USER=$pkgbase
export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})"

prepare() {
  cd $_srcname
  patch --forward --strip=1 --input=${srcdir}/0001-dark_sylinc-AMD-RGB-Patch-5.18.11.patch

  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
  diff -u ../config .config || :

  make -s kernelrelease > version
  echo "Prepared $pkgbase version $(<version)"
}

build() {
  cd $_srcname
  make htmldocs all
}

_package() {
  pkgdesc="The $pkgdesc kernel and modules"
  depends=(coreutils kmod initramfs)
  optdepends=('wireless-regdb: to set the correct wireless channels of your country'
              'linux-firmware: firmware images needed for some devices')
  provides=(VIRTUALBOX-GUEST-MODULES WIREGUARD-MODULE KSMBD-MODULE)
  replaces=(virtualbox-guest-modules-arch wireguard-arch)

  cd $_srcname
  local kernver="$(<version)"
  local modulesdir="$pkgdir/usr/lib/modules/$kernver"

  echo "Installing boot image..."
  # systemd expects to find the kernel here to allow hibernation
  # https://github.com/systemd/systemd/commit/edda44605f06a41fb86b7ab8128dcf99161d2344
  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 \
    DEPMOD=/doesnt/exist modules_install  # Suppress depmod

  # remove build and source links
  rm "$modulesdir"/{source,build}
}

_package-headers() {
  pkgdesc="Headers and scripts for building modules for the $pkgdesc kernel"
  depends=(pahole)

  cd $_srcname
  local builddir="$pkgdir/usr/lib/modules/$(<version)/build"

  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/x86" -m644 arch/x86/Makefile
  cp -t "$builddir" -a scripts

  # required when STACK_VALIDATION is enabled
  install -Dt "$builddir/tools/objtool" tools/objtool/objtool

  # required when DEBUG_INFO_BTF_MODULES is enabled
  install -Dt "$builddir/tools/bpf/resolve_btfids" tools/bpf/resolve_btfids/resolve_btfids

  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

  # 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 = */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 -Sib "$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"
}

_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")
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:
sha256sums=('SKIP'
            '4a9c92b501f70bd640682f3e497dcd37befb8a95b4440c592bac8d340ad4d9ed'
            'c8b3fbb7664801bebc2d2d1fdf624524865a7817d0021c55c98523cb58dee201')
sha256sums=('SKIP'
            '4a9c92b501f70bd640682f3e497dcd37befb8a95b4440c592bac8d340ad4d9ed'
            'c8b3fbb7664801bebc2d2d1fdf624524865a7817d0021c55c98523cb58dee201')

Last edited by YAOMTC (2023-04-14 20:55:40)

Offline

#2 2023-04-14 09:59:04

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,919

Re: Trying to patch the kernel with an AMDGPU color format fix [SOLVED]

It looks like that patch was only tested against 6.2.0  , not later versions .

It probably needs to be rebased against 6.2.11 , which is beyond my skill level wrt kernel patches.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#3 2023-04-14 13:39:46

loqs
Member
Registered: 2014-03-06
Posts: 17,369

Re: Trying to patch the kernel with an AMDGPU color format fix [SOLVED]

...
  patch --forward --strip=1 --input=${srcdir}/0001-dark_sylinc-AMD-RGB-Patch-5.18.11.patch

  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
...

The patch is applied successfully by the patch command you added then fails by the later patch command already contained in prepare.  Drop the line you added to prepare() and the kernel should then start to build.

Offline

#4 2023-04-14 20:59:31

YAOMTC
Member
Registered: 2010-02-23
Posts: 204

Re: Trying to patch the kernel with an AMDGPU color format fix [SOLVED]

loqs wrote:

The patch is applied successfully by the patch command you added then fails by the later patch command already contained in prepare.  Drop the line you added to prepare() and the kernel should then start to build.

That did it, thank you!

Offline

Board footer

Powered by FluxBB