Kernel compile error

Sorry for the late reply,

That’s weird. Can you still boot into the system correctly with vmlinuz-5.15.0-starfive, for example, replace l0 with the code below:

label l0
menu label Debian GNU/Linux bookworm/sid 5.15.0
linux /vmlinuz-5.15.0-starfive
initrd /initrd.img-5.15.0-starfive
fdtdir /dtbs
append root=/dev/nvme0n1p4 rw console=tty0 console=ttyS0,115200 earlycon rootwait stmmaceth=chain_mode:1 selinux=0

So which version of system image are you using? starfive-jh7110-202306-nvme-minimal-desktop.img? From your image in pasteboard, your system are using Gnome, iirc system version 202302 and before gnome isn’t the default desktop env.

@chbinnc Thanks for the reply.
I am using starfive-jh7110-202306-nvme-minimal-desktop.img.
As per the photo (Screenshot) I posted, at this stage there is no rescue possible.
Either I attach the NVME device to another system and try to repair things or I do a re-image.
I normally do a re-image as I find it is quicker.
As far as I am aware of, there is no trace of any 202302 on my system as I erase the device and re-image as outlined above.

Again, here is a print of /boot/extlinux/extlinux.conf in it’s original (virginal) state - fresh after a new install (re-image).

Aubrey

/extlinux/extlinux.conf

IMPORTANT WARNING

The configuration of this file is generated automatically.

Do not edit this file manually, use: u-boot-update

default l0
menu title U-Boot menu
prompt 0
timeout 50

label l0
menu label Debian GNU/Linux bookworm/sid 5.15.0-starfive
linux /vmlinuz-5.15.0-starfive
initrd /initrd.img-5.15.0-starfive

    fdtdir /dtbs
    append  root=/dev/nvme0n1p4 rw console=tty0 console=ttyS0,115200 earlycon rootwait stmmaceth=chain_mode:1 selinux=0

label l0r
menu label Debian GNU/Linux bookworm/sid 5.15.0-starfive (rescue target)
linux /vmlinuz-5.15.0-starfive
initrd /initrd.img-5.15.0-starfive

    fdtdir /dtbs
    append  root=/dev/nvme0n1p4 rw console=tty0 console=ttyS0,115200 earlycon rootwait stmmaceth=chain_mode:1 selinux=0 single

An apt search gnome returns this -

gnome/unstable 1:42+8 riscv64
Full GNOME Desktop Environment, with extra components
gnome-2048/unstable 3.38.2-3 riscv64
gnome-2048-dbgsym/unstable 3.38.2-3 riscv64

gnome is not my DE of choice, but at this point in time, I have no choice but to use gnome and wayland.

Aubrey

Hello all,

any (bright) ideas from anyone here??

Aubrey

Not a soul had an idea on how I can get this kernel compile to fly?

Aubrey

I do a fresh build and have the same issue in your pasteboard link,

by comparing config-5.15.0 and config-5.15.0-starfive in the boot partition, I found that the kernel of starfive-jh7110-202306-nvme-minimal-desktop.img is build with options GCC_PLUGINS=y and CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF_ALL=y.

After install gcc-12-plugin-dev and rebuild the kernel with those options enabled, I can successfully boot into the system.

Here is the recipe:

       sudo apt install git
       git clone https://github.com/starfive-tech/linux
       cd linux/
       git checkout -b JH7110_VisionFive2_devel origin/JH7110_VisionFive2_devel
       git pull
 
       sudo apt install make libncurses-dev bison flex libelf-dev libssl-dev bc

       sudo apt install gcc-12-plugin-dev

       make starfive_visionfive2_defconfig ARCH=riscv

       make ARCH=riscv menuconfig

  │ Symbol: GCC_PLUGINS [=y]                                                                       │  
  │ Type  : bool                                                                                   │  
  │ Defined at scripts/gcc-plugins/Kconfig:8                                                       │  
  │   Prompt: GCC plugins                                                                          │  
  │   Depends on: HAVE_GCC_PLUGINS [=y] && CC_IS_GCC [=y] && y                                     │  
  │   Location:                                                                                    │  
  │ (1) -> General architecture-dependent options   

  | Symbol: GCC_PLUGIN_STRUCTLEAK_BYREF_ALL [=y]                                                   │  
  │ Type  : bool                                                                                   │  
  │ Defined at security/Kconfig.hardening:83                                                       │  
  │   Prompt: zero-init everything passed by reference (very strong)                               │  
  │   Depends on: <choice> && GCC_PLUGINS [=y] && (!KASAN [=n] || !KASAN_STACK [=n])               │  
  │   Location:                                                                                    │  
  │     -> Security options                                                                        │  
  │       -> Kernel hardening options                                                              │  
  │         -> Memory initialization                                                               │  
  │ (2)       -> Initialize kernel stack variables at function entry (<choice> [=y])               │  
  │ Selects: GCC_PLUGIN_STRUCTLEAK [=y]

       time make ARCH=riscv -j4
       sudo make ARCH=riscv INSTALL_PATH=/boot/ zinstall
       sudo make INSTALL_DTBS_PATH="/boot/dtbs/new" dtbs_install
       sudo make INSTALL_MOD_PATH="/" INSTALL_MOD_STRIP=1 modules_install

       sudo update-initramfs -c -k 5.15.0

u-boot-update failed to work correctly for me either, so I still need to manually edit it:

## /boot/extlinux/extlinux.conf
##
## IMPORTANT WARNING
##
## The configuration of this file is generated automatically.
## Do not edit this file manually, use: u-boot-update

default l1
menu title U-Boot menu
prompt 0
timeout 50


label l0
	menu label Debian GNU/Linux bookworm/sid 5.15.0-starfive
	linux /vmlinuz-5.15.0-starfive
	initrd /initrd.img-5.15.0-starfive
	fdtdir /dtbs
	
	append root=/dev/mmcblk1p4 rw console=tty0 console=ttyS0,115200 earlycon rootwait stmmaceth=chain_mode:1 selinux=0

label l0r
	menu label Debian GNU/Linux bookworm/sid 5.15.0-starfive (rescue target)
	linux /vmlinuz-5.15.0-starfive
	initrd /initrd.img-5.15.0-starfive
	fdtdir /dtbs
	append root=/dev/mmcblk1p4 rw console=tty0 console=ttyS0,115200 earlycon rootwait stmmaceth=chain_mode:1 selinux=0 single
	

label l1
	menu label Debian GNU/Linux bookworm/sid 5.15.0
	linux /vmlinuz-5.15.0
	initrd /initrd.img-5.15.0
	fdtdir /dtbs/new
	
	append root=/dev/mmcblk1p4 rw console=tty0 console=ttyS0,115200 earlycon rootwait stmmaceth=chain_mode:1 selinux=0

label l1r
	menu label Debian GNU/Linux bookworm/sid 5.15.0 (rescue target)
	linux /vmlinuz-5.15.0
	initrd /initrd.img-5.15.0
	fdtdir /dtbs/new
	append root=/dev/mmcblk1p4 rw console=tty0 console=ttyS0,115200 earlycon rootwait stmmaceth=chain_mode:1 selinux=0 single

In your case you need to replace mmcblk1p4 to nvme0n1p4.

1 Like

@chbinnc
Sorry, but after installing the items you suggested, I do not have this (GCC) option in make menuconfig.

Ideas?

Aubrey

What’s your output of
apt search gcc | grep installed
?

cpp/unstable,now 4:13.1.0-4 riscv64 [installed,automatic]
cpp-12/unstable,now 12.3.0-6 riscv64 [installed,automatic]
cpp-13/unstable,now 13.1.0-9 riscv64 [installed,automatic]
dpkg-dev/unstable,now 1.21.22 all [installed,automatic]
gcc/unstable,now 4:13.1.0-4 riscv64 [installed,automatic]
gcc-12/unstable,now 12.3.0-6 riscv64 [installed,automatic]
gcc-12-base/unstable,now 12.3.0-6 riscv64 [installed]
gcc-12-plugin-dev/unstable,now 12.3.0-6 riscv64 [installed]
gcc-13/unstable,now 13.1.0-9 riscv64 [installed,automatic]
gcc-13-base/unstable,now 13.1.0-9 riscv64 [installed,automatic]
libatomic1/unstable,now 13.1.0-9 riscv64 [installed]
libcc1-0/unstable,now 13.1.0-9 riscv64 [installed,automatic]
libgcc-12-dev/unstable,now 12.3.0-6 riscv64 [installed,automatic]
libgcc-13-dev/unstable,now 13.1.0-9 riscv64 [installed,automatic]
libgcc-s1/unstable,now 13.1.0-9 riscv64 [installed]
libgomp1/unstable,now 13.1.0-9 riscv64 [installed,automatic]
root@risc-v:/Transit/linux#

So your default gcc is 13, install gcc-13-plugin-dev instead

@chbinnc Thanks for the tip. Now my GCC-plugin options are anabled.

However, when I select -

I am greeted with these options -

I have no possibility to enter “y” or “m”.

Have I missed something here?

Aubrey

Just press Enter on the first one and choose
zero-init everything passed by reference (very strong)

1 Like

@chninnc - That worked (a bit misleading). Thanks. Will report back.

@chbinnc The kernel compile works.
Thank you for your time and the assistance rendered.
A last question, why do I/we need all of this kernel hardening GCC Plugins (more overhead…) etc?

Regards

Aubrey

1 Like

I don’t know, guess it is related to Gnome or GPU.

@chbinnc
FYI - The kernel compiles and boots cleanly without the GCC Plugins being enabled also.

Aubrey

For a partial build (just remove the gcc-plugins options in the kernel and make again) or a complete build (pull the kernel sourcecode again and make)?

Partial build.
Something strange now…
Yesterday, I had 8GB RAM, after this kernel build, I now have only 4GB.
Firmware (U-Boot and SPL) is up to date.
Any ideas?

Aubrey

Could the wrong/old/incorrect DTB’s have been pulled in?

Aubrey

I only have a 4GB v1.2a board. Do a search on the forum and find this topic:

So manually change arch/riscv/boot/dts/starfive/jh7110-visionfive-v2.dtsi#L47

	memory@40000000 {
		device_type = "memory";
		reg = <0x0 0x40000000 0x1 0x0>;
	};

to

	memory@40000000 {
		device_type = "memory";
		reg = <0x0 0x40000000 0x2 0x0>;
	};

may help.

@chbinnc Just done so and rebooted. Now 8GB. Where did this “wrong” jh7110-visionfive-v2.dtb come from??

Aubrey