ext2.mk 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. ################################################################################
  2. #
  3. # Build the ext2 root filesystem image
  4. #
  5. ################################################################################
  6. EXT2_SIZE = $(call qstrip,$(BR2_TARGET_ROOTFS_EXT2_SIZE))
  7. ifeq ($(BR2_TARGET_ROOTFS_EXT2)-$(EXT2_SIZE),y-)
  8. $(error BR2_TARGET_ROOTFS_EXT2_SIZE cannot be empty)
  9. endif
  10. EXT2_MKFS_OPTS = $(call qstrip,$(BR2_TARGET_ROOTFS_EXT2_MKFS_OPTIONS))
  11. # qstrip results in stripping consecutive spaces into a single one. So the
  12. # variable is not qstrip-ed to preserve the integrity of the string value.
  13. EXT2_LABEL := $(subst ",,$(BR2_TARGET_ROOTFS_EXT2_LABEL))
  14. #" Syntax highlighting... :-/ )
  15. EXT2_OPTS = \
  16. -d $(TARGET_DIR) \
  17. -r $(BR2_TARGET_ROOTFS_EXT2_REV) \
  18. -N $(BR2_TARGET_ROOTFS_EXT2_INODES) \
  19. -m $(BR2_TARGET_ROOTFS_EXT2_RESBLKS) \
  20. -L "$(EXT2_LABEL)" \
  21. $(EXT2_MKFS_OPTS)
  22. ROOTFS_EXT2_DEPENDENCIES = host-e2fsprogs
  23. define ROOTFS_EXT2_CMD
  24. rm -f $@
  25. $(HOST_DIR)/sbin/mkfs.ext$(BR2_TARGET_ROOTFS_EXT2_GEN) $(EXT2_OPTS) $@ \
  26. "$(EXT2_SIZE)" \
  27. || { ret=$$?; \
  28. echo "*** Maybe you need to increase the filesystem size (BR2_TARGET_ROOTFS_EXT2_SIZE)" 1>&2; \
  29. exit $$ret; \
  30. }
  31. endef
  32. ifneq ($(BR2_TARGET_ROOTFS_EXT2_GEN),2)
  33. define ROOTFS_EXT2_SYMLINK
  34. ln -sf rootfs.ext2$(ROOTFS_EXT2_COMPRESS_EXT) $(BINARIES_DIR)/rootfs.ext$(BR2_TARGET_ROOTFS_EXT2_GEN)$(ROOTFS_EXT2_COMPRESS_EXT)
  35. endef
  36. ROOTFS_EXT2_POST_GEN_HOOKS += ROOTFS_EXT2_SYMLINK
  37. endif
  38. $(eval $(rootfs))