Alpine Linux with mainline u-boot, opensbi and kernel

Pleased to announce that we made Alpine Linux boot and work with mainline u-boot, opensbi and linux kernel, with some patches for u-boot and more patches for kernel.

Short guide how to use it is here https://arvanta.net/alpine/u-boot-visionfive2-alpine/

Source files for build u-boot and kernel are here https://gitlab.alpinelinux.org/nmeum/alpine-visionfive/-/tree/main/starfive

And guide how to install Alpine Linux on VisionFive V2 and V1 is here https://arvanta.net/alpine/alpine-on-visionfive/

9 Likes

w/musl?

yes, Alpine use musl as libc

2 Likes

I am having trouble getting an ethernet connection for dhcp.
https://gitlab.alpinelinux.org/nmeum/alpine-visionfive/-/issues/2
Tried static ip, nameserver to resolv.conf, hot-plug, various alternatives.
What to try?

For me setting static IP address and using dhcp works fine.
Could you post your /etc/network/interfaces file?

Also, instead of ifconfig you can use ip link, ip address and ip route commands, they will give more info

1 Like

Tried various (after which rc-service networking restart)
interfaces.bak (315 Bytes)

interfaces.vanilla (96 Bytes)

Hmmm… tried booting 2 & 3 alpine options.
With 3rd one, got inet!?! Used vanilla interfaces file.

rv64alpine:~# ifconfig
eth1      Link encap:Ethernet  HWaddr 6C:CF:39:00:18:6C  
          inet addr:192.168.50.88  Bcast:192.168.50.255  Mask:255.255.255.0
          inet6 addr: fe80::6ecf:39ff:fe00:186c/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:45 errors:0 dropped:6 overruns:0 frame:0
          TX packets:44 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:5901 (5.7 KiB)  TX bytes:4448 (4.3 KiB)
          Interrupt:60 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

ah, do you have v1.2a board version?

and did you set boot switches to boot from mmc?

1 Like

On 2023-09-23 14:24, mps via RVspace Forum wrote:

ah, do you have v1.2a board version?

Yes.

and did you set boot switches to boot from mmc?

Yes (switch: 1 is up=off, 2 is down=on)

BTW, /dev/fb0 (framebuffer) not present but supported in Debian kernel from VF2. How 2 enable?

Yes (switch: 1 is up=off, 2 is down=on)
could you break u-boot to get prompt (pressing enter while it count down timeout before menu) and issue version command and post what it says?

Also, result of printenv fdtfile command would be useful to see.
You are first who test this image with v1.2a board so all information would be useful for better testing and debugging.
BTW, /dev/fb0 (framebuffer) not present but supported in Debian kernel from VF2. How 2 enable?
We are using only mainline tools/software, i.e. u-boot, opensbi and kernel (with some patches), while Debian/starfive use kernel 5.15 with vendor (starfive) drivers and patches which are not yet upstream-ed to mainline kernel.

There is no DRM driver in mainline kernel yet and because this there is no/dev/fb0
We hope that with kernel 6.6 DRM driver will work

1 Like

could you break u-boot to get prompt (pressing enter while it count down timeout before menu) and issue version command and post what it says?
Hit any key to stop autoboot:  0
StarFive # version
U-Boot 2023.10-rc4 (Sep 16 2023 - 17:31:56 +0000)

gcc (Alpine 12.2.1_git20220924-r10) 12.2.1 20220924
GNU ld (GNU Binutils) 2.40
StarFive #
Also, result of printenv fdtfile command would be useful to see.
StarFive# printenv fdtfile
fdtfile=starfive/jh7110-starfive-visionfive-2-v1.2a.dtb
You are first who test this image with v1.2a board so all information would be useful for better testing and debugging.



BTW, /dev/fb0 (framebuffer) not present but supported in Debian kernel from VF2. How 2 enable?
We are using only mainline tools/software, i.e. u-boot, opensbi and kernel (with some patches), while Debian/starfive use kernel 5.15 with vendor (starfive) drivers and patches which are not yet upstream-ed to mainline kernel.

There is no DRM driver in mainline kernel yet and because this there is no/dev/fb0
We hope that with kernel 6.6 DRM driver will work

Likewise. I use a Smalltalk IDE in a framebuffer as its own window system (Cuis Smalltalk includes SVG, unicode, and truetype fonts), so I am very interested in getting /dev/fb0.

I like Alpine. Thanks much for this!
-KenD

could you break u-boot to get prompt (pressing enter while it count down timeout before menu) and issue version command and post what it says?
Hit any key to stop autoboot:  0
StarFive # version
U-Boot 2023.10-rc4 (Sep 16 2023 - 17:31:56 +0000)

gcc (Alpine 12.2.1_git20220924-r10) 12.2.1 20220924
GNU ld (GNU Binutils) 2.40
StarFive #
Also, result of printenv fdtfile command would be useful to see.
StarFive# printenv fdtfile
fdtfile=starfive/jh7110-starfive-visionfive-2-v1.2a.dtb

All looks good and it is very strange it didn’t boot automatically your board properly.

Likewise.  I use a Smalltalk IDE in a framebuffer as its own window system (Cuis Smalltalk includes SVG, unicode, and truetype fonts), so I am very interested in getting /dev/fb0.

I like Alpine. Thanks much for this!

You can join alpine IRC channel #alpine-riscv64 on OFTC where we discuss riscv and alpine, it is low in traffic

Hmmm… Clean vf2.img and select alpine option 3 (vf1.2a) allows eth1, but apk update seems to kill this. Clue?

 rv64alpine:~#  rc-service networking restart
 * WARNING: you are stopping a boot service
 * Stopping chronyd ...                                                   [ ok ]
 * Stopping networking ...
 *   lo ...              
 * Starting networking ...
 *   lo ...                                                               [ ok ]
 *   eth1 ...
ip: ioctl 0x8913 failed: No such device
udhcpc: ioctl 0x8933 failed: No such device
ifup: failed to change interface eth1 state to 'up'  

Looks like something is not good with eth1 driver. I tested and use only eth0 and it works.

Correction: I just tested eth1 on v1.3B board and it works fine

1 Like

I think the clue is that the original driver works fine with eth1 but doing an update kills it.

Unlikely to be a HW problem as the released VF2 Debian eth1 works fine.

So, how to either block driver update (good->bad) or recover the original driver. Is this a kernel module?

if kernel is upgraded modules are removed so reboot is needed after kernel upgrade

Right. Eth1 works until the reboot…

how did you upgraded kernel? You build it or you use something else?

No no no. I did a few apk adds then an apk update and rebooted. After reboot, Eth1 is unavailable.

rv64alpine:~#  rc-service networking restart
 * WARNING: you are stopping a boot service
 * Stopping chronyd ...                                                   [ ok ]
 * Stopping networking ...
 *   lo ...              
 * Starting networking ...
 *   lo ...                                                               [ ok ]
 *   eth1 ...
ip: ioctl 0x8913 failed: No such device
udhcpc: ioctl 0x8933 failed: No such device
ifup: failed to change interface eth1 state to 'up'  

apk update just update local packages database, it doesn’t upgrade any package.

apk upgrade upgrade all available packages to new versions.

So, if you didn’t upgrade kernel then modules are not removed.
What uname -a and lsmod says after reboot.

Also, I noticed that ethernet interface couldn’t be brought up if cable is not plugged in.
Check this by ip link set dev eth0 up without cable plugged.