{"id":49323856,"url":"https://github.com/jserv/cortexm-linux","last_synced_at":"2026-04-26T19:02:06.869Z","repository":{"id":352653614,"uuid":"1216000500","full_name":"jserv/cortexm-linux","owner":"jserv","description":"Linux on Arm Cortex-M","archived":false,"fork":false,"pushed_at":"2026-04-20T14:25:45.000Z","size":46,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-20T16:34:59.579Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","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/jserv.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":"2026-04-20T13:16:27.000Z","updated_at":"2026-04-20T16:21:43.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/jserv/cortexm-linux","commit_stats":null,"previous_names":["jserv/cortexm-linux"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/jserv/cortexm-linux","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jserv%2Fcortexm-linux","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jserv%2Fcortexm-linux/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jserv%2Fcortexm-linux/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jserv%2Fcortexm-linux/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jserv","download_url":"https://codeload.github.com/jserv/cortexm-linux/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jserv%2Fcortexm-linux/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32308879,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T17:23:19.671Z","status":"ssl_error","status_checked_at":"2026-04-26T17:23:19.195Z","response_time":129,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":"2026-04-26T19:02:06.220Z","updated_at":"2026-04-26T19:02:06.863Z","avatar_url":"https://github.com/jserv.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Linux on Arm Cortex-M\n\nA testbed for running and experimenting with Linux on Arm Cortex-M microcontrollers.\nCortex-M cores have no MMU, so the kernel runs in nommu mode and userspace binaries use the FDPIC ELF format with shared `uClibc-ng`.\nThe entire system -- cross-toolchain, C library, userspace, kernel, and boot wrapper --\nis built from source by a single shell script and boots under QEMU.\n\nUse this project to study how Linux behaves without an MMU,\nto prototype kernel patches for Cortex-M,\nor to experiment with minimal embedded Linux configurations on a microcontroller-class CPU.\n\n## Prerequisites\n\nA Linux host is required.  The build downloads and compiles an entire\ncross-toolchain, C library, BusyBox, and kernel from source, so expect\nsignificant build time and several gigabytes of disk space.\n\nInstall the host packages needed for a cross-toolchain build (Debian/Ubuntu):\n\n```shell\n$ sudo apt-get install build-essential bison flex texinfo \\\n    libncurses-dev wget git qemu-system-arm\n```\n\n## Quick start\n\n```shell\n$ ./build.sh\n$ qemu-system-arm -M mps2-an386 -cpu cortex-m4 -nographic \\\n    -kernel bootwrapper/linux.axf\n```\n\nExit QEMU with `Ctrl-a x`.\n\n## What gets built\n\nThe build runs in a fixed order, downloading sources automatically:\n\n| Step | Component | Version | Purpose |\n|------|-----------|---------|---------|\n| 1 | binutils | 2.46.0 | Assembler, linker (with Thumb-only patch) |\n| 2 | GCC | 15.2.0 | C-only cross-compiler, first-pass |\n| 3 | Linux headers | 7.0 | Kernel headers for C library build |\n| 4 | uClibc-ng | 1.0.57 | Shared FDPIC C library and dynamic loader for nommu targets |\n| 5 | BusyBox | 1.37.0 | Minimal userspace (shell, coreutils) |\n| 6 | Linux kernel | 7.0 | Kernel with embedded initramfs and FDPIC loader |\n| 7 | Boot wrapper | -- | Reset vectors for QEMU Cortex-M emulation |\n\nIndividual stages can be re-run selectively:\n```shell\n$ ./build.sh busybox finalize_rootfs linux bootwrapper\n```\n\nRun `./build.sh clean` to remove build artifacts while keeping downloaded sources.\n\n## Target platform\n\n- CPU: Arm Cortex-M4 (ARMv7E-M, Thumb-2 only, no Arm-mode instructions)\n- Machine: MPS2-AN386 (QEMU emulation of the ARM MPS2 FPGA board)\n- No MMU -- the kernel uses `CONFIG_MMU=n` with a bootwrapper-loaded image\n- Binaries are FDPIC ELF, loaded by `CONFIG_BINFMT_ELF_FDPIC`\n\nQEMU's MPS2-AN386 model does not provide the normal ARM Linux boot path,\nso this project uses a boot wrapper (from the `cortex-m-linux` branch of ARM-software/bootwrapper)\nthat supplies the Cortex-M vector table and jumps to the kernel at `0x21000000`.\n\n## FDPIC and XIP\n\nUserspace now defaults to shared FDPIC ELF binaries via the `arm-uclinuxfdpiceabi`\ntoolchain. This removes the old `elf2flt` conversion path and lets nommu processes\nshare text from shared libraries.\n\nMeasured against the historical FLAT build on `main`, the trade-off is mixed:\n- the FDPIC BusyBox executable is smaller (`112,972` bytes vs `172,316` bytes FLAT)\n- the shipped rootfs is larger (`340,906` bytes vs `172,654` bytes FLAT) because\n  `ld-uClibc.so` and `libuClibc.so` are extra payload in a single-binary system\n\nIn other words, shared FDPIC is the default here for dynamic-linking capability and\nfuture multi-binary sharing, not because it is the smallest possible image for the\ncurrent BusyBox-only userspace.\n\nApplication XIP is still not enabled in this repository. The current boot flow embeds\nthe root filesystem into an initramfs and boots it through QEMU `-kernel`, so userland\nis loaded into RAM rather than executed from a flash-backed XIP filesystem. To pursue\nApplication XIP with FDPIC, the project would need a flash-mapped `romfs`/`cramfs`\nlayout on MTD instead of the current initramfs design. FDPIC is a prerequisite for\nshared-code XIP, but it is not sufficient on its own.\n\n## Experiments you can try\n- Adjust kernel configs to measure the size floor for a bootable Cortex-M Linux system.\n- Add or remove BusyBox applets and observe the FDPIC binary and shared-library size impact.\n- Write small C programs, cross-compile them with the toolchain,\n  and drop them into the initramfs to see how nommu affects process behavior\n  (traditional `fork` is unavailable; programs use `vfork` or,\n  where the C library provides it, `posix_spawn`).\n- Test newer kernel versions for Cortex-M support regressions.\n\n## License\n\nBuild scripts are released under the MIT license.\nSee `LICENSE` for details.\nEach upstream component carries its own license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjserv%2Fcortexm-linux","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjserv%2Fcortexm-linux","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjserv%2Fcortexm-linux/lists"}