Git Product home page Git Product logo

init-snapshot's Introduction

Fly Init

This is a public snapshot of Fly's init code. It powers every Firecracker microvm we run for our users.

It is Rust-based and we thought making it public (even in this very limited fashion) could help as a reference for people making Rust-based init programs.

Usage

Please note that our init is tailored for firecracker microvms. These instructions might not quite work and differ from what we do in production.

  • Build with cargo build --release
  • Create a device for the init
fallocate -l 64M tmpinit
mkfs.ext2 tmpinit
mkdir initmount
mount -o loop,noatime tmpinit initmount
mkdir initmount/fly
cp target/x86_64-unknown-linux-musl/release/init initmount/fly/init
cp run.json initmount/fly/run.json # more on this later
umount initmount
  • Attach this device as /dev/vda
  • Attach your rootfs as /dev/vdb
  • Attach a vsock virtio device

initrd

This init should also work packaged as an initrd. However, we're not running it as such at the time of this writing.

mkdir -p tmpcpio/fly
cp target/x86_64-unknown-linux-musl/release/init tmpcpio/fly/init
cp run.json tmpcpio/fly/run.json
cd tmpcpio
ls | cpio --null --create -V --format=newc -O ../initrd.cpio

You can then use initrd.cpio as your initrd parameter.

/fly/run.json

To configure out init, we're injecting a JSON file into the root device.

You should be able to figure out the format by looking at lib.rs

init-snapshot's People

Contributors

jeromegn avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.