{"id":15003900,"url":"https://github.com/sysprog21/semu","last_synced_at":"2025-05-16T10:07:35.156Z","repository":{"id":44334822,"uuid":"512105473","full_name":"sysprog21/semu","owner":"sysprog21","description":"A minimalist RISC-V system emulator capable of running Linux kernel","archived":false,"fork":false,"pushed_at":"2025-04-24T07:46:25.000Z","size":4106,"stargazers_count":261,"open_issues_count":11,"forks_count":58,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-05-10T11:07:29.729Z","etag":null,"topics":["emulator","linux-kernel","risc-v","riscv","riscv-emulator","rv32ima"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sysprog21.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","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,"zenodo":null}},"created_at":"2022-07-09T05:51:44.000Z","updated_at":"2025-04-29T13:51:30.000Z","dependencies_parsed_at":"2024-03-08T02:25:48.055Z","dependency_job_id":"3a60886d-e471-4311-96a0-bf201a021627","html_url":"https://github.com/sysprog21/semu","commit_stats":{"total_commits":108,"total_committers":12,"mean_commits":9.0,"dds":0.6388888888888888,"last_synced_commit":"a0ad61bc98fc22959f566240a81805f1733b8551"},"previous_names":["sysprog21/semu","jserv/semu"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysprog21%2Fsemu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysprog21%2Fsemu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysprog21%2Fsemu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysprog21%2Fsemu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sysprog21","download_url":"https://codeload.github.com/sysprog21/semu/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254509476,"owners_count":22082891,"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":["emulator","linux-kernel","risc-v","riscv","riscv-emulator","rv32ima"],"created_at":"2024-09-24T19:00:37.156Z","updated_at":"2025-05-16T10:07:30.145Z","avatar_url":"https://github.com/sysprog21.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# semu\n\nA minimalist RISC-V system emulator capable of running Linux the kernel and corresponding userland.\n`semu` implements the following:\n- RISC-V instruction set architecture: RV32IMA\n- Privilege levels: S and U modes\n- Control and status registers (CSR)\n- Virtual memory system: RV32 MMU\n- UART: 8250/16550\n- PLIC (platform-level interrupt controller): 32 interrupts, no priority\n- Standard SBI, with the timer extension\n- Three types of I/O support using VirtIO standard:\n    - virtio-blk acquires disk image from the host.\n    - virtio-net is mapped as TAP interface.\n    - virtio-snd uses ALSA for sound operation with the following limitations:\n        - The emulator will hang if PulseAudio is enabled on host.\n        - The playback may plays with repeating artifact.\n\n## Prerequisites\n\n[Device Tree](https://www.kernel.org/doc/html/latest/devicetree/) compiler (dtc) is required.\nTo install it on Debian/Ubuntu Linux, enter the following command:\n```shell\n$ sudo apt install device-tree-compiler\n```\n\nFor macOS, use the following command:\n```shell\n$ brew install dtc\n```\n\nFor demonstration purposes, ext4 is used for file system mounting.\n`ext4` is a native Linux filesystem, offering stability, high capacity, reliability,\nand performance while requiring minimal maintenance. The `mkfs.ext4` command can\ncreate an ext4 file system from disk partitions. This command is a symbolic link of\nthe [mke2fs](https://man7.org/linux/man-pages/man8/mke2fs.8.html) command, and its\nusage is the same as the mke2fs command.\n\nFor most GNU/Linux distributions, `mkfs.ext4` command should be installed in advance.\nFor macOS, use the following command:\n```shell\n$ brew install e2fsprogs\n```\n\n## Build and Run\n\nBuild the emulator:\n```shell\n$ make\n```\n\nDownload prebuilt Linux kernel image:\n```shell\n$ make check\n```\n\nPlease be patient while `semu` is running.\n\nReference output:\n```\nStarting syslogd: OK\nStarting klogd: OK\nRunning sysctl: OK\nStarting network: OK\n\nWelcome to Buildroot\nbuildroot login:\n```\n\nEnter `root` to access shell.\n\nYou can exit the emulator using: \\\u003cCtrl-a x\\\u003e. (press Ctrl+A, leave it, afterwards press X)\n\n## Usage\n\n```shell\n./semu -k linux-image [-b dtb-file] [-i initrd-image] [-d disk-image]\n```\n\n* `linux-image` is the path to the Linux kernel `Image`.\n* `dtb-file` is optional, as it specifies the user-specified device tree blob.\n* `initrd-image` is optional, as it specifies the user-specified initial RAM disk image.\n* `disk-image` is optional, as it specifies the path of a disk image in ext4 file system for the virtio-blk device.\n\n## Build Linux kernel image and root file system\n\nAn automated build script is provided to compile the RISC-V cross-compiler, Busybox, and Linux kernel from source.\nPlease note that it only supports the Linux host environment.\n\n```shell\n$ make build-image\n```\n\n## License\n\n`semu` is released under the MIT License.\nUse of this source code is governed by a MIT-style license that can be found in the LICENSE file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsysprog21%2Fsemu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsysprog21%2Fsemu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsysprog21%2Fsemu/lists"}