{"id":25688994,"url":"https://github.com/embeddedos/aarch64_boot_code","last_synced_at":"2026-06-12T06:31:18.151Z","repository":{"id":278544100,"uuid":"935971201","full_name":"EmbeddedOS/aarch64_boot_code","owner":"EmbeddedOS","description":"Aarch64 bare metal boot code.","archived":false,"fork":false,"pushed_at":"2025-03-10T16:28:56.000Z","size":33,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-10T17:34:40.670Z","etag":null,"topics":["aarch64","assembly","c","el0","el1","el2","el3","exceptions-handling","qemu","svc","systemcalls"],"latest_commit_sha":null,"homepage":"","language":"Assembly","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/EmbeddedOS.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":"2025-02-20T10:17:37.000Z","updated_at":"2025-03-10T16:30:57.000Z","dependencies_parsed_at":"2025-03-10T17:36:59.615Z","dependency_job_id":null,"html_url":"https://github.com/EmbeddedOS/aarch64_boot_code","commit_stats":null,"previous_names":["embeddedos/aarch64_boot_code"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/EmbeddedOS/aarch64_boot_code","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EmbeddedOS%2Faarch64_boot_code","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EmbeddedOS%2Faarch64_boot_code/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EmbeddedOS%2Faarch64_boot_code/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EmbeddedOS%2Faarch64_boot_code/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EmbeddedOS","download_url":"https://codeload.github.com/EmbeddedOS/aarch64_boot_code/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EmbeddedOS%2Faarch64_boot_code/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34232789,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-12T02:00:06.859Z","response_time":109,"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":["aarch64","assembly","c","el0","el1","el2","el3","exceptions-handling","qemu","svc","systemcalls"],"created_at":"2025-02-24T21:17:22.916Z","updated_at":"2026-06-12T06:31:18.146Z","avatar_url":"https://github.com/EmbeddedOS.png","language":"Assembly","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Aarch64 bare metal boot code\n\n## What this project do\n\nBuilding bare metal boot code for AArch64 architecture, that's able to do:\n\n- Booting system from ROM as a bootloader.\n- Booting system from RAM as a kernel.\n- Self-relocating from ROM to RAM and start executing.\n- Able to boot from any Exception Level (EL3-\u003eEL0).\n- Run the EL0 code in C, and request `svc` system call to the kernel (EL1 code) and get the result.\n- Implement a system call dispatcher in EL1.\n\nThe blog that tells every details about this project here [Blog](https://embeddedos.github.io/posts/aarch64-bare-metal-boot-code/).\n\n## How to build\n\nDownload the toolchain from ARM official website, and change the cross compiler in Makefile to your path:\n\n```text\nCROSS_COMPILE=../linux/toolchain/bin/aarch64-none-linux-gnu-\n```\n\nAnd then `make`.\n\n## How to test\n\nI'm using QEMU as a platform, that you can change the EL by using option `virtualization` and `secure`. And also the `-bios` option tell the QEMU that our firmware will run as ROM code, `-kernel` option means run as kernel and start from RAM.\n\n- Start from EL3 as a ROM boot code:\n\n```bash\nqemu-system-aarch64 -M virt,virtualization=on,secure=on -cpu cortex-a57 -nographic -bios boot.bin -D log.txt -d int\n```\n\n- Start from EL2 as a ROM boot code:\n\n```bash\nqemu-system-aarch64 -M virt,virtualization=on,secure=off -cpu cortex-a57 -nographic -bios boot.bin -D log.txt -d int\n```\n\n- Start from EL1 as a ROM boot code:\n\n```bash\nqemu-system-aarch64 -M virt,virtualization=off,secure=off -cpu cortex-a57 -nographic -bios boot.bin -D log.txt -d int\n```\n\n- Start from EL3 as a kernel:\n\n```bash\nqemu-system-aarch64 -M virt,virtualization=on,secure=on -cpu cortex-a57 -nographic -kernel boot.elf -D log.txt -d int\n```\n\n- Start from EL2 as a kernel:\n\n```bash\nqemu-system-aarch64 -M virt,virtualization=on,secure=off -cpu cortex-a57 -nographic -kernel boot.elf -D log.txt -d int\n```\n\n- Start from EL1 as a kernel:\n\n```bash\nqemu-system-aarch64 -M virt,virtualization=off,secure=off -cpu cortex-a57 -nographic -kernel boot.elf -D log.txt -d int\n```\n\nSample result:\n\n```bash\n$ qemu-system-aarch64 -M virt,virtualization=on,secure=off -cpu cortex-a57 -nographic -bios boot.bin -D log.txt -d int\nAarch64 bare metal code!\nIn EL2!\nIn EL1!\nIn EL0!\nEnter el0_main!\nSystem call return a correct result.\nExit el0_main!\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fembeddedos%2Faarch64_boot_code","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fembeddedos%2Faarch64_boot_code","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fembeddedos%2Faarch64_boot_code/lists"}