[Mod] First commit

This commit is contained in:
2022-10-31 22:18:58 +08:00
commit 1c8a3d9709
13090 changed files with 526733 additions and 0 deletions

22
fs/Config.in Normal file
View File

@ -0,0 +1,22 @@
menu "Filesystem images"
source "fs/axfs/Config.in"
source "fs/btrfs/Config.in"
source "fs/cloop/Config.in"
source "fs/cpio/Config.in"
source "fs/cramfs/Config.in"
source "fs/erofs/Config.in"
source "fs/ext2/Config.in"
source "fs/f2fs/Config.in"
source "fs/initramfs/Config.in"
source "fs/iso9660/Config.in"
source "fs/jffs2/Config.in"
source "fs/oci/Config.in"
source "fs/romfs/Config.in"
source "fs/squashfs/Config.in"
source "fs/tar/Config.in"
source "fs/ubi/Config.in"
source "fs/ubifs/Config.in"
source "fs/yaffs2/Config.in"
endmenu

17
fs/axfs/Config.in Normal file
View File

@ -0,0 +1,17 @@
config BR2_TARGET_ROOTFS_AXFS
bool "axfs root filesystem"
help
The Advanced XIP File System is a Linux kernel filesystem
driver that enables files to be executed directly from flash
or ROM memory rather than being copied into RAM. It has the
ability to store individual *pages* in a file
uncompressed/XIP or compressed/Demand Paged.
So far, the only supported mode is 'XIP all', so all the
files that have the execute attribute set will be XIP'ed.
At the moment, the FS is not supported in Linux mainline
(v4.3-rc5), so the kernel has to be built with the axfs
patches to be able to read it. Patches can be found at:
https://github.com/jaredeh/axfs

13
fs/axfs/axfs.mk Normal file
View File

@ -0,0 +1,13 @@
################################################################################
#
# Build the axfs root filesystem image
#
################################################################################
ROOTFS_AXFS_DEPENDENCIES = host-axfsutils
define ROOTFS_AXFS_CMD
$(HOST_DIR)/bin/mkfs.axfs -s -a $(TARGET_DIR) $@
endef
$(eval $(rootfs))

50
fs/btrfs/Config.in Normal file
View File

@ -0,0 +1,50 @@
config BR2_TARGET_ROOTFS_BTRFS
bool "btrfs root filesystem"
select BR2_PACKAGE_HOST_BTRFS_PROGS
help
Build a btrfs root filesystem. If you enable this option, you
probably want to enable the btrfs-progs package too.
if BR2_TARGET_ROOTFS_BTRFS
config BR2_TARGET_ROOTFS_BTRFS_LABEL
string "filesystem label"
config BR2_TARGET_ROOTFS_BTRFS_SIZE
string "filesystem size"
default "100m"
help
The size of the filesystem image in bytes.
Suffix with k, m, g or t for power-of-two kilo-, mega-, giga-
or terabytes.
config BR2_TARGET_ROOTFS_BTRFS_SIZE_SECTOR
string "sector size"
default "4096"
help
This value should be set to the page size in bytes. The
default value of 4096 is the the most common page size for
most systems. If the sectorsize differs from the page size,
the created filesystem may not be mountable by the kernel.
Therefore it is recommended to leave this value at
4096. Unless you know that your kernel uses a different page
size. Suffix with k for power-of-two kilobytes.
config BR2_TARGET_ROOTFS_BTRFS_SIZE_NODE
string "btree node size"
default "16384"
help
The tree block size in which btrfs stores metadata in bytes.
This must be a multiple of the sectorsize, but not larger
than 64KiB (65536).
Suffix with k for power-of-two kilobytes.
config BR2_TARGET_ROOTFS_BTRFS_FEATURES
string "Filesystem Features"
help
A comma separated string of features that can be enabled
during creation time.
For a list of available options, use:
`.../host/bin/mkfs.btrfs -O list-all`
endif # BR2_TARGET_ROOTFS_BTRFS

36
fs/btrfs/btrfs.mk Normal file
View File

@ -0,0 +1,36 @@
################################################################################
#
# Build the btrfs root filesystem image
#
################################################################################
BTRFS_SIZE = $(call qstrip,$(BR2_TARGET_ROOTFS_BTRFS_SIZE))
ifeq ($(BR2_TARGET_ROOTFS_BTRFS)-$(BTRFS_SIZE),y-)
$(error BR2_TARGET_ROOTFS_BTRFS_SIZE cannot be empty)
endif
BTRFS_SIZE_NODE = $(call qstrip,$(BR2_TARGET_ROOTFS_BTRFS_SIZE_NODE))
BTRFS_SIZE_SECTOR = $(call qstrip,$(BR2_TARGET_ROOTFS_BTRFS_SIZE_SECTOR))
BTRFS_FEATURES = $(call qstrip,$(BR2_TARGET_ROOTFS_BTRFS_FEATURES))
# qstrip results in stripping consecutive spaces into a single one. So the
# variable is not qstrip-ed to preserve the integrity of the string value.
BTRFS_LABEL = $(subst ",,$(BR2_TARGET_ROOTFS_BTRFS_LABEL))
# ")
BTRFS_OPTS = \
-f \
-r '$(TARGET_DIR)' \
-L '$(BTRFS_LABEL)' \
--byte-count '$(BTRFS_SIZE)' \
$(if $(BTRFS_SIZE_NODE),--nodesize '$(BTRFS_SIZE_NODE)') \
$(if $(BTRFS_SIZE_SECTOR),--sectorsize '$(BTRFS_SIZE_SECTOR)') \
$(if $(BTRFS_FEATURES),--features '$(BTRFS_FEATURES)')
ROOTFS_BTRFS_DEPENDENCIES = host-btrfs-progs
define ROOTFS_BTRFS_CMD
$(RM) -f $@
$(HOST_DIR)/bin/mkfs.btrfs $(BTRFS_OPTS) $@
endef
$(eval $(rootfs))

10
fs/cloop/Config.in Normal file
View File

@ -0,0 +1,10 @@
config BR2_TARGET_ROOTFS_CLOOP
bool "cloop root filesystem for the target device"
help
Build a cloop root filesystem
cloop is a Linux kernel module that enables compressed
loopback filesystem support. With it you can mount a
compressed filesystem like a block device and seamlessly
decompress its data while accessing it. The majority of the
software on an LNX-BBC is accessed in this fashion.

14
fs/cloop/cloop.mk Normal file
View File

@ -0,0 +1,14 @@
################################################################################
#
# Build the compressed loop root filesystem image
#
################################################################################
ROOTFS_CLOOP_DEPENDENCIES = host-cloop host-cdrkit
define ROOTFS_CLOOP_CMD
$(HOST_DIR)/bin/genisoimage -r $(TARGET_DIR) | \
$(HOST_DIR)/bin/create_compressed_fs - 65536 > $@
endef
$(eval $(rootfs))

229
fs/common.mk Normal file
View File

@ -0,0 +1,229 @@
#
# Macro that builds the needed Makefile target to create a root
# filesystem image.
#
# The following variable must be defined before calling this macro
#
# ROOTFS_$(FSTYPE)_CMD, the command that generates the root
# filesystem image. A single command is allowed. The filename of the
# filesystem image that it must generate is $$@.
#
# The following variables can optionaly be defined
#
# ROOTFS_$(FSTYPE)_DEPENDENCIES, the list of dependencies needed to
# build the root filesystem (usually host tools)
#
# ROOTFS_$(FSTYPE)_PRE_GEN_HOOKS, a list of hooks to call before
# generating the filesystem image
#
# ROOTFS_$(FSTYPE)_POST_GEN_HOOKS, a list of hooks to call after
# generating the filesystem image
#
# In terms of configuration option, this macro assumes that the
# BR2_TARGET_ROOTFS_$(FSTYPE) config option allows to enable/disable
# the generation of a filesystem image of a particular type. If
# the configuration options BR2_TARGET_ROOTFS_$(FSTYPE)_GZIP,
# BR2_TARGET_ROOTFS_$(FSTYPE)_BZIP2 or
# BR2_TARGET_ROOTFS_$(FSTYPE)_LZMA exist and are enabled, then the
# macro will automatically generate a compressed filesystem image.
FS_DIR = $(BUILD_DIR)/buildroot-fs
ROOTFS_DEVICE_TABLES = $(call qstrip,$(BR2_ROOTFS_DEVICE_TABLE) \
$(BR2_ROOTFS_STATIC_DEVICE_TABLE))
ROOTFS_USERS_TABLES = $(call qstrip,$(BR2_ROOTFS_USERS_TABLES))
ROOTFS_FULL_DEVICES_TABLE = $(FS_DIR)/full_devices_table.txt
ROOTFS_FULL_USERS_TABLE = $(FS_DIR)/full_users_table.txt
ROOTFS_COMMON_NAME = rootfs-common
ROOTFS_COMMON_TYPE = rootfs
ROOTFS_COMMON_DEPENDENCIES = \
host-fakeroot host-makedevs \
$(BR2_TAR_HOST_DEPENDENCY) \
$(if $(PACKAGES_USERS)$(ROOTFS_USERS_TABLES),host-mkpasswd)
ifeq ($(BR2_REPRODUCIBLE),y)
define ROOTFS_REPRODUCIBLE
find $(TARGET_DIR) -print0 | xargs -0 -r touch -hd @$(SOURCE_DATE_EPOCH)
endef
endif
ifeq ($(BR2_PACKAGE_REFPOLICY),y)
define ROOTFS_SELINUX
$(HOST_DIR)/sbin/setfiles -m -r $(TARGET_DIR) \
-c $(TARGET_DIR)/etc/selinux/targeted/policy/policy.$(BR2_PACKAGE_LIBSEPOL_POLICY_VERSION) \
$(TARGET_DIR)/etc/selinux/targeted/contexts/files/file_contexts \
$(TARGET_DIR)
endef
ROOTFS_COMMON_DEPENDENCIES += host-policycoreutils
endif
ROOTFS_COMMON_FINAL_RECURSIVE_DEPENDENCIES = $(sort \
$(if $(filter undefined,$(origin ROOTFS_COMMON_FINAL_RECURSIVE_DEPENDENCIES__X)), \
$(eval ROOTFS_COMMON_FINAL_RECURSIVE_DEPENDENCIES__X := \
$(foreach p, \
$(ROOTFS_COMMON_DEPENDENCIES), \
$(p) \
$($(call UPPERCASE,$(p))_FINAL_RECURSIVE_DEPENDENCIES) \
) \
) \
) \
$(ROOTFS_COMMON_FINAL_RECURSIVE_DEPENDENCIES__X))
.PHONY: rootfs-common
rootfs-common: $(ROOTFS_COMMON_DEPENDENCIES) target-finalize
@$(call MESSAGE,"Generating root filesystems common tables")
rm -rf $(FS_DIR)
mkdir -p $(FS_DIR)
$(call PRINTF,$(PACKAGES_USERS)) >> $(ROOTFS_FULL_USERS_TABLE)
ifneq ($(ROOTFS_USERS_TABLES),)
cat $(ROOTFS_USERS_TABLES) >> $(ROOTFS_FULL_USERS_TABLE)
endif
$(call PRINTF,$(PACKAGES_PERMISSIONS_TABLE)) > $(ROOTFS_FULL_DEVICES_TABLE)
ifneq ($(ROOTFS_DEVICE_TABLES),)
cat $(ROOTFS_DEVICE_TABLES) >> $(ROOTFS_FULL_DEVICES_TABLE)
endif
ifeq ($(BR2_ROOTFS_DEVICE_CREATION_STATIC),y)
$(call PRINTF,$(PACKAGES_DEVICES_TABLE)) >> $(ROOTFS_FULL_DEVICES_TABLE)
endif
rootfs-common-show-depends:
@echo $(ROOTFS_COMMON_DEPENDENCIES)
.PHONY: rootfs-common-show-info
rootfs-common-show-info:
@:
$(info $(call clean-json,{ $(call json-info,ROOTFS_COMMON) }))
# Since this function will be called from within an $(eval ...)
# all variable references except the arguments must be $$-quoted.
define inner-rootfs
ROOTFS_$(2)_NAME = rootfs-$(1)
ROOTFS_$(2)_TYPE = rootfs
ROOTFS_$(2)_IMAGE_NAME ?= rootfs.$(1)
ROOTFS_$(2)_FINAL_IMAGE_NAME = $$(strip $$(ROOTFS_$(2)_IMAGE_NAME))
ROOTFS_$(2)_DIR = $$(FS_DIR)/$(1)
ROOTFS_$(2)_TARGET_DIR = $$(ROOTFS_$(2)_DIR)/target
ROOTFS_$(2)_DEPENDENCIES += rootfs-common
ROOTFS_$(2)_FINAL_RECURSIVE_DEPENDENCIES = $$(sort \
$$(if $$(filter undefined,$$(origin ROOTFS_$(2)_FINAL_RECURSIVE_DEPENDENCIES__X)), \
$$(eval ROOTFS_$(2)_FINAL_RECURSIVE_DEPENDENCIES__X := \
$$(foreach p, \
$$(ROOTFS_$(2)_DEPENDENCIES), \
$$(p) \
$$($$(call UPPERCASE,$$(p))_FINAL_RECURSIVE_DEPENDENCIES) \
) \
) \
) \
$$(ROOTFS_$(2)_FINAL_RECURSIVE_DEPENDENCIES__X))
ifeq ($$(BR2_TARGET_ROOTFS_$(2)_GZIP),y)
ROOTFS_$(2)_COMPRESS_EXT = .gz
ROOTFS_$(2)_COMPRESS_CMD = gzip -9 -c -n
endif
ifeq ($$(BR2_TARGET_ROOTFS_$(2)_BZIP2),y)
ROOTFS_$(2)_COMPRESS_EXT = .bz2
ROOTFS_$(2)_COMPRESS_CMD = bzip2 -9 -c
endif
ifeq ($$(BR2_TARGET_ROOTFS_$(2)_LZMA),y)
ROOTFS_$(2)_DEPENDENCIES += host-lzma
ROOTFS_$(2)_COMPRESS_EXT = .lzma
ROOTFS_$(2)_COMPRESS_CMD = $$(LZMA) -9 -c
endif
ifeq ($$(BR2_TARGET_ROOTFS_$(2)_LZ4),y)
ROOTFS_$(2)_DEPENDENCIES += host-lz4
ROOTFS_$(2)_COMPRESS_EXT = .lz4
ROOTFS_$(2)_COMPRESS_CMD = lz4 -l -9 -c
endif
ifeq ($$(BR2_TARGET_ROOTFS_$(2)_LZO),y)
ROOTFS_$(2)_DEPENDENCIES += host-lzop
ROOTFS_$(2)_COMPRESS_EXT = .lzo
ROOTFS_$(2)_COMPRESS_CMD = $$(LZOP) -9 -c
endif
ifeq ($$(BR2_TARGET_ROOTFS_$(2)_XZ),y)
ROOTFS_$(2)_DEPENDENCIES += host-xz
ROOTFS_$(2)_COMPRESS_EXT = .xz
ROOTFS_$(2)_COMPRESS_CMD = xz -9 -C crc32 -c
ifeq ($(BR2_REPRODUCIBLE),)
ROOTFS_$(2)_COMPRESS_CMD += -T $(PARALLEL_JOBS)
endif
endif
ifeq ($(BR2_TARGET_ROOTFS_$(2)_ZSTD),y)
ROOTFS_$(2)_DEPENDENCIES += host-zstd
ROOTFS_$(2)_COMPRESS_EXT = .zst
ROOTFS_$(2)_COMPRESS_CMD = zstd -19 -z -f -T$(PARALLEL_JOBS)
endif
$$(BINARIES_DIR)/$$(ROOTFS_$(2)_FINAL_IMAGE_NAME): ROOTFS=$(2)
$$(BINARIES_DIR)/$$(ROOTFS_$(2)_FINAL_IMAGE_NAME): FAKEROOT_SCRIPT=$$(ROOTFS_$(2)_DIR)/fakeroot
$$(BINARIES_DIR)/$$(ROOTFS_$(2)_FINAL_IMAGE_NAME): $$(ROOTFS_$(2)_DEPENDENCIES)
@$$(call MESSAGE,"Generating filesystem image $$(ROOTFS_$(2)_FINAL_IMAGE_NAME)")
mkdir -p $$(@D)
rm -rf $$(ROOTFS_$(2)_DIR)
mkdir -p $$(ROOTFS_$(2)_DIR)
rsync -auH \
--exclude=/$$(notdir $$(TARGET_DIR_WARNING_FILE)) \
$$(BASE_TARGET_DIR)/ \
$$(TARGET_DIR)
echo '#!/bin/sh' > $$(FAKEROOT_SCRIPT)
echo "set -e" >> $$(FAKEROOT_SCRIPT)
echo "chown -h -R 0:0 $$(TARGET_DIR)" >> $$(FAKEROOT_SCRIPT)
PATH=$$(BR_PATH) $$(TOPDIR)/support/scripts/mkusers $$(ROOTFS_FULL_USERS_TABLE) $$(TARGET_DIR) >> $$(FAKEROOT_SCRIPT)
echo "$$(HOST_DIR)/bin/makedevs -d $$(ROOTFS_FULL_DEVICES_TABLE) $$(TARGET_DIR)" >> $$(FAKEROOT_SCRIPT)
$$(foreach hook,$$(ROOTFS_PRE_CMD_HOOKS),\
$$(call PRINTF,$$($$(hook))) >> $$(FAKEROOT_SCRIPT)$$(sep))
$$(foreach s,$$(call qstrip,$$(BR2_ROOTFS_POST_FAKEROOT_SCRIPT)),\
echo "echo '$$(TERM_BOLD)>>> Executing fakeroot script $$(s)$$(TERM_RESET)'" >> $$(FAKEROOT_SCRIPT); \
echo $$(EXTRA_ENV) $$(s) $$(TARGET_DIR) $$(BR2_ROOTFS_POST_SCRIPT_ARGS) >> $$(FAKEROOT_SCRIPT)$$(sep))
$$(foreach hook,$$(ROOTFS_$(2)_PRE_GEN_HOOKS),\
$$(call PRINTF,$$($$(hook))) >> $$(FAKEROOT_SCRIPT)$$(sep))
echo "find $$(TARGET_DIR)/run/ -mindepth 1 -prune -print0 | xargs -0r rm -rf --" >> $$(FAKEROOT_SCRIPT)
echo "find $$(TARGET_DIR)/tmp/ -mindepth 1 -prune -print0 | xargs -0r rm -rf --" >> $$(FAKEROOT_SCRIPT)
$$(call PRINTF,$$(ROOTFS_REPRODUCIBLE)) >> $$(FAKEROOT_SCRIPT)
$$(call PRINTF,$$(ROOTFS_SELINUX)) >> $$(FAKEROOT_SCRIPT)
$$(call PRINTF,$$(ROOTFS_$(2)_CMD)) >> $$(FAKEROOT_SCRIPT)
chmod a+x $$(FAKEROOT_SCRIPT)
PATH=$$(BR_PATH) FAKEROOTDONTTRYCHOWN=1 $$(HOST_DIR)/bin/fakeroot -- $$(FAKEROOT_SCRIPT)
$(Q)rm -rf $$(TARGET_DIR)
ifneq ($$(ROOTFS_$(2)_COMPRESS_CMD),)
PATH=$$(BR_PATH) $$(ROOTFS_$(2)_COMPRESS_CMD) $$@ > $$@$$(ROOTFS_$(2)_COMPRESS_EXT)
endif
$$(foreach hook,$$(ROOTFS_$(2)_POST_GEN_HOOKS),$$(call $$(hook))$$(sep))
rootfs-$(1)-show-depends:
@echo $$(ROOTFS_$(2)_DEPENDENCIES)
rootfs-$(1)-show-info:
@:
$$(info $$(call clean-json,{ $$(call json-info,ROOTFS_$(2)) }))
rootfs-$(1): $$(BINARIES_DIR)/$$(ROOTFS_$(2)_FINAL_IMAGE_NAME)
.PHONY: rootfs-$(1) rootfs-$(1)-show-depends rootfs-$(1)-show-info
ifeq ($$(BR2_TARGET_ROOTFS_$(2)),y)
TARGETS_ROOTFS += rootfs-$(1)
PACKAGES += $$(filter-out rootfs-%,$$(ROOTFS_$(2)_FINAL_RECURSIVE_DEPENDENCIES))
endif
# Check for legacy POST_TARGETS rules
ifneq ($$(ROOTFS_$(2)_POST_TARGETS),)
$$(error Filesystem $(1) uses post-target rules, which are no longer supported.\
Update $(1) to use post-gen hooks instead)
endif
endef
# $(pkgname) also works well to return the filesystem name
rootfs = $(call inner-rootfs,$(pkgname),$(call UPPERCASE,$(pkgname)))
include $(sort $(wildcard fs/*/*.mk))

70
fs/cpio/Config.in Normal file
View File

@ -0,0 +1,70 @@
config BR2_TARGET_ROOTFS_CPIO
bool "cpio the root filesystem (for use as an initial RAM filesystem)"
help
Build a cpio archive of the root filesystem. This is typically
used for an initial RAM filesystem that is passed to the
kernel by the bootloader.
if BR2_TARGET_ROOTFS_CPIO
choice
prompt "Compression method"
default BR2_TARGET_ROOTFS_CPIO_NONE
help
Select compressor for cpio filesystem of the root filesystem.
If you use the cpio archive as an initial RAM filesystem, make
sure the kernel contains the decompression algorithm selected
here.
config BR2_TARGET_ROOTFS_CPIO_NONE
bool "no compression"
help
Do not compress the cpio filesystem.
config BR2_TARGET_ROOTFS_CPIO_GZIP
bool "gzip"
help
Do compress the cpio filesystem with gzip.
config BR2_TARGET_ROOTFS_CPIO_BZIP2
bool "bzip2"
help
Do compress the cpio filesystem with bzip2.
config BR2_TARGET_ROOTFS_CPIO_LZ4
bool "lz4"
help
Do compress the cpio filesystem with lz4.
config BR2_TARGET_ROOTFS_CPIO_LZMA
bool "lzma"
help
Do compress the cpio filesystem with lzma.
config BR2_TARGET_ROOTFS_CPIO_LZO
bool "lzo"
help
Do compress the cpio filesystem with lzop.
config BR2_TARGET_ROOTFS_CPIO_XZ
bool "xz"
help
Do compress the cpio filesystem with xz.
config BR2_TARGET_ROOTFS_CPIO_ZSTD
bool "zstd"
help
Do compress the cpio filesystem with zstd.
endchoice
config BR2_TARGET_ROOTFS_CPIO_UIMAGE
bool "Create U-Boot image of the root filesystem"
select BR2_PACKAGE_HOST_UBOOT_TOOLS
help
Add a U-Boot header to the cpio root filesystem. This allows
the initramfs to be loaded with the bootm command in U-Boot.
The U-Boot image will be called rootfs.cpio.uboot
endif # BR2_TARGET_ROOTFS_CPIO

56
fs/cpio/cpio.mk Normal file
View File

@ -0,0 +1,56 @@
################################################################################
#
# cpio to archive target filesystem
#
################################################################################
ifeq ($(BR2_ROOTFS_DEVICE_CREATION_STATIC),y)
define ROOTFS_CPIO_ADD_INIT
if [ ! -e $(TARGET_DIR)/init ]; then \
ln -sf sbin/init $(TARGET_DIR)/init; \
fi
endef
else
# devtmpfs does not get automounted when initramfs is used.
# Add a pre-init script to mount it before running init
# We must have /dev/console very early, even before /init runs,
# for stdin/stdout/stderr
define ROOTFS_CPIO_ADD_INIT
if [ ! -e $(TARGET_DIR)/init ]; then \
$(INSTALL) -m 0755 fs/cpio/init $(TARGET_DIR)/init; \
fi
mkdir -p $(TARGET_DIR)/dev
mknod -m 0622 $(TARGET_DIR)/dev/console c 5 1
endef
endif # BR2_ROOTFS_DEVICE_CREATION_STATIC
ROOTFS_CPIO_PRE_GEN_HOOKS += ROOTFS_CPIO_ADD_INIT
# --reproducible option was introduced in cpio v2.12, which may not be
# available in some old distributions, so we build host-cpio
ifeq ($(BR2_REPRODUCIBLE),y)
ROOTFS_CPIO_DEPENDENCIES += host-cpio
ROOTFS_CPIO_OPTS += --reproducible
endif
define ROOTFS_CPIO_CMD
cd $(TARGET_DIR) && \
find . \
| LC_ALL=C sort \
| cpio $(ROOTFS_CPIO_OPTS) --quiet -o -H newc \
> $@
endef
ifeq ($(BR2_TARGET_ROOTFS_CPIO_UIMAGE),y)
ROOTFS_CPIO_DEPENDENCIES += host-uboot-tools
define ROOTFS_CPIO_UBOOT_MKIMAGE
$(MKIMAGE) -A $(MKIMAGE_ARCH) -T ramdisk \
-C none -d $@$(ROOTFS_CPIO_COMPRESS_EXT) $@.uboot
endef
ROOTFS_CPIO_POST_GEN_HOOKS += ROOTFS_CPIO_UBOOT_MKIMAGE
endif
$(eval $(rootfs))

15
fs/cpio/init Executable file
View File

@ -0,0 +1,15 @@
#!/bin/sh
# devtmpfs does not get automounted for initramfs
/bin/mount -t devtmpfs devtmpfs /dev
# use the /dev/console device node from devtmpfs if possible to not
# confuse glibc's ttyname_r().
# This may fail (E.G. booted with console=), and errors from exec will
# terminate the shell, so use a subshell for the test
if (exec 0</dev/console) 2>/dev/null; then
exec 0</dev/console
exec 1>/dev/console
exec 2>/dev/console
fi
exec /sbin/init "$@"

26
fs/cramfs/Config.in Normal file
View File

@ -0,0 +1,26 @@
config BR2_TARGET_ROOTFS_CRAMFS
bool "cramfs root filesystem"
help
Build a cramfs root filesystem
https://github.com/npitre/cramfs-tools
if BR2_TARGET_ROOTFS_CRAMFS
config BR2_TARGET_ROOTFS_CRAMFS_XIP
bool "Support XIP of all ELF files"
help
For ELF files, uncompressed and properly aligned data blocks
will be automatically be mapped directly into user space
whenever possible providing eXecute-In-Place (XIP) from ROM
of read-only segments. Data segments mapped read-write
(hence they have to be copied to RAM) may still be
compressed in the cramfs image in the same file along with
non compressed read-only segments. Both MMU and no-MMU
systems are supported. This is particularly handy for tiny
embedded systems with very tight memory constraints.
The CRAMFS_MTD Kconfig option must also be enabled in a
4.15+ kernel.
endif # BR2_TARGET_ROOTFS_CRAMFS

27
fs/cramfs/cramfs.mk Normal file
View File

@ -0,0 +1,27 @@
################################################################################
#
# Build the cramfs root filesystem image
#
################################################################################
ifeq ($(BR2_ENDIAN),"BIG")
CRAMFS_OPTS = -B
else
CRAMFS_OPTS = -L
endif
ifeq ($(BR2_TARGET_ROOTFS_CRAMFS_XIP),y)
ifeq ($(BR2_USE_MMU),y)
CRAMFS_OPTS += -X -X
else
CRAMFS_OPTS += -X
endif
endif
define ROOTFS_CRAMFS_CMD
$(HOST_DIR)/bin/mkcramfs $(CRAMFS_OPTS) $(TARGET_DIR) $@
endef
ROOTFS_CRAMFS_DEPENDENCIES = host-cramfs
$(eval $(rootfs))

24
fs/erofs/Config.in Normal file
View File

@ -0,0 +1,24 @@
config BR2_TARGET_ROOTFS_EROFS
bool "erofs root filesystem"
select BR2_PACKAGE_HOST_EROFS_UTILS
help
Build a EROFS root filesystem.
if BR2_TARGET_ROOTFS_EROFS
config BR2_TARGET_ROOTFS_EROFS_LZ4HC
bool "lz4hc compression"
help
Use lz4 high-compression to compress data in the filesystem.
config BR2_TARGET_ROOTFS_EROFS_PCLUSTERSIZE
int "pcluster size"
default 0
help
Specify the maximum size of physical cluster in bytes, as a
multiple of 4KiB, for the big pcluster feature in order to
get much better compression ratios (thus better sequential
read performance for common storage devices), which has been
introduced since Linux 5.13.
endif # BR2_TARGET_ROOTFS_EROFS

21
fs/erofs/erofs.mk Normal file
View File

@ -0,0 +1,21 @@
################################################################################
#
# Build the EROFS root filesystem image
#
################################################################################
ROOTFS_EROFS_DEPENDENCIES = host-erofs-utils
ifeq ($(BR2_TARGET_ROOTFS_EROFS_LZ4HC),y)
ROOTFS_EROFS_ARGS += -zlz4hc
endif
ifneq ($(BR2_TARGET_ROOTFS_EROFS_PCLUSTERSIZE),0)
ROOTFS_EROFS_ARGS += -C$(strip $(BR2_TARGET_ROOTFS_EROFS_PCLUSTERSIZE))
endif
define ROOTFS_EROFS_CMD
$(HOST_DIR)/bin/mkfs.erofs $(ROOTFS_EROFS_ARGS) $@ $(TARGET_DIR)
endef
$(eval $(rootfs))

141
fs/ext2/Config.in Normal file
View File

@ -0,0 +1,141 @@
config BR2_TARGET_ROOTFS_EXT2
bool "ext2/3/4 root filesystem"
select BR2_PACKAGE_HOST_E2FSPROGS
help
Build an ext2/3/4 root filesystem
if BR2_TARGET_ROOTFS_EXT2
config BR2_TARGET_ROOTFS_EXT2_2
bool
choice
bool "ext2/3/4 variant"
default BR2_TARGET_ROOTFS_EXT2_2r1
config BR2_TARGET_ROOTFS_EXT2_2r0
bool "ext2 (rev0)"
select BR2_TARGET_ROOTFS_EXT2_2
config BR2_TARGET_ROOTFS_EXT2_2r1
bool "ext2 (rev1)"
select BR2_TARGET_ROOTFS_EXT2_2
config BR2_TARGET_ROOTFS_EXT2_3
bool "ext3"
config BR2_TARGET_ROOTFS_EXT2_4
bool "ext4"
endchoice
config BR2_TARGET_ROOTFS_EXT2_GEN
int
default 2 if BR2_TARGET_ROOTFS_EXT2_2
default 3 if BR2_TARGET_ROOTFS_EXT2_3
default 4 if BR2_TARGET_ROOTFS_EXT2_4
# All ext generations are revision 1, except ext2r0, which is revision 0
config BR2_TARGET_ROOTFS_EXT2_REV
int
default 0 if BR2_TARGET_ROOTFS_EXT2_2r0
default 1 if !BR2_TARGET_ROOTFS_EXT2_2r0
config BR2_TARGET_ROOTFS_EXT2_LABEL
string "filesystem label"
default "rootfs"
config BR2_TARGET_ROOTFS_EXT2_SIZE
string "exact size"
default BR2_TARGET_ROOTFS_EXT2_BLOCKS if BR2_TARGET_ROOTFS_EXT2_BLOCKS_WRAP # legacy 2017.08
default "60M"
help
The size of the filesystem image. If it does not have a
suffix, it is interpreted as power-of-two kilobytes. If it is
suffixed by 'k', 'm', 'g', 't' (either upper-case or
lower-case), then it is interpreted in power-of-two kilobytes,
megabytes, gigabytes, terabytes, etc.
config BR2_TARGET_ROOTFS_EXT2_INODES
int "exact number of inodes (leave at 0 for auto calculation)"
default 0
config BR2_TARGET_ROOTFS_EXT2_RESBLKS
int "reserved blocks percentage"
default 5
help
The number of blocks on the filesystem (as a percentage of the
total number of blocks), that are reserved for use by root.
Traditionally, this has been 5%, and all ext-related tools
still default to reserving 5% when creating a new ext
filesystem.
config BR2_TARGET_ROOTFS_EXT2_MKFS_OPTIONS
string "additional mke2fs options"
default "-O ^64bit"
help
Specify a space-separated list of mke2fs options, including
any ext2/3/4 filesystem features.
For more information about the mke2fs options, see the manual
page mke2fs(8).
For more information about the ext2/3/4 features which can be
set, see the manual page ext4(5).
The default is "-O ^64bit", i.e. disable 64-bit filesystem
support. This default value has been chosen because U-Boot
versions before 2017.02 don't support this filesystem
option: using it may make the filesystem unreadable by
U-Boot.
choice
prompt "Compression method"
default BR2_TARGET_ROOTFS_EXT2_NONE
help
Select compressor for ext2/3/4 filesystem of the root
filesystem
config BR2_TARGET_ROOTFS_EXT2_NONE
bool "no compression"
help
Do not compress the ext2/3/4 filesystem.
config BR2_TARGET_ROOTFS_EXT2_GZIP
bool "gzip"
help
Do compress the ext2/3/4 filesystem with gzip.
config BR2_TARGET_ROOTFS_EXT2_BZIP2
bool "bzip2"
help
Do compress the ext2/3/4 filesystem with bzip2.
config BR2_TARGET_ROOTFS_EXT2_LZ4
bool "lz4"
help
Do compress the ext2 filesystem with lz4.
config BR2_TARGET_ROOTFS_EXT2_LZMA
bool "lzma"
help
Do compress the ext2/3/4 filesystem with lzma.
config BR2_TARGET_ROOTFS_EXT2_LZO
bool "lzo"
help
Do compress the ext2 filesystem with lzop.
config BR2_TARGET_ROOTFS_EXT2_XZ
bool "xz"
help
Do compress the ext2 filesystem with xz.
config BR2_TARGET_ROOTFS_EXT2_ZSTD
bool "zstd"
help
Do compress the ext2 filesystem with zstd.
endchoice
endif # BR2_TARGET_ROOTFS_EXT2

46
fs/ext2/ext2.mk Normal file
View File

@ -0,0 +1,46 @@
################################################################################
#
# Build the ext2 root filesystem image
#
################################################################################
ROOTFS_EXT2_SIZE = $(call qstrip,$(BR2_TARGET_ROOTFS_EXT2_SIZE))
ifeq ($(BR2_TARGET_ROOTFS_EXT2)-$(ROOTFS_EXT2_SIZE),y-)
$(error BR2_TARGET_ROOTFS_EXT2_SIZE cannot be empty)
endif
ROOTFS_EXT2_MKFS_OPTS = $(call qstrip,$(BR2_TARGET_ROOTFS_EXT2_MKFS_OPTIONS))
# qstrip results in stripping consecutive spaces into a single one. So the
# variable is not qstrip-ed to preserve the integrity of the string value.
ROOTFS_EXT2_LABEL = $(subst ",,$(BR2_TARGET_ROOTFS_EXT2_LABEL))
#" Syntax highlighting... :-/ )
ROOTFS_EXT2_OPTS = \
-d $(TARGET_DIR) \
-r $(BR2_TARGET_ROOTFS_EXT2_REV) \
-N $(BR2_TARGET_ROOTFS_EXT2_INODES) \
-m $(BR2_TARGET_ROOTFS_EXT2_RESBLKS) \
-L "$(ROOTFS_EXT2_LABEL)" \
$(ROOTFS_EXT2_MKFS_OPTS)
ROOTFS_EXT2_DEPENDENCIES = host-e2fsprogs
define ROOTFS_EXT2_CMD
rm -f $@
$(HOST_DIR)/sbin/mkfs.ext$(BR2_TARGET_ROOTFS_EXT2_GEN) $(ROOTFS_EXT2_OPTS) $@ \
"$(ROOTFS_EXT2_SIZE)" \
|| { ret=$$?; \
echo "*** Maybe you need to increase the filesystem size (BR2_TARGET_ROOTFS_EXT2_SIZE)" 1>&2; \
exit $$ret; \
}
endef
ifneq ($(BR2_TARGET_ROOTFS_EXT2_GEN),2)
define ROOTFS_EXT2_SYMLINK
ln -sf rootfs.ext2$(ROOTFS_EXT2_COMPRESS_EXT) $(BINARIES_DIR)/rootfs.ext$(BR2_TARGET_ROOTFS_EXT2_GEN)$(ROOTFS_EXT2_COMPRESS_EXT)
endef
ROOTFS_EXT2_POST_GEN_HOOKS += ROOTFS_EXT2_SYMLINK
endif
$(eval $(rootfs))

59
fs/f2fs/Config.in Normal file
View File

@ -0,0 +1,59 @@
config BR2_TARGET_ROOTFS_F2FS
bool "f2fs root filesystem"
select BR2_PACKAGE_HOST_F2FS_TOOLS
help
Build a f2fs root filesystem. If you enable this option, you
probably want to enable the f2fs-tools package too.
if BR2_TARGET_ROOTFS_F2FS
config BR2_TARGET_ROOTFS_F2FS_LABEL
string "filesystem label"
config BR2_TARGET_ROOTFS_F2FS_SIZE
string "filesystem size"
default "100M"
help
The size of the filesystem image in bytes.
Suffix with K, M, G or T for power-of-two kilo-, mega-, giga-
or terabytes.
config BR2_TARGET_ROOTFS_F2FS_COLD_FILES
string "extension list for cold files"
help
Specify a comma separated file extension list in order f2fs
to treat them as cold files. The default list includes most
of multimedia file extensions such as jpg, gif, mpeg, mkv,
and so on.
config BR2_TARGET_ROOTFS_F2FS_HOT_FILES
string "extension list for hot files"
help
Specify a comma separated file extension list in order f2fs
to treat them as hot files. The default list includes only
a db extension.
config BR2_TARGET_ROOTFS_F2FS_OVERPROVISION
int "overprovision ratio"
default 0
help
The percentage over the volume size for overprovision
area. This area is hidden to users, and utilized by F2FS
cleaner.
Leave at 0 for autocalculation according to the partition
size.
config BR2_TARGET_ROOTFS_F2FS_DISCARD
bool "discard policy"
default y
help
Enable or disable discard policy.
config BR2_TARGET_ROOTFS_F2FS_FEATURES
string "filesystem features"
help
List of features that the F2FS filesystem should support
(e.g "encrypt")
endif # BR2_TARGET_ROOTFS_F2FS

45
fs/f2fs/f2fs.mk Normal file
View File

@ -0,0 +1,45 @@
################################################################################
#
# Build the f2fs root filesystem image
#
################################################################################
F2FS_SIZE = $(call qstrip,$(BR2_TARGET_ROOTFS_F2FS_SIZE))
ifeq ($(BR2_TARGET_ROOTFS_F2FS)-$(F2FS_SIZE),y-)
$(error BR2_TARGET_ROOTFS_F2FS_SIZE cannot be empty)
endif
# qstrip results in stripping consecutive spaces into a single one. So the
# variable is not qstrip-ed to preserve the integrity of the string value.
F2FS_LABEL = $(subst ",,$(BR2_TARGET_ROOTFS_F2FS_LABEL))
# ")
F2FS_COLD_FILES = $(call qstrip,$(BR2_TARGET_ROOTFS_F2FS_COLD_FILES))
F2FS_HOT_FILES = $(call qstrip,$(BR2_TARGET_ROOTFS_F2FS_HOT_FILES))
ifeq ($(BR2_TARGET_ROOTFS_F2FS_DISCARD),y)
F2FS_DISCARD = 1
else
F2FS_DISCARD = 0
endif
F2FS_FEATURES = $(call qstrip,$(BR2_TARGET_ROOTFS_F2FS_FEATURES))
F2FS_OPTS = \
-f \
-l "$(F2FS_LABEL)" \
-t $(F2FS_DISCARD) \
-o $(BR2_TARGET_ROOTFS_F2FS_OVERPROVISION) \
$(if $(F2FS_COLD_FILES),-e "$(F2FS_COLD_FILES)") \
$(if $(F2FS_HOT_FILES),-E "$(F2FS_HOT_FILES)") \
$(if $(F2FS_FEATURES),-O "$(F2FS_FEATURES)")
ROOTFS_F2FS_DEPENDENCIES = host-f2fs-tools
define ROOTFS_F2FS_CMD
$(RM) -f $@
truncate -s $(F2FS_SIZE) $@
$(HOST_DIR)/sbin/mkfs.f2fs $(F2FS_OPTS) $@
$(HOST_DIR)/sbin/sload.f2fs -f $(TARGET_DIR) $@
endef
$(eval $(rootfs))

22
fs/initramfs/Config.in Normal file
View File

@ -0,0 +1,22 @@
config BR2_TARGET_ROOTFS_INITRAMFS
bool "initial RAM filesystem linked into linux kernel"
depends on BR2_LINUX_KERNEL
select BR2_TARGET_ROOTFS_CPIO
help
Integrate the root filesystem generated by Buildroot as an
initramfs inside the kernel image. This integration will
take place automatically.
A rootfs.cpio file will be generated in the images/ directory.
This is the archive that will be included in the kernel image.
The default rootfs compression set in the kernel configuration
is used, regardless of how buildroot's cpio archive is
configured.
Note that enabling initramfs together with another filesystem
formats doesn't make sense: you would end up having two
identical root filesystems, one embedded inside the kernel
image, and one separately.
comment "initramfs needs a Linux kernel to be built"
depends on !BR2_LINUX_KERNEL

36
fs/initramfs/initramfs.mk Normal file
View File

@ -0,0 +1,36 @@
################################################################################
#
# Build a kernel with an integrated initial ramdisk filesystem based on cpio.
#
################################################################################
# The generic fs infrastructure isn't very useful here.
#
# The initramfs image does not actually build an image; its only purpose is:
# 1- to ensure rootfs.cpio is generated,
# 2- to then rebuild the kernel with rootfs.cpio as initramfs
#
# Note: ordering of the dependencies is not guaranteed here, but in
# linux/linux.mk, via the linux-rebuild-with-initramfs rule, which depends
# on the rootfs-cpio filesystem rule.
#
# Note: the trick here is that we directly depend on rebuilding the Linux
# kernel image (which itself depends on the rootfs-cpio rule), while we
# advertise that our dependency is on the rootfs-cpio rule, which is
# cleaner in the dependency graph.
rootfs-initramfs: linux-rebuild-with-initramfs
rootfs-initramfs-show-depends:
@echo rootfs-cpio
.PHONY: rootfs-initramfs rootfs-initramfs-show-depends
ifeq ($(BR2_TARGET_ROOTFS_INITRAMFS),y)
TARGETS_ROOTFS += rootfs-initramfs
endif
# Not using the rootfs infra, so fake the variables
ROOTFS_INITRAMFS_NAME = rootfs-initramfs
ROOTFS_INITRAMFS_TYPE = rootfs
ROOTFS_INITRAMFS_DEPENDENCIES = rootfs-cpio linux

102
fs/iso9660/Config.in Normal file
View File

@ -0,0 +1,102 @@
config BR2_TARGET_ROOTFS_ISO9660
bool "iso image"
depends on (BR2_i386 || BR2_x86_64)
depends on BR2_LINUX_KERNEL
depends on BR2_TARGET_GRUB2 || BR2_TARGET_SYSLINUX_ISOLINUX
select BR2_LINUX_KERNEL_INSTALL_TARGET \
if (!BR2_TARGET_ROOTFS_ISO9660_INITRD && !BR2_TARGET_ROOTFS_INITRAMFS)
help
Build a bootable ISO9660 image. By default, the root
filesystem is directly packed as the ISO9660 filesystem,
which means the root filesystem will be read-only. It
requires ISO9660 filesystem support and CDROM support in the
kernel.
However, if BR2_TARGET_ROOTFS_INITRAMFS or
BR2_TARGET_ROOTFS_ISO9660_INITRD have been enabled, the
ISO9660 filesystem will only contain a kernel image and
optionally an external initrd image. In this case, the
filesystem being in RAM, it will be read/write. No ISO9660
or CDROM support is needed in the kernel.
if BR2_TARGET_ROOTFS_ISO9660
choice
prompt "Bootloader"
config BR2_TARGET_ROOTFS_ISO9660_GRUB2
bool "grub2"
depends on BR2_TARGET_GRUB2
select BR2_TARGET_ROOTFS_ISO9660_BIOS_BOOTLOADER \
if BR2_TARGET_GRUB2_I386_PC
select BR2_TARGET_ROOTFS_ISO9660_EFI_BOOTLOADER \
if (BR2_TARGET_GRUB2_I386_EFI || BR2_TARGET_GRUB2_X86_64_EFI)
help
Use Grub 2 as the bootloader for the ISO9660 image. Make
sure to enable the 'iso9660' module in
BR2_TARGET_GRUB2_BUILTIN_MODULES_PC or
BR2_TARGET_GRUB2_BUILTIN_MODULES_EFI. Use 'cd' as the boot
partition in BR2_TARGET_GRUB2_BOOT_PARTITION= for GRUB on BIOS
or 'set root=(cd0)' in the configuration file passed to
BR2_TARGET_GRUB2_BUILTIN_CONFIG_EFI for GRUB on EFI.
config BR2_TARGET_ROOTFS_ISO9660_ISOLINUX
bool "isolinux"
depends on BR2_TARGET_SYSLINUX_ISOLINUX
select BR2_TARGET_ROOTFS_ISO9660_BIOS_BOOTLOADER
endchoice
config BR2_TARGET_ROOTFS_ISO9660_BIOS_BOOTLOADER
bool
config BR2_TARGET_ROOTFS_ISO9660_EFI_BOOTLOADER
bool
config BR2_TARGET_ROOTFS_ISO9660_BOOT_MENU
string "Boot menu config file"
default "fs/iso9660/grub.cfg" if BR2_TARGET_ROOTFS_ISO9660_GRUB2
default "fs/iso9660/isolinux.cfg" if BR2_TARGET_ROOTFS_ISO9660_ISOLINUX
help
Use this option to provide a custom bootloader configuration
file (grub.cfg for Grub 2, isolinux.cfg for isolinux).
Note that the strings __KERNEL_PATH__ and __INITRD_PATH__
will automatically be replaced by the path to the kernel and
initrd images respectively.
config BR2_TARGET_ROOTFS_ISO9660_INITRD
bool "Use initrd"
default y
select BR2_TARGET_ROOTFS_CPIO
help
Enable this option to have the root filesystem bundled as an
initrd/initramfs rather than directly as the ISO9660
filesystem. With this option enabled, the ISO9660 will only
contain a kernel image, an initrd image (unless an initramfs
linked into the kernel is used) and the bootloader.
config BR2_TARGET_ROOTFS_ISO9660_TRANSPARENT_COMPRESSION
bool "transparent compression"
depends on !BR2_TARGET_ROOTFS_ISO9660_INITRD
depends on !BR2_TARGET_ROOTFS_INITRAMFS
help
Say 'y' to enable use of transparent (de)compression. Files
are stored compressed and will be decompressed on-the-fly
upon access at runtime.
config BR2_TARGET_ROOTFS_ISO9660_HYBRID
bool "Build hybrid image"
depends on BR2_TARGET_ROOTFS_ISO9660_ISOLINUX
help
Enable this option to build an hybrid image, i.e an image
which can either be booted from a CD-ROM or from a device
which BIOS considers a hard disk or ZIP disk, e.g. a USB key
or similar.
endif
comment "iso image needs a Linux kernel and either grub2 or isolinux to be built"
depends on BR2_i386 || BR2_x86_64
depends on !BR2_LINUX_KERNEL || \
!(BR2_TARGET_GRUB2 || BR2_TARGET_SYSLINUX_ISOLINUX)

7
fs/iso9660/grub.cfg Normal file
View File

@ -0,0 +1,7 @@
set default="0"
set timeout="10"
menuentry "Buildroot" {
linux __KERNEL_PATH__ root=/dev/sr0
initrd __INITRD_PATH__
}

197
fs/iso9660/iso9660.mk Normal file
View File

@ -0,0 +1,197 @@
################################################################################
#
# Build the iso96600 root filesystem image
#
################################################################################
#
# We need to handle three cases:
#
# 1. The ISO9660 filesystem will really be the real root filesystem
# itself. This is when BR2_TARGET_ROOTFS_ISO9660_INITRD is
# disabled.
#
# 2. The ISO9660 filesystem will be a filesystem with just a kernel
# image, initrd and grub. This is when
# BR2_TARGET_ROOTFS_ISO9660_INITRD is enabled, but
# BR2_TARGET_ROOTFS_INITRAMFS is disabled.
#
# 3. The ISO9660 filesystem will be a filesystem with just a kernel
# image and grub. This is like (2), except that the initrd is
# built into the kernel image. This is when
# BR2_TARGET_ROOTFS_INITRAMFS is enabled (regardless of the value
# of BR2_TARGET_ROOTFS_ISO9660_INITRD).
ROOTFS_ISO9660_BOOT_MENU = $(call qstrip,$(BR2_TARGET_ROOTFS_ISO9660_BOOT_MENU))
ROOTFS_ISO9660_DEPENDENCIES = host-xorriso linux
ifeq ($(BR2_TARGET_ROOTFS_INITRAMFS),y)
ROOTFS_ISO9660_USE_INITRD = YES
endif
ifeq ($(BR2_TARGET_ROOTFS_ISO9660_INITRD),y)
ROOTFS_ISO9660_USE_INITRD = YES
endif
ifeq ($(ROOTFS_ISO9660_USE_INITRD),YES)
ROOTFS_ISO9660_TMP_TARGET_DIR = $(FS_DIR)/rootfs.iso9660.tmp
define ROOTFS_ISO9660_CREATE_TEMPDIR
$(RM) -rf $(ROOTFS_ISO9660_TMP_TARGET_DIR)
mkdir -p $(ROOTFS_ISO9660_TMP_TARGET_DIR)
endef
ROOTFS_ISO9660_PRE_GEN_HOOKS += ROOTFS_ISO9660_CREATE_TEMPDIR
else ifeq ($(BR2_TARGET_ROOTFS_ISO9660_TRANSPARENT_COMPRESSION),y)
ROOTFS_ISO9660_DEPENDENCIES += host-zisofs-tools
ROOTFS_ISO9660_TMP_TARGET_DIR = $(FS_DIR)/rootfs.iso9660.tmp
# This must be early, before we copy the bootloader files.
define ROOTFS_ISO9660_MKZFTREE
$(RM) -rf $(ROOTFS_ISO9660_TMP_TARGET_DIR)
$(HOST_DIR)/bin/mkzftree -X -z 9 -p $(PARALLEL_JOBS) \
$(TARGET_DIR) \
$(ROOTFS_ISO9660_TMP_TARGET_DIR)
endef
ROOTFS_ISO9660_PRE_GEN_HOOKS += ROOTFS_ISO9660_MKZFTREE
ROOTFS_ISO9660_OPTS += -z
else
ROOTFS_ISO9660_TMP_TARGET_DIR = $(TARGET_DIR)
endif
ifeq ($(BR2_REPRODUCIBLE),y)
ROOTFS_ISO9660_VFAT_OPTS = --invariant
ROOTFS_ISO9660_FIX_TIME = touch -d @$(SOURCE_DATE_EPOCH)
else
ROOTFS_ISO9660_FIX_TIME = :
endif
ifeq ($(BR2_TARGET_ROOTFS_ISO9660_GRUB2)$(BR2_TARGET_ROOTFS_ISO9660_BIOS_BOOTLOADER),yy)
ROOTFS_ISO9660_DEPENDENCIES += grub2
ROOTFS_ISO9660_BOOTLOADER_CONFIG_PATH = \
$(ROOTFS_ISO9660_TMP_TARGET_DIR)/boot/grub/grub.cfg
ROOTFS_ISO9660_BOOT_IMAGE = boot/grub/grub-eltorito.img
define ROOTFS_ISO9660_INSTALL_BOOTLOADER_BIOS
$(INSTALL) -D -m 0644 $(BINARIES_DIR)/grub-eltorito.img \
$(ROOTFS_ISO9660_TMP_TARGET_DIR)/boot/grub/grub-eltorito.img
endef
endif
ifeq ($(BR2_TARGET_ROOTFS_ISO9660_GRUB2)$(BR2_TARGET_ROOTFS_ISO9660_EFI_BOOTLOADER),yy)
ROOTFS_ISO9660_DEPENDENCIES += grub2 host-dosfstools host-mtools
ROOTFS_ISO9660_EFI_PARTITION = boot/fat.efi
ROOTFS_ISO9660_EFI_PARTITION_PATH = $(ROOTFS_ISO9660_TMP_TARGET_DIR)/$(ROOTFS_ISO9660_EFI_PARTITION)
ROOTFS_ISO9660_EFI_PARTITION_CONTENT = $(BINARIES_DIR)/efi-part
ROOTFS_ISO9660_BOOTLOADER_CONFIG_PATH = \
$(ROOTFS_ISO9660_TMP_TARGET_DIR)/boot/grub/grub.cfg
define ROOTFS_ISO9660_INSTALL_BOOTLOADER_EFI
rm -rf $(ROOTFS_ISO9660_EFI_PARTITION_PATH)
mkdir -p $(dir $(ROOTFS_ISO9660_EFI_PARTITION_PATH))
dd if=/dev/zero of=$(ROOTFS_ISO9660_EFI_PARTITION_PATH) bs=1M count=1
$(HOST_DIR)/sbin/mkfs.vfat $(ROOTFS_ISO9660_VFAT_OPTS) $(ROOTFS_ISO9660_EFI_PARTITION_PATH)
$(ROOTFS_ISO9660_FIX_TIME) $(ROOTFS_ISO9660_EFI_PARTITION_CONTENT)/*
$(HOST_DIR)/bin/mcopy -p -m -i $(ROOTFS_ISO9660_EFI_PARTITION_PATH) -s \
$(ROOTFS_ISO9660_EFI_PARTITION_CONTENT)/* ::/
$(ROOTFS_ISO9660_FIX_TIME) $(ROOTFS_ISO9660_EFI_PARTITION_PATH)
endef
endif
ifeq ($(BR2_TARGET_ROOTFS_ISO9660_ISOLINUX),y)
ROOTFS_ISO9660_DEPENDENCIES += syslinux
ROOTFS_ISO9660_BOOTLOADER_CONFIG_PATH = \
$(ROOTFS_ISO9660_TMP_TARGET_DIR)/isolinux/isolinux.cfg
ROOTFS_ISO9660_BOOT_IMAGE = isolinux/isolinux.bin
define ROOTFS_ISO9660_INSTALL_BOOTLOADER_BIOS
$(INSTALL) -D -m 0644 $(BINARIES_DIR)/syslinux/* \
$(ROOTFS_ISO9660_TMP_TARGET_DIR)/isolinux/
$(INSTALL) -D -m 0644 $(HOST_DIR)/share/syslinux/ldlinux.c32 \
$(ROOTFS_ISO9660_TMP_TARGET_DIR)/isolinux/ldlinux.c32
endef
endif
define ROOTFS_ISO9660_PREPARATION
$(INSTALL) -D -m 0644 $(ROOTFS_ISO9660_BOOT_MENU) \
$(ROOTFS_ISO9660_BOOTLOADER_CONFIG_PATH)
$(SED) "s%__KERNEL_PATH__%/boot/$(LINUX_IMAGE_NAME)%" \
$(ROOTFS_ISO9660_BOOTLOADER_CONFIG_PATH)
$(ROOTFS_ISO9660_INSTALL_BOOTLOADER_BIOS)
$(ROOTFS_ISO9660_INSTALL_BOOTLOADER_EFI)
endef
ROOTFS_ISO9660_PRE_GEN_HOOKS += ROOTFS_ISO9660_PREPARATION
define ROOTFS_ISO9660_DISABLE_EXTERNAL_INITRD
$(SED) '/__INITRD_PATH__/d' $(ROOTFS_ISO9660_BOOTLOADER_CONFIG_PATH)
endef
# Copy the kernel to temporary filesystem
define ROOTFS_ISO9660_COPY_KERNEL
$(INSTALL) -D -m 0644 $(LINUX_IMAGE_PATH) \
$(ROOTFS_ISO9660_TMP_TARGET_DIR)/boot/$(LINUX_IMAGE_NAME)
endef
ifeq ($(ROOTFS_ISO9660_USE_INITRD),YES)
ROOTFS_ISO9660_PRE_GEN_HOOKS += ROOTFS_ISO9660_COPY_KERNEL
# If initramfs is used, disable loading the initrd as the rootfs is
# already inside the kernel image. Otherwise, make sure a cpio is
# generated and use it as the initrd.
ifeq ($(BR2_TARGET_ROOTFS_INITRAMFS),y)
ROOTFS_ISO9660_PRE_GEN_HOOKS += ROOTFS_ISO9660_DISABLE_EXTERNAL_INITRD
else
ROOTFS_ISO9660_DEPENDENCIES += rootfs-cpio
define ROOTFS_ISO9660_COPY_INITRD
$(INSTALL) -D -m 0644 $(BINARIES_DIR)/rootfs.cpio$(ROOTFS_CPIO_COMPRESS_EXT) \
$(ROOTFS_ISO9660_TMP_TARGET_DIR)/boot/initrd
$(SED) "s%__INITRD_PATH__%/boot/initrd%" \
$(ROOTFS_ISO9660_BOOTLOADER_CONFIG_PATH)
endef
ROOTFS_ISO9660_PRE_GEN_HOOKS += ROOTFS_ISO9660_COPY_INITRD
endif
else # ROOTFS_ISO9660_USE_INITRD
ifeq ($(BR2_TARGET_ROOTFS_ISO9660_TRANSPARENT_COMPRESSION),y)
# We must use the uncompressed kernel image
ROOTFS_ISO9660_PRE_GEN_HOOKS += ROOTFS_ISO9660_COPY_KERNEL
endif
ROOTFS_ISO9660_PRE_GEN_HOOKS += ROOTFS_ISO9660_DISABLE_EXTERNAL_INITRD
endif # ROOTFS_ISO9660_USE_INITRD
ROOTFS_ISO9660_OPTS += -J -R
ROOTFS_ISO9660_OPTS_BIOS = \
-b $(ROOTFS_ISO9660_BOOT_IMAGE) \
-no-emul-boot \
-boot-load-size 4 \
-boot-info-table
ROOTFS_ISO9660_OPTS_EFI = \
--efi-boot $(ROOTFS_ISO9660_EFI_PARTITION) \
-no-emul-boot
ifeq ($(BR2_TARGET_ROOTFS_ISO9660_BIOS_BOOTLOADER)$(BR2_TARGET_ROOTFS_ISO9660_EFI_BOOTLOADER),yy)
ROOTFS_ISO9660_OPTS += \
$(ROOTFS_ISO9660_OPTS_BIOS) \
-eltorito-alt-boot \
$(ROOTFS_ISO9660_OPTS_EFI)
else ifeq ($(BR2_TARGET_ROOTFS_ISO9660_BIOS_BOOTLOADER),y)
ROOTFS_ISO9660_OPTS += $(ROOTFS_ISO9660_OPTS_BIOS)
else ifeq ($(BR2_TARGET_ROOTFS_ISO9660_EFI_BOOTLOADER),y)
ROOTFS_ISO9660_OPTS += $(ROOTFS_ISO9660_OPTS_EFI)
endif
define ROOTFS_ISO9660_CMD
$(HOST_DIR)/bin/xorriso -as mkisofs \
$(ROOTFS_ISO9660_OPTS) \
-o $@ $(ROOTFS_ISO9660_TMP_TARGET_DIR)
endef
ifeq ($(BR2_TARGET_ROOTFS_ISO9660_HYBRID),y)
define ROOTFS_ISO9660_GEN_HYBRID
$(HOST_DIR)/bin/isohybrid -t 0x96 $@
endef
ROOTFS_ISO9660_POST_GEN_HOOKS += ROOTFS_ISO9660_GEN_HYBRID
endif
$(eval $(rootfs))

5
fs/iso9660/isolinux.cfg Normal file
View File

@ -0,0 +1,5 @@
default 1
label 1
kernel __KERNEL_PATH__
initrd __INITRD_PATH__
append root=/dev/sr0

113
fs/jffs2/Config.in Normal file
View File

@ -0,0 +1,113 @@
config BR2_TARGET_ROOTFS_JFFS2
bool "jffs2 root filesystem"
help
Build a jffs2 root filesystem
if BR2_TARGET_ROOTFS_JFFS2
choice
prompt "Flash Type"
default BR2_TARGET_ROOTFS_JFFS2_FLASH_128
config BR2_TARGET_ROOTFS_JFFS2_DATAFLASH_1056
bool "AT45 dataflash with 1056 byte pagesize"
select BR2_TARGET_ROOTFS_JFFS2_NOCLEANMARKER
config BR2_TARGET_ROOTFS_JFFS2_DATAFLASH_528
bool "AT45 dataflash with 528 byte pagesize"
select BR2_TARGET_ROOTFS_JFFS2_NOCLEANMARKER
config BR2_TARGET_ROOTFS_JFFS2_NANDFLASH_16K
bool "NAND flash with 16 kB erasesize"
select BR2_TARGET_ROOTFS_JFFS2_NOCLEANMARKER
config BR2_TARGET_ROOTFS_JFFS2_NANDFLASH_128K
bool "NAND flash with 128 kB erasesize"
select BR2_TARGET_ROOTFS_JFFS2_NOCLEANMARKER
config BR2_TARGET_ROOTFS_JFFS2_FLASH_128
bool "Parallel flash with 128 kB erase size"
config BR2_TARGET_ROOTFS_JFFS2_FLASH_64
bool "Parallel flash with 64 kB erase size"
config BR2_TARGET_ROOTFS_JFFS2_CUSTOM
bool "Select custom erase size"
endchoice
config BR2_TARGET_ROOTFS_JFFS2_CUSTOM_EBSIZE
hex "Erase block size"
default 0x20000
depends on BR2_TARGET_ROOTFS_JFFS2_CUSTOM
help
Set to erase size of memory
config BR2_TARGET_ROOTFS_JFFS2_EBSIZE
hex
default 0x2100 if BR2_TARGET_ROOTFS_JFFS2_DATAFLASH_1056
default 0x1080 if BR2_TARGET_ROOTFS_JFFS2_DATAFLASH_528
default 0x4000 if BR2_TARGET_ROOTFS_JFFS2_NANDFLASH_16K
default 0x20000 if BR2_TARGET_ROOTFS_JFFS2_NANDFLASH_128K
default 0x20000 if BR2_TARGET_ROOTFS_JFFS2_FLASH_128
default 0x10000 if BR2_TARGET_ROOTFS_JFFS2_FLASH_64
default BR2_TARGET_ROOTFS_JFFS2_CUSTOM_EBSIZE if BR2_TARGET_ROOTFS_JFFS2_CUSTOM
config BR2_TARGET_ROOTFS_JFFS2_NOCLEANMARKER
bool "Do not use Cleanmarker"
default y if BR2_TARGET_ROOTFS_JFFS2_DATAFLASH_1056
default y if BR2_TARGET_ROOTFS_JFFS2_DATAFLASH_528
default y if BR2_TARGET_ROOTFS_JFFS2_NANDFLASH_16K
default y if BR2_TARGET_ROOTFS_JFFS2_NANDFLASH_128K
help
Do not use cleanmarkers if using NAND flash or Dataflash where
the pagesize is not a power of 2
config BR2_TARGET_ROOTFS_JFFS2_PAD
bool "Pad output"
config BR2_TARGET_ROOTFS_JFFS2_PADSIZE
hex "Pad output size (0x0 = to end of EB)"
default 0x0
depends on BR2_TARGET_ROOTFS_JFFS2_PAD
help
Set to 0x0 to pad to end of erase block.
choice
prompt "Endianess"
default BR2_TARGET_ROOTFS_JFFS2_BE if BR2_ENDIAN = "BIG"
config BR2_TARGET_ROOTFS_JFFS2_LE
bool "little-endian"
config BR2_TARGET_ROOTFS_JFFS2_BE
bool "big-endian"
endchoice
config BR2_TARGET_ROOTFS_JFFS2_SUMMARY
bool "Produce a summarized JFFS2 image"
help
A summarised image can be mounted faster if support is
enabled in the kernel (CONFIG_JFFS2_SUMMARY)
config BR2_TARGET_ROOTFS_JFFS2_USE_CUSTOM_PAGESIZE
bool "Select custom virtual memory page size"
help
Use a custom virtual memory page size. Note that this is not
related to the flash memory page size. Using this option is
only needed if Linux is configured to use a page size
different than 4kB.
config BR2_TARGET_ROOTFS_JFFS2_CUSTOM_PAGESIZE
hex "Virtual memory page size"
default 0x1000
depends on BR2_TARGET_ROOTFS_JFFS2_USE_CUSTOM_PAGESIZE
help
Set to virtual memory page size of target system (in bytes).
This value should match the virtual page size in Linux (i.e.
this should have the same value as the value of the PAGE_SIZE
macro in Linux). It is not related to the flash memory page
size.
endif

52
fs/jffs2/jffs2.mk Normal file
View File

@ -0,0 +1,52 @@
################################################################################
#
# Build the jffs2 root filesystem image
#
################################################################################
JFFS2_OPTS = -e $(BR2_TARGET_ROOTFS_JFFS2_EBSIZE) --with-xattr
SUMTOOL_OPTS = -e $(BR2_TARGET_ROOTFS_JFFS2_EBSIZE)
ifeq ($(BR2_TARGET_ROOTFS_JFFS2_PAD),y)
ifneq ($(strip $(BR2_TARGET_ROOTFS_JFFS2_PADSIZE)),0x0)
JFFS2_OPTS += --pad=$(strip $(BR2_TARGET_ROOTFS_JFFS2_PADSIZE))
else
JFFS2_OPTS += -p
endif
SUMTOOL_OPTS += -p
endif
ifeq ($(BR2_TARGET_ROOTFS_JFFS2_LE),y)
JFFS2_OPTS += -l
SUMTOOL_OPTS += -l
endif
ifeq ($(BR2_TARGET_ROOTFS_JFFS2_BE),y)
JFFS2_OPTS += -b
SUMTOOL_OPTS += -b
endif
ifeq ($(BR2_TARGET_ROOTFS_JFFS2_USE_CUSTOM_PAGESIZE),y)
JFFS2_OPTS += -s $(BR2_TARGET_ROOTFS_JFFS2_CUSTOM_PAGESIZE)
endif
ifeq ($(BR2_TARGET_ROOTFS_JFFS2_NOCLEANMARKER),y)
JFFS2_OPTS += -n
SUMTOOL_OPTS += -n
endif
ROOTFS_JFFS2_DEPENDENCIES = host-mtd
ifneq ($(BR2_TARGET_ROOTFS_JFFS2_SUMMARY),)
define ROOTFS_JFFS2_CMD
$(MKFS_JFFS2) $(JFFS2_OPTS) -d $(TARGET_DIR) -o $@.nosummary
$(SUMTOOL) $(SUMTOOL_OPTS) -i $@.nosummary -o $@
rm $@.nosummary
endef
else
define ROOTFS_JFFS2_CMD
$(MKFS_JFFS2) $(JFFS2_OPTS) -d $(TARGET_DIR) -o $@
endef
endif
$(eval $(rootfs))

106
fs/oci/Config.in Normal file
View File

@ -0,0 +1,106 @@
config BR2_TARGET_ROOTFS_OCI
bool "oci image"
depends on BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS
help
Build an OCI (Open Container Initiative) image.
By default, the image is generated in a directory called
rootfs-oci:
$ cd output/images
$ ls rootfs-oci/
blobs index.json oci-layout
You can push the image to a registry. Example using skopeo:
$ skopeo copy --dest-creds <user>:<pass> \
oci:rootfs-oci:<tag> docker://<user>/<image>[:tag]
And pull/run it with docker:
$ docker run -it <user>/<image>[:tag]
if BR2_TARGET_ROOTFS_OCI
config BR2_TARGET_ROOTFS_OCI_AUTHOR
string "author name and/or email address"
default "Buildroot"
help
Name and/or email address of the person which created the
image.
config BR2_TARGET_ROOTFS_OCI_TAG
string "image tag"
default "latest"
help
Tag to be used in the container image. If empty, 'latest' will
be used by default.
config BR2_TARGET_ROOTFS_OCI_ENTRYPOINT
string "entrypoint"
default "sh"
help
Command to execute when the container starts.
Spaces must be quoted or escaped, like for a shell string:
/usr/bin/env sh -c
/bin/my-init --some-option "1 2 3 4" some\ arg --
See the Docker documentation on how entrypoint and command
interact together:
https://docs.docker.com/engine/reference/builder/#understand-how-cmd-and-entrypoint-interact
config BR2_TARGET_ROOTFS_OCI_CMD
string "command (or entrypoint arguments)"
help
Default command, or entrypoint arguments, of the container.
Spaces must be quoted or escaped, like for a shell string:
"your shell scriptlet"
/usr/bin/env sh
See the Docker documentation on how entrypoint and command
interact together:
https://docs.docker.com/engine/reference/builder/#understand-how-cmd-and-entrypoint-interact
config BR2_TARGET_ROOTFS_OCI_WORKDIR
string "working directory"
help
Working directory of the entrypoint process in the
container.
config BR2_TARGET_ROOTFS_OCI_UID
string "username or UID"
default "0"
help
The username or UID of user the process run as.
config BR2_TARGET_ROOTFS_OCI_ENV_VARS
string "environment variables"
help
Default environment variables for the container.
Space-separated list of variable=value assignments.
config BR2_TARGET_ROOTFS_OCI_PORTS
string "ports"
help
Default set of ports to expose from a container running
this image as a space-separted list of ports in the following
format:
<port>/tcp, <port>/udp, <port> (same as <port>/tcp).
config BR2_TARGET_ROOTFS_OCI_LABELS
string "labels"
help
Metadata in the format KEY=VALUE for the container compliant
with OCI annotation rules. If KEY starts with a dot, it will
be prefixed with "org.opencontainers.image"
(e.g. .url -> org.opencontainers.image.url).
config BR2_TARGET_ROOTFS_OCI_ARCHIVE
bool "pack oci image into a tar archive"
help
Select whether the image should be packed into a TAR archive.
endif

86
fs/oci/oci.mk Normal file
View File

@ -0,0 +1,86 @@
################################################################################
#
# Build the oci image
#
################################################################################
ROOTFS_OCI_DEPENDENCIES = host-sloci-image
# architecture - take it from Go
OCI_SLOCI_IMAGE_OPTS = --arch $(GO_GOARCH)
# architecture variant (typically used only for arm)
OCI_SLOCI_IMAGE_OPTS += $(and $(GO_GOARM),--arch-variant v$(GO_GOARM))
# entrypoint and command
# Special treatment: both the entrypoint and arguments (aka command) are
# a double-quoted, space-separated, escaped-double-quoted string, like:
# "foo \"1 2 3 4\" ' a b c d ' bar\ buz"
# which should be interpreted as a 4-item list (using single quotes to
# delimit them and see leading/trailing spaces):
# 'foo'
# '1 2 3 4'
# ' a b c d '
# 'bar buz'
#
# We use some trickery to have the shell properly expand this into a list
# where each item is single-quoted and prefixed with the appropriate
# option string:
OCI_SLOCI_IMAGE_OPTS += \
$(shell eval printf -- "--entrypoint\ \'%s\'\ " $(BR2_TARGET_ROOTFS_OCI_ENTRYPOINT)) \
$(shell eval printf -- "--cmd\ \'%s\'\ " $(BR2_TARGET_ROOTFS_OCI_CMD))
# author
OCI_AUTHOR = $(call qstrip,$(BR2_TARGET_ROOTFS_OCI_AUTHOR))
ifneq ($(OCI_AUTHOR),)
OCI_SLOCI_IMAGE_OPTS += --author "$(OCI_AUTHOR)"
endif
# username or UID
OCI_UID = $(call qstrip,$(BR2_TARGET_ROOTFS_OCI_UID))
ifneq ($(OCI_UID),)
OCI_SLOCI_IMAGE_OPTS += --user "$(OCI_UID)"
endif
# labels
OCI_LABELS = $(call qstrip,$(BR2_TARGET_ROOTFS_OCI_LABELS))
ifneq ($(OCI_LABELS),)
OCI_SLOCI_IMAGE_OPTS += \
$(foreach label,$(OCI_LABELS),--label "$(label)")
endif
# environment variables
OCI_ENV_VARS = $(call qstrip,$(BR2_TARGET_ROOTFS_OCI_ENV_VARS))
ifneq ($(OCI_ENV_VARS),)
OCI_SLOCI_IMAGE_OPTS += \
$(foreach var,$(OCI_ENV_VARS),--env "$(var)")
endif
# working directory
OCI_WORKDIR = $(call qstrip,$(BR2_TARGET_ROOTFS_OCI_WORKDIR))
ifneq ($(OCI_WORKDIR),)
OCI_SLOCI_IMAGE_OPTS += --working-dir "$(OCI_WORKDIR)"
endif
# ports
OCI_PORTS = $(call qstrip,$(BR2_TARGET_ROOTFS_OCI_PORTS))
ifneq ($(OCI_PORTS),)
OCI_SLOCI_IMAGE_OPTS += \
$(foreach port,$(OCI_PORTS),--port "$(port)")
endif
# tag
OCI_TAG = $(or $(call qstrip,$(BR2_TARGET_ROOTFS_OCI_TAG)),latest)
# enable tar archive
ifeq ($(BR2_TARGET_ROOTFS_OCI_ARCHIVE),y)
OCI_SLOCI_IMAGE_OPTS += --tar
endif
define ROOTFS_OCI_CMD
rm -rf $(BINARIES_DIR)/rootfs-oci
$(HOST_DIR)/bin/sloci-image $(OCI_SLOCI_IMAGE_OPTS) $(TARGET_DIR) \
$(BINARIES_DIR)/rootfs-oci:$(OCI_TAG)
endef
$(eval $(rootfs))

4
fs/romfs/Config.in Normal file
View File

@ -0,0 +1,4 @@
config BR2_TARGET_ROOTFS_ROMFS
bool "romfs root filesystem"
help
Build a romfs image of the root filesystem.

13
fs/romfs/romfs.mk Normal file
View File

@ -0,0 +1,13 @@
################################################################################
#
# Build the romfs root filesystem image
#
################################################################################
ROOTFS_ROMFS_DEPENDENCIES = host-genromfs
define ROOTFS_ROMFS_CMD
$(HOST_DIR)/bin/genromfs -d $(TARGET_DIR) -f $@
endef
$(eval $(rootfs))

118
fs/squashfs/Config.in Normal file
View File

@ -0,0 +1,118 @@
config BR2_TARGET_ROOTFS_SQUASHFS
bool "squashfs root filesystem"
help
Build a squashfs root filesystem
if BR2_TARGET_ROOTFS_SQUASHFS
choice
prompt "block size"
default BR2_TARGET_ROOTFS_SQUASHFS_BS_128K
help
Data block size. Bigger values can improve
compression ratio.
If unsure, leave at 128k (default).
config BR2_TARGET_ROOTFS_SQUASHFS_BS_4K
bool "4k"
config BR2_TARGET_ROOTFS_SQUASHFS_BS_8K
bool "8k"
config BR2_TARGET_ROOTFS_SQUASHFS_BS_16K
bool "16k"
config BR2_TARGET_ROOTFS_SQUASHFS_BS_32K
bool "32k"
config BR2_TARGET_ROOTFS_SQUASHFS_BS_64K
bool "64k"
config BR2_TARGET_ROOTFS_SQUASHFS_BS_128K
bool "128k"
config BR2_TARGET_ROOTFS_SQUASHFS_BS_256K
bool "256k"
config BR2_TARGET_ROOTFS_SQUASHFS_BS_512K
bool "512k"
config BR2_TARGET_ROOTFS_SQUASHFS_BS_1024K
bool "1024k"
endchoice
config BR2_TARGET_ROOTFS_SQUASHFS_BS
string
default "4K" if BR2_TARGET_ROOTFS_SQUASHFS_BS_4K
default "8K" if BR2_TARGET_ROOTFS_SQUASHFS_BS_8K
default "16K" if BR2_TARGET_ROOTFS_SQUASHFS_BS_16K
default "32K" if BR2_TARGET_ROOTFS_SQUASHFS_BS_32K
default "64K" if BR2_TARGET_ROOTFS_SQUASHFS_BS_64K
default "128K" if BR2_TARGET_ROOTFS_SQUASHFS_BS_128K
default "256K" if BR2_TARGET_ROOTFS_SQUASHFS_BS_256K
default "512K" if BR2_TARGET_ROOTFS_SQUASHFS_BS_512K
default "1024K" if BR2_TARGET_ROOTFS_SQUASHFS_BS_1024K
config BR2_TARGET_ROOTFS_SQUASHFS_PAD
bool "pad to a 4K boundary"
default y # legacy was always ON
help
Say 'y' here (the default) to pad the the filesystem image
to a 4K boundary. Say 'n' to disable padding.
choice
prompt "Compression algorithm"
default BR2_TARGET_ROOTFS_SQUASHFS4_GZIP
help
Select the squashfs compression algorithm to use when
generating the filesystem.
config BR2_TARGET_ROOTFS_SQUASHFS4_GZIP
bool "gzip"
config BR2_TARGET_ROOTFS_SQUASHFS4_LZ4
bool "lz4"
config BR2_TARGET_ROOTFS_SQUASHFS4_LZMA
bool "lzma"
config BR2_TARGET_ROOTFS_SQUASHFS4_LZO
bool "lzo"
config BR2_TARGET_ROOTFS_SQUASHFS4_XZ
bool "xz"
config BR2_TARGET_ROOTFS_SQUASHFS4_ZSTD
bool "zstd"
endchoice
config BR2_TARGET_ROOTFS_SQUASHFS_EXTREME_COMP
bool "extreme compression when available"
default y if BR2_TARGET_ROOTFS_SQUASHFS4_LZ4 # legacy
help
Use options to increase compression ration as much as
possible, like using architecture-specific options, at
the cost of time when assembling the filesystem image.
For example:
- with gzip and lzo, use -Xcompression-level 9
- with xz use arch-specific bcj (branch-call-jump) filters
- with zstd use -Xcompression-level 22
- and more
config BR2_TARGET_ROOTFS_SQUASHFS_COMP_OPTS
string
default "-Xcompression-level 9" if BR2_TARGET_ROOTFS_SQUASHFS4_GZIP
default "-Xcompression-level 9" if BR2_TARGET_ROOTFS_SQUASHFS4_LZO
default "-Xhc" if BR2_TARGET_ROOTFS_SQUASHFS4_LZ4
default "-Xbcj arm,armthumb" if BR2_TARGET_ROOTFS_SQUASHFS4_XZ && (BR2_arm || BR_aarch64)
default "-Xbcj powerpc" if BR2_TARGET_ROOTFS_SQUASHFS4_XZ && (BR2_powerpc || BR2_powerpc64)
default "-Xbcj sparc" if BR2_TARGET_ROOTFS_SQUASHFS4_XZ && (BR2_sparc || BR2_sparc64)
default "-Xbcj x86" if BR2_TARGET_ROOTFS_SQUASHFS4_XZ && (BR2_i386 || BR2_x86_64)
default "-Xcompression-level 22" if BR2_TARGET_ROOTFS_SQUASHFS4_ZSTD
depends on BR2_TARGET_ROOTFS_SQUASHFS_EXTREME_COMP
endif

37
fs/squashfs/squashfs.mk Normal file
View File

@ -0,0 +1,37 @@
################################################################################
#
# Build the squashfs root filesystem image
#
################################################################################
ROOTFS_SQUASHFS_DEPENDENCIES = host-squashfs
ROOTFS_SQUASHFS_ARGS = \
-noappend \
-processors $(PARALLEL_JOBS) \
-b $(call qstrip,$(BR2_TARGET_ROOTFS_SQUASHFS_BS)) \
$(call qstrip,$(BR2_TARGET_ROOTFS_SQUASHFS_COMP_OPTS))
ifeq ($(BR2_TARGET_ROOTFS_SQUASHFS_PAD),)
ROOTFS_SQUASHFS_ARGS += -nopad
endif
ifeq ($(BR2_TARGET_ROOTFS_SQUASHFS4_LZ4),y)
ROOTFS_SQUASHFS_ARGS += -comp lz4
else ifeq ($(BR2_TARGET_ROOTFS_SQUASHFS4_LZO),y)
ROOTFS_SQUASHFS_ARGS += -comp lzo
else ifeq ($(BR2_TARGET_ROOTFS_SQUASHFS4_LZMA),y)
ROOTFS_SQUASHFS_ARGS += -comp lzma
else ifeq ($(BR2_TARGET_ROOTFS_SQUASHFS4_XZ),y)
ROOTFS_SQUASHFS_ARGS += -comp xz
else ifeq ($(BR2_TARGET_ROOTFS_SQUASHFS4_ZSTD),y)
ROOTFS_SQUASHFS_ARGS += -comp zstd
else
ROOTFS_SQUASHFS_ARGS += -comp gzip
endif
define ROOTFS_SQUASHFS_CMD
$(HOST_DIR)/bin/mksquashfs $(TARGET_DIR) $@ $(ROOTFS_SQUASHFS_ARGS)
endef
$(eval $(rootfs))

62
fs/tar/Config.in Normal file
View File

@ -0,0 +1,62 @@
config BR2_TARGET_ROOTFS_TAR
bool "tar the root filesystem"
default y
help
Build a tar archive of the root filesystem
choice
prompt "Compression method"
default BR2_TARGET_ROOTFS_TAR_NONE
depends on BR2_TARGET_ROOTFS_TAR
help
Select compressor for tar archive of the root filesystem
config BR2_TARGET_ROOTFS_TAR_NONE
bool "no compression"
help
Do not compress the tarball.
config BR2_TARGET_ROOTFS_TAR_GZIP
bool "gzip"
help
Do compress the tarball with gzip.
config BR2_TARGET_ROOTFS_TAR_BZIP2
bool "bzip2"
help
Do compress the tarball with bzip2.
config BR2_TARGET_ROOTFS_TAR_LZ4
bool "lz4"
help
Do compress the tarball with lz4.
config BR2_TARGET_ROOTFS_TAR_LZMA
bool "lzma"
help
Do compress the tarball with lzma.
config BR2_TARGET_ROOTFS_TAR_LZO
bool "lzo"
help
Do compress the tarball with lzop.
config BR2_TARGET_ROOTFS_TAR_XZ
bool "xz"
help
Do compress the tarball with xz.
config BR2_TARGET_ROOTFS_TAR_ZSTD
bool "zstd"
help
Do compress the tarball with zstd.
endchoice
config BR2_TARGET_ROOTFS_TAR_OPTIONS
string "other random options to pass to tar"
default ""
depends on BR2_TARGET_ROOTFS_TAR
help
Any other flags you want to pass to tar
Refer to tar --help for details

19
fs/tar/tar.mk Normal file
View File

@ -0,0 +1,19 @@
################################################################################
#
# tar to archive target filesystem
#
################################################################################
TAR_OPTS = $(call qstrip,$(BR2_TARGET_ROOTFS_TAR_OPTIONS))
ROOTFS_TAR_DEPENDENCIES = $(BR2_TAR_HOST_DEPENDENCY)
# do not store atime/ctime in PaxHeaders to ensure reproducbility
TAR_OPTS += --pax-option=exthdr.name=%d/PaxHeaders/%f,atime:=0,ctime:=0
define ROOTFS_TAR_CMD
(cd $(TARGET_DIR); find -print0 | LC_ALL=C sort -z | \
tar $(TAR_OPTS) -cf $@ --null --xattrs-include='*' --no-recursion -T - --numeric-owner)
endef
$(eval $(rootfs))

57
fs/ubi/Config.in Normal file
View File

@ -0,0 +1,57 @@
config BR2_TARGET_ROOTFS_UBI
bool "ubi image containing an ubifs root filesystem"
select BR2_TARGET_ROOTFS_UBIFS
help
Build an ubi image from the ubifs one (with ubinize).
if BR2_TARGET_ROOTFS_UBI
config BR2_TARGET_ROOTFS_UBI_PEBSIZE
hex "physical eraseblock size"
default 0x20000
help
Tells ubinize the physical eraseblock (PEB) size of the
flash chip the ubi image is created for. The value provided
here is passed to the -p/--peb-size option of ubinize.
config BR2_TARGET_ROOTFS_UBI_SUBSIZE
int "sub-page size"
default 512
help
Tells ubinize that the flash supports sub-pages and the
sub-page size. Use 0 if sub-pages are not supported on flash
chip.
The value provided here is passed to the -s/--sub-page-size
option of ubinize.
config BR2_TARGET_ROOTFS_UBI_USE_CUSTOM_CONFIG
bool "Use custom config file"
help
Select this option to use a custom ubinize configuration file,
rather than the default configuration used by Buildroot (which
defines a single dynamic volume marked as auto-resize).
Passing a custom ubinize configuration file allows you to
create several volumes, specify volume types, etc.
As a convenience, buildroot replaces the string
"BR2_ROOTFS_UBIFS_PATH" with the path to the built ubifs file.
So the volume defined for the root filesystem can specify the
image path as: image=BR2_ROOTFS_UBIFS_PATH
Buildroot also replaces the string "BINARIES_DIR" with the
value of $(BINARIES_DIR), so that it is possible to reference
other build artefacts (e.g. to include the kernel in a UBI
volume).
config BR2_TARGET_ROOTFS_UBI_CUSTOM_CONFIG_FILE
string "Configuration file path"
depends on BR2_TARGET_ROOTFS_UBI_USE_CUSTOM_CONFIG
help
Path to the ubinize configuration file.
config BR2_TARGET_ROOTFS_UBI_OPTS
string "Additional ubinize options"
help
Any additional ubinize options you may want to include.
endif # BR2_TARGET_ROOTFS_UBI

32
fs/ubi/ubi.mk Normal file
View File

@ -0,0 +1,32 @@
################################################################################
#
# Embed the ubifs image into an ubi image
#
################################################################################
UBI_UBINIZE_OPTS = -m $(BR2_TARGET_ROOTFS_UBIFS_MINIOSIZE)
UBI_UBINIZE_OPTS += -p $(BR2_TARGET_ROOTFS_UBI_PEBSIZE)
ifneq ($(BR2_TARGET_ROOTFS_UBI_SUBSIZE),0)
UBI_UBINIZE_OPTS += -s $(BR2_TARGET_ROOTFS_UBI_SUBSIZE)
endif
UBI_UBINIZE_OPTS += $(call qstrip,$(BR2_TARGET_ROOTFS_UBI_OPTS))
ROOTFS_UBI_DEPENDENCIES = rootfs-ubifs
ifeq ($(BR2_TARGET_ROOTFS_UBI_USE_CUSTOM_CONFIG),y)
UBI_UBINIZE_CONFIG_FILE_PATH = $(call qstrip,$(BR2_TARGET_ROOTFS_UBI_CUSTOM_CONFIG_FILE))
else
UBI_UBINIZE_CONFIG_FILE_PATH = fs/ubi/ubinize.cfg
endif
# don't use sed -i as it misbehaves on systems with SELinux enabled when this is
# executed through fakeroot (see #9386)
define ROOTFS_UBI_CMD
sed 's;BR2_ROOTFS_UBIFS_PATH;$@fs;;s;BINARIES_DIR;$(BINARIES_DIR);' \
$(UBI_UBINIZE_CONFIG_FILE_PATH) > $(BUILD_DIR)/ubinize.cfg
$(HOST_DIR)/sbin/ubinize -o $@ $(UBI_UBINIZE_OPTS) $(BUILD_DIR)/ubinize.cfg
rm $(BUILD_DIR)/ubinize.cfg
endef
$(eval $(rootfs))

8
fs/ubi/ubinize.cfg Normal file
View File

@ -0,0 +1,8 @@
[ubifs]
mode=ubi
vol_id=0
vol_type=dynamic
vol_name=rootfs
vol_alignment=1
vol_flags=autoresize
image=BR2_ROOTFS_UBIFS_PATH

98
fs/ubifs/Config.in Normal file
View File

@ -0,0 +1,98 @@
config BR2_TARGET_ROOTFS_UBIFS
bool "ubifs root filesystem"
help
Build a ubifs root filesystem
if BR2_TARGET_ROOTFS_UBIFS
config BR2_TARGET_ROOTFS_UBIFS_LEBSIZE
hex "logical eraseblock size"
default 0x1f800
help
Logical eraseblock (LEB) size. The value provided here is
passed to the -e/--leb-size option of mkfs.ubifs.
config BR2_TARGET_ROOTFS_UBIFS_MINIOSIZE
hex "minimum I/O unit size"
default 0x800
help
Minimum I/O unit size. The value provided here is passed
to the -m/--min-io-size option of mkfs.ubifs/ubinize.
config BR2_TARGET_ROOTFS_UBIFS_MAXLEBCNT
int "maximum logical eraseblock count"
default 2048
help
Maximum logical eraseblock (LEB) count. The value provided
here is passed to the -c/--max-leb-cnt option of mkfs.ubifs.
choice
prompt "ubifs runtime compression"
default BR2_TARGET_ROOTFS_UBIFS_RT_LZO
help
Select which compression format to use at run-time within
the ubifs file system. The choice made here is passed to
the -x/--compr option of mkfs.ubifs
config BR2_TARGET_ROOTFS_UBIFS_RT_NONE
bool "no compression"
help
Don't use run-time compression.
config BR2_TARGET_ROOTFS_UBIFS_RT_ZLIB
bool "gzip"
help
Use zlib compression at run-time.
config BR2_TARGET_ROOTFS_UBIFS_RT_LZO
bool "lzo"
help
Use lzo compression at run-time.
endchoice
choice
prompt "Compression method"
default BR2_TARGET_ROOTFS_UBIFS_NONE
help
Select which compression format to compress the final image
into.
config BR2_TARGET_ROOTFS_UBIFS_NONE
bool "no compression"
help
Do not compress the ubifs filesystem.
config BR2_TARGET_ROOTFS_UBIFS_GZIP
bool "gzip"
help
Do compress the ubifs filesystem with gzip.
config BR2_TARGET_ROOTFS_UBIFS_BZIP2
bool "bzip2"
help
Do compress the ubifs filesystem with bzip2.
config BR2_TARGET_ROOTFS_UBIFS_LZMA
bool "lzma"
help
Do compress the ubifs filesystem with lzma.
config BR2_TARGET_ROOTFS_UBIFS_LZO
bool "lzo"
help
Do compress the ubifs filesystem with lzop.
config BR2_TARGET_ROOTFS_UBIFS_XZ
bool "xz"
help
Do compress the ubifs filesystem with xz.
endchoice
config BR2_TARGET_ROOTFS_UBIFS_OPTS
string "Additional mkfs.ubifs options"
help
Any additional mkfs.ubifs options you may want to include.
endif # BR2_TARGET_ROOTFS_UBIFS

30
fs/ubifs/ubifs.mk Normal file
View File

@ -0,0 +1,30 @@
################################################################################
#
# Build the ubifs root filesystem image
#
################################################################################
UBIFS_OPTS = \
-e $(BR2_TARGET_ROOTFS_UBIFS_LEBSIZE) \
-c $(BR2_TARGET_ROOTFS_UBIFS_MAXLEBCNT) \
-m $(BR2_TARGET_ROOTFS_UBIFS_MINIOSIZE)
ifeq ($(BR2_TARGET_ROOTFS_UBIFS_RT_ZLIB),y)
UBIFS_OPTS += -x zlib
endif
ifeq ($(BR2_TARGET_ROOTFS_UBIFS_RT_LZO),y)
UBIFS_OPTS += -x lzo
endif
ifeq ($(BR2_TARGET_ROOTFS_UBIFS_RT_NONE),y)
UBIFS_OPTS += -x none
endif
UBIFS_OPTS += $(call qstrip,$(BR2_TARGET_ROOTFS_UBIFS_OPTS))
ROOTFS_UBIFS_DEPENDENCIES = host-mtd
define ROOTFS_UBIFS_CMD
$(HOST_DIR)/sbin/mkfs.ubifs -d $(TARGET_DIR) $(UBIFS_OPTS) -o $@
endef
$(eval $(rootfs))

4
fs/yaffs2/Config.in Normal file
View File

@ -0,0 +1,4 @@
config BR2_TARGET_ROOTFS_YAFFS2
bool "yaffs2 root filesystem"
help
Build a yaffs2 root filesystem

13
fs/yaffs2/yaffs2.mk Normal file
View File

@ -0,0 +1,13 @@
################################################################################
#
# Build the yaffs2 root filesystem image
#
################################################################################
ROOTFS_YAFFS2_DEPENDENCIES = host-yaffs2utils
define ROOTFS_YAFFS2_CMD
$(HOST_DIR)/bin/mkyaffs2 --all-root $(TARGET_DIR) $@
endef
$(eval $(rootfs))