Simple Linux kernel bootup guide (non-EFI)

Just in case anyone’s wondering and is going through the same trouble as I am with a Visionfive V2 (1.1) board. Here’s a short guide on how to get a kernel booted on the little bugger.

I’ll assume you boot from TF which has a single partition formatted for u-boot to be able to read it.

Grab Starfives’s fork of Linux and switch to V2 branch, build and get files:

git clone GitHub - starfive-tech/linux && cd linux
git checkout JH7110_VisionFive2_devel
ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- make starfive_visionfive2_defconfig
ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- make -j$(nproc)
cp arch/riscv/boot/Image.gz /media/sdcard/
cp arch/riscv/boot/dts/starfive/jh7110-visionfive-v2-A11.dtb /media/sdcard/

Upon boot, interrupt u-boot and feed it the following:

setenv fdtcontroladdr 0xffffffffffffffff;
setenv fileaddr a0000000;
setenv kernel_comp_addr_r 0xb0000000;
setenv kernel_comp_size 0x10000000;
load mmc 1:1 ${fdt_addr_r} jh7110-visionfive-v2-A11.dtb;
load mmc 1:1 ${kernel_addr_r} Image.gz
booti ${kernel_addr_r} - ${fdt_addr_r};

I’ve been cobbling this together from the SDK Quick Start guide and a bit of trial an error with various kernel images. I’ll be working with this for as long as I can’t get Grub to work stably again via bootefi. Btw, Grub itself works just fine via bootefi but it can’t boot anything on V2 just yet in my case.

5 Likes

Quick notes:

  • GbE port not detecting link (100Mbit port is fine)
  • only 4GB RAM are being detected on a 8GB board
  • no video output support

I guess missing blobs or something?

3 Likes

powervr · powervr · Frank Binns / linux-firmware · GitLab do either of these gpu blobs work?

1 Like

So far no, I’m trying to build the SDK for V2 as it was announced but I guess I’m fighting with bugs since I’m doing that on ppc64le. :smiley:

The new SDK includes additional out-of-tree drivers etc. So we shall see what works.

I got the sdk to build the sdcard image on ubuntu 22.04 under wsl but needed to tweak wsl to not add the windows PATH and I had to manually install libssl per this guide python - Ubuntu 22.04 | libssl.so.1.1: cannot open shared object file: No such file or directory - Stack Overflow
I’ll have to look around in it later for the gpu blob, now just waiting for the board to arrive

1 Like

Looks like the gpu blobs are in: soft_3rdpart/IMG_GPU/out

I had to revert the tarballs in there to a prior revision though, HEAD is busted and ships empty ones and the downloads don’t work.

git checkout a2c06b2c54c18961087d6caa834d6936e9862af9 soft_3rdpart/IMG_GPU/out/img-gpu-powervr-bin-1.17.6210866.tar.gz

I’m still stuck at ispsdk having build issues due to linker scripts errors in .a files it ships.

I did not use git-lfs (before), so I ASSumed it was optional and I ended up with a bunch of files that were only couple of hundred bytes and contained text like the following:

$ cat soft_3rdpart/IMG_GPU/out/img-gpu-powervr-bin-1.17.6210866.tar.gz
version https://git-lfs.github.com/spec/v1
oid sha256:8ef5eba77c776e0d4444d819e12c64bfa8eee0ae2cdf90b6eb7a3a9df7bd7ef2
size 62412446

If you installed git-lfs and then run “git lfs fetch” or “git-lfs fetch” it will pull down the “large file storage” files from at a guess an external webserver (I have not looked into the exact details of how it works yet)!

The files in VisionFive2 repository that are currently stored as lfs files using git lfs module are:

soft_3rdpart/IMG_GPU/out/img-gpu-powervr-bin-1.17.6210866.tar.gz
soft_3rdpart/IMG_GPU/out/img-gpu-powervr-bin-1.15.6052913.tar.gz
soft_3rdpart/ispsdk/DDKSource/libispsdk/libStfIncludes.a
soft_3rdpart/ispsdk/DDKSource/libispsdk/libStfCommon.a
soft_3rdpart/ispsdk/DDKSource/libispsdk/libStfLib_LinkedList.a
soft_3rdpart/ispsdk/DDKSource/libispsdk/libISPC.a
soft_3rdpart/ispsdk/DDKSource/libispsdk/libISP_API.a
soft_3rdpart/ispsdk/DDKSource/libispsdk/libmedia-ctrl.a
soft_3rdpart/ispsdk/DDKSource/libispsdk/libCI_User.a

$ cat .gitattributes
soft_3rdpart/IMG_GPU/out/.tar.gz filter=lfs diff=lfs merge=lfs -text
soft_3rdpart/ispsdk/DDKSource/libispsdk/
.a filter=lfs diff=lfs merge=lfs -text

My guess is that the git-lfs module is used because it reduces bandwidth hosting costs because people will end up with a single revision of large binary files (The very last revision, with no local copy of any previous revisions by default. “git lfs fetch --all” would pull down all current and previous revisions, really useful if you were migrating from one git provider to another.).

2 Likes

Good catch, I’ll have a look into git-lfs. Maybe it’s what I am missing and I already spent way too much time debugging. :smiley:

2 Likes