{"id":17693621,"url":"https://github.com/dom96/nimkernel","last_synced_at":"2025-04-07T05:08:21.254Z","repository":{"id":9255075,"uuid":"11079327","full_name":"dom96/nimkernel","owner":"dom96","description":"A small kernel written in Nim","archived":false,"fork":false,"pushed_at":"2021-11-04T21:56:42.000Z","size":13,"stargazers_count":619,"open_issues_count":1,"forks_count":39,"subscribers_count":26,"default_branch":"master","last_synced_at":"2025-03-30T23:23:44.597Z","etag":null,"topics":["example","kernel","nim","sample","simple"],"latest_commit_sha":null,"homepage":"","language":"Nim","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dom96.png","metadata":{"files":{"readme":"readme.markdown","changelog":null,"contributing":null,"funding":null,"license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-06-30T22:52:36.000Z","updated_at":"2025-03-29T10:47:20.000Z","dependencies_parsed_at":"2022-08-07T05:00:46.491Z","dependency_job_id":null,"html_url":"https://github.com/dom96/nimkernel","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dom96%2Fnimkernel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dom96%2Fnimkernel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dom96%2Fnimkernel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dom96%2Fnimkernel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dom96","download_url":"https://codeload.github.com/dom96/nimkernel/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247595334,"owners_count":20963943,"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":["example","kernel","nim","sample","simple"],"created_at":"2024-10-24T13:46:04.169Z","updated_at":"2025-04-07T05:08:21.237Z","avatar_url":"https://github.com/dom96.png","language":"Nim","readme":"# nimkernel\n\nThis is a small 32bit (i686) kernel written using the Nim programming language.\n\nI have been wanting to do this for a while but it wasn't until people in the #nim IRC\nchannel inquired about Nim OS dev and the\n[rustboot](https://github.com/charliesome/rustboot) kernel inspired me that I finally did it.\n\nIt doesn't do much, but it doesn't need to. Its purpose is to provide a starting\npoint for anyone wishing to write an OS in Nim.\n\nIt still manages to do a little more than fill a screen with a certain color.\nNimkernel implements:\n\n* A ``writeString`` function which shows a string on screen in a specified\n  position.\n* A ``rainbow`` function which shows a string with a rainbow-like text\n  foreground color differentiation in a specified position.\n* Some simple error handling by implementing Nim system.nim's ``panic``\n  function.\n* Support for 16 colors with a brilliant type safe API!\n\n![](http://picheta.me/private/images/nimkernel2.png)\n\n**Note**: The error at the bottom is intentional, it is used to show that\nthe error handling works properly.\n\n## Setup\n\nYou are required to have:\n\n* QEMU\n* a C and asm cross-compiler for i686\n* Nim 1.6.0 or higher\n* nimble (*)\n\n\\* You can always grab the nake library manually from [here](https://github.com/fowlmouth/nake).\n\n### Linux\n\nI have performed this setup on a Arch Linux machine, but all other distros\nshould work too.\n\n#### Building a cross compiler\n\nFor more information take a look at the [OSDev article](http://wiki.osdev.org/GCC_Cross-Compiler).\n\nYou will need to download the source of binutils and gcc.\n\nFirst ``cd`` into a suitable directory in which you would like to download, unzip\nand build the cross compiler. Then perform the following actions:\n\n```bash\n$ wget https://ftp.gnu.org/gnu/binutils/binutils-2.37.tar.xz\n$ tar -xJf binutils-2.37.tar.xz\n$ cd binutils-2.37\n$ mkdir build \u0026\u0026 cd build\n$ ../configure --target=i686-elf --prefix=$HOME/cross-tools/ --with-sysroot --disable-nls --disable-werror\n$ make -j$(nproc)\n$ make install\n```\n\nYou may then grab the GCC source and build it:\n\n```bash\n$ wget https://ftp.gnu.org/gnu/gcc/gcc-11.2.0/gcc-11.2.0.tar.xz\n$ tar -xJf gcc-11.2.0.tar.xz\n$ cd gcc-11.2.0\n$ mkdir build \u0026\u0026 cd build\n$ ../configure --target=i686-elf --prefix=$HOME/cross-tools/ --disable-nls --enable-languages=c --without-headers\n$ make all-gcc -j$(nproc)\n$ make all-target-libgcc -j$(nproc)\n$ make install-gcc\n$ make install-target-libgcc\n```\n\nYou should then have a i686-elf-gcc and i686-elf-as executable in $HOME/cross-tools/bin/ or somewhere thereabouts.\nYou should then add it to your PATH permanently or temporarily by doing:\n\n```bash\nexport PATH=$PATH:$HOME/cross-tools/bin\n```\n\n#### Downloading cross compiler binaries\n\nIf for some reason you either can't or don't want to build your own toolchain you can grab binaries from [https://github.com/lordmilko/i686-elf-tools/releases](https://github.com/lordmilko/i686-elf-tools/releases)\n\nPlease note that these are a bit outdated but they are confirmed to work.\n\n#### Nim setup\n\nFollow the instructions in the [Nim repo](https://github.com/Araq/nim) to bootstrap Nim and put it in your PATH.\n\nDo the same for [nimble](https://github.com/nim-lang/nimble) and install\n``nake`` by executing ``nimble install nake`` or\nalternatively just save [nake](https://github.com/fowlmouth/nake/raw/master/nake.nim)\ninto the root dir of this repo.\n\nYou can then compile the nakefile and therefore compile nimkernel:\n\n```bash\n$ nim c nakefile\n$ ./nakefile run\n```\n\nThis will automatically build and run the kernel using QEMU.\n\n## License\n\nNimkernel is licensed under the MIT license.\n\n \n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdom96%2Fnimkernel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdom96%2Fnimkernel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdom96%2Fnimkernel/lists"}