{"id":20467810,"url":"https://github.com/maxbanister/gemmini-device-driver","last_synced_at":"2025-10-05T22:11:52.101Z","repository":{"id":88377898,"uuid":"234160703","full_name":"MaxBanister/gemmini-device-driver","owner":"MaxBanister","description":"The companion driver and kernel patches for the gemmini firmware","archived":false,"fork":false,"pushed_at":"2020-04-20T01:33:37.000Z","size":24,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-05T12:47:55.752Z","etag":null,"topics":["linux-device-drivers","risc-v"],"latest_commit_sha":null,"homepage":"","language":"C","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/MaxBanister.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":"2020-01-15T19:52:52.000Z","updated_at":"2020-04-20T01:33:39.000Z","dependencies_parsed_at":"2024-03-30T16:01:20.286Z","dependency_job_id":null,"html_url":"https://github.com/MaxBanister/gemmini-device-driver","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/MaxBanister/gemmini-device-driver","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaxBanister%2Fgemmini-device-driver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaxBanister%2Fgemmini-device-driver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaxBanister%2Fgemmini-device-driver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaxBanister%2Fgemmini-device-driver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MaxBanister","download_url":"https://codeload.github.com/MaxBanister/gemmini-device-driver/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaxBanister%2Fgemmini-device-driver/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270657715,"owners_count":24623465,"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","status":"online","status_checked_at":"2025-08-16T02:00:11.002Z","response_time":91,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["linux-device-drivers","risc-v"],"created_at":"2024-11-15T13:30:10.035Z","updated_at":"2025-10-05T22:11:52.004Z","avatar_url":"https://github.com/MaxBanister.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gemmini Device Driver\n\n**Author:** Max Banister\n\n**Email:** maxbanister@berkeley.edu\n\nCompanion software to [GemminiOS](https://github.com/MaxBanister/gemmini-os)\n\n## Build Steps with Linux\n\nThis module must be built statically with Linux, since it uses RISC-V architecture specific functions and not Linux's publicly exported functions. As such, it is reliant on the internal functions of the RISC-V port and may be unstable with future kernel releases. Last tested with 5.5.\n\n### Building a Dynamically Loaded Module (Not Recommended)\n\nIt isn't currently possible to build a dynamically loadable module. However, for testing purposes there are reasons one may wish to do so, so I have included a `Makefile` for this purpose. To build, simply run:\n\n```\nmake CONFIG_GEMMINI=m CROSS_COMPILE=riscv64-unknown-linux-gnu- all\n```\n\nTo install it, `scp` the resultant `gemmini_driver.ko` to your RISC-V system, and run:\n\n```\nsudo modprobe gemmini_driver.ko\n```\n\nTo check to make sure it's installed, type:\n\n```\nlsmod | grep gemmini\n```\n\n### Building a Statically Linked Module with Linux\n\nThe normal way of using the module will be building it in to a custom kernel. To do so, first follow the instructions at https://github.com/tactcomplabs/xbgas-tools/blob/master/README.md to clone Linux, create a BusyBox archive, and build Spike if you haven't already, then follow these steps:\n\n1. In a scratch directory, clone the device driver.\n\n```\ngit clone https://github.com/MaxBanister/gemmini-device-driver\n```\n\n2. Navigate to the top level of the repo, and run:\n\n```\ncp gemmini_driver.c /PATH_TO_LINUX/drivers/gemmini\ncp Kconfig /PATH_TO_LINUX/drivers/gemmini\ncp Makefile /PATH_TO_LINUX/drivers/gemmini\ncp .config /PATH_TO_LINUX/drivers/gemmini\n```\n\nThen, make sure that the Kbuild system knows about our custom module:\n\n```\nsed -i '/^endmenu/i source \\\"drivers/gemmini/Kconfig\\\"\\n' Kconfig\n```\n\n\nThen, `cd` into the Linux repository and prepare to build. If you have an `initramfs` archive you want to include for use with Spike, be sure to copy it over and modify the config to point to it. For example, run `make ARCH=riscv menuconfig` and navigate to `General Settings` -\u003e `Initial RAM filesystem and RAM disk (initramfs/initrd) support` to point to your filesystem archive.\n\n3. Once you have a filesystem set up, make with:\n\n```\nmake -j16 ARCH=riscv CROSS_COMPILE=riscv64-unknown-linux-gnu-\n```\n\n4. Press ENTER to confirm all the new config options if necessary.\n\n5. At this point, you should have a `vmlinux` binary that is ready for use with Spike. Now, follow the instructions at https://github.com/MaxBanister/gemmini-os to clone Berkeley Bootloader and apply the patches to enable two heterogenous binaries to be launched. Once you are finished, you should have a `bbl` binary that is ready for use with Spike. To put this version of `bbl` on your path, you can run `make install` in that repo, although this will potentially override whatever version of `bbl` you have currently installed.\n\n6. To test in Spike, simply run:\n\n```\nspike -p2 bbl\n```\n\nThe `-p2` option feeds a two-hart device tree into Spike, which runs the modified version of bbl on both harts, which subsequently runs Linux on hart 0 and GemminiOS on hart 1. The modified version of bbl hardcodes the assumption that Gemmini firmware will run on hart 1, since this was designed for use with the a chip which had a systolic array on hart 1. Changing this in GemminiOS should be facile, but is not recommended.\n\nThis should drop you into the ash shell, from which you can run a test program that utilizes the device driver to send commands to the Gemmini hart.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxbanister%2Fgemmini-device-driver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaxbanister%2Fgemmini-device-driver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxbanister%2Fgemmini-device-driver/lists"}