Code Monkey home page Code Monkey logo

meta-sifive's Introduction

meta-sifive

SiFive BSPs layer for OpenEmbedded/Yocto

Description

This is the general hardware-specific BSP layer for the SiFive boards.

More information can be found at: https://sifive.com/ (Official Site)

Dependencies

This layer depends on:

Prerequisites for the build host

Create the build environment

mkdir dist && cd dist
git clone https://github.com/sifive/meta-sifive

Available machines

This layer provides a BSP for the following machines:

  • freedom-u540: The SiFive HiFive Unleashed board
  • unmatched: The Sifive Unmatched board

But changes are also validated on Qemu RISC-V 64bits, so this layer also provide a Kas yaml to build this machine.

Available distribution

This layer doesn't define new distributions. BSPs are validated with the core-image-minimal and the core-image-sato provides by the OE-core layer.

Build images

Building disk images is CPU intensive, could require <10GB of sources downloaded over the Internet and <200GB of local storage.

This layer provides Kas scripts configured to download and to configure the build environment to build core-minimal images for supported targets:

kas build --update ./meta-sifive/scripts/kas/freedom-u540.yml
kas build --update ./meta-sifive/scripts/kas/qemuriscv64.yml
kas build --update ./meta-sifive/scripts/kas/unmatched.yml

Moreover, it is also possible to build other images, or SDK, or also packages, for example:

kas build --update ./meta-sifive/scripts/kas/unmatched.yml --target core-image-weston
kas build --update ./meta-sifive/scripts/kas/unmatched.yml --target buildtools-extended-tarball
kas build --update ./meta-sifive/scripts/kas/unmatched.yml --target busybox
kas shell --update ./meta-sifive/scripts/kas/unmatched.yml -c "bitbake core-image-minimal -c populate_sdk"
kas shell --update ./meta-sifive/scripts/kas/unmatched.yml -c "bitbake core-image-minimal -c populate_sdk_ext"

Running in QEMU

The OpenEmbedded/Yocto framework provides a wrapper for QEMU, named runqemu in order to use it easily.

Below examples to use this Qemu over a Kas shell:

kas shell ./meta-sifive/scripts/kas/qemuriscv64.yml -c "runqemu slirp nographic core-image-minimal"
kas shell ./meta-sifive/scripts/kas/qemuriscv64.yml -c "runqemu slirp serialstdio core-image-sato"

Execute runtime tests

The OpenEmbedded/Yocto framework provides also provides tools to implement and to run tests.

These tests can be executed on all supported targets, using the following commands:

kas build --update ./meta-sifive/scripts/kas/qemuriscv64.yml:./meta-sifive/scripts/kas/include/test.yml
kas shell --update ./meta-sifive/scripts/kas/qemuriscv64.yml:./meta-sifive/scripts/kas/include/test.yml -c "bitbake core-image-minimal -c populate_sdk && bitbake core-image-minimal -c testsdk"
kas shell --update ./meta-sifive/scripts/kas/qemuriscv64.yml:./meta-sifive/scripts/kas/include/test.yml -c "bitbake core-image-minimal -c populate_sdk_ext && bitbake core-image-minimal -c testsdkext"
kas shell --update ./meta-sifive/scripts/kas/qemuriscv64.yml:./meta-sifive/scripts/kas/include/test.yml -c "resulttool report  ./tmp-glibc/log/oeqa"

Running on Hardware

You will find all available build fragments (incl. disk images) in $BUILDDIR/tmp/deploy/images/$MACHINE where MACHINE can be:

  • freedom-u540
  • qemuriscv64
  • unmatched

Disk images files use <image>-<machine>.<output_format> format, for example,

core-image-minimal-unmatched.wic.xz. We are interested in .wic.xz disk images for writing to uSD card.

Be very careful while picking /dev/sdX device! Look at dmesg, lsblk, blkid, GNOME Disks, etc. before and after plugging in your uSD card to find a proper device. Double check it to avoid overwriting any of system disks/partitions!

Unmount any mounted partitions from uSD card before writing!

Flash the image on SDCard

Images built can be flashed with bmaptool (faster), for example:

sudo bmaptool copy ../build/tmp-glibc/deploy/images/unmatched/core-image-minimal-unmatched.rootfs.wic.xz /dev/mmcblk0

Otherwise, you can also use the dd command, for example:

xzcat ../build/tmp-glibc/deploy/images/unmatched/core-image-minimal-unmatched.rootfs.wic.xz | sudo dd of=/dev/mmcblk0 bs=512K iflag=fullblock oflag=direct conv=fsync status=progress

MSEL for Unleashed

You will need to modify MSEL to allow using U-Boot SPL, OpenSBI, U-Boot proper bootloaders from uSD card instead of SPI-NOR Flash chip:

      USB   LED    Mode Select                  Ethernet
 +===|___|==****==+-+-+-+-+-+-+=================|******|===+
 |                | | | | |X| |                 |      |   |
 |                | | | | | | |                 |      |   |
 |        HFXSEL->|X|X|X|X| |X|                 |______|   |
 |                +-+-+-+-+-+-+                            |
 |        RTCSEL-----/ 0 1 2 3 <--MSEL                     |
 |                                                         |

MSEL for Unmatched

By default MSEL on Unmatched is set to use uSD instead of SPI-NOR Flash chip to load U-Boot SPL, OpenSBI and U-Boot proper. Below is the default configuration for DIP switches (located next to Assembly Number and RTC battery):

  +----------> CHIPIDSEL
  | +--------> MSEL3
  | | +------> MSEL2
  | | | +----> MSEL1
  | | | | +--> MSEL0
  | | | | |
 +-+-+-+-+-+
 | |X| |X|X| ON(1)
 | | | | | |
 |X| |X| | | OFF(0)
 +-+-+-+-+-+
BOOT MODE SEL

Connecting Using Serial Console

Connect your HiFive Unleashed or HiFive Unmatched to your PC using microUSB-USB cable to access serial console.

For macOS, run: screen -L /dev/tty.usbserial-*01 115200

For Linux, run: screen -L /dev/serial/by-id/usb-FTDI_Dual_RS232-HS-if01-port0 115200

The above commands might vary depending on your exact setup.

-L command will log all output to screenlog.0 in your current working directory.

To quit screen, hit Ctrl - A followed by \ symbol. Finally agree to terminate all windows by typing y.

You can login with root account. The password is sifive. We strongly recommend to change the default password for the root account on the first boot before you connect it to the Internet.

Connecting Using SSH

Before you connect your board to the Internet we strongly recommend to change the default password for the root account and configure your network equipment (for example, routers and firewalls) appropriately.

SSH daemon is enabled by default, in order to be able to execute remotely runtime tests. To disable SSH daemon connect to the board using serial console method described above. Once connected execute the following commands:

systemctl disable sshd.socket
systemctl stop sshd.socket

The HiFive Unleashed and Unmatched behave like any other network capable device (such as PC, laptop, and Single Board Computers like Raspberry Pi). Connect the board to your network (for example, a router), and it will acquire IPv4 + DNS configuration using DHCP protocol. You can use your router management panel to get assigned IPv4 address or use the serial console to acquire it directly from the board (use ip addr command to print active network information). Finally you can SSH to the board:

ssh -o PreferredAuthentications=password -o PubkeyAuthentication=no -o StrictHostKeyChecking=no -o "UserKnownHostsFile /dev/null" root@<IPv4>

Supported GPUs

Various GPUs from AMD were successfully tested with the boards. In particular Radeon HD 6450 is the most widely used. Other GPUs from the same family might also work, for instance, THD64xxM, HD7450, HD8450, R5 230, R5 235, R5 235X. The newest tested GPUs from AMD are RX 550, RX 570, RX 580 with no issues.

Online Resizing of rootfs (Root File Partition)

It is highly advised to resize partitions offline (i.e. before booting the system). If you already booted the system and cannot do offline resizing then the following instructions should resize rootfs (root file partition) to full uSD capacity:

sgdisk -v /dev/mmcblk0
sgdisk -e /dev/mmcblk0
parted /dev/mmcblk0 resizepart 4 100%
resize2fs /dev/mmcblk0p4
sync

NBD (Network Block Device) rootfs

This is an experimantal feature currently only available on SiFive HiFive Unmatched board. This allow sharing a block device over the network. This is not an extensive guide into NBD, but a quick start.

If you want to use this feature open extlinux.conf in /boot partition and modify the append line to:

append ip=dhcp root=/dev/nbd0 rw nbdroot=<server_ip_address>:<export_name> nbdport=10809 console=ttySIF0,115200 earlycon

If you are booting directly from U-Boot prompt, you would need to set bootargs variable instead.

Note that <export_name> value might be ignored by the NBD server (depends on the implementation and configuration).

nbdkit is a recommended NBD server for it's flexibility.

Here is an example command for nbdkit:

sudo nbdkit -f --verbose --threads 128 --filter=cow --filter=partition --filter=xz file core-image-minimal-unmatched-<..>.rootfs.wic.xz partition=4

This would expose the ext4 filesystem on the 4th partition from XZ compressed disk image. By default it's read-only thus we also add a COW (Copy-on-Write) layer. Note that COW layer is not saved by default and will be lost if nbdkit process is terminated. See nbdkit-cow-filter NOTES on how to save disk image with all the modifications for further use.

Using XZ compressed disk image is convenient, but doesn't deliver high performance. For higher performance uncompress disk image before sharing it via NBD.

Here is another example:

sudo mkdir rootfs
sudo tar -xJ --numeric-owner -C rootfs -f core-image-minimal-unmatched-<..>.rootfs.tar.xz
sudo nbdkit -f --verbose --threads 128 --filter=partition --filter=cow linuxdisk $PWD/rootfs size=+2G partition=1

In this particular case we uncompress rootfs into a directory. We ask nbdkit to take the directory, generate linux disk image from it, add some additional free space, add a COW layer to make it writable and send "naked" filesystem (i.e. no partition table) as before.

nbdkit has a number of plugins and filters allowing various ways how to share disk images over the network.

Run Tensorflow Lite demo

cd /usr/share/tensorflow/lite/examples/python/
python3 python3 mnist.py

Contributions & Feedback

If you want to file issues, send patches and make feature/enhancement requests use meta-sifive repository on GitHub. So that the maintainer can process your request.

You are also welcome to join SiFive Forums where we have HiFive Unleashed and HiFive Unmatched categories for discussions.

meta-sifive's People

Contributors

kraj avatar mengts avatar ruinland-tsai avatar tprrt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

meta-sifive's Issues

u-boot build noise

When building u-boot, there's a huge amount of warnings for a redefinition of CONFIG_SYS_I2C_TMP451_ADDR.

In file included from include/config.h:4,
                 from include/common.h:16,
                 from arch/riscv/lib/asm-offsets.c:11:
include/configs/sifive-unmatched.h:40: warning: "CONFIG_SYS_I2C_TMP451_ADDR" redefined
   40 | #define CONFIG_SYS_I2C_TMP451_ADDR      0x4c
      | 
In file included from ././include/linux/kconfig.h:4,
                 from <command-line>:
include/generated/autoconf.h:29: note: this is the location of the previous definition
   29 | #define CONFIG_SYS_I2C_TMP451_ADDR 0x0
      | 

Shouldn't the lines:

config SYS_I2C_TMP451_ADDR
	hex "Chip address of the TMP451 device"
	default 0

in drivers/misc/Kconfig be under the line if I2C_EEPROM? That's how it was before.

2022.04 do_rootfs fail

I want to build qemuriscv64 image using this original source code, but encounted this problem:
ERROR: demo-coreip-cli-1.0-r0 do_rootfs: The postinstall intercept hook 'update_mime_database' failed, details in /data/htf/riscv-sifive/build/tmp-glibc/work/qemuriscv64-oe-linux/demo-coreip-cli/1.0-r0/temp/log.do_rootfs ERROR: Logfile of failure stored in: /data/htf/riscv-sifive/build/tmp-glibc/work/qemuriscv64-oe-linux/demo-coreip-cli/1.0-r0/temp/log.do_rootfs.2028911 ERROR: Task (/data/htf/riscv-sifive/freedom-u-sdk/recipes-sifive/images/demo-coreip-cli.bb:do_rootfs) failed with exit code '1'
Any one knows how to solve this?

Can't bring up secondary CPUs

I'm running OpenSBI and 5.6-rc6 I can't get the secondary CPUs to come online.

CPU1: failed to come online

I've compiled with GCC 8.3.0 and 9.2.0.

Latest firmware images freeze on load

I've built the latest versions of the images for OpenSBI, U-Boot and Linux Kernel, applied the patches from the meta-sifive repository but it freezes on load:

U-Boot 2021.07-dirty (Aug 27 2021 - 19:02:51 -0300)

CPU:   rv64imafdc
Model: SiFive HiFive Unmatched A00
DRAM:  16 GiB
MMC:   spi@10050000:mmc@0: 0
Loading Environment from nowhere... OK
EEPROM: SiFive PCB EEPROM format v1
Product ID: 0002 (HiFive Unmatched)
PCB revision: 3
BOM revision: A
BOM variant: 0
Serial number: SF105SZ210400013
Ethernet MAC address: 70:b3:d5:92:f4:3c
CRC: 13149a3f
In:    serial@10010000
Out:   serial@10010000
Err:   serial@10010000
Model: SiFive HiFive Unmatched A00
Net:   eth0: ethernet@10090000
Hit any key to stop autoboot:  0 
PCIE-0: Link up (Gen1-x8, Bus0)

Device 0: Vendor: 0x126f Rev: T0707A0L Prod: 9110309600195
            Type: Hard Disk
            Capacity: 488386.3 MB = 476.9 GB (1000215216 x 512)
... is now current device
Scanning nvme 0:1...
Found /boot/extlinux/extlinux.conf
Retrieving file: /boot/extlinux/extlinux.conf
2811 bytes read in 1 ms (2.7 MiB/s)
SiFive Unmatched Boot Options
1:      Linux kernel-5.11.12
2:      Linux kernel-5.11.12 (recovery mode)
3:      Linux kernel-5.11.15
4:      Linux kernel-5.11.15 (recovery mode)
5:      Linux kernel-5.12.19
6:      Linux kernel-5.12.19 (recovery mode)
7:      Linux kernel-5.13.13
8:      Linux kernel-5.13.13 (recovery mode)
Enter choice: 7
7:      Linux kernel-5.13.13
Retrieving file: /boot/initrd.img-5.13.13
8510273 bytes read in 9 ms (901.8 MiB/s)
Retrieving file: /boot/vmlinuz-5.13.13
9807010 bytes read in 12 ms (779.4 MiB/s)
append: earlyprintk rw root=/dev/nvme0n1p1 rootfstype=ext4 rootwait console=ttySIF0,115200 LANG=en_US.UTF-8 earlycon
Retrieving file: /boot/dtbs/5.13.13/sifive/hifive-unmatched-a00.dtb
10927 bytes read in 1 ms (10.4 MiB/s)
   Uncompressing Kernel Image
Moving Image from 0x84000000 to 0x80200000, end=81686000
## Flattened Device Tree blob at 88000000
   Booting using the fdt blob at 0x88000000
   Loading Ramdisk to ff7e2000, end fffffb41 ... 

Using the same Kernel with previous firmware (built based on meta-sifive 2021.06 and uboot 2021.01) works fine:

U-Boot SPL 2021.01-dirty (Jul 05 2021 - 14:55:06 -0300)
Trying to boot from MMC1


U-Boot 2021.01-dirty (Jul 05 2021 - 14:55:06 -0300)

CPU:   rv64imafdc
Model: SiFive HiFive Unmatched A00
DRAM:  16 GiB
MMC:   spi@10050000:mmc@0: 0
EEPROM: SiFive PCB EEPROM format v1
Serial number: SF105SZ210400013
PCB revision: 3
Ethernet MAC address: 70:b3:d5:92:f4:3c
CRC: 13149a3f
EEPROM dump: (0x25 bytes)
00: F1 5E 50 45 01 02 00 03 41 00 53 46 31 30 35 53 
10: 5A 32 31 30 34 30 30 30 31 33 01 70 B3 D5 92 F4 
20: 3C 3F 9A 14 13 
found SiFive v1
In:    serial@10010000
Out:   serial@10010000
Err:   serial@10010000
Model: SiFive HiFive Unmatched A00
Net:   eth0: ethernet@10090000
Hit any key to stop autoboot:  0 
PCIe Link up, Gen1

Device 0: Vendor: 0x126f Rev: T0707A0L Prod: 9110309600195
            Type: Hard Disk
            Capacity: 488386.3 MB = 476.9 GB (1000215216 x 512)
... is now current device
Scanning nvme 0:1...
Found /boot/extlinux/extlinux.conf
Retrieving file: /boot/extlinux/extlinux.conf
2811 bytes read in 1 ms (2.7 MiB/s)
SiFive Unmatched Boot Options
1:      Linux kernel-5.11.12
2:      Linux kernel-5.11.12 (recovery mode)
3:      Linux kernel-5.11.15
4:      Linux kernel-5.11.15 (recovery mode)
5:      Linux kernel-5.12.19
6:      Linux kernel-5.12.19 (recovery mode)
7:      Linux kernel-5.13.13
8:      Linux kernel-5.13.13 (recovery mode)
Enter choice: 7
7:      Linux kernel-5.13.13
Retrieving file: /boot/initrd.img-5.13.13
8510273 bytes read in 9 ms (901.8 MiB/s)
Retrieving file: /boot/vmlinuz-5.13.13
9807010 bytes read in 11 ms (850.2 MiB/s)
append: earlyprintk rw root=/dev/nvme0n1p1 rootfstype=ext4 rootwait console=ttySIF0,115200 LANG=en_US.UTF-8 earlycon
Retrieving file: /boot/dtbs/5.13.13/sifive/hifive-unmatched-a00.dtb
10927 bytes read in 1 ms (10.4 MiB/s)
   Uncompressing Kernel Image
Moving Image from 0x84000000 to 0x80200000, end=81686000
## Flattened Device Tree blob at 88000000
   Booting using the fdt blob at 0x88000000
   Using Device Tree in place at 0000000088000000, end 0000000088005aae

Starting kernel ...

[    0.000000] Linux version 5.13.13 (carlosedp@UbuntuBuild) (riscv64-linux-gnu-gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #2 SMP Fri Aug 27 18:36:27 -03 2021
[    0.000000] OF: fdt: Ignoring memory range 0x80000000 - 0x80200000
[    0.000000] Machine model: SiFive HiFive Unmatched
[    0.000000] earlycon: sifive0 at MMIO 0x0000000010010000 (options '')
...

Patch out of sync with upstream: 0002-riscv-sifive-unmatched-update-for-16GB-rev3.patch

Where is the DRAM training codes

Just curious about the boot procedure, and wondering there is the lower level BSP codes:
I thought the DDR training was before OpenSBI executed via XIP directly in SPI flash or SD Card.
However I didn't see related codes in OpenSBI nor any board specific code.

Hang on high CPU load

I'm having an issue where I experience a hang on high CPU load such as compiling.

I've tried Linux 5.6.2 and 5.6.5 with OpenSBI 0.4 - 0.6 with the defconfig provided. I'm using the expansion board and this happens with NVMe or SATA drives. I didn't experience the issue on my previous setup (Linux 5.2.0, OpenSBI 0.4).

I've compared the device trees between both versions, old and new as it might have something to do with it.

--- /dev/fd/3	2020-04-19 11:39:26.936459828 -0400
+++ /dev/fd/0	2020-04-19 11:39:26.934459828 -0400
@@ -7,11 +7,13 @@
 	model = "SiFive HiFive Unleashed A00";
 
 	aliases {
+		ethernet0 = "/soc/ethernet@10090000";
 		serial0 = "/soc/serial@10010000";
 		serial1 = "/soc/serial@10011000";
 	};
 
 	chosen {
+		stdout-path = "serial0";
 	};
 
 	cpus {
@@ -20,11 +22,13 @@
 		timebase-frequency = <0xf4240>;
 
 		cpu@0 {
+			clocks = <0x01 0x00>;
 			compatible = "sifive,e51\0sifive,rocket0\0riscv";
 			device_type = "cpu";
 			i-cache-block-size = <0x40>;
 			i-cache-sets = <0x80>;
 			i-cache-size = <0x4000>;
+			operating-points-v2 = <0x02>;
 			reg = <0x00>;
 			riscv,isa = "rv64imac";
 			status = "disabled";
@@ -33,11 +37,12 @@
 				#interrupt-cells = <0x01>;
 				compatible = "riscv,cpu-intc";
 				interrupt-controller;
-				phandle = <0x01>;
+				phandle = <0x04>;
 			};
 		};
 
 		cpu@1 {
+			clocks = <0x01 0x00>;
 			compatible = "sifive,u54-mc\0sifive,rocket0\0riscv";
 			d-cache-block-size = <0x40>;
 			d-cache-sets = <0x40>;
@@ -51,6 +56,8 @@
 			i-tlb-sets = <0x01>;
 			i-tlb-size = <0x20>;
 			mmu-type = "riscv,sv39";
+			next-level-cache = <0x03>;
+			operating-points-v2 = <0x02>;
 			reg = <0x01>;
 			riscv,isa = "rv64imafdc";
 			tlb-split;
@@ -59,12 +66,12 @@
 				#interrupt-cells = <0x01>;
 				compatible = "riscv,cpu-intc";
 				interrupt-controller;
-				phandle = <0x02>;
+				phandle = <0x05>;
 			};
 		};
 
 		cpu@2 {
-			clock-frequency = <0x00>;
+			clocks = <0x01 0x00>;
 			compatible = "sifive,u54-mc\0sifive,rocket0\0riscv";
 			d-cache-block-size = <0x40>;
 			d-cache-sets = <0x40>;
@@ -78,6 +85,8 @@
 			i-tlb-sets = <0x01>;
 			i-tlb-size = <0x20>;
 			mmu-type = "riscv,sv39";
+			next-level-cache = <0x03>;
+			operating-points-v2 = <0x02>;
 			reg = <0x02>;
 			riscv,isa = "rv64imafdc";
 			tlb-split;
@@ -86,12 +95,12 @@
 				#interrupt-cells = <0x01>;
 				compatible = "riscv,cpu-intc";
 				interrupt-controller;
-				phandle = <0x03>;
+				phandle = <0x06>;
 			};
 		};
 
 		cpu@3 {
-			clock-frequency = <0x00>;
+			clocks = <0x01 0x00>;
 			compatible = "sifive,u54-mc\0sifive,rocket0\0riscv";
 			d-cache-block-size = <0x40>;
 			d-cache-sets = <0x40>;
@@ -105,6 +114,8 @@
 			i-tlb-sets = <0x01>;
 			i-tlb-size = <0x20>;
 			mmu-type = "riscv,sv39";
+			next-level-cache = <0x03>;
+			operating-points-v2 = <0x02>;
 			reg = <0x03>;
 			riscv,isa = "rv64imafdc";
 			tlb-split;
@@ -113,12 +124,12 @@
 				#interrupt-cells = <0x01>;
 				compatible = "riscv,cpu-intc";
 				interrupt-controller;
-				phandle = <0x04>;
+				phandle = <0x07>;
 			};
 		};
 
 		cpu@4 {
-			clock-frequency = <0x00>;
+			clocks = <0x01 0x00>;
 			compatible = "sifive,u54-mc\0sifive,rocket0\0riscv";
 			d-cache-block-size = <0x40>;
 			d-cache-sets = <0x40>;
@@ -132,6 +143,8 @@
 			i-tlb-sets = <0x01>;
 			i-tlb-size = <0x20>;
 			mmu-type = "riscv,sv39";
+			next-level-cache = <0x03>;
+			operating-points-v2 = <0x02>;
 			reg = <0x04>;
 			riscv,isa = "rv64imafdc";
 			tlb-split;
@@ -140,17 +153,22 @@
 				#interrupt-cells = <0x01>;
 				compatible = "riscv,cpu-intc";
 				interrupt-controller;
-				phandle = <0x05>;
+				phandle = <0x08>;
 			};
 		};
 	};
 
+	gpio-restart {
+		compatible = "gpio-restart";
+		gpios = <0x0f 0x0a 0x01>;
+	};
+
 	hfclk {
 		#clock-cells = <0x00>;
 		clock-frequency = <0x1fca055>;
 		clock-output-names = "hfclk";
 		compatible = "fixed-clock";
-		phandle = <0x06>;
+		phandle = <0x09>;
 	};
 
 	memory@80000000 {
@@ -158,12 +176,34 @@
 		reg = <0x00 0x80000000 0x02 0x00>;
 	};
 
+	opp-table {
+		compatible = "operating-points-v2";
+		opp-shared;
+		phandle = <0x02>;
+
+		opp-1400000000 {
+			opp-hz = <0x00 0x53724e00>;
+		};
+
+		opp-350000000 {
+			opp-hz = <0x00 0x14dc9380>;
+		};
+
+		opp-700000000 {
+			opp-hz = <0x00 0x29b92700>;
+		};
+
+		opp-999999999 {
+			opp-hz = <0x00 0x3b9ac9ff>;
+		};
+	};
+
 	rtcclk {
 		#clock-cells = <0x00>;
 		clock-frequency = <0xf4240>;
 		clock-output-names = "rtcclk";
 		compatible = "fixed-clock";
-		phandle = <0x07>;
+		phandle = <0x0a>;
 	};
 
 	soc {
@@ -172,41 +212,75 @@
 		compatible = "sifive,fu540-c000\0sifive,fu540\0simple-bus";
 		ranges;
 
+		cache-controller@2010000 {
+			cache-block-size = <0x40>;
+			cache-level = <0x02>;
+			cache-sets = <0x400>;
+			cache-size = <0x200000>;
+			cache-unified;
+			compatible = "sifive,fu540-c000-ccache\0cache";
+			interrupt-parent = <0x0b>;
+			interrupts = <0x01 0x02 0x03>;
+			phandle = <0x03>;
+			reg = <0x00 0x2010000 0x00 0x1000>;
+		};
+
 		clock-controller@10000000 {
 			#clock-cells = <0x01>;
-			clocks = <0x06 0x07>;
+			clocks = <0x09 0x0a>;
 			compatible = "sifive,fu540-c000-prci";
-			phandle = <0x09>;
+			phandle = <0x01>;
 			reg = <0x00 0x10000000 0x00 0x1000>;
 		};
 
+		dma@3000000 {
+			#dma-cells = <0x01>;
+			compatible = "sifive,fu540-c000-pdma";
+			interrupt-parent = <0x0b>;
+			interrupts = <0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e>;
+			reg = <0x00 0x3000000 0x00 0x8000>;
+		};
+
 		ethernet@10090000 {
 			#address-cells = <0x01>;
 			#size-cells = <0x00>;
 			clock-names = "pclk\0hclk";
-			clocks = <0x09 0x02 0x09 0x02>;
-			compatible = "sifive,fu540-macb";
-			interrupt-parent = <0x08>;
+			clocks = <0x01 0x02 0x01 0x02>;
+			compatible = "sifive,fu540-c000-gem";
+			interrupt-parent = <0x0b>;
 			interrupts = <0x35>;
 			local-mac-address = [00 00 00 00 00 00];
-			phy-handle = <0x0a>;
+			phy-handle = <0x0c>;
 			phy-mode = "gmii";
 			reg = <0x00 0x10090000 0x00 0x2000 0x00 0x100a0000 0x00 0x1000>;
-			reg-names = "control";
 			status = "okay";
 
 			ethernet-phy@0 {
-				phandle = <0x0a>;
+				phandle = <0x0c>;
 				reg = <0x00>;
 			};
 		};
 
+		gpio@10060000 {
+			#gpio-cells = <0x02>;
+			#interrupt-cells = <0x02>;
+			clocks = <0x01 0x03>;
+			compatible = "sifive,fu540-c000-gpio\0sifive,gpio0";
+			gpio-controller;
+			interrupt-controller;
+			interrupt-parent = <0x0b>;
+			interrupts = <0x07 0x08 0x09 0x0a 0x0b 0x0c 0x0d 0x0e 0x0f 0x10 0x11 0x12 0x13 0x14 0x15 0x16>;
+			phandle = <0x0f>;
+			reg = <0x00 0x10060000 0x00 0x1000>;
+			status = "okay";
+		};
+
 		i2c@10030000 {
 			#address-cells = <0x01>;
 			#size-cells = <0x00>;
-			clocks = <0x09 0x03>;
+			clocks = <0x01 0x03>;
 			compatible = "sifive,fu540-c000-i2c\0sifive,i2c0";
-			interrupt-parent = <0x08>;
+			interrupt-parent = <0x0b>;
 			interrupts = <0x32>;
 			reg = <0x00 0x10030000 0x00 0x1000>;
 			reg-io-width = <0x01>;
@@ -218,8 +292,8 @@
 			#interrupt-cells = <0x01>;
 			compatible = "sifive,plic-1.0.0";
 			interrupt-controller;
-			interrupts-extended = <0x01 0xffffffff 0x02 0xffffffff 0x02 0x09 0x03 0xffffffff 0x03 0x09 0x04 0xffffffff 0x04 0x09 0x05 0xffffffff 0x05 0x09>;
-			phandle = <0x08>;
+			interrupts-extended = <0x04 0xffffffff 0x05 0xffffffff 0x05 0x09 0x06 0xffffffff 0x06 0x09 0x07 0xffffffff 0x07 0x09 0x08 0xffffffff 0x08 0x09>;
+			phandle = <0x0b>;
 			reg = <0x00 0xc000000 0x00 0x4000000>;
 			riscv,ndev = <0x35>;
 		};
@@ -231,9 +305,9 @@
 			bus-range = <0x01 0x7f>;
 			compatible = "microsemi,ms-pf-axi-pcie-host";
 			device_type = "pci";
-			interrupt-map = <0x00 0x00 0x00 0x01 0x0b 0x00 0x00 0x00 0x00 0x02 0x0b 0x01 0x00 0x00 0x00 0x03 0x0b 0x02 0x00 0x00 0x00 0x04 0x0b 0x03>;
+			interrupt-map = <0x00 0x00 0x00 0x01 0x0e 0x00 0x00 0x00 0x00 0x02 0x0e 0x01 0x00 0x00 0x00 0x03 0x0e 0x02 0x00 0x00 0x00 0x04 0x0e 0x03>;
 			interrupt-map-mask = <0x00 0x00 0x00 0x07>;
-			interrupt-parent = <0x08>;
+			interrupt-parent = <0x0b>;
 			interrupts = <0x20>;
 			ranges = <0x3000000 0x00 0x40000000 0x00 0x40000000 0x00 0x20000000>;
 			reg = <0x20 0x30000000 0x00 0x4000000 0x20 0x00 0x00 0x100000>;
@@ -243,23 +317,80 @@
 				#address-cells = <0x00>;
 				#interrupt-cells = <0x01>;
 				interrupt-controller;
-				phandle = <0x0b>;
+				phandle = <0x0e>;
+			};
+		};
+
+		pwm@10020000 {
+			#pwm-cells = <0x03>;
+			clocks = <0x01 0x03>;
+			compatible = "sifive,fu540-c000-pwm\0sifive,pwm0";
+			interrupt-parent = <0x0b>;
+			interrupts = <0x2a 0x2b 0x2c 0x2d>;
+			phandle = <0x0d>;
+			reg = <0x00 0x10020000 0x00 0x1000>;
+			status = "okay";
+		};
+
+		pwm@10021000 {
+			#pwm-cells = <0x03>;
+			clocks = <0x01 0x03>;
+			compatible = "sifive,fu540-c000-pwm\0sifive,pwm0";
+			interrupt-parent = <0x0b>;
+			interrupts = <0x2e 0x2f 0x30 0x31>;
+			reg = <0x00 0x10021000 0x00 0x1000>;
+			status = "okay";
+		};
+
+		pwmleds {
+			compatible = "pwm-leds";
+
+			d1 {
+				active-low = <0x01>;
+				label = "green:d1";
+				linux,default-trigger = "none";
+				max-brightness = <0xff>;
+				pwms = <0x0d 0x00 0x773594 0x00>;
+			};
+
+			d2 {
+				active-low = <0x01>;
+				label = "green:d2";
+				linux,default-trigger = "none";
+				max-brightness = <0xff>;
+				pwms = <0x0d 0x01 0x773594 0x00>;
+			};
+
+			d3 {
+				active-low = <0x01>;
+				label = "green:d3";
+				linux,default-trigger = "none";
+				max-brightness = <0xff>;
+				pwms = <0x0d 0x02 0x773594 0x00>;
+			};
+
+			d4 {
+				active-low = <0x01>;
+				label = "green:d4";
+				linux,default-trigger = "none";
+				max-brightness = <0xff>;
+				pwms = <0x0d 0x03 0x773594 0x00>;
 			};
 		};
 
 		serial@10010000 {
-			clocks = <0x09 0x03>;
+			clocks = <0x01 0x03>;
 			compatible = "sifive,fu540-c000-uart\0sifive,uart0";
-			interrupt-parent = <0x08>;
+			interrupt-parent = <0x0b>;
 			interrupts = <0x04>;
 			reg = <0x00 0x10010000 0x00 0x1000>;
 			status = "okay";
 		};
 
 		serial@10011000 {
-			clocks = <0x09 0x03>;
+			clocks = <0x01 0x03>;
 			compatible = "sifive,fu540-c000-uart\0sifive,uart0";
-			interrupt-parent = <0x08>;
+			interrupt-parent = <0x0b>;
 			interrupts = <0x05>;
 			reg = <0x00 0x10011000 0x00 0x1000>;
 			status = "okay";
@@ -268,9 +399,9 @@
 		spi@10040000 {
 			#address-cells = <0x01>;
 			#size-cells = <0x00>;
-			clocks = <0x09 0x03>;
+			clocks = <0x01 0x03>;
 			compatible = "sifive,fu540-c000-spi\0sifive,spi0";
-			interrupt-parent = <0x08>;
+			interrupt-parent = <0x0b>;
 			interrupts = <0x33>;
 			reg = <0x00 0x10040000 0x00 0x1000 0x00 0x20000000 0x00 0x10000000>;
 			status = "okay";
@@ -288,9 +419,9 @@
 		spi@10041000 {
 			#address-cells = <0x01>;
 			#size-cells = <0x00>;
-			clocks = <0x09 0x03>;
+			clocks = <0x01 0x03>;
 			compatible = "sifive,fu540-c000-spi\0sifive,spi0";
-			interrupt-parent = <0x08>;
+			interrupt-parent = <0x0b>;
 			interrupts = <0x34>;
 			reg = <0x00 0x10041000 0x00 0x1000 0x00 0x30000000 0x00 0x10000000>;
 			status = "disabled";
@@ -299,9 +430,9 @@
 		spi@10050000 {
 			#address-cells = <0x01>;
 			#size-cells = <0x00>;
-			clocks = <0x09 0x03>;
+			clocks = <0x01 0x03>;
 			compatible = "sifive,fu540-c000-spi\0sifive,spi0";
-			interrupt-parent = <0x08>;
+			interrupt-parent = <0x0b>;
 			interrupts = <0x06>;
 			reg = <0x00 0x10050000 0x00 0x1000>;
 			status = "okay";

qemu-native fails to compile

Getting an error looking for a file, but I cannot determine what package(s) should be sourcing said files. This is against the 2021.10.00 release:

ERROR: qemu-native-6.1.0-r0 do_compile: ExecutionError('/home/caperry/src/riscv64/riscv-sifive/build/tmp-glibc/work/x86_64-linux/qemu-native/6.1.0-r0/temp/run.do_compile
.3928389', 1, None, None)
ERROR: Logfile of failure stored in: /home/caperry/src/riscv64/riscv-sifive/build/tmp-glibc/work/x86_64-linux/qemu-native/6.1.0-r0/temp/log.do_compile.3928389
Log data follows:
| DEBUG: Executing shell function do_compile
| NOTE: make -j 8 LD=ld  AR=ar OBJCOPY=objcopy LDFLAGS=-L/home/caperry/src/riscv64/riscv-sifive/build/tmp-glibc/work/x86_64-linux/qemu-native/6.1.0-r0/recipe-sysroot-nat
ive/usr/lib                         -L/home/caperry/src/riscv64/riscv-sifive/build/tmp-glibc/work/x86_64-linux/qemu-native/6.1.0-r0/recipe-sysroot-native/lib
             -Wl,--enable-new-dtags                         -Wl,-rpath-link,/home/caperry/src/riscv64/riscv-sifive/build/tmp-glibc/work/x86_64-linux/qemu-native/6.1.0-r0
/recipe-sysroot-native/usr/lib                         -Wl,-rpath-link,/home/caperry/src/riscv64/riscv-sifive/build/tmp-glibc/work/x86_64-linux/qemu-native/6.1.0-r0/reci
pe-sysroot-native/lib                         -Wl,-rpath,/home/caperry/src/riscv64/riscv-sifive/build/tmp-glibc/work/x86_64-linux/qemu-native/6.1.0-r0/recipe-sysroot-nat
ive/usr/lib                         -Wl,-rpath,/home/caperry/src/riscv64/riscv-sifive/build/tmp-glibc/work/x86_64-linux/qemu-native/6.1.0-r0/recipe-sysroot-native/lib
                      -Wl,-O1 -Wl,--allow-shlib-undefined -Wl,--dynamic-linker=/home/caperry/src/riscv64/riscv-sifive/build/tmp-glibc/sysroots-uninative/x86_64-linux/lib
/ld-linux-x86-64.so.2 -fuse-ld=bfd
| [1/177] Generating qemu-version.h with a custom command (wrapped by meson to capture output)
| [2/176] Compiling C object libqemu-x86_64-linux-user.fa.p/meson-generated_.._trace_generated-helpers.c.o
| [3/176] Compiling C object libqemu-x86_64-linux-user.fa.p/target_i386_tcg_user_seg_helper.c.o
| [4/176] Compiling C object libqemu-riscv64-linux-user.fa.p/linux-user_uname.c.o
| [5/176] Compiling C object libcommon.fa.p/ebpf_ebpf_rss.c.o
| FAILED: libcommon.fa.p/ebpf_ebpf_rss.c.o
| gcc -Ilibcommon.fa.p -I../qemu-6.1.0/capstone/include/capstone -I/home/caperry/src/riscv64/riscv-sifive/build/tmp-glibc/work/x86_64-linux/qemu-native/6.1.0-r0/recipe-s
ysroot-native/usr/lib/pkgconfig/../../../usr/include -I/home/caperry/src/riscv64/riscv-sifive/build/tmp-glibc/work/x86_64-linux/qemu-native/6.1.0-r0/recipe-sysroot-nativ
e/usr/lib/pkgconfig/../../../usr/include/glib-2.0 -I/home/caperry/src/riscv64/riscv-sifive/build/tmp-glibc/work/x86_64-linux/qemu-native/6.1.0-r0/recipe-sysroot-native/u
sr/lib/pkgconfig/../../../usr/lib/glib-2.0/include -fdiagnostics-color=auto -Wall -Winvalid-pch -std=gnu11 -O2 -g -isystem /home/caperry/src/riscv64/riscv-sifive/build/t
mp-glibc/work/x86_64-linux/qemu-native/6.1.0-r0/qemu-6.1.0/linux-headers -isystem linux-headers -iquote . -iquote /home/caperry/src/riscv64/riscv-sifive/build/tmp-glibc/
work/x86_64-linux/qemu-native/6.1.0-r0/qemu-6.1.0 -iquote /home/caperry/src/riscv64/riscv-sifive/build/tmp-glibc/work/x86_64-linux/qemu-native/6.1.0-r0/qemu-6.1.0/includ
e -iquote /home/caperry/src/riscv64/riscv-sifive/build/tmp-glibc/work/x86_64-linux/qemu-native/6.1.0-r0/qemu-6.1.0/disas/libvixl -iquote /home/caperry/src/riscv64/riscv-
sifive/build/tmp-glibc/work/x86_64-linux/qemu-native/6.1.0-r0/qemu-6.1.0/tcg/i386 -pthread -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET
_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -O2 -pipe -Wold-
style-declaration -Wold-style-definition -Wtype-limits -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wempty-body -Wnested-externs -Wendif-labels -Wexp
ansion-to-defined -Wimplicit-fallthrough=2 -Wno-missing-include-dirs -Wno-shift-negative-value -Wno-psabi -fstack-protector-strong -isystem/home/caperry/src/riscv64/risc
v-sifive/build/tmp-glibc/work/x86_64-linux/qemu-native/6.1.0-r0/recipe-sysroot-native/usr/include -O2 -fPIE -MD -MQ libcommon.fa.p/ebpf_ebpf_rss.c.o -MF libcommon.fa.p/e
bpf_ebpf_rss.c.o.d -o libcommon.fa.p/ebpf_ebpf_rss.c.o -c ../qemu-6.1.0/ebpf/ebpf_rss.c
| In file included from ../qemu-6.1.0/ebpf/ebpf_rss.c:24:
| ../qemu-6.1.0/ebpf/trace.h:1:10: fatal error: trace/trace-ebpf.h: No such file or directory
|     1 | #include "trace/trace-ebpf.h"
|       |          ^~~~~~~~~~~~~~~~~~~~
| compilation terminated.
| [6/176] Compiling C object libqemu-x86_64-linux-user.fa.p/target_i386_gdbstub.c.o
| [7/176] Compiling C object libqemu-x86_64-linux-user.fa.p/target_i386_tcg_int_helper.c.o
| [8/176] Compiling C object libqemu-x86_64-linux-user.fa.p/linux-user_x86_64_signal.c.o
| [9/176] Compiling C object libqemu-x86_64-linux-user.fa.p/target_i386_xsave_helper.c.o
| [10/176] Compiling C object libqemu-x86_64-linux-user.fa.p/linux-user_x86_64_cpu_loop.c.o
| [11/176] Compiling C object libqemu-x86_64-linux-user.fa.p/target_i386_cpu.c.o
| [12/176] Compiling C object libqemu-x86_64-linux-user.fa.p/target_i386_tcg_fpu_helper.c.o
| ninja: build stopped: subcommand failed.
| make: *** [Makefile:156: run-ninja] Error 1
| ERROR: oe_runmake failed
| WARNING: /home/caperry/src/riscv64/riscv-sifive/build/tmp-glibc/work/x86_64-linux/qemu-native/6.1.0-r0/temp/run.do_compile.3928389:186 exit 1 from 'exit 1'
| WARNING: Backtrace (BB generated script):
|       #1: bbfatal_log, /home/caperry/src/riscv64/riscv-sifive/build/tmp-glibc/work/x86_64-linux/qemu-native/6.1.0-r0/temp/run.do_compile.3928389, line 186
|       #2: die, /home/caperry/src/riscv64/riscv-sifive/build/tmp-glibc/work/x86_64-linux/qemu-native/6.1.0-r0/temp/run.do_compile.3928389, line 171
|       #3: oe_runmake, /home/caperry/src/riscv64/riscv-sifive/build/tmp-glibc/work/x86_64-linux/qemu-native/6.1.0-r0/temp/run.do_compile.3928389, line 176
|       #4: base_do_compile, /home/caperry/src/riscv64/riscv-sifive/build/tmp-glibc/work/x86_64-linux/qemu-native/6.1.0-r0/temp/run.do_compile.3928389, line 154
|       #5: do_compile, /home/caperry/src/riscv64/riscv-sifive/build/tmp-glibc/work/x86_64-linux/qemu-native/6.1.0-r0/temp/run.do_compile.3928389, line 148
|       #6: main, /home/caperry/src/riscv64/riscv-sifive/build/tmp-glibc/work/x86_64-linux/qemu-native/6.1.0-r0/temp/run.do_compile.3928389, line 196
ERROR: Task (/home/caperry/src/riscv64/riscv-sifive/openembedded-core/meta/recipes-devtools/qemu/qemu-native_6.1.0.bb:do_compile) failed with exit code '1'

Any ideas?

bitbake `unparsed line` error while building

Hi, I'm new to the yocto project and trying to build and boot a simple linux distro on qemu emulating the unleashed board.

I followed the readme, cloned bitbake, oe-core and meta-sifive, and ran kas build --update ./meta-sifive/scripts/kas/freedom-u540.yml --target core-image-minimal
and then got the error ERROR: ParseError at /home/amit/qemu_stuff/yocto-u54/build/../openembedded-core/meta/conf/layer.conf:132: unparsed line: 'addpylib ${LAYERDIR}/lib oe'

Am I missing something or doing something wrong?

do_rootfs fail

I want to build qemuriscv64 image using this original source code, but encounted this problem: meta-sifive ERROR: demo-coreip-cli-1.0-r0 do_rootfs: The postinstall intercept hook 'update_gtk_immodules_cache' failed, details in /home/rison/riscv-sifive/build/tmp-glibc/work/qemuriscv64-oe-linux/demo-coreip-cli/1.0-r0/temp/log.do_rootfs.
Any one knows how to solve this?

Build breaks at qemu-native-5.1.0-r0 do_configure

Log:
ERROR: qemu-native-5.1.0-r0 do_configure: Execution of '/home/tamood/test/riscv-sifive/build/tmp-glibc/work/x86_64-linux/qemu-native/5.1.0-r0/temp/run.do_configure.272720' failed with exit code 1:

ERROR: sizeof(size_t) doesn't match GLIB_SIZEOF_SIZE_T.
You probably need to set PKG_CONFIG_LIBDIR
to point to the right pkg-config files for your
build target

WARNING: exit code 1 from a shell command.

Unmatched: race condition in U-Boot's PCI stack

I was able to get Unmatched to boot from a SATA drive attached to a SIL3132 controller in the PCIe slot. To that end, I have enabled the following config options and enabled the SATA boot target:

diff --git a/configs/sifive_unmatched_defconfig b/configs/sifive_unmatched_defconfig
index 4b370fe31a..e6e28ea810 100644
--- a/configs/sifive_unmatched_defconfig
+++ b/configs/sifive_unmatched_defconfig
@@ -49,2 +49,9 @@ CONFIG_DM_USB=y
 CONFIG_USB_XHCI_HCD=y
 CONFIG_USB_XHCI_PCI=y
+CONFIG_AHCI=y
+CONFIG_AHCI_PCI=y
+CONFIG_SATA=y
+CONFIG_LIBATA=y
+CONFIG_SATA_SIL=y
+CONFIG_CMD_LSBLK=y
+CONFIG_CMD_SATA=y
diff --git a/include/configs/sifive-unmatched.h b/include/configs/sifive-unmatched.h
index 4fad69bb19..51a9b67103 100644
--- a/include/configs/sifive-unmatched.h
+++ b/include/configs/sifive-unmatched.h
@@ -45,6 +45,7 @@
 #ifndef CONFIG_SPL_BUILD
 #define BOOT_TARGET_DEVICES(func) \
  func(NVME, nvme, 0) \
+	func(SATA, sata, 0) \
  func(USB, usb, 0) \
  func(MMC, mmc, 0) \
  func(PXE, pxe, na) \

However, that is not enough because no SATA device is detected. I have tested this with two (completely) different SATA SSDs on both of the controller's ports:

Hit any key to stop autoboot:  0 
PCIE-0: Link up (Gen1-x8, Bus0)

Device 0: unknown device
No SATA device found!
starting USB...

Neither repeated executions of pci enum nor any of the sata- or block-related commands show anything useful. Naturally, I tried enabling verbose outputs... and surprisingly the problem went away - an instance of a Heisenbug. I played around and ended up delaying PCIe probing a bit:

diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c
index ce2eb5da2c..5e8f151fcb 100644
--- a/drivers/pci/pci-uclass.c
+++ b/drivers/pci/pci-uclass.c
@@ -1058,6 +1058,9 @@ static int pci_uclass_pre_probe(struct udevice *bus)
        bus->parent->name);
  hose = dev_get_uclass_priv(bus);
 
+	// printf("%s, bus=%d/%s, parent=%s\n", __func__, dev_seq(bus), bus->name, bus->parent->name);
+	mdelay(4);// Not OK: 2, 3, OK: 4, 5, 10, 100
+
  /*
   * Set the sequence number, if device_bind() doesn't. We want control
   * of this so that numbers are allocated as devices are probed. That

This function is called for each... PCI device? I am not exactly sure but definitely multiple times, so the sum of waited time is bigger but in the range of a few 10ths ms. I have tested adding (long) delays at other places that get executed during PCI+SATA enumeration, i.e. at the beginning of sata_probe(), ahci_pci_probe(), and pcie_sifive_probe() to no avail so I gave up searching further.

Kernel panic - not syncing: Fatal exception in interrupt

Hello Team,

I built an image for sifive unmatched board by using the 2021.02 branches, when I was testing the tables, I'm facing a kernel panic issue.

Please can you help me to fix this issue?
randomly it's coming kernel panic issue.

I posted in sifive-forum also, please go through the below link for more details.

https://forums.sifive.com/t/kernel-panic-not-syncing-fatal-exception-in-interrupt/5628/7?u=imbabu

65e5dee5c667647c63e91bda2162c5139b7a293a

[Fetched 3651 B in 0s (6615 B/s)
[ 70.566379] Unable to handle kernel paging request at virtual address 0000005f837c3064
[ 70.573535] Oops [#1]
[ 70.575783] Modules linked in: ccm rtl8192ee btcoexist rtl_pci rtlwifi mac80211 cfg80211 libarc4 fuse
[ 70.584995] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G W 5.10.41 #1
[ 70.592374] epc: ffffffdf837c3064 ra : ffffffe00025da46 sp : ffffffe001603b80
[ 70.599495] gp : ffffffe001810070 tp : ffffffe00160a380 t0 : 0000000000000040
[ 70.606705] t1 : 0000000000000000 t2 : 000000000026776f s0 : ffffffe001603c00
[ 70.613913] s1 : 0000000000000000 a0 : 000000000000003b a1 : ffffffe0872c06e0
[ 70.621123] a2 : 0000000000001000 a3 : 0000000000000000 a4 : ffffffdf837c3064
[ 70.628333] a5 : 000000000000003b a6 : ffffffe080200248 a7 : ffffffe080200270
[ 70.635541] s2 : ffffffe001603c0c s3 : 0000000000000001 s4 : 000000000000003b
[ 70.642752] s5 : 0000000000000002 s6 : ffffffe0018151e0 s7 : ffffffe087520800
[ 70.649961] s8 : ffffffe0017dbab8 s9 : ffffffe0017dba70 s10: 0000000000000000
[ 70.657170] s11: ffffffe087782100 t3 : 0000000000000002 t4 : 0000000000000402
[ 70.664378] t5 : ffffffe00168e3d0 t6 : ffffffe00168e3d8
[ 70.669677] status: 0000000200000100 badaddr: 0000005f837c3064 cause: 000000000000000c
[ 70.677610] ---[ end trace 2d84ae89b2c60abb ]---
[ 70.682193] Kernel panic - not syncing: Fatal exception in interrupt
[ 70.688527] SMP: stopping secondary CPUs
[ 70.692449] ---[ end Kernel panic - not syncing: Fatal exception in interrupt ]---

Thanks
Babu

Vanilla upstream kernel uses rev1 dtb for unmatched

ERROR:Bitbake version 1.47.0 is required and version 1.46.0 was found

I only found bitbake-1.46.3 in https://github.com/openembedded/bitbake/tags.

luyahan@plct-build-4:~/riscv-sifive$ bash ./meta-sifive/setup.sh
Init OE
You had no conf/local.conf file. This configuration file has therefore been
created for you with some default values. You may wish to edit it to, for
example, select a different MACHINE (target hardware). See conf/local.conf
for more information as common configuration options are commented.

You had no conf/bblayers.conf file. This configuration file has therefore been
created for you with some default values. To add additional metadata layers
into your configuration please add entries to conf/bblayers.conf.

The Yocto Project has extensive documentation about OE including a reference
manual which can be found at:
    http://yoctoproject.org/documentation

For more information about OpenEmbedded see their website:
    http://www.openembedded.org/


### Shell environment set up for builds. ###

You can now run 'bitbake <target>'

Common targets are:
    core-image-minimal
    core-image-sato
    meta-toolchain
    meta-ide-support

You can also run generated qemu images with a command like 'runqemu qemux86'.

Other commonly useful commands are:
 - 'devtool' and 'recipetool' handle common recipe tasks
 - 'bitbake-layers' handles common layer tasks
 - 'oe-pkgdata-util' handles common target package tasks
Adding layers
NOTE: Starting bitbake server...
NOTE: Starting bitbake server...
NOTE: Starting bitbake server...
NOTE: Starting bitbake server...
NOTE: Starting bitbake server...
NOTE: Starting bitbake server...
NOTE: Starting bitbake server...
NOTE: Starting bitbake server...
Creating auto.conf
---------------------------------------------------
MACHINE=freedom-u540 bitbake demo-coreip-cli
---------------------------------------------------

Buildable machine info
---------------------------------------------------
* freedom-u540: The SiFive HiFive Unleashed board
* qemuriscv64: The 64-bit RISC-V machine
---------------------------------------------------
luyahan@plct-build-4:~/riscv-sifive$ cd build/
luyahan@plct-build-4:~/riscv-sifive/build$ MACHINE=freedom-u540 bitbake demo-coreip-cl
ERROR:  OE-core's config sanity checker detected a potential misconfiguration.
    Either fix the cause of this error or at your own risk disable the checker (see sanity.conf).
    Following is the list of potential problems / advisories:

    Bitbake version 1.47.0 is required and version 1.46.0 was found

Is this SDK also appropriate for VC707 FPGA Dev Kit?

Hello, I would like to know whether this SDK is also appropriate for VC707 FPGA Dev Kit? Could I write the disk image to SD card with the zcat command as mentioned in the readme file or should I write the image in a different way if the SD card will be used in the VC707 FPGA Dev Kit? And how?

Upstreaming chassis fan / LED patches

Hi! Thanks for maintaining this repository. ❤️

I'm sorry if this is already noted somewhere (I looked quite a bit, but if I missed it I would really appreciate a link!) but is there already a plan or active effort to continue upstreaming patches, especially around u-boot and the chassis fan controls?

(It seems like something like https://forums.sifive.com/t/chassis-fan-header-not-working/4789/15 is probably also needed for the kernel to be able to control the fans, but just having them on at all has been a really dramatic difference for my otherwise pure-Debian-builds system and they'd understandably prefer to see patches upstreamed than maintain them just for the distribution 😊)

SD card partitions and copy U-Boot SPL, OpenSBI, U-Boot and rootFS image's to uSD card manually.

Hello floks,

As per the Readme file once demo-coreip-cli-freedom-u540.wic.xz image is build and we are flashing image on SD-card with following command,
$ xzcat demo-coreip-cli-freedom-u540.wic.xz | sudo dd of=/dev/sdX bs=512K iflag=fullblock oflag=direct conv=fsync status=progress.

I have a few questions with wic.xz image like,

  1. How demo-coreip-cli-freedom-u540.wic.xz image creating partitions on SD-card?
  • As per my knowledge to create partitions it's using freedom-u540-spl-opensbi.wks file but one thing i was not getting is, if i Run those .wks file commands i was not able to create partitions.
  • How partitions are created, if i want to create partitions manually how can do it?
  1. How to copy the U-Boot SPL, OpenSBI, U-Boot and rootFS image's
  • on BOOT partition following files to uSD card manually.
    boot.scr.uimg extlinux/ hifive-unleashed-a00-microsemi.dtb Image.gz

And boot u540 board successfully.

can anyone help me to do this?

Thanks in advance,
khan.

image not booting with 5.10.x

copied image with the mentioned command but image is not booting further
SiFive FSBL: 2018-03-20
HiFive-U serial #: 00000127

after the above log i am not able to see anything on the console. what could be the reason kindly help??

i have made following changes in the freedom-u540.conf file

RISCV_SBI_FDT ?= "hifive-unleashed-a00.dtb"

Use this to add Microsemi Expansion board support

#RISCV_SBI_FDT ?= "hifive-unleashed-a00-microsemi.dtb"

SERIAL_CONSOLES = "115200;ttySIF0"

MACHINE_EXTRA_RRECOMMENDS += " kernel-modules"

IMAGE_FSTYPES += "wic.xz ext4 tar.xz"
KERNEL_DEVICETREE ?= "sifive/${RISCV_SBI_FDT}"

Do not update fstab file when using wic images

#WIC_CREATE_EXTRA_ARGS ?= "--no-fstab-update"

EXTRA_IMAGEDEPENDS += "u-boot"
UBOOT_MACHINE = "sifive_fu540_defconfig"

Set this to "mmc-boot" to generate a boot.scr file which should be included

in the boot partition. It will try to load a kernel image by TFTP and if that

fails it will fall back to local images in the boot partition.

UBOOT_ENV ?= "mmc-boot"

U-Boot SPL

SPL_BINARY ?= "spl/u-boot-spl.bin"

U-Boot ITB (FIT image with U-Boot S-mode, OpenSBI FW_DYNAMIC, DTB [from

U-Boot source code tree])

UBOOT_SUFFIX ?= "itb"

wic default support

WKS_FILE_DEPENDS ?= "
opensbi
e2fsprogs-native
bmap-tools-native
"

IMAGE_BOOT_FILES ?= "
Image.gz
*hifive-unleashed-a00.dtb *
boot.scr.uimg
"

Originally posted by @pankajjoshi347 in #13 (comment)

gdb fails to compile when lzma is available on the host claiming that the library is missing

My host has liblzma installed and as such the recipe for gdb in riscv-sifive/openembedded-core/meta/recipes-devtools/gdb tries to compile in lzma support even if it's not yet built for the target. Is there some override option that should be set to fix this?

| configure: error: missing liblzma for --with-lzma
| make[1]: *** [Makefile:9702: configure-gdb] Error 1
| make[1]: Leaving directory '/home/caperry/src/riscv64/riscv-sifive/build/tmp-glibc/work/riscv64-oe-linux/gdb/10.2-r0/build-riscv64-oe-linux'
| make: *** [Makefile:854: all] Error 2
| ERROR: oe_runmake failed
| WARNING: /home/caperry/src/riscv64/riscv-sifive/build/tmp-glibc/work/riscv64-oe-linux/gdb/10.2-r0/temp/run.do_compile.3435449:187 exit 1 from 'exit 1'
| WARNING: Backtrace (BB generated script):
|       #1: bbfatal_log, /home/caperry/src/riscv64/riscv-sifive/build/tmp-glibc/work/riscv64-oe-linux/gdb/10.2-r0/temp/run.do_compile.3435449, line 187
|       #2: die, /home/caperry/src/riscv64/riscv-sifive/build/tmp-glibc/work/riscv64-oe-linux/gdb/10.2-r0/temp/run.do_compile.3435449, line 171
|       #3: oe_runmake, /home/caperry/src/riscv64/riscv-sifive/build/tmp-glibc/work/riscv64-oe-linux/gdb/10.2-r0/temp/run.do_compile.3435449, line 166
|       #4: autotools_do_compile, /home/caperry/src/riscv64/riscv-sifive/build/tmp-glibc/work/riscv64-oe-linux/gdb/10.2-r0/temp/run.do_compile.3435449, line 161
|       #5: do_compile, /home/caperry/src/riscv64/riscv-sifive/build/tmp-glibc/work/riscv64-oe-linux/gdb/10.2-r0/temp/run.do_compile.3435449, line 156
|       #6: main, /home/caperry/src/riscv64/riscv-sifive/build/tmp-glibc/work/riscv64-oe-linux/gdb/10.2-r0/temp/run.do_compile.3435449, line 200

Default FDT file is not set, nor is USE_PREBOOT.

I'm trying to ensure that extlinux.conf generated on ubuntu, specifies the location for each ubuntu kernel of the devicetree files, such that for each menu entry a matching one is loaded. Thus also allowing to easily build / install / test new kernels with custom dtbs.

However doing so results in:

Retrieving file: /lib/firmware/5.11.0-1002-generic/device-tree/<NULL>-hifive_unmatched_fu7
Failed to load '/lib/firmware/5.11.0-1002-generic/device-tree/<NULL>-hifive_unmatched_fu7

And similar. I think by default u-boot tries to use $FDTDIR/$SOC-$BOARD.dtb but for unmatched at least, $SOC is not defined, and whilst $BOARD is defined, it is not what is actually in use.

shouldn't configs specify

CONFIG_DEFAULT_FDT_FILE="sifive/hifive-unleashed-a00.dtb"
CONFIG_DEFAULT_FDT_FILE="sifive/hifive-unmatched-a00.dtb"

?

Also I've noticed that unmatched does not use CONFIG_USE_PREBOOT=y by default. But unleashed did. Not sure if that's intentional or not. I guess with unmatched you might be thinking that external devicetree should always be used which is fair enough.

how to install apt ?

I find there is no apt-get program.
It's very hard to install some program easily.
Can we install apt-get program in this OS ?

Which consoles are available and which ones should be used?

It seems that there is early SBI based console.
That there is hvc0 (virtual console) provided by sbi? which is the same as ttySIF0?

However it seems that hvc0 & ttySIF0 are the same. And systemd starts serial-getty on both. Hence if one doesn't specify any options, one ends up with two consoles at the same time.

Also whilst there is ttySIF1 console, getty is not started there by default.

I am wondering what would be the best kernel cmdline option that would be universal and work in Qemu, SiFive and non-SiFive boards.

something like console=hvc0 earlycon=sbi ?

MACHINE=freedom-u540 is invalid

On Ubuntu 18.04, while trying to generate a bootable image for the Unleashed SD card, I get the following after the steps listed in the README.md:

➜  riscv-sifive $ . ./meta-sifive/setup.sh    
Init OE

### Shell environment set up for builds. ###

You can now run 'bitbake <target>'

Common targets are:
    core-image-minimal
    core-image-sato
    meta-toolchain
    meta-ide-support

You can also run generated qemu images with a command like 'runqemu qemux86'
Your build directory already has local configuration file!
If you want to start from scratch remove old build directory:

    rm -rf /home/pmatos/dev/riscv-sifive/build

---------------------------------------------------
MACHINE=freedom-u540 bitbake demo-coreip-cli
---------------------------------------------------

Buildable machine info
---------------------------------------------------
* freedom-u540: The SiFive HiFive Unleased board
* qemuriscv64: The 64-bit RISC-V machine
---------------------------------------------------
➜  build $ MACHINE=freedom-u540 bitbake demo-coreip-cli
ERROR:  OE-core's config sanity checker detected a potential misconfiguration.
    Either fix the cause of this error or at your own risk disable the checker (see sanity.conf).
    Following is the list of potential problems / advisories:

    MACHINE=freedom-u540 is invalid. Please set a valid MACHINE in your local.conf, environment or other configuration file.


Summary: There was 1 ERROR message shown, returning a non-zero exit code.

Qemu build is using over 1TB of disk space for demo-coreip-cli

I have a VM disk just for the source code and have given it 1TB of space. Started a qemu build

MACHINE=qemuriscv64 bitbake demo-coreip-cli
At some point in the build it ran out of disk space.

The readme.md says:
Building disk images is CPU intensive, requires <10GB of sources downloaded over the Internet and <110GB of local storage.

I do not see how any system build should eat up this much disk space..

What is CONFIG_SIFIVE_BEU ?

$ git grep SIFIVE_BEU
recipes-kernel/linux/files/unmatched/defconfig:CONFIG_SIFIVE_BEU=y

Yet in no kernel trees or patches I see that. Is that just obsolete config option, or some driver is still not published?

Rebooting fails on Hifive Unleashed

Hello,

I have a problem with rebooting my SiFive Unleashed.

I flashed my SD-card according to the instructions on sifive/freedom-u-sdk v201908-branch (which should be the same as the current master here) with “MACHINE=freedom-u540 bitbake demo-coreip-cli” and dd afterwards.

The system boots up fine. But if I try to restart the board, I get the following messages:

[   87.423510] reboot: Restarting system                           
[  108.422889] rcu: INFO: rcu_sched self-detected stall on CPU
[  108.427707] rcu:     0-....: (5249 ticks this GP) idle=eb6/1/0x4000000000000002 softirq=3623/3623 fqs=2592
[  108.437164]  (t=5250 jiffies g=2501 q=41)                       
[  108.441158] Task dump for CPU 0:                           
[  108.444369] systemd-shutdow R  running task        0     1      0 0x00000008                                
[  108.451400] Call Trace:                                 
[  108.453849] [<ffffffe00003d968>] walk_stackframe+0x0/0xa6
[  108.459220] [<ffffffe00003dace>] show_stack+0x2a/0x34
[  108.464262] [<ffffffe00005c64a>] sched_show_task+0xba/0x10c
[  108.469813] [<ffffffe000060bb0>] dump_cpu_task+0x3e/0x48
[  108.475112] [<ffffffe000089668>] rcu_dump_cpu_stacks+0x7c/0xb4
[  108.480925] [<ffffffe000088bb8>] rcu_sched_clock_irq+0x3de/0x532
[  108.486917] [<ffffffe00008d3d4>] update_process_times+0x22/0x4c
[  108.492821] [<ffffffe00009613e>] tick_periodic+0x42/0xd6
[  108.498115] [<ffffffe0000961f2>] tick_handle_periodic+0x20/0x5e
[  108.504028] [<ffffffe000452c54>] riscv_timer_interrupt+0x32/0x3a
[  108.510018] [<ffffffe0005772fc>] do_IRQ+0xa4/0xb8
[  108.514700] [<ffffffe00003c8a4>] ret_from_exception+0x0/0xc
[  108.520256] [<ffffffe00003d056>] machine_restart+0xc/0xe

The whole block (except the first two lines) is repeated every 63 seconds.

Any ideas what could be the problem or how to fix it?

Best regards
Christian

testing qemuriscv32 support

I was curious if it was possible to build for qemuriscv32. I used the demo-coreip-cli target with 2020.05. I found a typo in the llvm sources, and two places with hooks for riscv64 that I had to duplicate for riscv32. The next problem is that perf doesn't compile, complaining that SYS_futex is undefined. I haven't tried to debug that yet.

qemuriscv32-patch.txt

Update to nss 3.50 breaks fresh build.

Did a fresh clone and attempt qemu build per readme.md

Fails on no recipe available:
ERROR: No recipes available for:
/media/marckarasek/source/riscv-sifive/meta-sifive/recipes-support/nss/nss_3.50.bbappend

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.