{"id":19999260,"url":"https://github.com/gbionescu/build-rootfs","last_synced_at":"2025-06-30T17:34:37.538Z","repository":{"id":69271271,"uuid":"249487761","full_name":"gbionescu/build-rootfs","owner":"gbionescu","description":"Generate ext4 and initrd images from containers.","archived":false,"fork":false,"pushed_at":"2024-09-04T10:05:08.000Z","size":10272,"stargazers_count":10,"open_issues_count":0,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-01T07:12:36.336Z","etag":null,"topics":["alpine","alpine-linux","amazonlinux2","builder","docker","ext4","ext4-filesystem","initrd","ubuntu"],"latest_commit_sha":null,"homepage":"","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/gbionescu.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}},"created_at":"2020-03-23T16:42:48.000Z","updated_at":"2025-04-04T22:22:14.000Z","dependencies_parsed_at":"2025-05-31T20:05:59.450Z","dependency_job_id":"0a2aa1e6-6377-43fb-836d-44b50ed576b5","html_url":"https://github.com/gbionescu/build-rootfs","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/gbionescu/build-rootfs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gbionescu%2Fbuild-rootfs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gbionescu%2Fbuild-rootfs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gbionescu%2Fbuild-rootfs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gbionescu%2Fbuild-rootfs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gbionescu","download_url":"https://codeload.github.com/gbionescu/build-rootfs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gbionescu%2Fbuild-rootfs/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262819421,"owners_count":23369470,"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":["alpine","alpine-linux","amazonlinux2","builder","docker","ext4","ext4-filesystem","initrd","ubuntu"],"created_at":"2024-11-13T05:11:12.893Z","updated_at":"2025-06-30T17:34:37.526Z","avatar_url":"https://github.com/gbionescu.png","language":"Shell","readme":"# Rootfs image builder\n\nThis repo builds root filesystem images or initrd images based on Docker containers.\n\nNote: *some assembly required.*\n\nImages are generated by:\n1. Pulling a base image from Docker Hub.\n2. Installing systemd or any other init system. Alpine uses OpenRC while Amazon Linux and Ubuntu use systemd.\n3. Installs sshd and other utilities to make the image usable.\n4. Sets `root:root` as the default user and password.\n5. Packs the docker container into a rootfs/initrd image.\n\nSee the [releases](https://github.com/gbionescu/build-rootfs/releases) page for pre-built images and kernel.\n\n## Prerequisites\n\nHave `docker` installed.\n\n## Building a rootfs\n\nSimply run:\n\n```bash\n./build-rootfs.sh \u003crootfs-type\u003e\n```\n\nWhere `rootfs-type` is one of the root filesystem generators that starts with `type-`.\n\nFor example, to generate an `alpine` rootfs, run:\n\n```bash\n./build-rootfs.sh alpine\n```\n\nNotes:\n\n- All images have ssh enabled by default.\n- The default user is `root` with password `root`.\n- By default, all images are generated as sparse files.\n\n## Building an initrd\n\nThe initrd is built using `./build-initrd.sh`. By default it's based on the alpine image.\n\n## Run with QEMU\n\nTo run the generated rootfs with QEMU, run:\n\n```bash\n./run-qemu.sh rootfs.ext4\n```\n\nThis will start a QEMU instance with the rootfs with the following options:\n- no KVM, network, or graphics\n- 1GB of RAM\n- 1 CPU (default)\n- serial console in the terminal\n- uses a kernel image that is [built-in to the repo](kernel/README.md)\n\n## Customizing the build process\n\nEach rootfs generator consists of 3 files:\n\n- `init-rootfs.sh`: creates the root filesystem and formats it.\nThis is needed because a distribution may take a larger amount of space\n\n- `inside-container.sh`: what is installed in a rootfs.\nHere this script usually finishes with copying the rootfs contents to a mounted rootfs.ext4 file.\n\n- `run-container.sh`: controls the container lifetime. For example the Ubuntu container is started\ntwice because systemd needs to be initialized.\n\n### Adding a new image type\n\nJust add a new folder with the 3 files described above\n\n### Tests\n\nCurrently the built-in tests build the rootfs for all the types and run them with QEMU.\n\nTests poll the serial console output for the `login:` prompt.\n\nTo run the tests, simply run:\n\n```bash\n./tests/test-all.sh\n```\n\n## Troubleshooting\n\n- Need a larger image? Change `init-rootfs.sh`.\n- Need to install more packages? Change `inside-container.sh`.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgbionescu%2Fbuild-rootfs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgbionescu%2Fbuild-rootfs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgbionescu%2Fbuild-rootfs/lists"}