Skip to contentSkip to conversation

patch to allow selection of e2fsprogs tools to install

Buildroot Hamish Moffatt 3 participants 5 messages Feb 20, 2008 – Feb 21, 2008

lore
Share & tools
lore
#0 lore raw

Any objection to the following patch, which allows choice of which e2fsprogs tools to install (a la package/mtd and others)?

I wish there were a better way to write the makefile other than a ton of ifneq/endif lines. I suspect some sort of macro and $(call ..) could do it.

I only omit tools at install time, not build time. This allows you to build multiple projects with different tool selections if you wanted. Plus, e2fsprogs does not support disabling most tools at build time.

Hamish

e2fsprogs/e2fsprogs.mk +48 -3
Index: package/e2fsprogs/e2fsprogs.mk
===================================================================
@@ -75,12 +75,57 @@
 		${TARGET_DIR}/sbin/fsck.ext[23] \
 		${TARGET_DIR}/sbin/findfs \
 		${TARGET_DIR}/sbin/tune2fs
+ifneq ($(strip $(BR2_PACKAGE_E2FSPROGS_BADBLOCKS)),y)
+	rm -rf ${TARGET_DIR}/sbin/badblocks
+endif
+ifneq ($(strip $(BR2_PACKAGE_E2FSPROGS_BLKID)),y)
+	rm -rf ${TARGET_DIR}/sbin/blkid
+endif
+ifneq ($(strip $(BR2_PACKAGE_E2FSPROGS_CHATTR)),y)
+	rm -rf ${TARGET_DIR}/bin/chattr
+endif
+ifneq ($(strip $(BR2_PACKAGE_E2FSPROGS_DUMPE2FS)),y)
+	rm -rf ${TARGET_DIR}/sbin/dumpe2fs
+endif
+ifneq ($(strip $(BR2_PACKAGE_E2FSPROGS_E2LABEL)),y)
+	rm -rf ${TARGET_DIR}/sbin/e2label
+endif
+ifneq ($(strip $(BR2_PACKAGE_E2FSPROGS_E2FSCK)),y)
+	rm -rf ${TARGET_DIR}/sbin/e2fsck
+else
+	ln -sf e2fsck ${TARGET_DIR}/sbin/fsck.ext2
+	ln -sf e2fsck ${TARGET_DIR}/sbin/fsck.ext3
+endif
+ifneq ($(strip $(BR2_PACKAGE_E2FSPROGS_FILEFRAG)),y)
+	rm -rf ${TARGET_DIR}/sbin/filefrag
+endif
+ifeq ($(strip $(BR2_PACKAGE_E2FSPROGS_FINDFS)),y)
+	ln -sf e2label ${TARGET_DIR}/sbin/findfs
+endif
+ifneq ($(strip $(BR2_PACKAGE_E2FSPROGS_FSCK)),y)
+	rm -rf ${TARGET_DIR}/sbin/fsck
+endif
+ifneq ($(strip $(BR2_PACKAGE_E2FSPROGS_LOGSAVE)),y)
+	rm -rf ${TARGET_DIR}/sbin/logsave
+endif
+ifneq ($(strip $(BR2_PACKAGE_E2FSPROGS_LSATTR)),y)
+	rm -rf ${TARGET_DIR}/bin/lsattr
+endif
+ifneq ($(strip $(BR2_PACKAGE_E2FSPROGS_MKE2FS)),y)
+	rm -rf ${TARGET_DIR}/sbin/mke2fs
+else
 	ln -sf mke2fs ${TARGET_DIR}/sbin/mkfs.ext2
 	ln -sf mke2fs ${TARGET_DIR}/sbin/mkfs.ext3
-	ln -sf e2fsck ${TARGET_DIR}/sbin/fsck.ext2
-	ln -sf e2fsck ${TARGET_DIR}/sbin/fsck.ext3
+endif
+ifneq ($(strip $(BR2_PACKAGE_E2FSPROGS_MKLOSTFOUND)),y)
+	rm -rf ${TARGET_DIR}/sbin/mklost+found
+endif
+ifeq ($(strip $(BR2_PACKAGE_E2FSPROGS_TUNE2FS)),y)
 	ln -sf e2label ${TARGET_DIR}/sbin/tune2fs
-	ln -sf e2label ${TARGET_DIR}/sbin/findfs
+endif
+ifneq ($(strip $(BR2_PACKAGE_E2FSPROGS_UUIDGEN)),y)
+	rm -rf ${TARGET_DIR}/bin/uuidgen
+endif
 ifneq ($(BR2_HAVE_INFOPAGES),y)
 	rm -rf $(TARGET_DIR)/usr/share/info
 endif
e2fsprogs/Config.in +78 -0

81 lines not on this page · raw message

Signature · 1 line
Hamish Moffatt VK3SB <[email protected]> <[email protected]>
#1 lore raw

----- Original Message -----
From: "Hamish Moffatt" <[email protected]>
To: <[email protected]>
Sent: Wednesday, February 20, 2008 7:18 AM
Subject: [Buildroot] patch to allow selection of e2fsprogs tools to install

Quoted 7 lines

Any objection to the following patch, which allows choice of which e2fsprogs tools to install (a la package/mtd and others)?

I wish there were a better way to write the makefile other than a ton of ifneq/endif lines. I suspect some sort of macro and $(call ..) could do it.

Quoted 6 lines

I only omit tools at install time, not build time. This allows you to build multiple projects with different tool selections if you wanted. Plus, e2fsprogs does not support disabling most tools at build time.

Hamish

Something similar to:

EF2FS_RM-$(strip $(BR2_PACKAGE_E2FSPROGS_BADBLOCKS)) += ${TARGET_DIR}/sbin/badblocks

for all configs should create a list of files to remove and another list of files to keep.

The "rm -rf" all files in the list

Best Regards
Ulf Samuelsson

#2 lore raw
Quoted 6 lines · Ulf Samuelsson

----- Original Message -----
From: "Hamish Moffatt" <[email protected]>

Quoted 3 lines

I wish there were a better way to write the makefile other than a ton of ifneq/endif lines. I suspect some sort of macro and $(call ..) could do it.

Quoted 7 lines

Something similar to:

EF2FS_RM-$(strip $(BR2_PACKAGE_E2FSPROGS_BADBLOCKS)) += ${TARGET_DIR}/sbin/badblocks

for all configs should create a list of files to remove and another list of files to keep.

The "rm -rf" all files in the list

Thanks, that's much better. Here's my updated patch. Unless there are any objections I'll commit it tomorrow.

Hamish

e2fsprogs/e2fsprogs.mk +25 -0
Index: package/e2fsprogs/e2fsprogs.mk
===================================================================
@@ -68,6 +68,20 @@
 	#$(STRIPCMD) $(E2FSPROGS_DIR)/lib/lib*.so.*.*
 	touch -c $@
 
+E2FSPROGS_RM$(strip $(BR2_PACKAGE_E2FSPROGS_BADBLOCKS)) += ${TARGET_DIR}/sbin/badblocks
+E2FSPROGS_RM$(strip $(BR2_PACKAGE_E2FSPROGS_BLKID)) += ${TARGET_DIR}/sbin/blkid
+E2FSPROGS_RM$(strip $(BR2_PACKAGE_E2FSPROGS_CHATTR)) += ${TARGET_DIR}/bin/chattr
+E2FSPROGS_RM$(strip $(BR2_PACKAGE_E2FSPROGS_DUMPE2FS)) += ${TARGET_DIR}/sbin/dumpe2fs
+E2FSPROGS_RM$(strip $(BR2_PACKAGE_E2FSPROGS_E2LABEL)) += ${TARGET_DIR}/sbin/e2label
+E2FSPROGS_RM$(strip $(BR2_PACKAGE_E2FSPROGS_E2FSCK)) += ${TARGET_DIR}/sbin/e2fsck
+E2FSPROGS_RM$(strip $(BR2_PACKAGE_E2FSPROGS_FILEFRAG)) += ${TARGET_DIR}/sbin/filefrag
+E2FSPROGS_RM$(strip $(BR2_PACKAGE_E2FSPROGS_FSCK)) += ${TARGET_DIR}/sbin/fsck
+E2FSPROGS_RM$(strip $(BR2_PACKAGE_E2FSPROGS_LOGSAVE)) += ${TARGET_DIR}/sbin/logsave
+E2FSPROGS_RM$(strip $(BR2_PACKAGE_E2FSPROGS_LSATTR)) += ${TARGET_DIR}/bin/lsattr
+E2FSPROGS_RM$(strip $(BR2_PACKAGE_E2FSPROGS_MKE2FS)) += ${TARGET_DIR}/sbin/mke2fs
+E2FSPROGS_RM$(strip $(BR2_PACKAGE_E2FSPROGS_MKLOSTFOUND)) += ${TARGET_DIR}/sbin/mklost+found
+E2FSPROGS_RM$(strip $(BR2_PACKAGE_E2FSPROGS_UUIDGEN)) += ${TARGET_DIR}/bin/uuidgen
+
 $(TARGET_DIR)/$(E2FSPROGS_TARGET_BINARY): $(E2FSPROGS_DIR)/$(E2FSPROGS_BINARY)
 	$(MAKE1) PATH=$(TARGET_PATH) DESTDIR=$(TARGET_DIR) LDCONFIG=true \
 		-C $(E2FSPROGS_DIR) install
@@ -75,12 +89,23 @@
 		${TARGET_DIR}/sbin/fsck.ext[23] \
 		${TARGET_DIR}/sbin/findfs \
 		${TARGET_DIR}/sbin/tune2fs
+ifneq ($(strip $(E2FSPROGS_RM)),)
+	rm -rf $(E2FSPROGS_RM)
+endif
+ifeq ($(strip $(BR2_PACKAGE_E2FSPROGS_MKE2FS)),y)
 	ln -sf mke2fs ${TARGET_DIR}/sbin/mkfs.ext2
 	ln -sf mke2fs ${TARGET_DIR}/sbin/mkfs.ext3
+endif
+ifeq ($(strip $(BR2_PACKAGE_E2FSPROGS_E2FSCK)),y)
 	ln -sf e2fsck ${TARGET_DIR}/sbin/fsck.ext2
 	ln -sf e2fsck ${TARGET_DIR}/sbin/fsck.ext3
+endif
+ifeq ($(strip $(BR2_PACKAGE_E2FSPROGS_TUNE2FS)),y)
 	ln -sf e2label ${TARGET_DIR}/sbin/tune2fs
+endif
+ifeq ($(strip $(BR2_PACKAGE_E2FSPROGS_FINDFS)),y)
 	ln -sf e2label ${TARGET_DIR}/sbin/findfs
+endif
 ifneq ($(BR2_HAVE_INFOPAGES),y)
 	rm -rf $(TARGET_DIR)/usr/share/info
 endif
e2fsprogs/Config.in +78 -0

81 lines not on this page · raw message

Signature · 1 line
Hamish Moffatt VK3SB <[email protected]> <[email protected]>
#3 lore raw

[Buildroot] patch to allow selection of e2fsprogs tools toinstall

That doesn't work so I assume it was never tested. Pls test before you resubmit.

$(E2FSPROGS_RM) is always clear
$(E2FSPROGS_RM-y) and $(E2FSPROGS_RM-n) may have contents.

Best Regards
Ulf Samuelsson ulf at atmel.com
Atmel Nordic AB

Mail:  Box 2033, 174 02 Sundbyberg, Sweden
Visit:  Kavalleriv?gen 24, 174 58 Sundbyberg, Sweden

Phone +46 (8) 441 54 22 Fax +46 (8) 441 54 29
GSM +46 (706) 22 44 57

Technical support when I am not available:
AT90 AVR Applications Group: mailto:avr at atmel.com
AT91 ARM Applications Group: mailto:at91support at atmel.com
AVR32 Applications Group mailto:avr32 at atmel.com
http://www.avrfreaks.net/; http://avr32linux.org/
http://www.at91.com/ ; ftp://at91dist:distrib at 81.80.104.162/
----- Original Message -----
From: "Hamish Moffatt" <[email protected]>
To: "Ulf Samuelsson" <[email protected]>
Cc: <[email protected]>
Sent: Thursday, February 21, 2008 2:38 AM
Subject: Re: [Buildroot] patch to allow selection of e2fsprogs tools toinstall

Quoted 159 lines · Ulf Samuelsson
Quoted 6 lines

----- Original Message -----
From: "Hamish Moffatt" <[email protected]>

Quoted 3 lines

I wish there were a better way to write the makefile other than a ton of ifneq/endif lines. I suspect some sort of macro and $(call ..) could do it.

Quoted 7 lines

Something similar to:

EF2FS_RM-$(strip $(BR2_PACKAGE_E2FSPROGS_BADBLOCKS)) += ${TARGET_DIR}/sbin/badblocks

for all configs should create a list of files to remove and another list of files to keep.

The "rm -rf" all files in the list

Thanks, that's much better. Here's my updated patch. Unless there are any objections I'll commit it tomorrow.

Hamish

Index: package/e2fsprogs/e2fsprogs.mk
===================================================================

e2fsprogs/e2fsprogs.mk (working copy) renamed from e2fsprogs/e2fsprogs.mk (revision 3559) +25 -0
@@ -68,6 +68,20 @@
 #$(STRIPCMD) $(E2FSPROGS_DIR)/lib/lib*.so.*.*
 touch -c $@
 
+E2FSPROGS_RM$(strip $(BR2_PACKAGE_E2FSPROGS_BADBLOCKS)) += ${TARGET_DIR}/sbin/badblocks
+E2FSPROGS_RM$(strip $(BR2_PACKAGE_E2FSPROGS_BLKID)) += ${TARGET_DIR}/sbin/blkid
+E2FSPROGS_RM$(strip $(BR2_PACKAGE_E2FSPROGS_CHATTR)) += ${TARGET_DIR}/bin/chattr
+E2FSPROGS_RM$(strip $(BR2_PACKAGE_E2FSPROGS_DUMPE2FS)) += ${TARGET_DIR}/sbin/dumpe2fs
+E2FSPROGS_RM$(strip $(BR2_PACKAGE_E2FSPROGS_E2LABEL)) += ${TARGET_DIR}/sbin/e2label
+E2FSPROGS_RM$(strip $(BR2_PACKAGE_E2FSPROGS_E2FSCK)) += ${TARGET_DIR}/sbin/e2fsck
+E2FSPROGS_RM$(strip $(BR2_PACKAGE_E2FSPROGS_FILEFRAG)) += ${TARGET_DIR}/sbin/filefrag
+E2FSPROGS_RM$(strip $(BR2_PACKAGE_E2FSPROGS_FSCK)) += ${TARGET_DIR}/sbin/fsck
+E2FSPROGS_RM$(strip $(BR2_PACKAGE_E2FSPROGS_LOGSAVE)) += ${TARGET_DIR}/sbin/logsave
+E2FSPROGS_RM$(strip $(BR2_PACKAGE_E2FSPROGS_LSATTR)) += ${TARGET_DIR}/bin/lsattr
+E2FSPROGS_RM$(strip $(BR2_PACKAGE_E2FSPROGS_MKE2FS)) += ${TARGET_DIR}/sbin/mke2fs
+E2FSPROGS_RM$(strip $(BR2_PACKAGE_E2FSPROGS_MKLOSTFOUND)) += ${TARGET_DIR}/sbin/mklost+found
+E2FSPROGS_RM$(strip $(BR2_PACKAGE_E2FSPROGS_UUIDGEN)) += ${TARGET_DIR}/bin/uuidgen
+
 $(TARGET_DIR)/$(E2FSPROGS_TARGET_BINARY): $(E2FSPROGS_DIR)/$(E2FSPROGS_BINARY)
 $(MAKE1) PATH=$(TARGET_PATH) DESTDIR=$(TARGET_DIR) LDCONFIG=true \
 -C $(E2FSPROGS_DIR) install
@@ -75,12 +89,23 @@
 ${TARGET_DIR}/sbin/fsck.ext[23] \
 ${TARGET_DIR}/sbin/findfs \
 ${TARGET_DIR}/sbin/tune2fs
+ifneq ($(strip $(E2FSPROGS_RM)),)
+ rm -rf $(E2FSPROGS_RM)
+endif
+ifeq ($(strip $(BR2_PACKAGE_E2FSPROGS_MKE2FS)),y)
 ln -sf mke2fs ${TARGET_DIR}/sbin/mkfs.ext2
 ln -sf mke2fs ${TARGET_DIR}/sbin/mkfs.ext3
+endif
+ifeq ($(strip $(BR2_PACKAGE_E2FSPROGS_E2FSCK)),y)
 ln -sf e2fsck ${TARGET_DIR}/sbin/fsck.ext2
 ln -sf e2fsck ${TARGET_DIR}/sbin/fsck.ext3
+endif
+ifeq ($(strip $(BR2_PACKAGE_E2FSPROGS_TUNE2FS)),y)
 ln -sf e2label ${TARGET_DIR}/sbin/tune2fs
+endif
+ifeq ($(strip $(BR2_PACKAGE_E2FSPROGS_FINDFS)),y)
 ln -sf e2label ${TARGET_DIR}/sbin/findfs
+endif
 ifneq ($(BR2_HAVE_INFOPAGES),y)
 rm -rf $(TARGET_DIR)/usr/share/info

endif
Index: package/e2fsprogs/Config.in
===================================================================

e2fsprogs/Config.in (working copy) renamed from e2fsprogs/Config.in (revision 3559) +78 -0
@@ -3,3 +3,81 @@
 default n
 help
   The EXT2 file system utilities and libraries
+
+config BR2_PACKAGE_E2FSPROGS_BADBLOCKS
+ bool "badblocks"
+ default y
+ depends on BR2_PACKAGE_E2FSPROGS
+
+config BR2_PACKAGE_E2FSPROGS_BLKID
+ bool "blkid"
+ default y
+ depends on BR2_PACKAGE_E2FSPROGS
+
+config BR2_PACKAGE_E2FSPROGS_CHATTR
+ bool "chattr"
+ default y
+ depends on BR2_PACKAGE_E2FSPROGS
+
+config BR2_PACKAGE_E2FSPROGS_DUMPE2FS
+ bool "dumpe2fs"
+ default y
+ depends on BR2_PACKAGE_E2FSPROGS
+
+config BR2_PACKAGE_E2FSPROGS_E2FSCK
+ bool "e2fsck"
+ default y
+ depends on BR2_PACKAGE_E2FSPROGS
+
+config BR2_PACKAGE_E2FSPROGS_E2LABEL
+ bool "e2label"
+ default y
+ depends on BR2_PACKAGE_E2FSPROGS
+
+config BR2_PACKAGE_E2FSPROGS_FILEFRAG
+ bool "filefrag"
+ default y
+ depends on BR2_PACKAGE_E2FSPROGS
+
+config BR2_PACKAGE_E2FSPROGS_FINDFS
+ bool "findfs"
+ default y
+ depends on BR2_PACKAGE_E2FSPROGS
+ select BR2_PACKAGE_E2FSPROGS_E2LABEL
+
+config BR2_PACKAGE_E2FSPROGS_FSCK
+ bool "fsck"
+ default y
+ depends on BR2_PACKAGE_E2FSPROGS
+
+config BR2_PACKAGE_E2FSPROGS_LOGSAVE
+ bool "logsave"
+ default y
+ depends on BR2_PACKAGE_E2FSPROGS
+
+config BR2_PACKAGE_E2FSPROGS_LSATTR
+ bool "chattr"
+ default y
+ depends on BR2_PACKAGE_E2FSPROGS
+
+config BR2_PACKAGE_E2FSPROGS_MKE2FS
+ bool "mke2fs"
+ default y
+ depends on BR2_PACKAGE_E2FSPROGS
+
+config BR2_PACKAGE_E2FSPROGS_MKLOSTFOUND
+ bool "mklost+found"
+ default y
+ depends on BR2_PACKAGE_E2FSPROGS
+
+config BR2_PACKAGE_E2FSPROGS_TUNE2FS
+ bool "tune2fs"
+ default y
+ depends on BR2_PACKAGE_E2FSPROGS
+ select BR2_PACKAGE_E2FSPROGS_E2LABEL
+
+config BR2_PACKAGE_E2FSPROGS_UUIDGEN
+ bool "uuidgen"
+ default y
+ depends on BR2_PACKAGE_E2FSPROGS
+
Signature · 1 line
Hamish Moffatt VK3SB <[email protected]> <[email protected]>
#4 lore raw

[Buildroot] patch to allow selection of e2fsprogs tools toinstall

Quoted 2 lines · Ulf Samuelsson

That doesn't work so I assume it was never tested. Pls test before you resubmit.

I did, and it works for me.

Quoted 2 lines

$(E2FSPROGS_RM) is always clear
$(E2FSPROGS_RM-y) and $(E2FSPROGS_RM-n) may have contents.

No,

Quoted 2 lines

e2fsprogs/e2fsprogs.mk line 72

Quoted 2 lines
e2fsprogs/e2fsprogs.mk +2 -0
+E2FSPROGS_RM$(strip $(BR2_PACKAGE_E2FSPROGS_BADBLOCKS)) += ${TARGET_DIR}/sbin/badblocks
+E2FSPROGS_RM$(strip $(BR2_PACKAGE_E2FSPROGS_BLKID)) += ${TARGET_DIR}/sbin/blkid

$(E2FSPROGS_RM-*) is not used, it is $(E2FSPROGS_RM)y and $(E2FSPROGS_RM). I could have used RM-, but I thought $(E2FSPROGS_RM-) looked odd.

Hence,

Quoted 3 lines

e2fsprogs/e2fsprogs.mk line 94

Quoted 3 lines
e2fsprogs/e2fsprogs.mk +3 -0
+ifneq ($(strip $(E2FSPROGS_RM)),)
+ rm -rf $(E2FSPROGS_RM)
+endif

Hamish

Signature · 1 line
Hamish Moffatt VK3SB <[email protected]> <[email protected]>