|
|
@ -28,40 +28,13 @@ ROOTFS_EXT2_DEPENDENCIES = host-e2fsprogs |
|
|
|
|
|
|
|
define ROOTFS_EXT2_CMD |
|
|
|
rm -f $@ |
|
|
|
if [ "x$(BR2_ROOTFS_EXT2_SIZE)" != "x" ] |
|
|
|
then |
|
|
|
$(HOST_DIR)/sbin/mkfs.ext$(BR2_TARGET_ROOTFS_EXT2_GEN) $(ROOTFS_EXT2_OPTS) $@ \
|
|
|
|
$(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; \
|
|
|
|
} |
|
|
|
else |
|
|
|
EXT2_SIZE_E=`du -s $(TARGET_DIR) | cut -f 1` |
|
|
|
while true |
|
|
|
do |
|
|
|
EXT2_SIZE_E=$$(($${EXT2_SIZE_E} + 100 * 1024)) |
|
|
|
echo "The size of rootfs.ext2 will set to $${EXT2_SIZE_E}" |
|
|
|
$(HOST_DIR)/sbin/mkfs.ext$(BR2_TARGET_ROOTFS_EXT2_GEN) $(ROOTFS_EXT2_OPTS) $@ "$${EXT2_SIZE_E}K" \
|
|
|
|
&& break |
|
|
|
done |
|
|
|
|| { ret=$$?; \
|
|
|
|
echo "*** Maybe you need to increase the filesystem size (BR2_TARGET_ROOTFS_EXT2_SIZE)" 1>&2; \
|
|
|
|
exit $$ret; \
|
|
|
|
} |
|
|
|
|
|
|
|
FREE_BLOCK=`dumpe2fs $@ 2>/dev/null | grep -i "^Free blocks" | awk -F ':' '{print $$2}'` |
|
|
|
BLOCK_COUNT=`dumpe2fs $@ 2>/dev/null | grep -i "^Block count" | awk -F ':' '{print $$2}'` |
|
|
|
BLOCK_SIZE=`dumpe2fs $@ 2>/dev/null | grep -i "^Block size" | awk -F ':' '{print $$2}'` |
|
|
|
|
|
|
|
FREE_BLOCK=$$(($${FREE_BLOCK}*$${BLOCK_SIZE}/1024)) |
|
|
|
BLOCK_COUNT=$$(($${BLOCK_COUNT}*$${BLOCK_SIZE}/1024)) |
|
|
|
USED_BLOCK=$$(($${BLOCK_COUNT}-$${FREE_BLOCK})) |
|
|
|
|
|
|
|
EXT2_SIZE_E=$$(($${USED_BLOCK}*100/90)) |
|
|
|
|
|
|
|
if [ $$(($${EXT2_SIZE_E} - $${USED_BLOCK})) -le 51200 ] |
|
|
|
then |
|
|
|
EXT2_SIZE_E=$$(($${USED_BLOCK} + 51200)) |
|
|
|
fi |
|
|
|
|
|
|
|
fi |
|
|
|
endef |
|
|
|
|
|
|
|
ifneq ($(BR2_TARGET_ROOTFS_EXT2_GEN),2) |
|
|
|