Skip to contentSkip to conversation

Patch: parted support

Buildroot Igor Serebryany 3 participants 3 messages Oct 8, 2009 – Oct 9, 2009

lore
Share & tools
lore
#0 lore raw

This patch adds GNU parted to buildroot. It's against the 2009.08 release. The makefile could probaby be improved significantly, for instance enabling readline support if it's present in buildroot. But it works for now, and I've tested it under i686 and x86_64.

Most of the credit should go to Marco Lazzarotto (m.lazzarotto at robox.it) who originally wrote the makefile. I simply modified it to use the latest version.

To apply: "cd buildroot-2009.08; patch -p1 < parted.patch".

--Igor
-------------- next part --------------
A non-text attachment was scrubbed...
Name: parted.patch
Type: text/x-diff
Size: 3440 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20091008/c9098d28/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20091008/c9098d28/attachment.pgp>

#1 lore raw
Quoted 38 lines · Igor Serebryany

This patch adds GNU parted to buildroot. It's against the 2009.08 release. The makefile could probaby be improved significantly, for instance enabling readline support if it's present in buildroot. But it works for now, and I've tested it under i686 and x86_64.

Most of the credit should go to Marco Lazzarotto (m.lazzarotto at robox.it) who originally wrote the makefile. I simply modified it to use the latest version.

To apply: "cd buildroot-2009.08; patch -p1 < parted.patch".

--Igor

diff -rpuN buildroot-2009.08/package/Config.in buildroot-2009.08.new/package/Config.in

package/Config.in +0 -0
@@ -264,6 +264,7 @@ source "package/memtester/Config.in"

source "package/mtd/Config.in"
source "package/ntfs-3g/Config.in"
source "package/ntfsprogs/Config.in"
+source "package/parted/Config.in"
source "package/pciutils/Config.in"
source "package/pcmcia/Config.in"
source "package/setserial/Config.in"
diff -rpuN buildroot-2009.08/package/parted/Config.in buildroot-2009.08.new/package/parted/Config.in

package/parted/Config.in +6 -0
@@ -0,0 +1,6 @@
+config BR2_PACKAGE_PARTED
+	bool "parted"
+	default n
+	help
+		GNU parted
+		http://ftp.gnu.org/gnu/parted

diff -rpuN buildroot-2009.08/package/parted/parted.mk buildroot-2009.08.new/package/parted/parted.mk

package/parted/parted.mk line 6

Quoted 6 lines
package/parted/parted.mk +6 -0
@@ -0,0 +1,70 @@
+#############################################################
+#
+# parted
+#
+#############################################################
+PARTED_VERSION:=1.9.0

nowadays packages have to be written differently, like (completely untested):
cat >package/parted/parted.mk<<EOF
#############################################################
#

# parted
#
#############################################################

PARTED_VERSION:=1.9.0 PARTED_SOURCE:=parted-$(PARTED_VERSION).tar.gz PARTED_SITE:=$(BR2_GNU_MIRROR)/parted
PARTED_CONF_OPT=$(if $(BR2_ENABLE_DEBUG),--enable-debug,--disable-debug) ifeq ($(BR2_ENABLE_DEBUG),y) PARTED_INSTALL_TARGET_OPT:=DESTDIR=$(TARGET_DIR) INSTALLCMD='./install-sh -c' \
install
else
PARTED_INSTALL_TARGET_OPT:=DESTDIR=$(TARGET_DIR)

INSTALLCMD='./install-sh -c' \
			  STRIPPROG="$(TARGET_STRIP)" install-strip
endif
PARTED_CONF_OPT:= \
	$(if $(BR2_PACKAGE_READLINE),,--without-readline) \
	--disable-dynamic-loading \
	--without-included-regex

$(eval $(call AUTOTARGETS,package,parted))
EOF

Can you please try to use this type of makefile? See package/rsync/rsync.mk and others as examples.

TIA,

Quoted 64 lines
package/parted/parted.mk +64 -0
+PARTED_SOURCE:=parted-$(PARTED_VERSION).tar.gz
+PARTED_SITE:=http://ftp.gnu.org/gnu/parted/
+PARTED_DIR:=$(BUILD_DIR)/parted-$(PARTED_VERSION)
+PARTED_BINARY:=parted/parted
+PARTED_TARGET_BINARY:=sbin/parted
+PARTED_COMPILE_OPT:=--without-readline --disable-dynamic-loading --disable-nls --without-included-regex --disable-shared
+
+$(DL_DIR)/$(PARTED_SOURCE):
+	$(WGET) -P $(DL_DIR) $(PARTED_SITE)/$(PARTED_SOURCE)
+
+$(PARTED_DIR)/.source: $(DL_DIR)/$(PARTED_SOURCE)
+	$(ZCAT) $(DL_DIR)/$(PARTED_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
+	touch $@
+	
+parted-source: $(DL_DIR)/$(PARTED_SOURCE)
+
+$(PARTED_DIR)/.unpacked: $(DL_DIR)/$(PARTED_SOURCE)
+	$(ZCAT) $(DL_DIR)/$(PARTED_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
+	toolchain/patch-kernel.sh $(PARTED_DIR) package/parted/ parted\*.patch
+	touch $@
+
+$(PARTED_DIR)/.configured: $(PARTED_DIR)/.unpacked
+	(cd $(PARTED_DIR); rm -rf config.cache; \
+		$(TARGET_CONFIGURE_OPTS) \
+		$(TARGET_CONFIGURE_ARGS) \
+		CFLAGS="$(TARGET_CFLAGS)" \
+		./configure \
+		--target=$(GNU_TARGET_NAME) \
+		--host=$(GNU_TARGET_NAME) \
+		--build=$(GNU_HOST_NAME) \
+		--prefix=/ \
+		--sbindir=/sbin \
+		$(PARTED_COMPILE_OPT) \
+		)
+		touch $@
+
+$(PARTED_DIR)/$(PARTED_BINARY): $(PARTED_DIR)/.configured
+	$(MAKE) CC=$(TARGET_CC) -C $(PARTED_DIR)
+
+$(TARGET_DIR)/$(PARTED_TARGET_BINARY): $(PARTED_DIR)/$(PARTED_BINARY)
+	$(MAKE1) PATH=$(TARGET_PATH) DESTDIR=$(TARGET_DIR) -C $(PARTED_DIR) install-exec
+	rm -rf $(TARGET_DIR)/usr/man
+	rm -rf $(TARGET_DIR)/usr/include
+
+parted: uclibc e2fsprogs $(TARGET_DIR)/$(PARTED_TARGET_BINARY)
+
+parted-source: $(DL_DIR)/$(PARTED_SOURCE)
+
+parted-clean:
+	$(MAKE1) PATH=$(TARGET_PATH) DESTDIR=$(TARGET_DIR) -C $(PARTED_DIR) uninstall
+	-$(MAKE) -C $(PARTED_DIR) clean
+
+parted-dirclean:
+	rm -rf $(PARTED_DIR)
+
+#############################################################
+#
+# Toplevel Makefile options
+#
+#############################################################
+
+ifeq ($(strip $(BR2_PACKAGE_PARTED)),y)
+TARGETS+=parted
+endif
#2 lore raw

Le Thu, 8 Oct 2009 19:45:44 +0200,
Bernhard Reutner-Fischer <[email protected]> a ?crit :

Quoted 2 lines

nowadays packages have to be written differently, like (completely untested):

Yes.

Quoted 8 lines

($(BR2_ENABLE_DEBUG),y)
PARTED_INSTALL_TARGET_OPT:=DESTDIR=$(TARGET_DIR)
INSTALLCMD='./install-sh -c' \ install
else
PARTED_INSTALL_TARGET_OPT:=DESTDIR=$(TARGET_DIR)

INSTALLCMD='./install-sh -c' \
			  STRIPPROG="$(TARGET_STRIP)" install-strip

endif

What is this INSTALLCMD thing ?

Concerning the ENABLE_DEBUG test, it is not necessary. Makefile.autotools.in already does:

ifeq ($(BR2_ENABLE_DEBUG),y)
$(2)_INSTALL_TARGET_OPT ?= DESTDIR=$$(TARGET_DIR) install-exec
else
$(2)_INSTALL_TARGET_OPT ?= DESTDIR=$$(TARGET_DIR) install-strip
endif

Sincerly,

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers and embedded Linux development,
consulting, training and support.
http://free-electrons.com