{"id":30727618,"url":"https://github.com/zuki/xv6-sdhost","last_synced_at":"2025-09-03T14:08:17.588Z","repository":{"id":312496483,"uuid":"1040442911","full_name":"zuki/xv6-sdhost","owner":"zuki","description":"rpi-osでmmcの代わりにsdhostを使用する","archived":false,"fork":false,"pushed_at":"2025-08-31T02:17:14.000Z","size":2497,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-08-31T04:14:19.583Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/zuki.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-08-19T01:48:15.000Z","updated_at":"2025-08-19T01:49:00.000Z","dependencies_parsed_at":"2025-08-31T04:14:29.546Z","dependency_job_id":"7e2e4d64-416f-4721-9ec5-1a41353a6b3a","html_url":"https://github.com/zuki/xv6-sdhost","commit_stats":null,"previous_names":["zuki/xv6-sdhost"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/zuki/xv6-sdhost","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zuki%2Fxv6-sdhost","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zuki%2Fxv6-sdhost/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zuki%2Fxv6-sdhost/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zuki%2Fxv6-sdhost/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zuki","download_url":"https://codeload.github.com/zuki/xv6-sdhost/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zuki%2Fxv6-sdhost/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273453710,"owners_count":25108473,"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-09-03T02:00:09.631Z","response_time":76,"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":[],"created_at":"2025-09-03T14:08:15.442Z","updated_at":"2025-09-03T14:08:17.580Z","avatar_url":"https://github.com/zuki.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Raspberry Pi Operating System\n\nYet another unix-like toy operating system running on Raspberry Pi 3/4, which is built when I was preparing [labs](https://github.com/FDUCSLG/OS-2020Fall-Fudan/) for operating system course at Fudan University, following the classic framework of [xv6](https://github.com/mit-pdos/xv6-public/).\n\nTested on Raspberry Pi 3A+, 3B+, 4B.\n\n## Related works\n\n- [linux](https://github.com/raspberrypi/linux): real world operating system\n- [circle](https://github.com/rsta2/circle): contains lots of portable drivers\n- [s-matyukevich's](https://github.com/s-matyukevich/raspberry-pi-os)\n- [bztsrc's](https://github.com/bztsrc/raspi3-tutorial)\n\n## What's different?\n\n- We use [musl](https://musl.libc.org/) as user programs libc instead of reinventing one.\n- The set of syscalls supported by our kernel is a subset of linux's.\n- Compared to xv6, we use a queue-based scheduler and hash pid for process sleeping and waking.\n\n## Features\n\n- [x] AArch64 only\n- [x] Basic multi-core support\n- [x] Memory management\n- [x] Virtual memory without swapping\n- [x] Process management\n- [x] Disk driver(EMMC): ported from [circle](https://github.com/rsta2/circle/tree/master/addon/SDCard)\n- [x] File system: ported from xv6\n- [x] C library: [musl](https://musl.libc.org/)\n- [x] Shell: ported from xv6\n  - [x] Support argc, envp\n  - [x] Support pipe\n\n## Prerequisite\n\nFor Ubuntu 20.04 on x86, just run `make init` and skip this section.\n\n### GCC toolchain\n\nIf you are cross compiling on macOS,\n\n1. run `brew install zstd`,\n2. install aarch64-unknown-linux-gnu by [macos-cross-toolchains](https://github.com/messense/homebrew-macos-cross-toolchains),\n3. change the prefix such as `CROSS := aarch64-unknown-linux-gnu-` in config.mk.\n\nIf you are native compiling, i.e., running natively on ARMv8, set `CROSS := ` in config.mk to use local gcc.\n\nIf `$(CROSS)gcc --version` gives out version less than 9.3.0, remove `-mno-outline-atomics` from Makefile.\n\n### QEMU\n\nYou can install QEMU (\u003e= 6.0) by package manager or compile it from source such as\n\n```\ngit clone https://github.com/qemu/qemu.git\nmkdir -p qemu/build\n(cd qemu/build \u0026\u0026 ../configure --target-list=aarch64-softmmu \u0026\u0026 make -j8)\n```\n\nOn some OS such as CentOS, you may also need to install the following dependencies\n\n```\nyum install ninja-build\nyum install pixman-devel.aarch64\n```\n\nThen add the generated `qemu-system-aarch64` to PATH or just modify the `QEMU` variable in config.mk.\n\n### Build musl\n\nFirst, fetch musl by `git submodule update --init --recursive`.\n\nThen if you are cross compiling, run `(cd libc \u0026\u0026 export CROSS_COMPILE=X \u0026\u0026 ./configure --target=aarch64)`, where `X` is the `CROSS` variable in config.mk. Otherwise, run `(cd libc \u0026\u0026 ./configure)`.\n\n### File system tools\n\nmtools is used to build our fat32 file system image, which can be installed by package manager, e.g, `sudo apt install mtools` on Ubuntu and `brew install mtools` on macOS.\n\nsfdisk is used to create MBR-partitioned disk images. It has already been installed on most Linux distributions. But for macOS,\n\n1. run `brew install util-linux` to install sfdisk,\n2. modify the PATH according to the instructions given by brew.\n\n## Development\n\n- `make qemu`: Emulate the kernel at `obj/kernel8.img`.\n- `make`: Create a bootable sd card image at `obj/sd.img` for Raspberry Pi 3, which can be burned to a tf card using [Raspberry Pi Imager](https://www.raspberrypi.org/software/).\n- `make lint`: Lint source code of kernel and user programs.\n\n### Raspberry Pi 4\n\nIt works on Pi 4 as well. Change `RASPI := 3` to `RASPI := 4` in Makefile, run `make clean \u0026\u0026 make` and have fun with your Pi 4.\n\n### Logging level\n\nLogging level is controlled via compiler option `-DLOG_XXX` in Makefile, where `XXX` can be one of\n\n- `ERROR`\n- `WARN`\n- `INFO`\n- `DEBUG`\n- `TRACE`\n\nDefaults to `-DLOG_INFO`.\n\n### Debug mode\n\nEnabling debug mode via compiler option `-DDEBUG` in Makefile will incorporate runtime assertions,\ntesting and memory usage profiling(see below). Defaults to `-DNOT_DEBUG`.\n\n### Profile\n\nWe can inspect the information of processes and memory usage(shown when `-DDEBUG`) by `Ctrl+P`.\nThis may output something like\n\n```\n1 sleep  init\n2 run    idle\n3 runble idle\n4 run    idle\n5 run    idle\n6 sleep  sh fa: 1  \n```\n\nwhere each row contains the pid, state, name and father's pid of each process.\n\n## Project structure\n\n```\n.\n├── Makefile\n├── mksd.mk: Part of Makefile for generating bootable image.\n|\n├── boot: Official boot loader.\n├── libc: C library musl.\n|\n├── inc: Kernel headers.\n├── kern: Kernel source code.\n└── usr: User programs.\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzuki%2Fxv6-sdhost","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzuki%2Fxv6-sdhost","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzuki%2Fxv6-sdhost/lists"}