diff mbox

[3/3,v3] fs/ext2: add option to specify a filesystem label

Message ID 0244e2c2f1c3933e110df8478544efafe66c7e5c.1417868913.git.yann.morin.1998@free.fr
State Changes Requested
Headers show

Commit Message

Yann E. MORIN Dec. 6, 2014, 12:29 p.m. UTC
Filesystems of the ext familly can carry a filesystem label.
Add an option for the user to specify such a label.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Károly Kasza <kaszak@gmail.com>

---
Changes v2 -> v3:
  - fix quoting for when the label contains a space  (Károly)
---
 fs/ext2/Config.in | 3 +++
 fs/ext2/ext2.mk   | 8 ++++++++
 2 files changed, 11 insertions(+)

Comments

Karoly Kasza Dec. 6, 2014, 2:15 p.m. UTC | #1
Hi Yann, Thomas, list,

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> Cc: Károly Kasza <kaszak@gmail.com>
>

Tested-by: Karoly Kasza <kaszak@gmail.com>
Reviewed-by: Karoly Kasza <kaszak@gmail.com>

Tested the whole series of 3 together (v3), successfully built different
rootfs.ext images and booted them.
Tested with master branch, x86_64 arch in QEMU, internal toolchain GCC
4.9.2 w/ uclibc, Linux 3.17.4.

Regards,
Karoly
Thomas Petazzoni Dec. 6, 2014, 6:23 p.m. UTC | #2
Dear Yann E. MORIN,

On Sat,  6 Dec 2014 13:29:46 +0100, Yann E. MORIN wrote:
> Filesystems of the ext familly can carry a filesystem label.
> Add an option for the user to specify such a label.
> 
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> Cc: Károly Kasza <kaszak@gmail.com>

Reviewed-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Tested-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

 (on x86-64 in qemu, tested an ext4 filesystem with only the ext4
 kernel driver compiled in, and then tested an ext2 filesystem with
 only the ext2 kernel driver compiled in).

Thanks,

Thomas
diff mbox

Patch

diff --git a/fs/ext2/Config.in b/fs/ext2/Config.in
index 8751b62..5b1cd0c 100644
--- a/fs/ext2/Config.in
+++ b/fs/ext2/Config.in
@@ -41,6 +41,9 @@  config BR2_TARGET_ROOTFS_EXT2_REV
 	default 0   if BR2_TARGET_ROOTFS_EXT2_2r0
 	default 1   if !BR2_TARGET_ROOTFS_EXT2_2r0
 
+config BR2_TARGET_ROOTFS_EXT2_LABEL
+	string "filesystem label"
+
 config BR2_TARGET_ROOTFS_EXT2_BLOCKS
 	int "size in blocks (leave at 0 for auto calculation)"
 	default 0
diff --git a/fs/ext2/ext2.mk b/fs/ext2/ext2.mk
index 96b7a4a..1cac72e 100644
--- a/fs/ext2/ext2.mk
+++ b/fs/ext2/ext2.mk
@@ -18,6 +18,14 @@  ifneq ($(strip $(BR2_TARGET_ROOTFS_EXT2_RESBLKS)),0)
 EXT2_OPTS += -r $(BR2_TARGET_ROOTFS_EXT2_RESBLKS)
 endif
 
+# Not qstrip-ing the variable, because it may contain spaces, but we must
+# qstrip it when checking. Furthermore, we need to further quote it, so
+# that the quotes do not get eaten by the echo statement when creating the
+# fakeroot script
+ifneq ($(call qstrip,$(BR2_TARGET_ROOTFS_EXT2_LABEL)),)
+EXT2_OPTS += -l '$(BR2_TARGET_ROOTFS_EXT2_LABEL)'
+endif
+
 ROOTFS_EXT2_DEPENDENCIES = host-mke2img
 
 define ROOTFS_EXT2_CMD