You are not logged in.

#1 2024-09-30 20:49:14

Leprotto
Member
Registered: 2023-07-07
Posts: 34

Making my PKGBUILD from kernel.git

I'm trying to make my PKGBUILD to build from kernel sources and i need some advice.

First: i get my config file from the kernel i'm running with:

zcat /proc/config.gz > config

What about the new configs introduced in the update? Make will prompt you for those but i noticed makepkg doesn't. Will it just stick to the defaults?

Second: pkgver doesn't accept dashes in the field, should i use underscores instead?

Offline

#2 2024-09-30 20:54:46

gromit
Package Maintainer (PM)
From: Germany
Registered: 2024-02-10
Posts: 630
Website

Re: Making my PKGBUILD from kernel.git

What kernel are you packaging? Rather take existing PKGBUILDs such as https://gitlab.archlinux.org/archlinux/ … type=heads

Offline

#3 2024-09-30 21:09:11

Leprotto
Member
Registered: 2023-07-07
Posts: 34

Re: Making my PKGBUILD from kernel.git

gromit wrote:

What kernel are you packaging? Rather take existing PKGBUILDs such as https://gitlab.archlinux.org/archlinux/ … type=heads

linux-6.12-rc1 from kernel.org

Last edited by Leprotto (2024-09-30 21:10:01)

Offline

#4 2024-09-30 21:21:45

gromit
Package Maintainer (PM)
From: Germany
Registered: 2024-02-10
Posts: 630
Website

Re: Making my PKGBUILD from kernel.git

See for a maintained PKGBUILD: https://aur.archlinux.org/pkgbase/linux-mainline

Offline

#5 2024-09-30 21:49:35

Leprotto
Member
Registered: 2023-07-07
Posts: 34

Re: Making my PKGBUILD from kernel.git

gromit wrote:

oh yes it hadn't occured to me to edit the aur PKGBUILD. That explains many things by itself.

Offline

#6 2024-09-30 22:00:45

gromit
Package Maintainer (PM)
From: Germany
Registered: 2024-02-10
Posts: 630
Website

Re: Making my PKGBUILD from kernel.git

Why would you want to edit it? it's at v6.12-rc1

Offline

#7 2024-09-30 23:24:58

Leprotto
Member
Registered: 2023-07-07
Posts: 34

Re: Making my PKGBUILD from kernel.git

gromit wrote:

Why would you want to edit it? it's at v6.12-rc1

I've just built futex_wait_multiple and some misc patches. Is there a way to remove the "dirty" flag? hmm

Offline

#8 2024-10-01 06:37:01

seth
Member
Registered: 2012-09-03
Posts: 58,092

Offline

#9 2024-10-01 13:24:53

Leprotto
Member
Registered: 2023-07-07
Posts: 34

Re: Making my PKGBUILD from kernel.git

So i did this:

prepare() {
  cd $_srcname

  touch .scmversion # avoid "dirty" flag in kernel name
  echo "Setting version..."
  echo "-$pkgrel" > localversion.10-pkgrel
  echo "${pkgbase#linux}" > localversion.20-pkgname

although an user suggests it doesn't work anymore as 6.11

Well, now i have another issue i didn't had yesterday:

Makefile:193: *** source directory cannot contain spaces or colons. Stop.

I checked it happens with the unedited aur PKGBUILD too. Maybe some issue on sources?

Offline

#10 2024-10-01 13:38:15

seth
Member
Registered: 2012-09-03
Posts: 58,092

Re: Making my PKGBUILD from kernel.git

You should just commit your local patches to indicate what that kernel actually is, but, oh well.

Makefile:193: *** source directory cannot contain spaces or colons. Stop.

And what *is* the source directory path?

Offline

#11 2024-10-01 13:45:34

Leprotto
Member
Registered: 2023-07-07
Posts: 34

Re: Making my PKGBUILD from kernel.git

seth wrote:

You should just commit your local patches to indicate what that kernel actually is, but, oh well.

Makefile:193: *** source directory cannot contain spaces or colons. Stop.

And what *is* the source directory path?

Oh yes, it misleaded me to think it was the kernel source directory and not the build one. Just a lame typo! big_smile

Offline

#12 2024-10-01 14:45:11

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

Re: Making my PKGBUILD from kernel.git

Leprotto wrote:

So i did this:

prepare() {
  cd $_srcname

  touch .scmversion # avoid "dirty" flag in kernel name
  echo "Setting version..."
  echo "-$pkgrel" > localversion.10-pkgrel
  echo "${pkgbase#linux}" > localversion.20-pkgname

although an user suggests it doesn't work anymore as 6.11

You can see the replacement Arch used for .scmversion (before switching back to tarballs) which I believe was equivalent to `scripts/setlocalversion --save-scmversion`  in https://gitlab.archlinux.org/archlinux/ … 3f097c8e51.

Offline

#13 2024-10-01 21:02:56

Leprotto
Member
Registered: 2023-07-07
Posts: 34

Re: Making my PKGBUILD from kernel.git

loqs wrote:
Leprotto wrote:

So i did this:

prepare() {
  cd $_srcname

  touch .scmversion # avoid "dirty" flag in kernel name
  echo "Setting version..."
  echo "-$pkgrel" > localversion.10-pkgrel
  echo "${pkgbase#linux}" > localversion.20-pkgname

although an user suggests it doesn't work anymore as 6.11

You can see the replacement Arch used for .scmversion (before switching back to tarballs) which I believe was equivalent to `scripts/setlocalversion --save-scmversion`  in https://gitlab.archlinux.org/archlinux/ … 3f097c8e51.

It doesn't work. From the script code:

echo "Usage: $0 [--no-local] [srctree]"

Offline

#14 2024-10-01 21:40:16

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

Re: Making my PKGBUILD from kernel.git

Based on Arch's replacement for `scripts/setlocalversion --save-scmversion` did you come up with something like:

diff --git a/PKGBUILD b/PKGBUILD
index ee2b6fb..0583063 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -53,12 +53,20 @@ export KBUILD_BUILD_HOST=archlinux
 export KBUILD_BUILD_USER=$pkgbase
 export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})"
 
+_make() {
+  test -s version
+  make KERNELRELEASE="$(<version)" "$@"
+}
+
 prepare() {
   cd $_srcname
 
   echo "Setting version..."
   echo "-$pkgrel" > localversion.10-pkgrel
   echo "${pkgbase#linux}" > localversion.20-pkgname
+  make defconfig
+  make -s kernelrelease > version
+  make mrproper
 
   local src
   for src in "${source[@]}"; do
@@ -75,15 +83,14 @@ prepare() {
   make olddefconfig
   diff -u ../config .config || :
 
-  make -s kernelrelease > version
   echo "Prepared $pkgbase version $(<version)"
 }
 
 build() {
   cd $_srcname
-  make all
-  make -C tools/bpf/bpftool vmlinux.h feature-clang-bpf-co-re=1
-  make htmldocs
+  _make all
+  _make -C tools/bpf/bpftool vmlinux.h feature-clang-bpf-co-re=1
+  _make htmldocs
 }
 
 _package() {
@@ -119,7 +126,7 @@ _package() {
   echo "$pkgbase" | install -Dm644 /dev/stdin "$modulesdir/pkgbase"
 
   echo "Installing modules..."
-  ZSTD_CLEVEL=19 make INSTALL_MOD_PATH="$pkgdir/usr" INSTALL_MOD_STRIP=1 \
+  ZSTD_CLEVEL=19 _make INSTALL_MOD_PATH="$pkgdir/usr" INSTALL_MOD_STRIP=1 \
     DEPMOD=/doesnt/exist modules_install  # Suppress depmod
 
   # remove build link

Which from v6.12.0-rc1 if you then do:

$ git revert -n HEAD
$  make -s kernelrelease
6.11.0-1-mainline-12115-g9852d85ec9d4-dirty
$  _make -s kernelrelease
6.12.0-rc1-1-mainline

Last edited by loqs (2024-10-01 21:41:17)

Offline

Board footer

Powered by FluxBB