2017-10-02 23:08:43 -07:00
# meta-riscv
RISC-V Architecture Layer for OpenEmbedded/Yocto
2017-10-04 10:09:23 -07:00
2018-03-16 17:52:50 -07:00
[](https://github.com/riscv/meta-riscv/blob/kraj/master/COPYRIGHT)
2018-03-17 18:27:00 -07:00
[](https://travis-ci.org/riscv/meta-riscv)
2017-10-04 10:09:23 -07:00
## Description
2019-10-01 16:14:04 +05:30
This is the general hardware-specific BSP overlay for the RISC-V based devices.
2017-10-04 10:09:23 -07:00
More information can be found at: < https: / / riscv . org / > (Official Site)
The core BSP part of meta-riscv should work with different
OpenEmbedded/Yocto distributions and layer stacks, such as:
* Distro-less (only with OE-Core).
2020-11-18 08:31:59 -08:00
* Yoe Distro.
2019-07-03 11:24:05 -07:00
* Yocto/Poky.
2017-10-04 10:09:23 -07:00
## Dependencies
This layer depends on:
2022-04-10 10:44:21 -07:00
* URI: https://github.com/openembedded/openembedded-core
2017-10-22 08:15:39 -07:00
* branch: master
* revision: HEAD
2022-04-10 10:44:21 -07:00
* URI: https://github.com/openembedded/bitbake
2017-10-04 10:09:23 -07:00
* branch: master
* revision: HEAD
## Quick Start
2019-07-03 11:24:05 -07:00
**Note: You only need this if you do not have an existing Yocto Project build environment.**
2018-03-16 17:46:11 -07:00
Make sure to [install the `repo` command by Google ](https://source.android.com/setup/downloading#installing-repo ) first.
2019-07-03 11:24:05 -07:00
### Create workspace
2018-08-29 09:43:03 -07:00
```text
2018-08-29 09:41:01 -07:00
mkdir riscv-yocto & & cd riscv-yocto
2022-04-10 10:44:21 -07:00
repo init -u https://github.com/riscv/meta-riscv -b master -m tools/manifests/riscv-yocto.xml
2018-03-16 17:46:11 -07:00
repo sync
repo start work --all
```
2019-07-03 11:24:05 -07:00
### Update existing workspace
2018-06-21 15:59:00 -07:00
2019-10-01 16:14:04 +05:30
In order to bring all the layers up to date with upstream
2018-06-21 15:59:00 -07:00
2018-08-29 09:43:03 -07:00
```text
2018-06-21 15:59:00 -07:00
cd riscv-yocto
repo sync
repo rebase
```
2019-07-03 11:24:05 -07:00
### Setup Build Environment
2018-08-29 09:43:03 -07:00
```text
2018-03-16 17:46:11 -07:00
. ./meta-riscv/setup.sh
```
2018-08-29 10:16:43 -07:00
2019-10-01 16:14:04 +05:30
## Available Machines
2019-07-03 11:24:05 -07:00
2021-02-09 10:33:10 -08:00
The different machines you can build for are:
2019-07-03 11:24:05 -07:00
2019-10-01 16:14:04 +05:30
* freedom-u540: The SiFive HiFive Unleashed board
2021-05-05 08:30:34 -07:00
* beaglev-starlight-jh7100: BeagleV - Based on Starlight JH7100 SOC
2023-02-04 19:45:43 +01:00
* mangopi-mq-pro: MangoPi MQ Pro - Based on Allwinner D1 SOC
2019-07-03 11:24:05 -07:00
2021-02-09 10:33:10 -08:00
Note that this layer also provides improvements and features for the
upstream qemuriscv32 and qemuriscv64 machines.
2021-05-05 08:30:34 -07:00
Additional beagleV notes on bringup are [here ](https://github.com/riscv/meta-riscv/blob/master/docs/BeagleV.md )
2019-07-03 11:24:05 -07:00
## Build Images
A console-only image for the 64-bit QEMU machine
2018-08-29 09:43:03 -07:00
```text
2019-07-03 11:24:05 -07:00
MACHINE=qemuriscv64 bitbake core-image-full-cmdline
2021-05-05 08:30:34 -07:00
MACHINE=beaglev-starlight-jh7100 bitbake core-image-full-cmdline
2018-03-16 17:46:11 -07:00
```
2018-08-29 10:16:43 -07:00
2019-10-01 16:14:04 +05:30
To build an image to run on the HiFive Unleashed using Wayland run the following
2019-07-03 11:24:05 -07:00
```text
2020-07-24 08:50:08 +09:00
MACHINE=freedom-u540 bitbake core-image-weston
2019-07-03 11:24:05 -07:00
```
2021-05-05 08:30:34 -07:00
To build an image to run on the BeagleV using Wayland run the following
```text
MACHINE=beaglev-starlight-jh7100 bitbake core-image-weston
```
2023-02-04 19:45:43 +01:00
To build an image to run on the MangoPi MQ Pro (console only has been tested so far) run the following:
```text
MACHINE=mangopi-mq-pro bitbake core-image-base
```
2019-10-01 16:14:04 +05:30
To build a full GUI equipped image running Plasma Mobile see the in-tree documentation [here ](https://github.com/riscv/meta-riscv/blob/master/docs/Plasma-Mobile-on-Unleashed.md ).
2019-07-03 11:24:05 -07:00
## Running in QEMU
Run the 64-bit machine in QEMU using the following command:
2018-08-29 10:16:43 -07:00
2019-07-03 11:24:05 -07:00
```text
MACHINE=qemuriscv64 runqemu nographic
2018-08-29 10:16:43 -07:00
```
2019-07-03 11:24:05 -07:00
Run the 32-bit machine in QEMU using the following command:
```text
MACHINE=qemuriscv32 runqemu nographic
2018-08-29 10:16:43 -07:00
```
2019-07-03 11:24:05 -07:00
## Running on hardware
### Setting up a TFTP server
If you would like to boot the images from a TFTP server (optional) you should set your TFTP server address in your local.conf with the following line. Change ```127.0.0.1` `` to the IP address of your TFTP server and copy the uImage to the server.
2018-08-29 09:43:03 -07:00
```text
2019-07-03 11:24:05 -07:00
TFTP_SERVER_IP = "127.0.0.1"
2018-03-16 17:46:11 -07:00
```
2018-04-09 21:04:24 -07:00
2019-07-03 11:24:05 -07:00
### Running with the Microsemi Expansion board
2018-04-09 21:04:24 -07:00
2019-07-03 11:24:05 -07:00
To use the Microsemi expansion board with your HiFive Unleased add the following line to your local.conf. This tells the Unleashed to use a device tree with the PCIe device described:
2018-04-09 21:04:24 -07:00
2018-08-29 09:43:03 -07:00
```text
2021-08-04 15:31:09 -07:00
RISCV_SBI_FDT:freedom-u540 = "hifive-unleashed-a00-microsemi.dtb"
2018-04-09 21:04:24 -07:00
```
2019-07-03 11:24:05 -07:00
### Sparse Image Creation
2019-01-03 15:25:07 -08:00
The output of the build can also be written to an SD card using bmaptool, the steps to do this are below:
```text
2019-02-12 11:15:16 -08:00
$ MACHINE=freedom-u540 wic create freedom-u540-opensbi -e core-image-minimal
$ bmaptool create ./freedom-u540-opensbi-201812181337-mmcblk.direct > image.bmap
2019-07-03 11:24:05 -07:00
$ sudo bmaptool copy --bmap image.bmap ./freedom-u540-opensbi-201812181337-mmcblk.direct /dev/sdX
```
### dding wic.gz
2023-02-04 19:45:43 +01:00
The output of a ```freedom-u540` ``, ` ``beaglev-starlight-jh7100` `` or ` ``mangopi-mq-pro` `` build will be a ` ``<image>.wic.gz` `` file. You can write this file to an sd card using:
2019-07-03 11:24:05 -07:00
```text
$ zcat < image > -< machine > .wic.gz | sudo dd of=/dev/sdX bs=4M iflag=fullblock oflag=direct conv=fsync status=progress
2019-01-03 15:25:07 -08:00
```
2023-02-04 19:45:43 +01:00
### Using bmaptoop to write the image
Instead of dding wic.gz image ```bmaptool` `` (available in most Linux distributions and/or pip) can be used for more reliable and faster flashing. You can write this file to an sd card using:
```text
$ sudo bmaptool copy < image > -< machine > .wic.gz /dev/sdX
```
2018-03-09 18:24:30 -08:00
## Maintainer(s)
2017-10-04 10:09:23 -07:00
* Khem Raj `<raj dot khem at gmail.com>`