Experimental Gentoo Image

For those who do not have time to create their own Gentoo Image I have created a basic image that you can experiment with that does not have a GUI installed and only has a limited amount of packages installed.
It is based on the Risc V lp64d systemd image from stage3.
For a limited time I will have it avaiable for download here

The Image has 2 users which are listed below with their passwords
root/1Starfive?
user/1Starfive?

Install the image to a SD Card of at least 32GB
Then extend the tf card rootfs partition if needed.

This could be done on Ubuntu host, need to install the below package:

$ sudo apt install cloud-guest-utils e2fsprogs

Then insert the tf card to Ubuntu host, run the below, note /dev/sdX is the tf card device.

$ sudo growpart /dev/sdX 3 # extend partition 4
$ sudo e2fsck -f /dev/sdX3
$ sudo resize2fs /dev/sdX3 # extend filesystem
$ sudo fsck.ext4 /dev/sdX3

Place the SD card in your Visionfive2 and boot up with an ethernet cable installed.
Check your router to see the IP Address. It may take a few minutes to show up.

Connect using SSH and log on as either root or user and login with the password 1Starfive?
In the folder /root I have a script called system-update.sh which you could run to update the system.

The Image is currently running the stock Visionfive2 Debian Kernel.

In /usr/src I have a copy of the Linux kernel ready to be compiled
In /usr/src/linux I have a file called build-patch.txt which I applied to fix a compile error. You can read the file for details. You can refer to the Visionfive2 Documentation on how to compile and update the kernel.

When comparing Performance of my Visionfive2 running Gentoo with my 8GB Rasperry Pi 4 I found that for the tests I did my Visionfive2 runs faster running Gentoo than my Rasperry Pi 4 does.

The types of tests I did was with commands like
genlop -t gcc
genlop -t glibc
genlop -t bc
Which show the compile times of the programs given as the argument

Additionally running other tests like
time echo “scale=5000; 4*a(1)” | bc -l
was also faster on my Visionfive2

12 Likes

Thank you for your Image. I think, Gentoo is the best Linux distribution at this time for our starfive 2. And as a Desktop Gentoo user, I think gentoo is the best linux distribution also :smiley:

One little note: To be honest, comparing compile times with genlop is not really fair, because a raspberry and a visionfive 2 are complete different architectures and different sourcecode-trees.

A small indicator for performance is the “nbench” benchmark. Try this on your rasberry and your starfive 2. (did you use the optimized cflags for your raspberry also?). I would be very interested in the results.

Yes I had optimized my Raspberry PI 4 at some point.

Here are the results from nbench

********************* VISIONFIVE2 NBENCH***********************

StarFive ~ # nbench

BYTEmark* Native Mode Benchmark ver. 2 (10/95)
Index-split by Andrew D. Balsa (11/97)
Linux/Unix* port by Uwe F. Mayer (12/96,11/97)

TEST : Iterations/sec. : Old Index : New Index
: : Pentium 90* : AMD K6/233*
--------------------:------------------:-------------:------------
NUMERIC SORT : 748.13 : 19.19 : 6.30
STRING SORT : 95.89 : 42.85 : 6.63
BITFIELD : 2.6558e+08 : 45.56 : 9.52
FP EMULATION : 106.07 : 50.90 : 11.74
FOURIER : 17872 : 20.33 : 11.42
ASSIGNMENT : 11.736 : 44.66 : 11.58
IDEA : 4273.6 : 65.36 : 19.41
HUFFMAN : 1598.6 : 44.33 : 14.16
NEURAL NET : 11.927 : 19.16 : 8.06
LU DECOMPOSITION : 442.09 : 22.90 : 16.54
==========================ORIGINAL BYTEMARK RESULTS==========================
INTEGER INDEX : 42.407
FLOATING-POINT INDEX: 20.738
Baseline (MSDOS*) : Pentium* 90, 256 KB L2-cache, Watcom* compiler 10.0
==============================LINUX DATA BELOW===============================
CPU : 4 CPU
L2 Cache :
OS : Linux 5.15.0-starfive
C compiler : riscv64-unknown-linux-gnu-gcc
libc :
MEMORY INDEX : 9.008
INTEGER INDEX : 11.941
FLOATING-POINT INDEX: 11.502
Baseline (LINUX) : AMD K6/233*, 512 KB L2-cache, gcc 2.7.2.3, libc-5.4.38

  • Trademarks are property of their respective holder.
    StarFive ~ #

************************RASPBERRY PI 4 NBENCH *************************
andrew@gentoo ~ $ nbench

BYTEmark* Native Mode Benchmark ver. 2 (10/95)
Index-split by Andrew D. Balsa (11/97)
Linux/Unix* port by Uwe F. Mayer (12/96,11/97)

TEST : Iterations/sec. : Old Index : New Index
: : Pentium 90* : AMD K6/233*
--------------------:------------------:-------------:------------
NUMERIC SORT : 268.99 : 6.90 : 2.27
STRING SORT : 127.12 : 56.80 : 8.79
BITFIELD : 8.5729e+07 : 14.71 : 3.07
FP EMULATION : 64.01 : 30.71 : 7.09
FOURIER : 18381 : 20.90 : 11.74
ASSIGNMENT : 7.7555 : 29.51 : 7.65
IDEA : 2410 : 36.86 : 10.94
HUFFMAN : 780.14 : 21.63 : 6.91
NEURAL NET : 18.063 : 29.02 : 12.21
LU DECOMPOSITION : 427.44 : 22.14 : 15.99
==========================ORIGINAL BYTEMARK RESULTS==========================
INTEGER INDEX : 23.672
FLOATING-POINT INDEX: 23.770
Baseline (MSDOS*) : Pentium* 90, 256 KB L2-cache, Watcom* compiler 10.0
==============================LINUX DATA BELOW===============================
CPU : 4 CPU
L2 Cache :
OS : Linux 5.15.56-v8+
C compiler : aarch64-unknown-linux-gnu-gcc
libc :
MEMORY INDEX : 5.913
INTEGER INDEX : 5.903
FLOATING-POINT INDEX: 13.184
Baseline (LINUX) : AMD K6/233*, 512 KB L2-cache, gcc 2.7.2.3, libc-5.4.38

  • Trademarks are property of their respective holder.
    andrew@gentoo ~ $
2 Likes
Here are the results of another Test


VISIONFIVE2
time echo "scale=5000; 4*a(1)" | bc -l -q ; cat /proc/cpuinfo | grep "model name"; cat /proc/meminfo  | grep MemTotal
3.141592653589793238462643383279502884197169399375105820974944592307\
81640628620899862803482534211706798214808651328230664709384460955058\
22317253594081284811174502841027019385211055596446229489549303819644\
28810975665933446128475648233786783165271201909145648566923460348610\
45432664821339360726024914127372458700660631558817488152092096282925\
40917153643678925903600113305305488204665213841469519415116094330572\
70365759591953092186117381932611793105118548074462379962749567351885\
75272489122793818301194912983367336244065664308602139494639522473719\
07021798609437027705392171762931767523846748184676694051320005681271\
45263560827785771342757789609173637178721468440901224953430146549585\
37105079227968925892354201995611212902196086403441815981362977477130\
99605187072113499999983729780499510597317328160963185950244594553469\
08302642522308253344685035261931188171010003137838752886587533208381\
42061717766914730359825349042875546873115956286388235378759375195778\
18577805321712268066130019278766111959092164201989380952572010654858\
63278865936153381827968230301952035301852968995773622599413891249721\
77528347913151557485724245415069595082953311686172785588907509838175\
46374649393192550604009277016711390098488240128583616035637076601047\
10181942955596198946767837449448255379774726847104047534646208046684\
25906949129331367702898915210475216205696602405803815019351125338243\
00355876402474964732639141992726042699227967823547816360093417216412\
19924586315030286182974555706749838505494588586926995690927210797509\
30295532116534498720275596023648066549911988183479775356636980742654\
25278625518184175746728909777727938000816470600161452491921732172147\
72350141441973568548161361157352552133475741849468438523323907394143\
33454776241686251898356948556209921922218427255025425688767179049460\
16534668049886272327917860857843838279679766814541009538837863609506\
80064225125205117392984896084128488626945604241965285022210661186306\
74427862203919494504712371378696095636437191728746776465757396241389\
08658326459958133904780275900994657640789512694683983525957098258226\
20522489407726719478268482601476990902640136394437455305068203496252\
45174939965143142980919065925093722169646151570985838741059788595977\
29754989301617539284681382686838689427741559918559252459539594310499\
72524680845987273644695848653836736222626099124608051243884390451244\
13654976278079771569143599770012961608944169486855584840635342207222\
58284886481584560285060168427394522674676788952521385225499546667278\
23986456596116354886230577456498035593634568174324112515076069479451\
09659609402522887971089314566913686722874894056010150330861792868092\
08747609178249385890097149096759852613655497818931297848216829989487\
22658804857564014270477555132379641451523746234364542858444795265867\
82105114135473573952311342716610213596953623144295248493718711014576\
54035902799344037420073105785390621983874478084784896833214457138687\
51943506430218453191048481005370614680674919278191197939952061419663\
42875444064374512371819217999839101591956181467514269123974894090718\
64942319615679452080951465502252316038819301420937621378559566389377\
87083039069792077346722182562599661501421503068038447734549202605414\
66592520149744285073251866600213243408819071048633173464965145390579\
62685610055081066587969981635747363840525714591028970641401109712062\
80439039759515677157700420337869936007230558763176359421873125147120\
53292819182618612586732157919841484882916447060957527069572209175671\
16722910981690915280173506712748583222871835209353965725121083579151\
36988209144421006751033467110314126711136990865851639831501970165151\
16851714376576183515565088490998985998238734552833163550764791853589\
32261854896321329330898570642046752590709154814165498594616371802709\
81994309924488957571282890592323326097299712084433573265489382391193\
25974636673058360414281388303203824903758985243744170291327656180937\
73444030707469211201913020330380197621101100449293215160842444859637\
66983895228684783123552658213144957685726243344189303968642624341077\
32269780280731891544110104468232527162010526522721116603966655730925\
47110557853763466820653109896526918620564769312570586356620185581007\
29360659876486117910453348850346113657686753249441668039626579787718\
55608455296541266540853061434443185867697514566140680070023787765913\
44017127494704205622305389945613140711270004078547332699390814546646\
45880797270826683063432858785698305235808933065757406795457163775254\
20211495576158140025012622859413021647155097925923099079654737612551\
76567513575178296664547791745011299614890304639947132962107340437518\
95735961458901938971311179042978285647503203198691514028708085990480\
10941214722131794764777262241425485454033215718530614228813758504306\
33217518297986622371721591607716692547487389866549494501146540628433\
66393790039769265672146385306736096571209180763832716641627488880078\
69256029022847210403172118608204190004229661711963779213375751149595\
01566049631862947265473642523081770367515906735023507283540567040386\
74351362222477158915049530984448933309634087807693259939780541934144\
73774418426312986080998886874132604720

real	1m9.992s
user	1m9.969s
sys	0m0.001s
MemTotal:        8118100 kB

RASPBERRY PI 4
time echo "scale=5000; 4*a(1)" | bc -l -q ; cat /proc/cpuinfo | grep "model name"; cat /proc/meminfo  | grep MemTotal
3.141592653589793238462643383279502884197169399375105820974944592307\
81640628620899862803482534211706798214808651328230664709384460955058\
22317253594081284811174502841027019385211055596446229489549303819644\
28810975665933446128475648233786783165271201909145648566923460348610\
45432664821339360726024914127372458700660631558817488152092096282925\
40917153643678925903600113305305488204665213841469519415116094330572\
70365759591953092186117381932611793105118548074462379962749567351885\
75272489122793818301194912983367336244065664308602139494639522473719\
07021798609437027705392171762931767523846748184676694051320005681271\
45263560827785771342757789609173637178721468440901224953430146549585\
37105079227968925892354201995611212902196086403441815981362977477130\
99605187072113499999983729780499510597317328160963185950244594553469\
08302642522308253344685035261931188171010003137838752886587533208381\
42061717766914730359825349042875546873115956286388235378759375195778\
18577805321712268066130019278766111959092164201989380952572010654858\
63278865936153381827968230301952035301852968995773622599413891249721\
77528347913151557485724245415069595082953311686172785588907509838175\
46374649393192550604009277016711390098488240128583616035637076601047\
10181942955596198946767837449448255379774726847104047534646208046684\
25906949129331367702898915210475216205696602405803815019351125338243\
00355876402474964732639141992726042699227967823547816360093417216412\
19924586315030286182974555706749838505494588586926995690927210797509\
30295532116534498720275596023648066549911988183479775356636980742654\
25278625518184175746728909777727938000816470600161452491921732172147\
72350141441973568548161361157352552133475741849468438523323907394143\
33454776241686251898356948556209921922218427255025425688767179049460\
16534668049886272327917860857843838279679766814541009538837863609506\
80064225125205117392984896084128488626945604241965285022210661186306\
74427862203919494504712371378696095636437191728746776465757396241389\
08658326459958133904780275900994657640789512694683983525957098258226\
20522489407726719478268482601476990902640136394437455305068203496252\
45174939965143142980919065925093722169646151570985838741059788595977\
29754989301617539284681382686838689427741559918559252459539594310499\
72524680845987273644695848653836736222626099124608051243884390451244\
13654976278079771569143599770012961608944169486855584840635342207222\
58284886481584560285060168427394522674676788952521385225499546667278\
23986456596116354886230577456498035593634568174324112515076069479451\
09659609402522887971089314566913686722874894056010150330861792868092\
08747609178249385890097149096759852613655497818931297848216829989487\
22658804857564014270477555132379641451523746234364542858444795265867\
82105114135473573952311342716610213596953623144295248493718711014576\
54035902799344037420073105785390621983874478084784896833214457138687\
51943506430218453191048481005370614680674919278191197939952061419663\
42875444064374512371819217999839101591956181467514269123974894090718\
64942319615679452080951465502252316038819301420937621378559566389377\
87083039069792077346722182562599661501421503068038447734549202605414\
66592520149744285073251866600213243408819071048633173464965145390579\
62685610055081066587969981635747363840525714591028970641401109712062\
80439039759515677157700420337869936007230558763176359421873125147120\
53292819182618612586732157919841484882916447060957527069572209175671\
16722910981690915280173506712748583222871835209353965725121083579151\
36988209144421006751033467110314126711136990865851639831501970165151\
16851714376576183515565088490998985998238734552833163550764791853589\
32261854896321329330898570642046752590709154814165498594616371802709\
81994309924488957571282890592323326097299712084433573265489382391193\
25974636673058360414281388303203824903758985243744170291327656180937\
73444030707469211201913020330380197621101100449293215160842444859637\
66983895228684783123552658213144957685726243344189303968642624341077\
32269780280731891544110104468232527162010526522721116603966655730925\
47110557853763466820653109896526918620564769312570586356620185581007\
29360659876486117910453348850346113657686753249441668039626579787718\
55608455296541266540853061434443185867697514566140680070023787765913\
44017127494704205622305389945613140711270004078547332699390814546646\
45880797270826683063432858785698305235808933065757406795457163775254\
20211495576158140025012622859413021647155097925923099079654737612551\
76567513575178296664547791745011299614890304639947132962107340437518\
95735961458901938971311179042978285647503203198691514028708085990480\
10941214722131794764777262241425485454033215718530614228813758504306\
33217518297986622371721591607716692547487389866549494501146540628433\
66393790039769265672146385306736096571209180763832716641627488880078\
69256029022847210403172118608204190004229661711963779213375751149595\
01566049631862947265473642523081770367515906735023507283540567040386\
74351362222477158915049530984448933309634087807693259939780541934144\
73774418426312986080998886874132604720

real	1m45.397s
user	1m45.378s
sys	0m0.010s
MemTotal:        7999720 kB
1 Like

hi,

I did do similar thing like you. I replaced the whole rootfs of official Debian with gentoo stage3. Everything works fine except hdmi, I could not see any output on screen, while it was ok when I booted Debian. So could you share us how you did your gentoo image?

1 Like

The gl driver is missing. Try to access with serial and then ssh. If everything working, then try to install the binary blob driver under: soft_3rdpart/IMG_GPU/out at b580826be8a00fb8143bc5ea3310ba12af612468 · starfive-tech/soft_3rdpart · GitHub

Thank you, Andrew.

I have some VisionFive2 on order and expect the first to arrive by Valentine’s Day.

I have been planning to build a Gentoo image for the VisionFive2 using the work-flow from the GenPi64 project where I built a Gentoo image for the Raspberry Pi 4. Using a Gentoo VM on an AMD Bulldozer (2013) processor, it took 8 days and 8 nights because everything was running under Qemu. Since then I’ve built a cross-compiler and have run some experiments with distcc, but I haven’t rebuilt the image using a cross compiler.

I would very much like to learn more about how you built your Gentoo image for the VisionFive2.

Question: two releases (OpenRC):

  1. stage3-rv64_lp64-openrc-20230203T170205Z.tar.xz
  2. stage3-rv64_lp64d-openrc-20230203T170205Z.tar.xz

I read at Downloads – Gentoo Linux (click the riscv tab):

Processor compatibility

The lp64d stages can be used on all 64-bit RISC-V processors supporting the double-precision floating point instruction set. The lp64 stages can be used on all 64-bit RISC-V processors; they require no hardware support for floating point arithmetics.

I therefore was wondering if the StarFive VisionFive2 RISC-V Single Board Computer’s processor, “JH7110”, supported the RISC-V Extension D: Standard Extension for Double-Precision Floating-Point.

I could not find anything indicating the JH71110 does, so I was thinking I should use the “lp64”. I noticed your image references the “lp64d” which suggests support for Extension D and wonder why you selected the “lp64d” version.

(Note: I had additional links, but this forum’s restriction on new users allowed a maximum of 2 links per post caused me to excise the links.)

John

I started with the debian image for the Visionfive2 and replaced the third partion with the gentoo riscv stage3 image. I setup the network and sshd to start on boot. For some more hints see the thread on safe gcc flags. I see you have already been answered on the question of why i chose the stage3 version i did.

As you have found out, you should use stage3-rv64_lp64d.

I am also running OpenRC Gentoo. Upstream stage3 works fine, but you may want to rebuild with flags found in another thread. Current Gentoo RV stage3 comes with GCC 12. Cross-built the kernel from VF2’s 5.15.0 buildroot primarily to to add modules for RTCs, wireless cards, turn on some missing options, …

Trying to compile as much for the board on the board as I can though. Currently self-hosted compiling KDE. This will take a while. =)

I plan to create an ebuild and overlay for anything VF2 specific - the IMG drivers being one thing, but also rtl82xxb out-of-tree wireless driver (at least a binary built against my kernel as building against buildroot kernel on the target seems to be a pain in the ass. Maybe I should rebuild the kernel on the VF2 now that it’s running and scrap buildroot…)

Is there a way to test “Double-Precision Floating-Point” calculation?

I do all my kernel rebuilds and emerging on the Visionfive2. It rebuilds the kernel and emerges packages much faster than my Raspberry Pi 4 does running Gentoo

I’m not sure what you want to test. If you write C code that uses doubles then you are using instructions from the D set. Various test from RISC-V Inc. also tests D, but given the history of this core and the FP implementation, I’d be surprised if there are any issues at all. D isn’t a novelty and in fact, due to C’s promotion rules, far far more D instructions are executed than F.

3 Likes
Dhrystone comparison on Gentoo between my Visionfive 2 and my Raspberry PI 4 both with 8GB of Memory
In this test my Visionfive2 is FASTER that my Raspberry PI 4
-------------------------- Visionfive 2-------------------
StarFive ~/Downloads/benchmark-dhrystone # ./dhrystone

Dhrystone Benchmark, Version 2.1 (Language: C)

Program compiled without 'register' attribute

Execution starts, 200000000 runs through Dhrystone
Execution ends

Final values of the variables used in the benchmark:

Int_Glob:            5
        should be:   5
Bool_Glob:           1
        should be:   1
Ch_1_Glob:           A
        should be:   A
Ch_2_Glob:           B
        should be:   B
Arr_1_Glob[8]:       7
        should be:   7
Arr_2_Glob[8][7]:    200000010
        should be:   Number_Of_Runs + 10
Ptr_Glob->
  Ptr_Comp:          -1193049440
        should be:   (implementation-dependent)
  Discr:             0
        should be:   0
  Enum_Comp:         2
        should be:   2
  Int_Comp:          17
        should be:   17
  Str_Comp:          DHRYSTONE PROGRAM, SOME STRING
        should be:   DHRYSTONE PROGRAM, SOME STRING
Next_Ptr_Glob->
  Ptr_Comp:          -1193049440
        should be:   (implementation-dependent), same as above
  Discr:             0
        should be:   0
  Enum_Comp:         1
        should be:   1
  Int_Comp:          18
        should be:   18
  Str_Comp:          DHRYSTONE PROGRAM, SOME STRING
        should be:   DHRYSTONE PROGRAM, SOME STRING
Int_1_Loc:           5
        should be:   5
Int_2_Loc:           13
        should be:   13
Int_3_Loc:           7
        should be:   7
Enum_Loc:            1
        should be:   1
Str_1_Loc:           DHRYSTONE PROGRAM, 1'ST STRING
        should be:   DHRYSTONE PROGRAM, 1'ST STRING
Str_2_Loc:           DHRYSTONE PROGRAM, 2'ND STRING
        should be:   DHRYSTONE PROGRAM, 2'ND STRING

Microseconds for one run through Dhrystone: 0
Dhrystones per Second:                      8695652

-------------------- Raspberry PI 4 ----------------
gentoo ~/Downloads/benchmark-dhrystone # ./dhrystone

Dhrystone Benchmark, Version 2.1 (Language: C)

Program compiled without 'register' attribute

Execution starts, 200000000 runs through Dhrystone
Execution ends

Final values of the variables used in the benchmark:

Int_Glob:            5
        should be:   5
Bool_Glob:           1
        should be:   1
Ch_1_Glob:           A
        should be:   A
Ch_2_Glob:           B
        should be:   B
Arr_1_Glob[8]:       7
        should be:   7
Arr_2_Glob[8][7]:    200000010
        should be:   Number_Of_Runs + 10
Ptr_Glob->
  Ptr_Comp:          -1895116128
        should be:   (implementation-dependent)
  Discr:             0
        should be:   0
  Enum_Comp:         2
        should be:   2
  Int_Comp:          17
        should be:   17
  Str_Comp:          DHRYSTONE PROGRAM, SOME STRING
        should be:   DHRYSTONE PROGRAM, SOME STRING
Next_Ptr_Glob->
  Ptr_Comp:          -1895116128
        should be:   (implementation-dependent), same as above
  Discr:             0
        should be:   0
  Enum_Comp:         1
        should be:   1
  Int_Comp:          18
        should be:   18
  Str_Comp:          DHRYSTONE PROGRAM, SOME STRING
        should be:   DHRYSTONE PROGRAM, SOME STRING
Int_1_Loc:           5
        should be:   5
Int_2_Loc:           13
        should be:   13
Int_3_Loc:           7
        should be:   7
Enum_Loc:            1
        should be:   1
Str_1_Loc:           DHRYSTONE PROGRAM, 1'ST STRING
        should be:   DHRYSTONE PROGRAM, 1'ST STRING
Str_2_Loc:           DHRYSTONE PROGRAM, 2'ND STRING
        should be:   DHRYSTONE PROGRAM, 2'ND STRING

Microseconds for one run through Dhrystone: 0
Dhrystones per Second:                      5882353


2 Likes

Are both clocked at 1.5 GHz or is the RPi4 running at 1.8 GHz ?
And which compiler version was used on each ?

That gives the VF2: 5.797* DMIPS/MHz (@ 1.5 GHz).
And the RPi4 either: 3.268 DMIPS/MHz (@ 1.8GHz) or 3.922 DMIPS/MHz (@ 1.5GHz).

*The official benchmark results are 4.27/2.81 DMIPS/MHz (Best Effort/Legal) for the u74-mc and 4.27/3.32 DMIPS/MHz (Best Effort/Legal) for the U74. I’m guessing that both your benchmarks are heavily optimised (i.e. Best Effort instead of Legal). It is only a synthetic benchmark of integer maths and string manipulation (and compilers) mostly, but impressive none the less. Thanks for sharing.

1 Like

Both devices were running at 1.5 GHz using gcc 12.2.1. The benchmark for the Visionfive2 is from sfive and hosted on github. I modified it for the PI so both were using assembler routines for strcmp

1 Like

Was it 32bit or 64bit OS on the RPi, because I found these results elsewhere:

                            DMIPS
 System     MHz    DMIPS     /MHz

 32 bit    1500     5077     3.76
 64 bit    1500     7814     5.21

 64/32 bit          1.54

EDIT: Just noticed that the above benchmark results were generated by Roy Longbottom (currently aged 88, 51 years of computer benchmarking and stress testing 1972 to 2023. He was involved as a developer for the whetstone benchmark in the 1980’s), he also has an entire website (http only, no https) dedicated to benchmarking and benchmarking tools. Interestingly he has no publicly listed results (yet) for any RISC-V hardware.

I am running a 64bit gentoo on my Raspberry Pi 4 as well as the Visionfive2

2 Likes

Hello all!

Andrew reached out to me via email, so I am going to present the following link as a resource to anyone who would like to collaborate on getting the installation process for Gentoo documented for the StarFive VisionFive 2. Please feel free to use it as a landing page to document your efforts; especially if you find a trick or detail others would find useful

https://wiki.gentoo.org/wiki/User:Maffblaster/Drafts/StarFive_VisionFive_2

Once the page matures enough we’ll move it out of my user namespace and into a better place on the wiki.

I don’t mean to detract from this forum post, my desire is merely to provide a link to a location in the official Gentoo ecosystem that can be used to consolidate useful Gentoo-related knowledge. This can help prevent having to crawl many sites to get the information necessary to install Gentoo. :slightly_smiling_face:

I look forward to collaborating with you!

8 Likes

Here is a link to my latest Image which includes the v2.10.4 Firmware on the SD Image
https://drive.google.com/file/d/10TDsk2FwZDJv3yJvDAfCam5Wf9ibS6Eg/view?usp=sharing

Install using dd or Balana Etcher after uncompressing the file EG

sudo dd if=gentoo.img of=/dev/mmcblk0 bs=1024

Modify the SD Card for expand the last partition to use the rest of the SD Card.

sudo growpart /dev/mmcblk0 4
sudo e2fsck -f /dev/mmcblk0p4
sudo resize2fs /dev/mmcblk0p4
sudo fsck.ext4 /dev/mmcblk0p4

Set the DIP Switches on the board to boot from the SD Card

Boot the device and connect using either the serial port or using ssh
Log on as root

Set a root password.

passwd root

Update /etc/portage/make.conf with CPU Info etc

Refer to https://wiki.gentoo.org/wiki/Safe_CFLAGS The section on RISC-V

Add a normal User and set the Password.

useradd -m -G users,wheel,audio -s /bin/bash user
passwd user

Do an Initial Sync of the Device and select a Profile.

emaint -a sync

eselect profile list
eselect profile set 8

Select the Kernel

eselect kernel list
eselect kernel set 1

Follow the standard Gentoo Documents.

If you want to build a custom Kernel follow the steps below

emerge --ask –verbose sys-kernel/dracut

mkdir -p /usr/src/compiled-kernel
cd /usr/src/linux
make menuconfig
time make -j4


make  INSTALL_PATH=/usr/src/compiled-kernel/ zinstall -j4

make modules_install

mkdir /boot/dtbs/new
mkdir /boot/dtbs/new/starfive
cp arch/riscv/boot/dts/starfive/jh7110-visionfive-v2*.dtb /boot/dtbs/new/starfive/
cp -r arch/riscv/boot/dts/starfive/vf2-overlay /boot/dtbs/new/starfive/
cp /usr/src/compiled-kernel/vmlinuz-5.15.0-starfive-dirty /boot/vmlinuz-5.15.0-starfive-dirty
cp /usr/src/compiled-kernel/System.map-5.15.0-starfive-dirty /boot/System.map-5.15.0-starfive-dirty
cp /usr/src/compiled-kernel/config-5.15.0-starfive-dirty /boot/config-5.15.0-starfive-dirty

dracut /boot/initrd.img-5.15.0-starfive-dirty  --force

edit /boot/extlinux/extlinux.conf so that it looks like this

## /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 Gentoo GNU/Linux 5.15.0-starfive-dirty
        linux /vmlinuz-5.15.0-starfive-dirty
        initrd /initrd.img-5.15.0-starfive-dirty

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

Reboot and test

If you build your own kernel and it only shows half your ram when you reboot you need to apply the fix mentioned in this thread Device trees limit Linux to 4GB of RAM on 8GB devices · Issue #20 · starfive-tech/VisionFive2 · GitHub
by Updating the Memory settings in arch/riscv/boot/dts/starfive/jh7110-visionfive-v2.dtsi and then rebuild the kernel and install it again.

4 Likes