mirror of
https://github.com/MiyooCFW/buildroot.git
synced 2025-09-27 22:24:19 +03:00
Merge from bittboy/buildroot@db180c0
This commit is contained in:
65
fs/cpio/Config.in
Normal file
65
fs/cpio/Config.in
Normal file
@@ -0,0 +1,65 @@
|
||||
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.
|
||||
|
||||
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
|
||||
52
fs/cpio/cpio.mk
Normal file
52
fs/cpio/cpio.mk
Normal file
@@ -0,0 +1,52 @@
|
||||
################################################################################
|
||||
#
|
||||
# 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 . | 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))
|
||||
7
fs/cpio/init
Executable file
7
fs/cpio/init
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
# devtmpfs does not get automounted for initramfs
|
||||
/bin/mount -t devtmpfs devtmpfs /dev
|
||||
exec 0</dev/console
|
||||
exec 1>/dev/console
|
||||
exec 2>/dev/console
|
||||
exec /sbin/init "$@"
|
||||
Reference in New Issue
Block a user