Build Linux initramfs cpio archives from OCaml
0
fork

Configure Feed

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

ocaml-initramfs: defer disk I/O via build_initramfs function

The README block called [Initramfs.build] at top level with hard-coded
[./my-init] / [./rootfs] paths, so mdx execution raised
[Sys_error: No such file or directory]. Wrap as
[build_initramfs ~init_path ~rootfs = ...] so the example typechecks
without touching the filesystem, and qualify the variant constructors
with [Initramfs.] for explicitness.

+10 -7
+10 -7
README.md
··· 29 29 ## Usage 30 30 31 31 ```ocaml 32 - let archive = Initramfs.build [ 33 - Dir "/etc"; 34 - File { name = "/init"; path = "./my-init" }; 35 - Content { name = "/etc/hostname"; data = "spaceos\n"; perm = 0o644 }; 36 - Tree "./rootfs"; 37 - ] 38 - (* archive is a cpio newc string, suitable for use as a Linux initramfs *) 32 + (* Build a cpio newc archive suitable as a Linux initramfs. *) 33 + let build_initramfs ~init_path ~rootfs = 34 + Initramfs.build 35 + [ 36 + Initramfs.Dir "/etc"; 37 + Initramfs.File { name = "/init"; path = init_path }; 38 + Initramfs.Content 39 + { name = "/etc/hostname"; data = "spaceos\n"; perm = 0o644 }; 40 + Initramfs.Tree rootfs; 41 + ] 39 42 ``` 40 43 41 44 ## API