https://github.com/hempflower/firefly_init
Tiny init for MircoVM with useful features.
https://github.com/hempflower/firefly_init
init linux microvm
Last synced: 14 days ago
JSON representation
Tiny init for MircoVM with useful features.
- Host: GitHub
- URL: https://github.com/hempflower/firefly_init
- Owner: hempflower
- License: mit
- Created: 2024-11-30T10:42:48.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-30T11:12:17.000Z (over 1 year ago)
- Last Synced: 2025-02-09T08:41:59.774Z (over 1 year ago)
- Topics: init, linux, microvm
- Language: Go
- Homepage:
- Size: 13.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Firefly Init - MicroVM init
## Introduction
This is a tiny init for MicroVMs. It can set hostname, dns, and run a entrypoint command like docker.
## Build
This project is built with [Taskfile](https://taskfile.dev/). But you can also build it manually.
### Taskfile
```bash
task initramfs
```
### Manual Build
```bash
mkdir build
cd firefly
export CGO_ENABLED=0
go build -o ../build/init .
```
then create initramfs:
```bash
mkdir build/initramfs
cp build/init build/initramfs/init
chmod +x build/initramfs/init
find . | cpio -o -H newc > ../initramfs.cpio
```
## Usage
FireFly read commandline arguments from `/proc/cmdline`:
for example:
```
root=/dev/vda ip=192.168.10.2/24:192.168.10.1 endpoint=/bin/bash
```
- `root` is the root device
- `ip` is the static ip 192.168.10.2/24 with gateway 192.168.10.1
- `endpoint` is the entrypoint command
## Features
- Set hostname
- Set dns
- Set static ip
- Run entrypoint
- Auto mount necessary filesystems such as /dev, /proc, /sys, etc
- Shutdown VM if entrypoint exits
## Supported Commandline Arguments
- `hostname` is the hostname
- `dns` is the dns server
- `root` is the root device
- `rootfstype` is the root filesystem type, default is `ext4`
- `ip` is the static ip
- `endpoint` is the entrypoint
## Rescue Shell
Firefly can run a rescue shell if something goes wrong. Such as cannot found root device, entrypoint not found...
You can add shell binary to `/bin/sh`, or run `task build-busybox` to add busybox to rootfs.
## License
MIT