Creating filesystem images with device tables
We saw in the earlier Creating a boot initramfs section that the kernel has the option to create initramfs
, using a device table. Device tables are really useful because they allow a non-root user to create device nodes and allocate arbitrary UID and GID values to any file or directory. The same concept has been applied to tools that create other filesystem image formats, as shown in this mapping from the filesystem format to tool:
- jffs2:
mkfs.jffs2
- ubifs:
mkfs:ubifs
- ext2:
genext2fs
We will cover jffs2 and ubifs in Chapter 9, when we look at filesystems for flash memory. ext2 is a format commonly used for managed flash memory, including SD cards. The example that follows uses ext2 to create a disk image that can be copied to an SD card.
To begin with, you need to install the genext2fs
tool on your host. On Ubuntu, the package to install is named genext2fs
:
$ sudo apt install genext2fs
genext2fs...