Compiling Kernel

Hello,
How can I only compile the kernel for hifive unleashed + expansion board patches? Instead of using freedom-u-sdk,yocto or buildroot? Can someone guide me on how to build the kernel only?

Thanks! :slightly_smiling_face:

Hi @banitos

Building the Linux kernel for HiFive Unleashed + Microsemi Expansion board (the hard way :slight_smile: )

  1. Reference kernel info and patches in FUSDK:
    meta-sifive/linux-mainline_5.8.bb at 2021.04 · sifive/meta-sifive · GitHub
    meta-sifive/recipes-kernel/linux/files at 2021.04 · sifive/meta-sifive · GitHub

  2. Clone kernel and checkout the branch referenced in FUSDK:
    git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git

  3. Apply patches from FUSDK.

  4. Export Environment Variables:
    export ARCH=riscv
    export CROSS_COMPILE=~/x-tools/riscv64-unknown-linux-gnu/bin/riscv64-unknown-linux-gnu- # or wherever your cross-compiler is

  5. Cross compiler might be acquired from here: Cross-compilation toolchains for Linux - riscv64 toolchains

  6. make defconfig

  7. Change any kernel config options you need to.

  8. make all

1 Like

freedom-u-sdk is dropping support for the Microsemi Expansion Board because it is too difficult to support. You might want to take a look at support that Microsemi provides for it. See for instance
https://github.com/polarfire-soc/meta-polarfire-soc-yocto-bsp
and
https://github.com/polarfire-soc/polarfire-soc-documentation/blob/master/boards/mpfs-dev-kit/MPFS-DEV-KIT_user_guide.md

Hi,
Thank you for providing me the instructions. I have built the kernel your way but the expansion board is not detected in lspci -vvvv. I’m getting empty lspci -vvvv output. I have ran the patches on top of 5.8 version kernel and added the dtb file to extlinux.
Extlinux: extlinux - Pastebin.com
Boot log: bootlog - Pastebin.com

Thank you for your help.

PCIE_MICROSEMI was disabled in defconfig, I enabled it manually but I’m still getting empty output on lspci.

How do I apply the defconfig? I’m getting the following error:

ricecracker@ricecracker-MS-7B98:~/unleashed/linux2/linux$ make -j8 ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- make defconfig
make[1]: *** No rule to make target 'make'.  Stop.
make: *** [Makefile:336: __build_one_by_one] Error 2

I moved my defconfig to arch/riscv/configs/defconfig. Now the .config file seems fine but I’m still not getting any output on lspci or on the amd video card. Kernel Config file: kernel config riscv - Pastebin.com

Is this a known good hardware configuration and you’re just trying to create your own software flow?

For example, does lspci command and PCIe video card work with the 2020.04 release of FUSDK?

Yes, the hardware is working with FUSDK. I was getting xfce working on a rootfs environment with it. I enabled the dts from meta-polarfire-soc-yocto-bsp/mpfs.dts at 0a9dafd4156952b13b93639f39673b8bdc67721c · polarfire-soc/meta-polarfire-soc-yocto-bsp · GitHub but it is still not working.

What I’m trying to do is use ubuntu image for the board with the custom kernel for expansion board support.

Would you be able to use the Ubuntu rootfs with the FUSDK kernel to achieve this? You may also need to use the defconfig from Ubuntu build with the FUSDK kernel.

Yes, thank you maybe that’s the best idea to get it to work then.

You have one “make” too much in this command. Removing the one just before “defconfig” should fix this error.

I followed the following excellent guide to do this, and a little more:

(Permalink: riscv-bringup/Readme.md at 6b2858f36966d112f5667161f3783e5e77a03729 · carlosedp/riscv-bringup · GitHub)