Skip to content

joachifm/lkl-pseudofs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

lkl-buildfs

Build filesystem image from a symbolic description

Usage

Create an unpartitioned EXT4 image

$ truncate -s 512M image.ext4
$ nix run -f release.nix build -c lkl-buildfs -t ext4 -P 0 -i image.ext4 <<EOF
# A simple initramfs
dir /dev 0755 0 0
nod /dev/console 0600 0 0 c 5 1
dir /root 0700 0 0
dir /sbin 0755 0 0
file /sbin/kinit /usr/src/klibc/kinit/kinit 0755 0 0
EOF

See more elaborate examples.

Syntax

The syntax is the same as gen_init_cpio.c https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/usr/gen_init_cpio.c?id=HEAD

A line is one of:

# comment
file <name> <location> <mode> <uid> <gid> [<hardlinks>]
dir <name> <mode> <uid> <gid>
nod <name> <mode> <uid> <gid> <dev_type> <maj> <min>
slink <name> <target> <uid> <gid>
pipe <name> <mode> <uid> <gid>
sock <name> <mode> <uid> <gid>

where

  • <name> names the file/dir/nod/&c in the pseudofs
  • <location> source file; expands shell variables quoted with ${} (TODO: not yet)
  • <target> link target
  • <mode> mode/perms
  • <uid> user id (0=root)
  • <gid> group id (0=root)
  • <dev_type> device type (b=block, c=char)
  • <maj> nod major number
  • <min> nod minor number
  • <hardlinks> space separated list of other links to file (TODO)

About

Build filesystem image from a symbolic description (like gen_init_cpio for any Linux supported filesystem)

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published