Build Linux initramfs cpio archives from OCaml
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

docs: add README.md for 18 packages missing documentation

Add READMEs for: ocaml-fdir, ocaml-initramfs, ocaml-jailhouse,
ocaml-linkedin, ocaml-openamp, ocaml-pid1, ocaml-rpmsg, ocaml-sbom,
ocaml-slack, ocaml-vz, ocaml-zephyr, space, space-block, space-ground,
space-net, space-sim, space-test, space-wire.

+35
+35
README.md
··· 1 + # initramfs 2 + 3 + Build initramfs cpio archives from file and directory entries. 4 + 5 + High-level API for creating Linux initramfs images in cpio newc format. 6 + Supports adding empty directories, files from disk (preserving permissions), 7 + inline content with explicit permissions, and recursive directory trees. Built 8 + on top of the `cpio` library. 9 + 10 + ## Installation 11 + 12 + ``` 13 + opam install initramfs 14 + ``` 15 + 16 + ## Usage 17 + 18 + ```ocaml 19 + let archive = Initramfs.build [ 20 + Dir "/etc"; 21 + File { name = "/init"; path = "./my-init" }; 22 + Content { name = "/etc/hostname"; data = "spaceos\n"; perm = 0o644 }; 23 + Tree "./rootfs"; 24 + ] 25 + (* archive is a cpio newc string, suitable for use as a Linux initramfs *) 26 + ``` 27 + 28 + ## API 29 + 30 + - **`entry`** -- Describes an archive entry: `Dir` (empty directory), `File` 31 + (file from disk, renamed in the archive), `Content` (inline data with 32 + explicit permissions), or `Tree` (recursive directory walk). 33 + - **`build`** -- Takes a list of entries and produces a cpio newc archive as a 34 + string. Directories are created with 0o755 permissions; files from disk 35 + preserve their original permissions.