Kernel compile error

Hello all,

the last time I compiled a VF2 kernel was in February.
For various reasons, I decided to compile a VF2 kernel anew… using these commands -

cd linux
git clone GitHub - starfive-tech/linux
git checkout -b JH7110_VisionFive2_devel origin/JH7110_VisionFive2_devel
Makefile:

VERSION = 5
PATCHLEVEL = 15
SUBLEVEL = 0
EXTRAVERSION = -starfive
NAME = Trick or Treat

git pull

make starfive_visionfive2_defconfig

However, the following error(s) are being produced -

.
.
.
CC fs/ext4/ext4_jbd2.o
CC drivers/clk/starfive/clk-starfive-jh7110-pll.o
CC fs/ext4/extents.o
drivers/clk/starfive/clk-starfive-jh7110-pll.c:291:23: error: ‘jh7110_clk_pll_debug_init’ undeclared here (not in a function); did you mean ‘jh7110_clk_debug_init’?
291 | .debug_init = jh7110_clk_pll_debug_init,
| ^~~~~~~~~~~~~~~~~~~~~~~~~
| jh7110_clk_debug_init
make[3]: *** [scripts/Makefile.build:277: drivers/clk/starfive/clk-starfive-jh7110-pll.o] Error 1
make[2]: *** [scripts/Makefile.build:540: drivers/clk/starfive] Error 2
make[1]: *** [scripts/Makefile.build:540: drivers/clk] Error 2
make: *** [Makefile:1868: drivers] Error 2
make: *** Waiting for unfinished jobs…
.
.
Anyone experienced a similiar problem?

Regards

Aubrey

1 Like

How did you build? Cross compile or native in the box itself?

Native. Always have done so.

Aubrey.

I always build in the box too, but I use the released kernel source. Check my build script here https://github.com/cwt/Arch-VF2-Image/blob/main/build.sh

It’s for Arch, but fundamental is the same.

Oops! Wrong must be here https://github.com/cwt/pkgbuild-linux-cwt-starfive-visionfive2/blob/5.15/PKGBUILD

1 Like

Thanks for the information but that is a developer’s script.
I am running Debian. Too many things to change from Arch to Debian.
I will wait.
The error in the compile should be relatively easy to pin down.

AUbrey

Hello all,

This topics is a few days old already… anyone any ideas??

Aubrey

Maybe ARCH=riscv is not detected by default, so the recipe below may help:

mv .config .config-bak
make ARCH=riscv starfive_visionfive2_defconfig
# make ARCH=riscv menuconfig
make ARCH=riscv -j4

Cheers.

3 Likes

@ chbinnc.
Appreciate the reply.
The kernel now compiles clean when I enable debug fs in menuconfig. Thanks.
What happens AFTER your last step ourlined above (make ARCH=riscv -j4)

Make install, make modules_install??, i.e, what happens with Image.gz and the DTB's newly created?
This is NOT explained in the documentation.

Regards

Aubrey

It is partially available at Software Technical Reference Manual: Adding New File

For me I directly generate necessary files with the commands below:

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

Btw these commands are also borrowed from

2 Likes

@chbinnc
Thanks for the information.
I followed your instructions, then ran u-boot-update to update extlinux.conf.
I then amended extlinux.conf to point to the newly compiled kernel (l1).
The board is now dead (red led, but no I/O activity (green)).

Any ideas?

Regards

Aubrey

Do you have a USB to TTL serial cable? Any debug info?

I have, but one of the pins is bent, so I cannot use it.
It looks like I will have to re-image the board again. :frowning:
Is there a chance I forgot a step in the install sequence?
I have been building kernels for years, this case is proving difficult…

Aubrey

PS In the abovementioned steps you describe -
" ```
make ARCH=riscv INSTALL_PATH=/boot/ zinstall
make INSTALL_DTBS_PATH=“/boot/dtbs” dtbs_install
make INSTALL_MOD_PATH=“/” INSTALL_MOD_STRIP=1 modules_install

You make no mention of extlinux.conf. In the meantime, this topic has surfaced in the documentation...
I find the mixture of cross-compile and native compile instructions in the documentation misleading and non-intuitive.
It would be preferable if the native (on the box) and cross-compile instructions were treated in separate paragraphs.

Aubrey

Old kernel is still in the /boot partition and was renamed to *.old, you can try to edit extlinux.conf again and point to it. If it doesn’t work, please paste your extlinux.conf here.

Difficult to do when I do not have an OS…

You can just connect your system sdcard/emmc/nvme with a USB adapter to your PC and edit the extlinux.conf file. Anyway, if you are going to re-image the board, you need another device and a working OS.

I could have taken the NVME device out and attached it to another machine and done my magic from there. Did not have the time. I re-imaged the NVME SSD, quicker.
Now I am back to where I was before all of these shenanigans started.

Can you confirm that these steps are still valid and in the right sequence -

make ARCH=riscv INSTALL_PATH=/boot/ zinstall
make INSTALL_DTBS_PATH="/boot/dtbs" dtbs_install
make INSTALL_MOD_PATH="/" INSTALL_MOD_STRIP=1 modules_install

Aubrey

PS There is no “old” or backup copy of vmlinuz being created when running the first command - see below

root@risc-v:/Transit/linux/linux# make ARCH=riscv INSTALL_PATH=/boot/ zinstall
sh ./arch/riscv/boot/install.sh 5.15.0
arch/riscv/boot/Image.gz System.map “/boot/”
root@risc-v:/Transit/linux/linux# ll /boot
total 32744
-rwx------ 1 root root 4003528 Aug 6 11:56 System.map-5.15.0
-rwx------ 1 root root 4415441 Jun 11 09:48 System.map-5.15.0-starfive
-rwx------ 1 root root 194818 Aug 6 11:56 config-5.15.0
-rwx------ 1 root root 199013 Jun 11 09:48 config-5.15.0-starfive
drwx------ 4 root root 2048 Jun 11 11:40 dtbs
drwx------ 2 root root 2048 Jun 11 11:40 extlinux
-rwx------ 1 root root 9272081 Jun 11 11:32 initrd.img-5.15.0-starfive
-rwx------ 1 root root 406 Jun 11 11:31 uEnv.txt
-rwx------ 1 root root 6858544 Aug 6 11:56 vmlinuz-5.15.0
-rwx------ 1 root root 8574915 Jun 11 09:48 vmlinuz-5.15.0-starfive
root@risc-v:/Transit/linux/linux#

Aubrey

Your new kernel is vmlinuz-5.15.0, the old one is vmlinuz-5.15.0-starfive, the name is different, so no backup files are generated. You need to edit extlinux.conf and change vmlinuz-5.15.0-starfive to vmlinuz-5.15.0.

I can confirm, except sometimes for avoiding overwriting dtbs files, I may change

make INSTALL_DTBS_PATH="/boot/dtbs" dtbs_install

to

make INSTALL_DTBS_PATH="/boot/dtbs/new" dtbs_install

And change dtbs path in the extlinux.conf respectively.

1 Like

As mentioned already, I ran the three commands in the sequence you outlined.
I edited extlinux.conf and changed the boot menu option from “l0” to “l1” whci pointed to
menu label Debian GNU/Linux bookworm/sid 5.15.0
linux /vmlinuz-5.15.0
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

As you can see from the above I did not change the initrd line. I then powered off, restarted, result system dead.

Any thoughts?

Aubrey

After running the three commands

make ARCH=riscv INSTALL_PATH=/boot/ zinstall
make INSTALL_DTBS_PATH="/boot/dtbs" dtbs_install
make INSTALL_MOD_PATH="/" INSTALL_MOD_STRIP=1 modules_install

The contents of /boot are as follows -
-rwx------ 1 root root 4003528 Aug 6 12:48 System.map-5.15.0
-rwx------ 1 root root 4415441 Jun 11 09:48 System.map-5.15.0-starfive
-rwx------ 1 root root 4003528 Aug 6 11:56 System.map-5.15.0.old
-rwx------ 1 root root 194818 Aug 6 12:48 config-5.15.0
-rwx------ 1 root root 199013 Jun 11 09:48 config-5.15.0-starfive
-rwx------ 1 root root 194818 Aug 6 11:56 config-5.15.0.old
drwx------ 4 root root 2048 Jun 11 11:40 dtbs
drwx------ 2 root root 2048 Jun 11 11:40 extlinux
-rwx------ 1 root root 9272081 Jun 11 11:32 initrd.img-5.15.0-starfive
-rwx------ 1 root root 406 Jun 11 11:31 uEnv.txt
-rwx------ 1 root root 6858544 Aug 6 12:48 vmlinuz-5.15.0
-rwx------ 1 root root 8574915 Jun 11 09:48 vmlinuz-5.15.0-starfive
-rwx------ 1 root root 6858544 Aug 6 11:56 vmlinuz-5.15.0.old

After running u-boot-update, this is what /boot/extlinux/extlinux.conf looks like -

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

label l0
menu label Debian GNU/Linux bookworm/sid 5.15.0.old
linux /vmlinuz-5.15.0.old

    append root=/dev/nvme0n1p4 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.old (rescue target)
linux /vmlinuz-5.15.0.old
fdtdir /dtbs

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

Notice, the line containing “fdtdir /dtbs” is missing…

Thoughts?

Aubrey

Having added the failing line “fdtdir /dtbs” to the new kernel that I compiled section in /boot/extlinux/extlinux.conf, I am greeted with this on a reboot -

VF2 Reboot

Any ideas?

Aubrey