I’m trying to build an LFS system for VisionFive 2, if you have tried can you tell me what problems did you face etc. Looking forward to your advice.
Linux From Scratch (Version 11.0) Linux kernel 5.13.12 Linux From Scratch (Version 11.1) Linux kernel 5.16.9 Linux From Scratch (Version 11.2) linux kernel 5.19.2 Linux From Scratch (Version 11.3) linux kernel 6.1.11
Visionfive 2 is currently using the 5.15.0 Linux kernel, which is a longterm stable kernel that will be supported until 2026-10. And everything is also being upstreamed so that it will be in the mainline Linux kernel before then.
No matter what version of LFS you pick, getting it to work will involved an lot of work forward-porting or back-porting patches. And even then I can predict that you will have new interesting encounters with as yet undiscovered problems.
I’m not saying it can not be done, just that it will be painful.
do you think it’s worth it to even try it? i’m new to this whole space, but wanted to learn more about it.
I only ever tried to use LFS once, so I’m no expert.
EDIT: Maybe ask questions about what would be involved where there is the largest concentration of knowledge about LFS. Which appears to be IRC and mailing lists, but always check their FAQ first, before asking questions. Oh, and in IRC be very patient, people are in multiple timezones, sometimes it can take 24 hours for the right person to see your question and respond, other times you are in close timezone and the response is instant (unless that person is busy at the time). Oddly enough sometimes a mailing list can get you a faster reply than IRC, which is counter intuitive.
Linux From Scratch ? This is nothing to discuss.
At the end of LFS, you will need a package manager software.
This result will take you back to beginning.
You will choose a package manager software at first.
And you will find out you will build a Linux Distribution, not a LFS.img.
So, why you not to choose a Linux Distribution and just to use?
For example, Gentoo .
Oh, LFS was fun when I learned Linux. It’s great teaching tool. But running it daily might be pain (I tried various Linux flavors of such taste in deeper past: LFS, musl based Linux with pure Busybox userspace), because you have to update or install software with your bare hands. Which Linux never made easy, as each package, each piece of software requires special attention and you have to read lots of documents and resolve dependencies manually, which is quite painful, believe me.
Right now I’m closer to it running a custom Slackware build on one of my boards, just for fun. I might even say that LFS is much more like Slackware if you rebuild it from source code. It’s quite easy, just grab sources and run their scripts. Not all packages are however RISC-V friendly these days. Some have outdated autoconf scripts, some just reject you with “Unknown CPU architecture”. Go figure.
One advantage of running Slackware for example is that you can use existing binary packages even if you built it from source code. Useful for example to install big software packages like chromium which would take ages to compile otherwise.
I’m too old to type everything by hand so I don’t run LFS anymore. But it was a good start when I was a Linux newbie.
As the others have already implied, if you want to do LFS to learn Linux then do it on a x86 machine. Most of what you learn will also apply to Linux on rv64.
VF2 is an affordable way for devs to learn the specifics of rv.
Rule of thumb: if you:
- Don’t know what’s the difference between RISC and CISC or 8086 asm is still magic world for you, and
- You had no prior embedded Linux experience (you don’t know what U-Boot is, how to build it, how to properly make it boot on target etc.; you did never at least discover internals of typical WRT firmware etc.), and
- You want to learn Linux internals really quick
then go LFS x86 (or x86_64 these days), preferrably in a VM. Easy to set up, build and learn, lots of tools and software, almost everything is compatible and error-free (if you pick stable versions).
On the other hand, VF2 offers pain-free way to learn embedded, because you are completely free from pitfalls that await you on other platforms like flashing invalid bootloaders bricking your devices, desolder chips and reprogram them and solder back etc plus common embedded limitations like very low RAM and CPU resources, little to no periphery aside from intended usage etc.
VF2 is just baremetal with that flash chip which can be easily removed and inserted back (properly formatted SDCard with bootloader section, akin to old times x86 PC boot floppy), lots of RAM and CPU resources (compared to typical embedded) and offers much more fun with shiny new RISC-V RV64 arch.