{"id":19466179,"url":"https://github.com/sifive/meta-sifive","last_synced_at":"2025-02-25T13:45:02.343Z","repository":{"id":46179221,"uuid":"200890948","full_name":"sifive/meta-sifive","owner":"sifive","description":"SiFive OpenEmbedded / Yocto BSP Layer","archived":false,"fork":false,"pushed_at":"2025-02-25T10:50:10.000Z","size":1913,"stargazers_count":52,"open_issues_count":0,"forks_count":40,"subscribers_count":63,"default_branch":"master","last_synced_at":"2025-02-25T11:37:24.897Z","etag":null,"topics":["bsp","openembedded","sifive","yocto"],"latest_commit_sha":null,"homepage":"","language":"BitBake","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sifive.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-08-06T16:52:43.000Z","updated_at":"2025-02-21T11:08:39.000Z","dependencies_parsed_at":"2023-02-01T08:45:42.690Z","dependency_job_id":"61c1f391-bd64-43ba-a758-fc7fe8e89956","html_url":"https://github.com/sifive/meta-sifive","commit_stats":null,"previous_names":[],"tags_count":46,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sifive%2Fmeta-sifive","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sifive%2Fmeta-sifive/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sifive%2Fmeta-sifive/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sifive%2Fmeta-sifive/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sifive","download_url":"https://codeload.github.com/sifive/meta-sifive/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240679774,"owners_count":19840130,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bsp","openembedded","sifive","yocto"],"created_at":"2024-11-10T18:25:59.060Z","updated_at":"2025-02-25T13:45:02.295Z","avatar_url":"https://github.com/sifive.png","language":"BitBake","funding_links":[],"categories":[],"sub_categories":[],"readme":"# meta-sifive\nSiFive BSPs layer for OpenEmbedded/Yocto\n\n## Description\n\nThis is the general hardware-specific BSP layer for the SiFive boards.\n\nMore information can be found at: \u003chttps://sifive.com/\u003e (Official Site)\n\n## Dependencies\n\nThis layer depends on:\n* https://github.com/openembedded/bitbake\n* https://github.com/openembedded/openembedded-core\n\n## Prerequisites for the build host\n\n* [Yocto](https://docs.yoctoproject.org/singleindex.html#compatible-linux-distribution)\n* [kas](https://kas.readthedocs.io/en/latest/userguide.html#dependencies-installation)\n\n### Create the build environment\n\n```bash\nmkdir dist \u0026\u0026 cd dist\ngit clone https://github.com/sifive/meta-sifive\n```\n\n## Available machines\n\nThis layer provides a BSP for the following machines:\n* `freedom-u540`: The SiFive HiFive Unleashed board\n* `unmatched`: The Sifive Unmatched board\n\nBut changes are also validated on Qemu RISC-V 64bits, so this layer\nalso provide a Kas yaml to build this machine.\n\n## Available distribution\n\nThis layer doesn't define new distributions.\nBSPs are validated with the `core-image-minimal` and the `core-image-sato`\nprovides by the `OE-core` layer.\n\n## Build images\n\n\u003e\n\u003e Building disk images is CPU intensive, could require \u003c10GB of sources\n\u003e downloaded over the Internet and \u003c200GB of local storage.\n\nThis layer provides Kas scripts configured to download and to configure the\nbuild environment to build `core-minimal` images for supported targets:\n\n```bash\nkas build --update ./meta-sifive/scripts/kas/freedom-u540.yml\nkas build --update ./meta-sifive/scripts/kas/qemuriscv64.yml\nkas build --update ./meta-sifive/scripts/kas/unmatched.yml\n```\n\nMoreover, it is also possible to build other images, or SDK, or also packages,\nfor example:\n\n```bash\nkas build --update ./meta-sifive/scripts/kas/unmatched.yml --target core-image-weston\nkas build --update ./meta-sifive/scripts/kas/unmatched.yml --target buildtools-extended-tarball\nkas build --update ./meta-sifive/scripts/kas/unmatched.yml --target busybox\nkas shell --update ./meta-sifive/scripts/kas/unmatched.yml -c \"bitbake core-image-minimal -c populate_sdk\"\nkas shell --update ./meta-sifive/scripts/kas/unmatched.yml -c \"bitbake core-image-minimal -c populate_sdk_ext\"\n```\n\n## Running in QEMU\n\nThe OpenEmbedded/Yocto framework provides a wrapper for QEMU, named `runqemu` in order to use it easily.\n\nBelow examples to use this Qemu over a Kas shell:\n\n```bash\nkas shell ./meta-sifive/scripts/kas/qemuriscv64.yml -c \"runqemu slirp nographic core-image-minimal\"\nkas shell ./meta-sifive/scripts/kas/qemuriscv64.yml -c \"runqemu slirp serialstdio core-image-sato\"\n```\n\n## Execute runtime tests\n\nThe OpenEmbedded/Yocto framework provides also provides tools to implement and to run tests.\n\nThese tests can be executed on all supported targets, using the following commands:\n\n```bash\nkas build --update ./meta-sifive/scripts/kas/qemuriscv64.yml:./meta-sifive/scripts/kas/include/test.yml\nkas shell --update ./meta-sifive/scripts/kas/qemuriscv64.yml:./meta-sifive/scripts/kas/include/test.yml -c \"bitbake core-image-minimal -c populate_sdk \u0026\u0026 bitbake core-image-minimal -c testsdk\"\nkas shell --update ./meta-sifive/scripts/kas/qemuriscv64.yml:./meta-sifive/scripts/kas/include/test.yml -c \"bitbake core-image-minimal -c populate_sdk_ext \u0026\u0026 bitbake core-image-minimal -c testsdkext\"\nkas shell --update ./meta-sifive/scripts/kas/qemuriscv64.yml:./meta-sifive/scripts/kas/include/test.yml -c \"resulttool report  ./tmp-glibc/log/oeqa\"\n```\n\n## Running on Hardware\n\nYou will find all available build fragments (incl. disk images) in\n`$BUILDDIR/tmp/deploy/images/$MACHINE` where `MACHINE` can be:\n- `freedom-u540`\n- `qemuriscv64`\n- `unmatched`\n\nDisk images files use `\u003cimage\u003e-\u003cmachine\u003e.\u003coutput_format\u003e` format, for example,\n\n`core-image-minimal-unmatched.wic.xz`. We are interested in `.wic.xz` disk\nimages for writing to uSD card.\n\n\u003e Be very careful while picking /dev/sdX device! Look at dmesg, lsblk, blkid,\n\u003e GNOME Disks, etc. before and after plugging in your uSD card to find a\n\u003e proper device. Double check it to avoid overwriting any of system\n\u003e disks/partitions!\n\u003e\n\u003e Unmount any mounted partitions from uSD card before writing!\n\n### Flash the image on SDCard\n\nImages built can be flashed with `bmaptool` (faster), for example:\n\n```bash\nsudo bmaptool copy ../build/tmp-glibc/deploy/images/unmatched/core-image-minimal-unmatched.rootfs.wic.xz /dev/mmcblk0\n```\n\nOtherwise, you can also use the `dd` command, for example:\n\n```bash\nxzcat ../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\n```\n\n### MSEL for Unleashed\n\nYou 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:\n\n```\n      USB   LED    Mode Select                  Ethernet\n +===|___|==****==+-+-+-+-+-+-+=================|******|===+\n |                | | | | |X| |                 |      |   |\n |                | | | | | | |                 |      |   |\n |        HFXSEL-\u003e|X|X|X|X| |X|                 |______|   |\n |                +-+-+-+-+-+-+                            |\n |        RTCSEL-----/ 0 1 2 3 \u003c--MSEL                     |\n |                                                         |\n```\n\n### MSEL for Unmatched\n\nBy 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):\n\n```\n  +----------\u003e CHIPIDSEL\n  | +--------\u003e MSEL3\n  | | +------\u003e MSEL2\n  | | | +----\u003e MSEL1\n  | | | | +--\u003e MSEL0\n  | | | | |\n +-+-+-+-+-+\n | |X| |X|X| ON(1)\n | | | | | |\n |X| |X| | | OFF(0)\n +-+-+-+-+-+\nBOOT MODE SEL\n\n```\n\n\n### Connecting Using Serial Console\n\nConnect your HiFive Unleashed or HiFive Unmatched to your PC using microUSB-USB cable to access serial console.\n\nFor macOS, run: `screen -L /dev/tty.usbserial-*01 115200`\n\nFor Linux, run: `screen -L /dev/serial/by-id/usb-FTDI_Dual_RS232-HS-if01-port0 115200`\n\nThe above commands might vary depending on your exact setup.\n\n`-L` command will log all output to `screenlog.0` in your current working directory.\n\nTo quit screen, hit `Ctrl - A` followed by `\\` symbol. Finally agree to\nterminate all windows by typing `y`.\n\nYou can login with `root` account. The password is `sifive`. __We strongly\nrecommend to change the default password  for the root account on the first\nboot before you connect it to the Internet.__\n\n### Connecting Using SSH\n\n__Before you connect your board to the Internet we strongly recommend to change\nthe default password for the root account and configure your network equipment\n(for example, routers and firewalls) appropriately.__\n\nSSH daemon is enabled by default, in order to be able to execute remotely\nruntime tests. To disable SSH daemon connect to the board using serial console\nmethod described above. Once connected execute the following commands:\n\n```\nsystemctl disable sshd.socket\nsystemctl stop sshd.socket\n```\n\nThe HiFive Unleashed and Unmatched behave like any other network capable\ndevice (such as PC, laptop, and Single Board Computers like Raspberry Pi).\nConnect the board to your network (for example, a router), and it will acquire\nIPv4 + DNS configuration using DHCP protocol. You can use your router\nmanagement panel to get assigned IPv4 address or use the serial console to\nacquire it directly from the board (use `ip addr` command to print active\nnetwork information). Finally you can SSH to the board:\n\n```\nssh -o PreferredAuthentications=password -o PubkeyAuthentication=no -o StrictHostKeyChecking=no -o \"UserKnownHostsFile /dev/null\" root@\u003cIPv4\u003e\n```\n\n### Supported GPUs\n\nVarious GPUs from AMD were successfully tested with the boards. In particular\n**Radeon HD 6450** is the most widely used. Other GPUs from the same family\nmight also work, for instance, THD64xxM, HD7450, HD8450, R5 230, R5 235,\nR5 235X. The newest tested GPUs from AMD are RX 550, RX 570, RX 580 with no\nissues.\n\n### Online Resizing of rootfs (Root File Partition)\n\nIt is highly advised to resize partitions offline (i.e. before booting the\nsystem). If you already booted the system and cannot do offline resizing then\nthe following instructions should resize rootfs (root file partition) to full\nuSD capacity:\n\n```bash\nsgdisk -v /dev/mmcblk0\nsgdisk -e /dev/mmcblk0\nparted /dev/mmcblk0 resizepart 4 100%\nresize2fs /dev/mmcblk0p4\nsync\n```\n\n### NBD (Network Block Device) rootfs\n\nThis is an experimantal feature currently only available on SiFive HiFive\nUnmatched board. This allow sharing a block device over the network. This is\nnot an extensive guide into NBD, but a quick start.\n\nIf you want to use this feature open `extlinux.conf` in `/boot` partition and\nmodify the `append` line to:\n\n```\nappend ip=dhcp root=/dev/nbd0 rw nbdroot=\u003cserver_ip_address\u003e:\u003cexport_name\u003e nbdport=10809 console=ttySIF0,115200 earlycon\n```\n\nIf you are booting directly from U-Boot prompt, you would need to set\n`bootargs` variable instead.\n\nNote that `\u003cexport_name\u003e` value might be ignored by the NBD server (depends on\nthe implementation and configuration).\n\n`nbdkit` is a recommended NBD server for it's flexibility.\n\nHere is an example command for `nbdkit`:\n```\nsudo nbdkit -f --verbose --threads 128 --filter=cow --filter=partition --filter=xz file core-image-minimal-unmatched-\u003c..\u003e.rootfs.wic.xz partition=4\n```\nThis would expose the ext4 filesystem on the 4th partition from XZ compressed\ndisk image. By default it's read-only thus we also add a COW (Copy-on-Write)\nlayer. Note that COW layer is not saved by default and will be lost if\n`nbdkit` process is terminated. See\n[nbdkit-cow-filter](https://libguestfs.org/nbdkit-cow-filter.1.html) NOTES on\nhow to save disk image with all the modifications for further use.\n\nUsing XZ compressed disk image is convenient, but doesn't deliver high\nperformance. For higher performance uncompress disk image before sharing it\nvia NBD.\n\nHere is another example:\n```\nsudo mkdir rootfs\nsudo tar -xJ --numeric-owner -C rootfs -f core-image-minimal-unmatched-\u003c..\u003e.rootfs.tar.xz\nsudo nbdkit -f --verbose --threads 128 --filter=partition --filter=cow linuxdisk $PWD/rootfs size=+2G partition=1\n```\nIn this particular case we uncompress rootfs into a directory. We ask `nbdkit`\nto take the directory, generate linux disk image from it, add some additional\nfree space, add a COW layer to make it writable and send \"naked\" filesystem\n(i.e. no partition table) as before.\n\n`nbdkit` has a number of plugins and filters allowing various ways how to share\ndisk images over the network.\n\n## Run Tensorflow Lite demo\n\n```\ncd /usr/share/tensorflow/lite/examples/python/\npython3 python3 mnist.py\n```\n\n## Contributions \u0026 Feedback\n\nIf you want to file issues, send patches and make feature/enhancement requests\nuse [meta-sifive](https://github.com/sifive/meta-sifive) repository on\nGitHub. So that the maintainer can process your request.\n\nYou are also welcome to join [SiFive Forums ](https://forums.sifive.com/)\nwhere we have [HiFive Unleashed](https://forums.sifive.com/c/hifive-unleashed/12)\nand [HiFive Unmatched](https://forums.sifive.com/c/hifive-unmatched/16)\ncategories for discussions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsifive%2Fmeta-sifive","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsifive%2Fmeta-sifive","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsifive%2Fmeta-sifive/lists"}