From patchwork Mon Jul 3 22:51:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Martin X-Patchwork-Id: 783689 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3x1j7k30qMz9s1h for ; Tue, 4 Jul 2017 08:52:18 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="FBNFrlrk"; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id D76FA82119; Mon, 3 Jul 2017 22:52:11 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3IR6HGBgKZ90; Mon, 3 Jul 2017 22:52:11 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id C1CA982043; Mon, 3 Jul 2017 22:52:10 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id B93811C2035 for ; Mon, 3 Jul 2017 22:51:42 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id B017C86D68 for ; Mon, 3 Jul 2017 22:51:42 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0rZsCoVXuZhS for ; Mon, 3 Jul 2017 22:51:40 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by whitealder.osuosl.org (Postfix) with ESMTPS id 8F77D838BC for ; Mon, 3 Jul 2017 22:51:40 +0000 (UTC) Received: by mail-wm0-f66.google.com with SMTP id p204so23068879wmg.1 for ; Mon, 03 Jul 2017 15:51:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=IeVFgTinHTzTFYd3g/GYz7sH7DWuMJ6B3jDK1sLs3rk=; b=FBNFrlrk9GoDSqPh9coDCuv30WlrdH4O0bIwSxqnRmYOh0rvKMOSDLYgEViOC0+BP+ 06hHO2oXZPpSeFn7+rONQk+fuLhZ8v8psQsbkb/NjkmLJDXbxtR1oIw50vXlF8aICPBS PIqktQBZebML8nqIerkibCjCejgQtMo/KS7gYOluOpToNciIiLdm/COadak/9OR8UDoK BRcllQ2cJo7cP1uf8qNF9nPCNtGYrY/g+Skhb7mWFc7LcmcG838TFidYbyiJ3uNXAsfG J5f7EeBAIsXkjyYq9aWqUdKxD/CI/ib5zsk2IXl9v8aNjPqRFMGO+aDovw+oxEMlgVqd LaxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=IeVFgTinHTzTFYd3g/GYz7sH7DWuMJ6B3jDK1sLs3rk=; b=OLrwBkcgJhL+lEEYjtNOiQdLoKFzmUHaPJ+xWaiL72n3YUq77fjTtrX1cMoZr13TS4 dd6TEY0N47zm23BJRKxdmGOpM4txYsWaddB4koUmqu8vFtp5PYyd3mt4UyyG0PhzpQYp RoAvp4pT2uAlL1c4+E3WyaIGQEyLASJ4ZRPFWF2WEoGC7vE6cyKwcfMzI+U7dOXpPq0q VOpSzQuT7uBcGplaBi8DdJQTOO/UEdQs33xE0I1TjEW2EslNPd27GCyEJw+88RUooGxj um68bpV7e5TE0dbDRUrAP+o6VmnAoZ+VazH8N0Bhc9fMP90fkHS7lADMDAxGmY4HYu+d G/Iw== X-Gm-Message-State: AIVw112yX+avZKen9y0+ALfrw3DEWxjgOlSAfQIt9FMfbYjPqCqjDQdm EZwo4fjEw4hekg+aqs0= X-Received: by 10.28.97.86 with SMTP id v83mr4632438wmb.74.1499122298744; Mon, 03 Jul 2017 15:51:38 -0700 (PDT) Received: from localhost.localdomain (2a01cb08861073004a51b7fffed22913.ipv6.abo.wanadoo.fr. [2a01:cb08:8610:7300:4a51:b7ff:fed2:2913]) by smtp.gmail.com with ESMTPSA id j125sm11101920wmf.6.2017.07.03.15.51.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Jul 2017 15:51:37 -0700 (PDT) From: Samuel Martin To: buildroot@buildroot.org Date: Tue, 4 Jul 2017 00:51:04 +0200 Message-Id: <20170703225106.1492-10-s.martin49@gmail.com> X-Mailer: git-send-email 2.13.2 In-Reply-To: <20170703225106.1492-1-s.martin49@gmail.com> References: <20170703225106.1492-1-s.martin49@gmail.com> MIME-Version: 1.0 Cc: "Yann E. MORIN" Subject: [Buildroot] [PATCH v3 09/11] fs/ext2: use mkfs to generate rootfs image X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Sébastien Szymanski mkfs is now capable of generating rootfs images. Use mkfs instead of genext2fs. If not set, we now let mkfs calculate the block size and the number of inodes needed. This change also adjusts the options to meet those of mkfs. Note that passing a null inode number to mkfs triggers its automatic calculation. The BR2_TARGET_ROOTFS_EXT2_BLOCKS symbol is ranamed as well, into BR2_TARGET_ROOTFS_EXT2_SIZE, since it now accepts the same values as the mkfs' fs-size argument (i.e. with k, m, g or t suffix). Signed-off-by: Sébastien Szymanski Signed-off-by: Samuel Martin Cc: "Yann E. MORIN" --- changes v2->v3: - reword commit log changes v1->v2: - rebase - add default size value --- Config.in.legacy | 8 ++++++++ fs/ext2/Config.in | 21 +++++++++++---------- fs/ext2/ext2.mk | 23 ++++++++++++++--------- 3 files changed, 33 insertions(+), 19 deletions(-) diff --git a/Config.in.legacy b/Config.in.legacy index 5efe0d1ba0..68275f9e0e 100644 --- a/Config.in.legacy +++ b/Config.in.legacy @@ -145,6 +145,14 @@ endif ############################################################################### comment "Legacy options removed in 2017.08" +config BR2_TARGET_ROOTFS_EXT2_BLOCKS + int "exact size in blocks has been removed" + default 0 + help + This option has been removed in favor of BR2_TARGET_ROOTFS_EXT2_SIZE. + +# Note: BR2_TARGET_ROOTFS_EXT2_BLOCKS still reference in fs/ext2/Config.in + config BR2_TARGET_ROOTFS_EXT2_EXTRA_INODES int "extra inodes has been removed" if BR2_TARGET_ROOTFS_EXT2_INODES = 0 default 0 diff --git a/fs/ext2/Config.in b/fs/ext2/Config.in index 0071ba2bec..9850823e10 100644 --- a/fs/ext2/Config.in +++ b/fs/ext2/Config.in @@ -1,6 +1,6 @@ config BR2_TARGET_ROOTFS_EXT2 bool "ext2/3/4 root filesystem" - select BR2_PACKAGE_HOST_MKE2IMG + select BR2_PACKAGE_HOST_E2FSPROGS help Build an ext2/3/4 root filesystem @@ -66,19 +66,20 @@ config BR2_TARGET_ROOTFS_EXT2_BLOCK_SIZE default 2048 if BR2_TARGET_ROOTFS_EXT2_BLOCK_2048 default 4096 if BR2_TARGET_ROOTFS_EXT2_BLOCK_4096 -# 61440 block od 1024 bytes = 60MB, i.e usually small enough to fit -# on a 64MB media -config BR2_TARGET_ROOTFS_EXT2_BLOCKS - int "exact size in blocks" - default 61440 - help - Specify the file system size as a number of blocks, which - size is specified above. - config BR2_TARGET_ROOTFS_EXT2_INODES int "exact number of inodes (leave at 0 for auto calculation)" default 0 +config BR2_TARGET_ROOTFS_EXT2_SIZE + string "exact size" + default BR2_TARGET_ROOTFS_EXT2_BLOCKS if BR2_TARGET_ROOTFS_EXT2_BLOCKS != 0 # legacy 2017.08 + default "60M" # default size + help + The size of the filesystem image. If it does not have a suffix, it is + interpreted as power-of-two kilobytes. If it is suffixed by 'k', 'm', + 'g', 't' (either upper-case or lower-case), then it is interpreted in + power-of-two kilobytes, megabytes, gigabytes, terabytes, etc. + config BR2_TARGET_ROOTFS_EXT2_RESBLKS int "reserved blocks percentage" default 5 diff --git a/fs/ext2/ext2.mk b/fs/ext2/ext2.mk index 24643afeb9..bc366bc689 100644 --- a/fs/ext2/ext2.mk +++ b/fs/ext2/ext2.mk @@ -4,24 +4,29 @@ # ################################################################################ +EXT2_SIZE = $(call qstrip,$(BR2_TARGET_ROOTFS_EXT2_SIZE)) +ifeq ($(EXT2_SIZE),) +$(error BR2_TARGET_ROOTFS_EXT2_SIZE cannot be empty) +endif + # 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. EXT2_LABEL := $(subst ",,$(BR2_TARGET_ROOTFS_EXT2_LABEL)) #" Syntax highlighting... :-/ ) EXT2_OPTS = \ - -G $(BR2_TARGET_ROOTFS_EXT2_GEN) \ - -R $(BR2_TARGET_ROOTFS_EXT2_REV) \ - -B $(BR2_TARGET_ROOTFS_EXT2_BLOCK_SIZE) \ - -b $(BR2_TARGET_ROOTFS_EXT2_BLOCKS) \ - -i $(BR2_TARGET_ROOTFS_EXT2_INODES) \ - -r $(BR2_TARGET_ROOTFS_EXT2_RESBLKS) \ - -l "$(EXT2_LABEL)" + -d $(TARGET_DIR) \ + -r $(BR2_TARGET_ROOTFS_EXT2_REV) \ + -b $(BR2_TARGET_ROOTFS_EXT2_BLOCK_SIZE) \ + -N $(BR2_TARGET_ROOTFS_EXT2_INODES) \ + -m $(BR2_TARGET_ROOTFS_EXT2_RESBLKS) \ + -L "$(EXT2_LABEL)" -ROOTFS_EXT2_DEPENDENCIES = host-mke2img +ROOTFS_EXT2_DEPENDENCIES = host-e2fsprogs define ROOTFS_EXT2_CMD - PATH=$(BR_PATH) mke2img -d $(TARGET_DIR) $(EXT2_OPTS) -o $@ + rm -f $@ + PATH=$(BR_PATH) mkfs.ext$(BR2_TARGET_ROOTFS_EXT2_GEN) $(EXT2_OPTS) $@ $(EXT2_SIZE) endef rootfs-ext2-symlink: