#Pernel Kanic

1 messages · Page 1 of 1 (latest)

obsidian otter
#

gentoo musl/clang doesnt start with a compiled kernel via genkernel.

ivory compass
#

Try extracting busybox from the compiled initrd image and run it with the command ./busybox sh. If it segfaults it confirms that busybox is the problem and not the kernel. Next step is to know how to make it build properly with musl/clang so it doesn't segfault.

obsidian otter
#

i can try to compile with -O2 instead of -O3

#

but in my main system kernel compiled with -Ofast and works fine

ivory compass
#

How about the -march flag, do you specify one? (Does clang even support -march; I have zero knowledge on clang.)

#

By the way, I'm pretty sure others would have already suggested that you use gentoo-kernel or gentoo-kernel-bin instead, although it's still interesting to know how this bug comes up and how it can be fixed.

obsidian otter
#

i have tried to install gentoo-kernel-bin but i have error with portage (compile). However i tested the kernel which compiled on my main system and it's work fine, but module amdgpu doesn't work. I want to compile kernel on this (not my main) system

torpid tusk
ivory compass
torpid tusk
#

seems like the issue here is busybox tho

#

if it segfaults both when extracted and booting

#

if init dies your kernel will die

#

I'm pretty sure

ivory compass
# obsidian otter march native

Here are a few more suggestions I can give: First step is to reproduce the segfault error in the busybox package itself. You can compile it temporarily with a different CFLAGS value and not install it in tbe system by using CFLAGS="new values" ebuild /path/to/busybox-version.ebuild clean install. Then go to the image dir in /var/tmp/portage/. Find the compiled busybox and run it with busybox sh. Repeat with different flags yo find what works and what doesn't.

torpid tusk
#

yes this is good troubleshooting

ivory compass
#

I think it has something to do with -march native. You might want a more conservative value. Maybe disable a few CPU features too, like avx512 maybe?

obsidian otter
#
/var/tmp/portage/sys-apps/busybox-1.36.1/image/bin # 
#

compiled with march=native -O2 -pipe

torpid tusk
#

so

#

it seemingly works?

obsidian otter
#

i can try to compile with the same flags as the kernel

#

to make sure that this is the problem

torpid tusk
#

march=native -O2 -pipe

#

is already VERY safe

#

if you want to confirm konsolebox's hypothesis

#

do

#

-march=x86-64

#

for generic amd64

#

if it's actually march=native

#

which happens very rarely

#

but sometimes

#

I know some packages that need march=x86-64-v2

obsidian otter
ivory compass
#

It would be nice if you get to reproduce the segfault too, because that would confirm that you're using the same busybox version or at least has similar set of buggy code. If not, it might be just busybox used by genkernel that gets buggy against musl/clang.

torpid tusk
#

massive ricer flags, I respect it if you know what they do

#

(I do the same)

#

but try to debug it with safe flags

#

xd

obsidian otter
#

busybox works

#

with this flags

torpid tusk
#

curious

obsidian otter
#

then why doesnt it work in initramfs

ivory compass
#

Difference in busybox version probably. I'm sure there's a way to make genkernel use a different version.

obsidian otter
#
#BUSYBOX_CONFIG="/path/to/file"

# NOTE: Since genkernel 3.4.41 the version of
#   busybox, lvm, mdadm, ... have been moved to
#   /usr/share/genkernel/defaults/software.sh in order to
#   reduce the merging you have to do during etc-update.
#   You can still override these settings in here.
#
GKPKG_BUSYBOX_PV="${GKPKG_BUSYBOX_PV:-1.34.1}"
GKPKG_BUSYBOX_DEPS="libxcrypt"
GKPKG_BUSYBOX_SRCTAR="${GKPKG_BUSYBOX_SRCTAR:-${DISTDIR}/busybox-${GKPKG_BUSYBOX_PV}.tar.bz2}"
GKPKG_BUSYBOX_SRCDIR="${GKPKG_BUSYBOX_SRCDIR:-busybox-${GKPKG_BUSYBOX_PV}}"
GKPKG_BUSYBOX_BINPKG="${GKPKG_BUSYBOX_BINPKG:-%%CACHE%%/busybox-${GKPKG_BUSYBOX_PV}-%%ARCH%%.tar.xz}"
#

i can try to compile 1.34.1

obsidian otter
#

but i have only 1.34.1-r2 ebuild

#

i'll try it

#
/var/tmp/portage/sys-apps/busybox-1.34.1-r2/image/bin #``` works fine
ivory compass
#

You can try specifying a different hopefully nonbuggy version with VERSION_BUSYBOX

#

Or GKPKG_BUSYBOX_PV maybe if it doesn't work.

#

GKPKG_BUSYBOX_PV=version genkernel ...

obsidian otter
#

i set the 1.36.1 version

#

i went to rebuild the kernel

#

it will take about 20 minutes

ivory compass
#

You can also just rebuild the initrd with genkernel initramfs next time.

obsidian otter
#

exactly

#

worksgamer

#

ok ill try this with the kernel

#

i deleted the kernel so im going to compile and test quickly now

#

i hope amdgpu will load normally

obsidian otter
ivory compass
#

initramfs can be used if you already had a full kernel build and install. But if you rebuild your kernel with different settings or compiler, you might want to rerun initramfs again (unless you used all) since it might need to recopy a few updated stuff like modules.

obsidian otter
#

iuse all

obsidian otter
#

it works!

#

thx u for help <33