I’ve been trying to compile a new kernel for Fedora RISC-V for a while, every time without success. In my most recent try
I have an up-to-date Fedora RISC-V, Fedora release 31 (Rawhide), gcc (GCC) 9.0.1 20190320 (Red Hat 9.0.1-0.11) on the device, that I’m using to compile the kernel
I’ve also, just in case, updated riscv-pk to current master https://github.com/riscv/riscv-pk.git (but I have the same problems with the referenced commit)
Then I do make and it produces a bbl.u540 that I install to the correctly labeled GPT partition of a SD card.
I get this, then nothing at all, no error messages through the serial out
Is the serial device name in the command line console=ttySI0 still correct? (could this explain no output?)
edit: okay, this could be it, we might need ttySIF0:
Is it a boot loader issue? Does it need u-boot instead of bbl perhaps? (just found this)
Edit: or, what is opensbi? I realize I have no clue how this all fits together.
Edit: YESS after simply changing the branch to v5.1-rc1_unleashed (hadn’t noticed that it existed), I get kernel output !
[ 0.000000] OF: fdt: Ignoring memory range 0x80000000 - 0x80200000
[ 0.000000] Linux version 5.1.0-rc1-00010-ge3827dbacb90 (root@medusa.local) (gcc version 9.0.1 20190320 (Red Hat 9.0.1-0.11) (GCC)) #8 SMP Fri Mar 29 14:12:06 UTC 2019
...
[ 16.407127] systemd[1]: System time before build time, advancing clock.
[ 16.426215] systemd[1]: systemd v241-2.gita09c170.0.riscv64.fc30 running in system mode. (+PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 -SECCOMP +BLKID +ELFUTILS +KMOD +IDN2 -IDN +PCRE2 default-hierarchy=hybrid)
[ 16.449523] systemd[1]: Detected architecture riscv64.
Welcome to Fedora 31 (Rawhide)!
[ 16.463061] systemd[1]: Set hostname to <medusa.local>.
../machine/mtrap.c:21: machine mode: unhandlable trap 4 @ 0x000000008000387a
Power off
It even gets as far as booting from nbd0, right after setting the hostname it dies in a mtrap (huh - CAUSE_MISALIGNED_LOAD 0x4) but so happy to have output now.
Edit: okay, this issue was funny. Apparently the compiler is generating RISCV-C but not defining __riscv_compressed, resulting in the trap handler getting unexpected input (the other __riscv_* are defined though?!? edit: this has been reported, is a known issue in gcc mainline [1]). After defining that manually and recompiling riscv-pk it works and boots !
So if that ‘just works’, then I need to update freedom-u-sdk and figure out how to support two kernel targets. Any thoughts on the best way to build that without creating a bunch of checked-out bloat?
Although if you want to come bleed with us a mainline-able U-boot might be working from https://github.com/sifive/u-boot soonish
Not really, at the moment I definitely have a lot of checked-out bloat here At least wanted to document my steps so it might help people running into some of the same issues.
I don’t think submodule would work for the use-case. I suppose the script would have to explicitly add remote, fetch, and check out the kernel branch that is going to be built. At least the git history is shared for large part.
i have downloaded the latest fedora disk image from this link
(https://dl.fedoraproject.org/pub/alt/risc-v/disk-images/fedora/),
following the same procedure here find that they mentione -sda.raw file but in the link provided -sda1.raw image which is EXT4 file system , i copied the same raw image to first partition in sd card using dd command and in the second partition copied the bbl+kernel+initramfs images but still the u540 board is not booting up, struck in the middle any suggestion how to boot up with fedora-riscv raw image
New threads for new problems please. It is confusing to add something that is unrelated to the original question. The kernel you are using will boot on qemu but not on the HiFive Unleashed, as it is missing drivers required for the hardware. We are still in the process of upstreaming the necessary drivers to the linux kernel sources. Meanwhile, you can build something that will boot on the hardware by using github.com/sifive/freedom-u-sdk, and then optionally replace the debian rootfs with a fedora rootfs. You will have to edit the u-boot config file to disable initramfs to boot the debian/fedora rootfs instead of initramfs.
It doesn’t seem that I have permission to edit or delete this: but please close/delete this topic; the instructions here don’t work with newer kernels and might confuse people.
I don’t know of any way to close discussions other than to mark them as spam, and this isn’t spam. Posting a note that the info it obsolete should be good enough and you already did that.