2013-06-06 23:54:13 +02:00
|
|
|
################################################################################
|
2006-11-22 20:10:59 +01:00
|
|
|
#
|
|
|
|
# cpio to archive target filesystem
|
|
|
|
#
|
2013-06-06 23:54:13 +02:00
|
|
|
################################################################################
|
2006-11-22 20:10:59 +01:00
|
|
|
|
2011-09-06 23:16:08 +02:00
|
|
|
ifeq ($(BR2_ROOTFS_DEVICE_CREATION_STATIC),y)
|
|
|
|
|
|
|
|
define ROOTFS_CPIO_ADD_INIT
|
2014-10-25 20:29:31 +02:00
|
|
|
if [ ! -e $(TARGET_DIR)/init ]; then \
|
|
|
|
ln -sf sbin/init $(TARGET_DIR)/init; \
|
|
|
|
fi
|
2011-09-06 23:16:08 +02:00
|
|
|
endef
|
|
|
|
|
|
|
|
else
|
|
|
|
# devtmpfs does not get automounted when initramfs is used.
|
|
|
|
# Add a pre-init script to mount it before running init
|
fs/cpio: don't extend packages' permissions table
Currently, when we build a cpio filesystem without static devices, we
shoehorn the /dev/console node as if it were specified by a package.
This means that this device is added for all filesystems as well, not
just the cpio. But if we disable cpio, that device is not created for
other filesystems.
This is not very clean, and may break expectations.
Instead, use an explicit mknod as part of the _CMD, as we know it's
going to run under fakeroot.
This is still visible to all filesystems built after cpio, and not to
those built before it, though.
[Peter: ensure /dev exists, simplify comment]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Cc: Arnout Vandecappelle <arnout@mind.be>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2018-03-31 11:05:48 +02:00
|
|
|
# We must have /dev/console very early, even before /init runs,
|
|
|
|
# for stdin/stdout/stderr
|
2011-09-06 23:16:08 +02:00
|
|
|
define ROOTFS_CPIO_ADD_INIT
|
2014-10-25 20:29:31 +02:00
|
|
|
if [ ! -e $(TARGET_DIR)/init ]; then \
|
|
|
|
$(INSTALL) -m 0755 fs/cpio/init $(TARGET_DIR)/init; \
|
|
|
|
fi
|
fs/cpio: don't extend packages' permissions table
Currently, when we build a cpio filesystem without static devices, we
shoehorn the /dev/console node as if it were specified by a package.
This means that this device is added for all filesystems as well, not
just the cpio. But if we disable cpio, that device is not created for
other filesystems.
This is not very clean, and may break expectations.
Instead, use an explicit mknod as part of the _CMD, as we know it's
going to run under fakeroot.
This is still visible to all filesystems built after cpio, and not to
those built before it, though.
[Peter: ensure /dev exists, simplify comment]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Cc: Arnout Vandecappelle <arnout@mind.be>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2018-03-31 11:05:48 +02:00
|
|
|
mkdir -p $(TARGET_DIR)/dev
|
|
|
|
mknod -m 0622 $(TARGET_DIR)/dev/console c 5 1
|
2010-03-10 00:13:24 +01:00
|
|
|
endef
|
2006-11-22 20:10:59 +01:00
|
|
|
|
2011-09-06 23:16:08 +02:00
|
|
|
endif # BR2_ROOTFS_DEVICE_CREATION_STATIC
|
|
|
|
|
|
|
|
ROOTFS_CPIO_PRE_GEN_HOOKS += ROOTFS_CPIO_ADD_INIT
|
2007-08-12 00:01:13 +02:00
|
|
|
|
2019-07-17 08:56:35 +02:00
|
|
|
# --reproducible option was introduced in cpio v2.12, which may not be
|
2019-07-16 19:35:18 +02:00
|
|
|
# available in some old distributions, so we build host-cpio
|
|
|
|
ifeq ($(BR2_REPRODUCIBLE),y)
|
|
|
|
ROOTFS_CPIO_DEPENDENCIES += host-cpio
|
|
|
|
ROOTFS_CPIO_OPTS += --reproducible
|
|
|
|
endif
|
|
|
|
|
2010-03-10 00:13:24 +01:00
|
|
|
define ROOTFS_CPIO_CMD
|
2020-06-29 14:37:01 +02:00
|
|
|
cd $(TARGET_DIR) && \
|
|
|
|
find . \
|
|
|
|
| LC_ALL=C sort \
|
|
|
|
| cpio $(ROOTFS_CPIO_OPTS) --quiet -o -H newc \
|
|
|
|
> $@
|
2010-03-10 00:13:24 +01:00
|
|
|
endef
|
2007-08-12 00:01:13 +02:00
|
|
|
|
2013-11-07 00:12:34 +01:00
|
|
|
ifeq ($(BR2_TARGET_ROOTFS_CPIO_UIMAGE),y)
|
2017-11-12 18:45:44 +01:00
|
|
|
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
|
2013-11-07 00:12:34 +01:00
|
|
|
endif
|
|
|
|
|
2017-12-28 11:40:32 +01:00
|
|
|
$(eval $(rootfs))
|