Skip to contentSkip to conversation

package/pflash: new package

PATCH New Joel Stanley 3 participants 7 messages Jul 25, 2016 – Jul 26, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/pflash: new package

pflash is a tool for reading and writing to the PNOR on OpenPower servers, for firmware upgrades, and extracting diagnostic information.

This includes a fix so that pflash can build with musl, which has been submitted upstream[1].

[1] http://patchwork.ozlabs.org/patch/652168/

---
 package/Config.in                                  |  1 +
 ...-pflash-use-atexit-for-musl-compatibility.patch | 42 ++++++++++++++++++++++
 package/pflash/Config.in                           |  6 ++++
 package/pflash/pflash.mk                           | 32 +++++++++++++++++
 4 files changed, 81 insertions(+)
 create mode 100644 package/pflash/0001-pflash-use-atexit-for-musl-compatibility.patch
 create mode 100644 package/pflash/Config.in
 create mode 100644 package/pflash/pflash.mk
package/Config.in +1 -0
index 814141f18784..9f873c31fa58 100644
@@ -426,6 +426,7 @@ endmenu
 	source "package/owl-linux/Config.in"
 	source "package/parted/Config.in"
 	source "package/pciutils/Config.in"
+	source "package/pflash/Config.in"
 	source "package/picocom/Config.in"
 	source "package/pifmrds/Config.in"
 	source "package/powertop/Config.in"
package/pflash/0001-pflash-use-atexit-for-musl-compatibility.patch new file +42 -0

42 lines not on this page · raw message

package/pflash/Config.in new file +6 -0
new file mode 100644
index 000000000000..315989724088
@@ -0,0 +1,6 @@
+config BR2_PACKAGE_PFLASH
+	bool "pflash"
+	depends on BR2_arm || BR2_powerpc64 || BR2_powerpc64le || BR2_x86_64
+	help
+	  PNOR Flash reading and writing tool for OpenPower servers. Used for
+	  firmware upgrades and extracting diagnostic infromation from flash.
package/pflash/pflash.mk new file +32 -0
new file mode 100644
index 000000000000..ab19ad699866
@@ -0,0 +1,32 @@
+################################################################################
+#
+# pflash
+#
+################################################################################
+
+PFLASH_VERSION = skiboot-5.2.4
+
+PFLASH_SITE = $(call github,open-power,skiboot,$(PFLASH_VERSION))
+PFLASH_INSTALL_STAGING = YES
+PFLASH_LICENSE = Apache 2.0
+PFLASH_LICENSE_FILE = LICENCE
+
+PFLASH_MAKE_OPTS += CROSS_COMPILE="$(TARGET_CROSS)" \
+		    PFLASH_VERSION=$(PFLASH_VERSION) \
+		    DESTDIR=$(TARGET_DIR) \
+		    -C $(@D)/external/pflash \
+
+# A makefile bug causes recent versions of pflash to fail setting CC and LD
+# based on CROSS_COMPILE. Set CC and LD to remain compatible with those
+# versions.
+PFLASH_MAKE_OPTS += CC=$(TARGET_CC) LD=$(TARGET_LD)
+
+define PFLASH_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) $(PFLASH_MAKE_OPTS) all
+endef
+
+define PFLASH_INSTALL_TARGET_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) $(PFLASH_MAKE_OPTS) install
+endef
+
+$(eval $(generic-package))
Signature · 1 line
2.8.1
#1 lore raw

PATCH 1/1 package/pflash: new package

Hi,

Am Mon, 25 Jul 2016 15:31:27 +0930 schrieb Joel Stanley:

package/pflash/Config.in line 6

Quoted 12 lines
package/pflash/Config.in new file +6 -0
new file mode 100644
index 000000000000..315989724088
@@ -0,0 +1,6 @@
+config BR2_PACKAGE_PFLASH
+	bool "pflash"
+	depends on BR2_arm || BR2_powerpc64 || BR2_powerpc64le || BR2_x86_64
+	help
+	  PNOR Flash reading and writing tool for OpenPower servers. Used for
+	  firmware upgrades and extracting diagnostic infromation from flash.

please add

https://github.com/open-power/skiboot

to the help text.

Quoted 6 lines
package/pflash/pflash.mk new file +0 -0
new file mode 100644
index 000000000000..ab19ad699866

package/pflash/pflash.mk line 8

Quoted 8 lines
package/pflash/pflash.mk new file +8 -0
@@ -0,0 +1,32 @@
+################################################################################
+#
+# pflash
+#
+################################################################################
+
+PFLASH_VERSION = skiboot-5.2.4
+

no newline here.

package/pflash/pflash.mk line 10

Quoted 2 lines
package/pflash/pflash.mk new file +2 -0
+PFLASH_SITE = $(call github,open-power,skiboot,$(PFLASH_VERSION))
+PFLASH_INSTALL_STAGING = YES

Do other packages need header files from pflash? If not, it is not necessary to install the package to staging.

Regards, Bernd

#2 lore raw

PATCH 1/1 package/pflash: new package

Quoted 19 lines · Bernd Kuhls

Hi,

Am Mon, 25 Jul 2016 15:31:27 +0930 schrieb Joel Stanley:

package/pflash/Config.in line 6

Quoted 12 lines
package/pflash/Config.in new file +6 -0
new file mode 100644
index 000000000000..315989724088
@@ -0,0 +1,6 @@
+config BR2_PACKAGE_PFLASH
+     bool "pflash"
+     depends on BR2_arm || BR2_powerpc64 || BR2_powerpc64le || BR2_x86_64
+     help
+       PNOR Flash reading and writing tool for OpenPower servers. Used for
+       firmware upgrades and extracting diagnostic infromation from flash.

please add

Quoted 3 lines

https://github.com/open-power/skiboot

to the help text.

Good idea.

Quoted 18 lines
Quoted 7 lines
package/pflash/pflash.mk new file +0 -0
new file mode 100644
index 000000000000..ab19ad699866

package/pflash/pflash.mk line 8

Quoted 8 lines
package/pflash/pflash.mk new file +8 -0
@@ -0,0 +1,32 @@
+################################################################################
+#
+# pflash
+#
+################################################################################
+
+PFLASH_VERSION = skiboot-5.2.4
+

no newline here.

Quoted 5 lines

package/pflash/pflash.mk line 10

Quoted 2 lines
package/pflash/pflash.mk new file +2 -0
+PFLASH_SITE = $(call github,open-power,skiboot,$(PFLASH_VERSION))
+PFLASH_INSTALL_STAGING = YES

Do other packages need header files from pflash? If not, it is not necessary to install the package to staging.

Thanks for the explanation. We don't install any headers so I can drop this.

Thanks for the review!

Cheers,

Joel

Quoted 6 lines

Regards, Bernd

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

#3 lore raw

PATCH v2 1/1 package/pflash: new package

In reply to Joel Stanley

pflash is a tool for reading and writing to the PNOR on OpenPower servers, for firmware upgrades, and extracting diagnostic information.

This includes a fix so that pflash can build with musl, which has been submitted upstream[1].

[1] http://patchwork.ozlabs.org/patch/652168/

---
v2:
- fix whitespcae in pflash.mk
- drop PFLASH_INSTALL_STAGING; we do not install headers and therefore do not need to install the package to staging
- add url to help text

 package/Config.in                                  |  1 +
 ...-pflash-use-atexit-for-musl-compatibility.patch | 42 ++++++++++++++++++++++
 package/pflash/Config.in                           |  8 +++++
 package/pflash/pflash.mk                           | 30 ++++++++++++++++
 4 files changed, 81 insertions(+)
 create mode 100644 package/pflash/0001-pflash-use-atexit-for-musl-compatibility.patch
 create mode 100644 package/pflash/Config.in
 create mode 100644 package/pflash/pflash.mk
package/Config.in +1 -0
index 814141f18784..9f873c31fa58 100644
@@ -426,6 +426,7 @@ endmenu
 	source "package/owl-linux/Config.in"
 	source "package/parted/Config.in"
 	source "package/pciutils/Config.in"
+	source "package/pflash/Config.in"
 	source "package/picocom/Config.in"
 	source "package/pifmrds/Config.in"
 	source "package/powertop/Config.in"
package/pflash/0001-pflash-use-atexit-for-musl-compatibility.patch new file +42 -0

42 lines not on this page · raw message

package/pflash/Config.in new file +8 -0
new file mode 100644
index 000000000000..c1937f2cea32
@@ -0,0 +1,8 @@
+config BR2_PACKAGE_PFLASH
+	bool "pflash"
+	depends on BR2_arm || BR2_powerpc64 || BR2_powerpc64le || BR2_x86_64
+	help
+	  PNOR Flash reading and writing tool for OpenPower servers. Used for
+	  firmware upgrades and extracting diagnostic infromation from flash.
+
+	  https://github.com/open-power/skiboot
package/pflash/pflash.mk new file +30 -0
new file mode 100644
index 000000000000..ce5c546fc043
@@ -0,0 +1,30 @@
+################################################################################
+#
+# pflash
+#
+################################################################################
+
+PFLASH_VERSION = skiboot-5.2.4
+PFLASH_SITE = $(call github,open-power,skiboot,$(PFLASH_VERSION))
+PFLASH_LICENSE = Apache 2.0
+PFLASH_LICENSE_FILE = LICENCE
+
+PFLASH_MAKE_OPTS += CROSS_COMPILE="$(TARGET_CROSS)" \
+		    PFLASH_VERSION=$(PFLASH_VERSION) \
+		    DESTDIR=$(TARGET_DIR) \
+		    -C $(@D)/external/pflash \
+
+# A makefile bug causes recent versions of pflash to fail setting CC and LD
+# based on CROSS_COMPILE. Set CC and LD to remain compatible with those
+# versions.
+PFLASH_MAKE_OPTS += CC=$(TARGET_CC) LD=$(TARGET_LD)
+
+define PFLASH_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) $(PFLASH_MAKE_OPTS) all
+endef
+
+define PFLASH_INSTALL_TARGET_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) $(PFLASH_MAKE_OPTS) install
+endef
+
+$(eval $(generic-package))
Signature · 1 line
2.8.1
#4 lore raw

PATCH 1/1 package/pflash: new package

In reply to Joel Stanley

Hello,

package/pflash/Config.in line 3

Quoted 9 lines · Joel Stanley
package/pflash/Config.in new file +3 -0
new file mode 100644
index 000000000000..315989724088
@@ -0,0 +1,6 @@
+config BR2_PACKAGE_PFLASH
+	bool "pflash"
+	depends on BR2_arm || BR2_powerpc64 || BR2_powerpc64le || BR2_x86_64

Is there something that makes it inherently usable only on those architectures?

Quoted 6 lines
package/pflash/pflash.mk new file +0 -0
new file mode 100644
index 000000000000..ab19ad699866

package/pflash/pflash.mk line 9

Quoted 9 lines
package/pflash/pflash.mk new file +9 -0
@@ -0,0 +1,32 @@
+################################################################################
+#
+# pflash
+#
+################################################################################
+
+PFLASH_VERSION = skiboot-5.2.4
+
+PFLASH_SITE = $(call github,open-power,skiboot,$(PFLASH_VERSION))

So skiboot is a much much larger repository, with lots of other things, and you're building just the external/pflash subdirectory of it.

Are you sure we'll never want to have a package for other things in the skiboot repository?

package/pflash/pflash.mk line 10

Quoted 1 line
package/pflash/pflash.mk new file +1 -0
+PFLASH_INSTALL_STAGING = YES

You're not specifying any PFLASH_INSTALL_STAGING_CMDS, so this is useless.

package/pflash/pflash.mk line 16

Quoted 6 lines
package/pflash/pflash.mk new file +6 -0
+PFLASH_LICENSE = Apache 2.0
+PFLASH_LICENSE_FILE = LICENCE
+
+PFLASH_MAKE_OPTS += CROSS_COMPILE="$(TARGET_CROSS)" \
+		    PFLASH_VERSION=$(PFLASH_VERSION) \
+		    DESTDIR=$(TARGET_DIR) \

DESTDIR should only be passed at install time.

package/pflash/pflash.mk line 17

Quoted 1 line
package/pflash/pflash.mk new file +1 -0
+		    -C $(@D)/external/pflash \

Unneeded trailing \

Also, we prefer the -C option and its argument to be part of the build and install commands themselves.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#5 lore raw

PATCH 1/1 package/pflash: new package

Quoted 4 lines · Thomas Petazzoni

Hello,

On Mon, 25 Jul 2016 15:31:27 +0930, Joel Stanley wrote:

Quoted 12 lines

package/pflash/Config.in line 3

Quoted 9 lines
package/pflash/Config.in new file +3 -0
new file mode 100644
index 000000000000..315989724088
@@ -0,0 +1,6 @@
+config BR2_PACKAGE_PFLASH
+     bool "pflash"
+     depends on BR2_arm || BR2_powerpc64 || BR2_powerpc64le || BR2_x86_64

Is there something that makes it inherently usable only on those architectures?

Yeah, the 'libflash' library selects different backends depending on it's

Quoted 20 lines
Quoted 7 lines
package/pflash/pflash.mk new file +0 -0
new file mode 100644
index 000000000000..ab19ad699866

package/pflash/pflash.mk line 9

Quoted 9 lines
package/pflash/pflash.mk new file +9 -0
@@ -0,0 +1,32 @@
+################################################################################
+#
+# pflash
+#
+################################################################################
+
+PFLASH_VERSION = skiboot-5.2.4
+
+PFLASH_SITE = $(call github,open-power,skiboot,$(PFLASH_VERSION))

So skiboot is a much much larger repository, with lots of other things, and you're building just the external/pflash subdirectory of it.

Quoted 2 lines

Are you sure we'll never want to have a package for other things in the skiboot repository?

We might want to package other tools in the future.

How should I change the packaging of pflash?

Quoted 5 lines

package/pflash/pflash.mk line 10

Quoted 2 lines
package/pflash/pflash.mk new file +1 -0
+PFLASH_INSTALL_STAGING = YES

You're not specifying any PFLASH_INSTALL_STAGING_CMDS, so this is useless.

Thanks for clearing that up. I've fixed it in v2.

Quoted 9 lines

package/pflash/pflash.mk line 16

Quoted 7 lines
package/pflash/pflash.mk new file +6 -0
+PFLASH_LICENSE = Apache 2.0
+PFLASH_LICENSE_FILE = LICENCE
+
+PFLASH_MAKE_OPTS += CROSS_COMPILE="$(TARGET_CROSS)" \
+                 PFLASH_VERSION=$(PFLASH_VERSION) \
+                 DESTDIR=$(TARGET_DIR) \

DESTDIR should only be passed at install time.

Okay.

Quoted 4 lines

package/pflash/pflash.mk line 17

Quoted 2 lines
package/pflash/pflash.mk new file +1 -0
+                 -C $(@D)/external/pflash \

Unneeded trailing \

Okay.

Quoted 3 lines

Also, we prefer the -C option and its argument to be part of the build and install commands themselves.

Even though we would be replicating them for every invocation of make? I think it's better placed in a variable so changes can be made in one place.

Cheers,

Joel

#6 lore raw

PATCH 1/1 package/pflash: new package

Hello,

Quoted 13 lines · Joel Stanley
Quoted 4 lines
Quoted 4 lines
package/pflash/Config.in new file +0 -1
new file mode 100644
index 000000000000..315989724088
--- /dev/null
Quoted 8 lines

package/pflash/Config.in line 3

Quoted 5 lines

+++ b/package/pflash/Config.in

package/pflash/Config.in new file +3 -0
@@ -0,0 +1,6 @@
+config BR2_PACKAGE_PFLASH
+     bool "pflash"
+     depends on BR2_arm || BR2_powerpc64 || BR2_powerpc64le || BR2_x86_64  

Is there something that makes it inherently usable only on those architectures?

Quoted 1 line

Yeah, the 'libflash' library selects different backends depending on it's

OK. But then it makes sense only for pflash itself, and not skitool as the whole I suppose?

Quoted 9 lines
Quoted 5 lines

So skiboot is a much much larger repository, with lots of other things, and you're building just the external/pflash subdirectory of it.

Are you sure we'll never want to have a package for other things in the skiboot repository?

We might want to package other tools in the future.

How should I change the packaging of pflash?

A top-level BR2_PACKAGE_SKITOOL option, with a package called skitool. And then a sub-option BR2_PACKAGE_SKITOOL_PFLASH, which enables the build/installation of pflash.

BR2_PACKAGE_SKITOOL can "select" BR2_PACKAGE_SKITOOL_PFLASH to make sure the package at least installs one thing.

Quoted 6 lines
Quoted 2 lines

Also, we prefer the -C option and its argument to be part of the build and install commands themselves.

Even though we would be replicating them for every invocation of make? I think it's better placed in a variable so changes can be made in one place.

We generally repeat the -C $(@D) in the different invocations, yes. Not sure it's ideal, but that's how we typically do it in most packages.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com