Coder Social home page Coder Social logo

initramfs-overlay's Introduction

initramfs-overlay

Initramfs focussed on mounting a read only image with writeable overlay using overlayfs.

Disk partitions

The following disk partitions are expected, currently located by label:

  • The image partition (ext4,LABEL=img): Contains the OS squashfs image to mount and boot.
  • The overlay partition (ext4,LABEL=overlay): Writeable partition overlaid with the OS image, cleared each boot.
  • The boot partition (vfat,LABEL=boot): Optional for initframfs, contains the kernel plus squashfs module (if not in kernel).
  • The new image partition (ext4,LABEL=newimg): Optional, can be used to provide an updated OS image.

The boot partition

If the partition is detected, the squashfs module will be loaded from /modules//squashfs.ko if the module existed. Otherwise it is assumed the kernel has build-in support for squashfs.

The overlay partition

This is used as the writeable area of the overlay and consists of three directories which are created if not preset:

  • /upper: Used for the 'upperdir' of the overlayfs. This is where all deleted/modified/created files are stored. This is cleared on each boot.
  • /work: Used for the 'workdir' of the overlayfs.
  • /persistent: Used as an additional 'lowerdir' of the overlayfs. As the 'upperdir' is cleared, this read-only lower dir allows customisations to be made compared to the read-only OS image. eg. SSH keys.

The image partition

This must contain a single file, root-squashfs.img which contains the full operating system. This is mounted read-only.

If the overlayfs module is found within the image under /lib/modules/ it is loaded, otherwise it is assumed overlayfs support is build into the kernel.

The new image partition.

If the partition is detected and contains an image file with the same name as the one that will be mounted from the image partition it will be moved into the image partition. The previous image will be renamed -old.img

If this partition is used, then the 'image' partition should be at least double the size in order to hold old and new images.

Project structure

The build.sh script will generate two initramfs files per architecture into a 'target' directory.

  • init--.gz - The 'standard' initramfs. This should be used in most cases.
  • init---debug.gz - The 'debug' initramfs. This will load a shell before booting to allow any checks to made, type 'exit' to boot. Also it will load a shell if an error occurs, rather than exiting immediately resulting in a shutdown.

Currently three architectures are built:

  • armv6l
  • i686
  • x86_64

The build will include all files under 'src' in the intramfs. A busybox binary (cached into 'busybox-cache') is also placed under /bin/busybox and corresponding symlinks for all commands supported by busybox.

initramfs-overlay's People

Contributors

jumperfly avatar

Watchers

 avatar  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.