2013-06-06 23:54:13 +02:00
|
|
|
################################################################################
|
2002-04-26 13:45:55 +02:00
|
|
|
#
|
|
|
|
# Build the ext2 root filesystem image
|
|
|
|
#
|
2013-06-06 23:54:13 +02:00
|
|
|
################################################################################
|
2002-04-26 13:45:55 +02:00
|
|
|
|
2021-09-17 22:19:44 +02:00
|
|
|
ROOTFS_EXT2_SIZE = $(call qstrip,$(BR2_TARGET_ROOTFS_EXT2_SIZE))
|
|
|
|
ifeq ($(BR2_TARGET_ROOTFS_EXT2)-$(ROOTFS_EXT2_SIZE),y-)
|
2017-07-09 07:00:38 +02:00
|
|
|
$(error BR2_TARGET_ROOTFS_EXT2_SIZE cannot be empty)
|
|
|
|
endif
|
|
|
|
|
2021-09-17 22:19:44 +02:00
|
|
|
ROOTFS_EXT2_MKFS_OPTS = $(call qstrip,$(BR2_TARGET_ROOTFS_EXT2_MKFS_OPTIONS))
|
2017-07-09 07:00:39 +02:00
|
|
|
|
2016-11-21 17:15:29 +01:00
|
|
|
# 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.
|
2021-09-17 22:19:44 +02:00
|
|
|
ROOTFS_EXT2_LABEL = $(subst ",,$(BR2_TARGET_ROOTFS_EXT2_LABEL))
|
2017-07-04 00:50:58 +02:00
|
|
|
#" Syntax highlighting... :-/ )
|
|
|
|
|
2021-09-17 22:19:44 +02:00
|
|
|
ROOTFS_EXT2_OPTS = \
|
2017-07-04 16:47:26 +02:00
|
|
|
-d $(TARGET_DIR) \
|
|
|
|
-r $(BR2_TARGET_ROOTFS_EXT2_REV) \
|
|
|
|
-N $(BR2_TARGET_ROOTFS_EXT2_INODES) \
|
|
|
|
-m $(BR2_TARGET_ROOTFS_EXT2_RESBLKS) \
|
2021-10-13 18:01:34 +02:00
|
|
|
-L "$(ROOTFS_EXT2_LABEL)" \
|
fs/ext2: generate Y2K38-resilient filesystems
When creating a filesystem, mkfs.ext will chose the inode size depending
on the size of the filesystem. Small filesystem get 128-bytes inodes,
while bigger filesystems use 256-byte inodes (inode must be a power of 2
larger or equal to 128, and smaller or equal to the blocksize).
However, 128-byte inodes can't store timestamps past the dreaded
2038-01-19 03:14:07Z deadline, while inodes larger than or equal to 256
do not have the issue.
It turns out that the tipping point to decide whether a filesystem is
small or big, is about around the size of the filesystems we generate
for our runtime tests. This causes the kernel to emit warning like:
ext2 filesystem being remounted at / supports timestamps until 2038 (0x7fffffff)
We add a new option to our ext2 filesystem, so that user can specify the
size of the inode. That new option defaults to 256 to be resilient to
the Y2K38 problem.
Note: it was already possible for users to explicitly pass the -I
option, through BR2_TARGET_ROOTFS_EXT2_MKFS_OPTIONS. We could have
chosen to extend the existing value with a -I 256, but that is not
satisfactory. Indeed, we do want to ensure that the default is now
Y2K38-OK, even for existing configurations that did not have explicit
setting.
We also pass that new option before the user-specified arbitrary ones,
so that BR2_TARGET_ROOTFS_EXT2_MKFS_OPTIONS still wins (in case -I was
set there).
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
[Peter: tweak help text]
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2022-11-20 21:42:26 +01:00
|
|
|
-I $(BR2_TARGET_ROOTFS_EXT2_INODE_SIZE) \
|
2021-09-17 22:19:44 +02:00
|
|
|
$(ROOTFS_EXT2_MKFS_OPTS)
|
2014-12-06 23:40:06 +01:00
|
|
|
|
2017-07-04 16:47:26 +02:00
|
|
|
ROOTFS_EXT2_DEPENDENCIES = host-e2fsprogs
|
2005-01-23 11:53:06 +01:00
|
|
|
|
2010-03-10 00:15:15 +01:00
|
|
|
define ROOTFS_EXT2_CMD
|
2017-07-04 16:47:26 +02:00
|
|
|
rm -f $@
|
2021-09-17 22:19:44 +02:00
|
|
|
$(HOST_DIR)/sbin/mkfs.ext$(BR2_TARGET_ROOTFS_EXT2_GEN) $(ROOTFS_EXT2_OPTS) $@ \
|
|
|
|
"$(ROOTFS_EXT2_SIZE)" \
|
2017-07-26 00:05:28 +02:00
|
|
|
|| { ret=$$?; \
|
|
|
|
echo "*** Maybe you need to increase the filesystem size (BR2_TARGET_ROOTFS_EXT2_SIZE)" 1>&2; \
|
|
|
|
exit $$ret; \
|
|
|
|
}
|
2010-03-10 00:15:15 +01:00
|
|
|
endef
|
2002-04-26 13:45:55 +02:00
|
|
|
|
2013-04-11 14:17:52 +02:00
|
|
|
ifneq ($(BR2_TARGET_ROOTFS_EXT2_GEN),2)
|
2017-11-12 18:45:43 +01:00
|
|
|
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
|
2013-04-11 14:17:52 +02:00
|
|
|
endif
|
|
|
|
|
2017-12-28 11:40:32 +01:00
|
|
|
$(eval $(rootfs))
|