{"id":17464573,"url":"https://github.com/hqarroum/initrd-snapshot","last_synced_at":"2025-10-07T13:12:22.748Z","repository":{"id":141119270,"uuid":"67311601","full_name":"HQarroum/initrd-snapshot","owner":"HQarroum","description":":camera: Library and tools to create and parse initial ramdisk snapshots.","archived":false,"fork":false,"pushed_at":"2016-09-10T13:05:44.000Z","size":240,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-28T07:27:43.520Z","etag":null,"topics":["archiver","initrd"],"latest_commit_sha":null,"homepage":"","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/HQarroum.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}},"created_at":"2016-09-03T21:04:17.000Z","updated_at":"2025-02-23T07:13:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"aaee49ca-3505-4a4e-b199-fc28996df299","html_url":"https://github.com/HQarroum/initrd-snapshot","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/HQarroum/initrd-snapshot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HQarroum%2Finitrd-snapshot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HQarroum%2Finitrd-snapshot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HQarroum%2Finitrd-snapshot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HQarroum%2Finitrd-snapshot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HQarroum","download_url":"https://codeload.github.com/HQarroum/initrd-snapshot/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HQarroum%2Finitrd-snapshot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278779725,"owners_count":26044435,"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-10-07T02:00:06.786Z","response_time":59,"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":["archiver","initrd"],"created_at":"2024-10-18T10:46:29.142Z","updated_at":"2025-10-07T13:12:22.721Z","avatar_url":"https://github.com/HQarroum.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n  \u003cbr\u003e\n  \u003ca href=\"#\"\u003e\u003cimg width=\"500\" src=\"snapshot.png\" alt=\"initrd-snapshot\" /\u003e\u003c/a\u003e\n  \u003cbr\u003e\u003cbr\u003e\n\u003c/h1\u003e\n\n\u003ch4 align=\"center\"\u003eLibrary and tools to create and parse initial ramdisk snapshots. \u003c/h4\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://travis-ci.org/HQarroum/initrd-snapshot\"\u003e\n    \u003cimg src=\"https://travis-ci.org/HQarroum/initrd-snapshot.svg\"\n         alt=\"Travis Build\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\u003cbr\u003e\n\n## Description\n\nInitial ramdisks (initrd) provide the capability to load a RAM disk by the boot loader. This RAM disk can then be mounted as the root file system and programs can be run from it. Afterwards, a new root file system can be mounted from a different device. The previous root (from initrd) is then moved to a directory and can be subsequently unmounted.\n\n`initrd` snapshots are mainly designed to allow system startup to occur in two phases, where the kernel comes up with a minimum set of compiled-in drivers, and where additional modules are loaded from `initrd`.\n\nThis project contains different components, namely :\n\n * A C++11 library initially developped to provide the [Microcosm Kernel](https://github.com/HQarroum/microcosm) with the ability to load its root filesystem, though it is not dependant on any of microcosm's software components.\n * A set of POSIX tools built on top the library to create and browse initrd images.\n\n## Library usage\n\n### Creating an image in memory\n\nIn order to create an `initrd` image you can use the image builder that is bundled with the library before writing it to a file :\n\n```c++\nauto image = initrd::builder_t()\n  .addFile({ file: file_1, size: size_of_file_1 })\n  .addFile({ file: file_2, size: size_of_file_2 })\n  .addFiles(list_of_files)\n  .build()\n```\n\n### Writing the image to disk\n\nOnce the image has been constructed in memory, you can write the image raw data to disk by calling the `.data()` accessor on the `initrd::image_t` class :\n\n```c++\nstd::ofstream file(\"initrd.img\", std::ofstream::out);\nfile.write(image.data(), image.size());\n```\n\n### Reading an image from disk\n\nThe operation here involves loading an image from the disk, and passing it to `initrd::reader_t` :\n\n```c++\ntry {\n  auto file = read_file(\"./initrd.img\");\n  initrd::reader_t reader(file.data(), file.size());\n  std::cout \u003c\u003c reader.image() \u003c\u003c std::endl;\n} catch (std::exception\u0026 e) {\n  std::cout \u003c\u003c e.what() \u003c\u003c std::endl;\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhqarroum%2Finitrd-snapshot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhqarroum%2Finitrd-snapshot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhqarroum%2Finitrd-snapshot/lists"}