Boot problem with custom linux on debian image-69


I built custom kernel, but I’m having trouble loading it.
Booting hangs on:
[ 1.052175] Freeing unused kernel image (initmem) memory: 2168K
[ 1.068868] Run /init as init process

Did I forget something or do something wrong?

Here are the steps I repeated when building the kernel:

  1. clone linux
    git clone GitHub - starfive-tech/linux

  2. move to linux dir
    cd linux

  3. switch to JH7110_VisionFive2_devel branch
    git checkout -b JH7110_VisionFive2_devel

  4. configure kernel
    make menuconfig


  1. build
    make -j4

  2. generate vmlinuz
    make INSTALL_PATH=~/linux zinstall

  3. copy dtb, and vmlinuz to boot
    cp ~/linux/vmlinuz-5.15.0-starfive-custom /boot/boot/
    cp ~/.local/projects/linux/arch/riscv/boot/dts/starfive/jh7110-visionfive-v2.dtb /boot/boot/dtbs/

  4. edit extlinux config in /boot/boot/extlinux/extlinux.conf
    label l2
    menu label Custom linux SD-root
    linux /boot/vmlinuz-5.15.0-starfive-custom
    initrd /boot/initrd.img-5.15.0-starfive

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

  1. uEnv.txt
1 Like

4.1 start with good default: make starfive_visionfive2_defconfig
4.2 configure kernel: make menuconfig

Assuming a working stock image, just replacing the kernel is a good first start, then modifying/replacing dtb, initrd, uenv.txt etc


I downloaded the zip archive for the JH7110_VisionFive2_devel branch, ran: make starfive_visionfive2_defconfig && make menuconfig && make and now I can boot from a custom kernel. thanks.


If you are using newer GNU binutils, you will need to patch the arch/riscv/Makefile. Here’s the patch.

Following is what I did…

git clone <repo>
cd <repo>
patch <the patchfile that I linked to>

make clean
make mrproper
make starfive_visionfive2_defconfig

ARCH=riscv CFLAGS="-march=rv64imafdc_zicsr_zba_zbb -mcpu=sifive-u74 -mtune=sifive-7-series -O2 -pipe" make deb-pkg

# install compiled kernel
dpkg -i ../*.deb
1 Like

Isn’t -pipe redundant these days?

Maybe… I took the CFLAGS from Gentoo’s wiki. I’m not a C/C++ dev by a long shot :sweat_smile:

You should follow the make cmd in offical Makefile in

My linux compile cmd is like this:
add HWBOARD_FLAG=HWBOARD_VISIONFIVE2 to normal make kernel cmd.

cd /root/linux
make ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- HWBOARD_FLAG=HWBOARD_VISIONFIVE2 vmlinux

My kernel has run sucess with this cmd.