Sysop: | Amessyroom |
---|---|
Location: | Fayetteville, NC |
Users: | 43 |
Nodes: | 6 (0 / 6) |
Uptime: | 95:29:07 |
Calls: | 290 |
Files: | 904 |
Messages: | 76,417 |
Sent: Saturday, January 04, 2025 at 11:54 AM
From: "Lee" <ler762@gmail.com>
To: "Franco Martelli" <martellif67@gmail.com>
Cc: debian-user@lists.debian.org
Subject: Re: debian kernel compiler
On Sat, Jan 4, 2025 at 7:52 AM Franco Martelli wrote:
On 02/01/25 at 12:53, Istvan Toth wrote:
amd 5700G cpu
If you are new to kernel compiling maybe you don't know that you can optimize the kernel for your specific CPU architecture, if you are using the GCC compiler:
first make a backup copy of the Makefile:
$ cd linux-source-6.1
$ cp arch/x86/Makefile arch/x86/Makefile.backup
then edit "arch/x86/Makefile":
$ cd linux-source-6.1
$ vi arch/x86/Makefile
at line 152 change:
cflags-$(CONFIG_MK8) += -march=k8
to
cflags-$(CONFIG_MK8) += -march=znver3
and below at line 159 change
rustflags-$(CONFIG_MK8) += -Ctarget-cpu=k8
to
rustflags-$(CONFIG_MK8) += -Ctarget-cpu=znver3
save and exit vim. "znver3" is the GCC's switch for the µarch of your GPU.
GPU or central processing unit?
As long as you're not cross-compiling, how is march=znver3 better than march=native ?
On my machine, 'man gcc' has the "znver1" and "znver2" strings, but no "znver3" so it seems like "march=native" would be more correct.. or
at least less chances of an error.
... assuming there are no drawbacks to using "march=native".
TIA,
Lee
Sent: Saturday, January 04, 2025 at 7:12 PM
From: "Jeffrey Walton" <noloader@gmail.com>
To: pocket@homemail.com
Cc: "debian-user" <debian-user@lists.debian.org>
Subject: Re: debian kernel compiler
On Sat, Jan 4, 2025 at 4:17 PM <pocket@homemail.com> wrote:
Sent: Saturday, January 04, 2025 at 11:54 AM
From: "Lee" <ler762@gmail.com>
To: "Franco Martelli" <martellif67@gmail.com>
Cc: debian-user@lists.debian.org
Subject: Re: debian kernel compiler
On Sat, Jan 4, 2025 at 7:52 AM Franco Martelli wrote:
On 02/01/25 at 12:53, Istvan Toth wrote:
amd 5700G cpu
If you are new to kernel compiling maybe you don't know that you can optimize the kernel for your specific CPU architecture, if you are using
the GCC compiler:
first make a backup copy of the Makefile:
$ cd linux-source-6.1
$ cp arch/x86/Makefile arch/x86/Makefile.backup
then edit "arch/x86/Makefile":
$ cd linux-source-6.1
$ vi arch/x86/Makefile
at line 152 change:
cflags-$(CONFIG_MK8) += -march=k8
to
cflags-$(CONFIG_MK8) += -march=znver3
and below at line 159 change
rustflags-$(CONFIG_MK8) += -Ctarget-cpu=k8
to
rustflags-$(CONFIG_MK8) += -Ctarget-cpu=znver3
save and exit vim. "znver3" is the GCC's switch for the µarch of your GPU.
GPU or central processing unit?
As long as you're not cross-compiling, how is march=znver3 better than march=native ?
On my machine, 'man gcc' has the "znver1" and "znver2" strings, but no "znver3" so it seems like "march=native" would be more correct.. or
at least less chances of an error.
... assuming there are no drawbacks to using "march=native".
As someone that has compiled many a kernel on different platforms over 30 years......
gcc has a facility to interrogate the system it is on, it will tell you what is available on the platform hardware and flag wise.
You should use that.
The option to compile for "this machine" or "compiling machine" is -march=native. It should be added to CFLAGS and CXXFLAGS, assuming GNU makefile rules.
The native option is available on certain targets. See, for example, <https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html>.
Jeff
Hi Marko,
thank you for your detailed and thorough advice.
I implemented them, everything ran without errors. But unfortunately the error persists,
Building module:
Cleaning build area...
env NV_VERBOSE=1 make -j16 modules KERNEL_UNAME=6.1.119- fah105..................(bad exit status: 2)
Error! Bad return status for module build on kernel: 6.1.119-fah105 (x86_64) Consult /var/lib/dkms/nvidia-current/535.183.01/build/make.log for more information.
Error! One or more modules failed to install during autoinstall.
Refer to previous errors for more information.
dkms: autoinstall for kernel: 6.1.119-fah105 failed!
run-parts: /etc/kernel/postinst.d/dkms exited with return code 11
...
dpkg: error processing package linux-image-6.1.119-fah105 (--install):
installed linux-image-6.1.119-fah105 package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
These lines are very familiar, there were two cases where I didn't see
them, and linux-image.x.y.z ran without error.
With thanks to you ti
On 1/4/25 11:26, Franco Martelli wrote:
On 02/01/25 at 12:53, Istvan Toth wrote:
amd 5700G cpu
If you are new to kernel compiling maybe you don't know that you can
optimize the kernel for your specific CPU architecture, if you are
using the GCC compiler:
first make a backup copy of the Makefile:
$ cd linux-source-6.1
$ cp arch/x86/Makefile arch/x86/Makefile.backup
then edit "arch/x86/Makefile":
$ cd linux-source-6.1
$ vi arch/x86/Makefile
at line 152 change:
cflags-$(CONFIG_MK8) += -march=k8
to
cflags-$(CONFIG_MK8) += -march=znver3
and below at line 159 change
rustflags-$(CONFIG_MK8) += -Ctarget-cpu=k8
to
rustflags-$(CONFIG_MK8) += -Ctarget-cpu=znver3
save and exit vim. "znver3" is the GCC's switch for the µarch of your
GPU.
Clean the old kernel build with:
$ make -j16 clean
then with the Kernel configuration tool, I use:
$ make -j16 menuconfig
in: "Processor type and features --->"
in: "Processor family"
choose: "Opteron/Athlon64/Hammer/K8"
then select "Exit" and "Save" the kernel configuration.
To build the kernel I use the command:
$ time make -s -j16 bindeb-pkg
This command generates Linux-image and Linux-header packages (.deb)
that can be installed with "dpkg -i" command.
Be aware that objtool command may not support the "znver3" GCC's
switch, showing you "warning ..." during the Kernel compilation
process, in that circumstance you can try other GCC switch: "znver2"
or "znver1".
If also that fail, restore the "Makefile" file using the backup copy.
Just my 2¢ tips, cheers.
Most
times, about 100 times so far, the compiler ran at 40 minutes, but then it does not compile the nvidia-current 183.216.01 or the 535.183.01 module. Because of this, there will be no /boot/initrd.img file, the boot will not start.
[...] amd 5700G cpu [...]
The other time interval is more than 4 hours, on December 5 and
December 26, but then nvidia turned on too, the initrd.img was downloaded, and the kernel started without errors and works.
Could you help me with some ideas?
when installing
the image the build module does not run during the short-term (30-40 minute) compiler runtime (I attach it).
[...]
~/kernel$ sudo dpkg -i linux-image-6.1.119-fah79_6.1.119-1_amd64.deb
env NV_VERBOSE=1 make -j16 modules KERNEL_UNAME=6.1.119-fah79
Consult /var/lib/dkms/nvidia-current/535.216.01/build/make.log for more information.
~/kernel$ sudo dpkg -i linux-image-6.1.119-fah79_6.1.119-1_amd64.deb Selecting previously unselected package linux-image-6.1.119-fah79.
(Reading database ... 192934 files and directories currently installed.) Preparing to unpack linux-image-6.1.119-fah79_6.1.119-1_amd64.deb ... Unpacking linux-image-6.1.119-fah79 (6.1.119-1) ...
Setting up linux-image-6.1.119-fah79 (6.1.119-1) ...
dkms: running auto installation service for kernel 6.1.119-fah79.
Sign command: /usr/lib/linux-kbuild-6.1/scripts/sign-file
Signing key: /var/lib/dkms/mok.key
Public certificate (MOK): /var/lib/dkms/mok.pub
Building module:
Cleaning build area...
env NV_VERBOSE=1 make -j16 modules KERNEL_UNAME=6.1.119-fah79.................................(bad exit status: 2)
Error! Bad return status for module build on kernel: 6.1.119-fah79 (x86_64) Consult /var/lib/dkms/nvidia-current/535.216.01/build/make.log for more information.
Error! One or more modules failed to install during autoinstall.
Refer to previous errors for more information.
dkms: autoinstall for kernel: 6.1.119-fah79 failed!
I am attaching the nvidia make.log.I made the fah79 image deb package
myself. It also included - linux-headers-6.1.119-fah79_6.1.119-1_amd64.deb
#error dma_buf_export() conftest failed!generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h -D__KERNEL__ -fmacro-prefix-map=./= -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-
#error wait_on_bit_lock() conftest failed!
#error radix_tree_replace_slot() conftest failed!
gcc -Wp,-MMD,/var/lib/dkms/nvidia-current/535.216.01/build/nvidia/.nv-dma.o.d -nostdinc -I./arch/x86/include -I./arch/x86/include/generated -I./include -I./arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I./include/uapi -I./include/
gcc -Wp,-MMD,/var/lib/dkms/nvidia-current/535.216.01/build/nvidia/.nv-i2c.o.d -nostdinc -I./arch/x86/include -I./arch/x86/include/generated -I./include -I./arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h -D__KERNEL__ -fmacro-prefix-map=./= -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-
In file included from /var/lib/dkms/nvidia-current/535.216.01/build/common/inc/conftest.h:28,
from /var/lib/dkms/nvidia-current/535.216.01/build/common/inc/nv_stdarg.h:29,
from /var/lib/dkms/nvidia-current/535.216.01/build/common/inc/os-interface.h:40,
from /var/lib/dkms/nvidia-current/535.216.01/build/nvidia/nv-cray.c:26:
/var/lib/dkms/nvidia-current/535.216.01/build/conftest/functions.h:74:2: error: #error dma_buf_export() conftest failed!
74 | #error dma_buf_export() conftest failed!
| ^~~~~ /var/lib/dkms/nvidia-current/535.216.01/build/conftest/functions.h:87:2: error: #error wait_on_bit_lock() conftest failed!
87 | #error wait_on_bit_lock() conftest failed!
| ^~~~~ /var/lib/dkms/nvidia-current/535.216.01/build/conftest/functions.h:90:2: error: #error radix_tree_replace_slot() conftest failed!
90 | #error radix_tree_replace_slot() conftest failed!
| ^~~~~
On Thu, Jan 02, 2025 at 20:12:09 +0100, Istvan Toth wrote:
I am attaching the nvidia make.log.I made the fah79 image deb package myself. It also included - linux-headers-6.1.119-fah79_6.1.119-1_amd64.deb
The log is quite large. I'm surprised the mailing list actually allowed this.
every time it's about newly built packages, because the .config file that I usually consider to be correct has not been able to compile properly.