Skip to contentSkip to conversation

package/mhz: add new package

PATCH Superseded Robert Marko 2 participants 4 messages Jul 31, 2023

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 package/mhz: add new package

mhz is a tool to mathematically calculate the real running CPU frequency and as such has proved as invaluable tool for developing CPUFreq and similar features in the kernel.

Its source finally got a license recently so it can be packaged.

---
Changes in v2:
* Use the Makefile from source and override CC and CFLAGS

---
 package/Config.in     |  1 +
 package/mhz/Config.in |  6 ++++++
 package/mhz/mhz.hash  |  2 ++
 package/mhz/mhz.mk    | 21 +++++++++++++++++++++
 4 files changed, 30 insertions(+)
 create mode 100644 package/mhz/Config.in
 create mode 100644 package/mhz/mhz.hash
 create mode 100644 package/mhz/mhz.mk
package/Config.in +1 -0
index a60a1a8858..b9b6dd2580 100644
@@ -549,6 +549,7 @@ endmenu
 	source "package/memtest86/Config.in"
 	source "package/memtester/Config.in"
 	source "package/memtool/Config.in"
+	source "package/mhz/Config.in"
 	source "package/minicom/Config.in"
 	source "package/msr-tools/Config.in"
 	source "package/nanocom/Config.in"
package/mhz/Config.in new file +6 -0
new file mode 100644
index 0000000000..2f4af5026e
@@ -0,0 +1,6 @@
+config BR2_PACKAGE_MHZ
+	bool "mhz"
+	help
+	  CPU frequency measurement utility.
+
+	  https://github.com/wtarreau/mhz.git
package/mhz/mhz.hash new file +2 -0
new file mode 100644
index 0000000000..6b39eb4bb7
@@ -0,0 +1,2 @@
+# Locally calculated
+sha256  1e07bb0d455d63fd33fb87a24f65a803c7c2d920fde4e5b5378b8c1b07de3b47  mhz-11aac2399780a1f7ea9f007b14af0464797d5cf1-br1.tar.gz
package/mhz/mhz.mk new file +21 -0
new file mode 100644
index 0000000000..924bf0793e
@@ -0,0 +1,21 @@
+################################################################################
+#
+# mhz
+#
+################################################################################
+
+MHZ_VERSION = 11aac2399780a1f7ea9f007b14af0464797d5cf1
+MHZ_SITE = https://github.com/wtarreau/mhz.git
+MHZ_SITE_METHOD = git
+MHZ_LICENSE = MIT/X11
+MHZ_LICENSE_FILES = LICENSE
+
+define MHZ_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) CC="$(TARGET_CC)" CFLAGS="$(TARGET_CFLAGS) $(TARGET_LDFLAGS)" -C $(@D)
+endef
+
+define MHZ_INSTALL_TARGET_CMDS
+	$(INSTALL) $(@D)/mhz $(TARGET_DIR)/usr/bin/mhz
+endef
+
+$(eval $(generic-package))
Signature · 6 lines
2.41.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

Hi Robert,

Quoted 50 lines · Robert Marko

mhz is a tool to mathematically calculate the real running CPU frequency and as such has proved as invaluable tool for developing CPUFreq and similar features in the kernel.

Its source finally got a license recently so it can be packaged.

---
Changes in v2:
* Use the Makefile from source and override CC and CFLAGS

---
 package/Config.in     |  1 +
 package/mhz/Config.in |  6 ++++++
 package/mhz/mhz.hash  |  2 ++
 package/mhz/mhz.mk    | 21 +++++++++++++++++++++
 4 files changed, 30 insertions(+)
 create mode 100644 package/mhz/Config.in
 create mode 100644 package/mhz/mhz.hash
 create mode 100644 package/mhz/mhz.mk
package/Config.in +1 -0
index a60a1a8858..b9b6dd2580 100644
@@ -549,6 +549,7 @@ endmenu
 	source "package/memtest86/Config.in"
 	source "package/memtester/Config.in"
 	source "package/memtool/Config.in"
+	source "package/mhz/Config.in"
 	source "package/minicom/Config.in"
 	source "package/msr-tools/Config.in"
 	source "package/nanocom/Config.in"
package/mhz/Config.in new file +6 -0
new file mode 100644
index 0000000000..2f4af5026e
@@ -0,0 +1,6 @@
+config BR2_PACKAGE_MHZ
+	bool "mhz"
+	help
+	  CPU frequency measurement utility.
+
+	  https://github.com/wtarreau/mhz.git
package/mhz/mhz.hash new file +0 -0
new file mode 100644
index 0000000000..6b39eb4bb7

package/mhz/mhz.hash line 2

Quoted 2 lines
package/mhz/mhz.hash new file +2 -0
@@ -0,0 +1,2 @@
+# Locally calculated
+sha256  1e07bb0d455d63fd33fb87a24f65a803c7c2d920fde4e5b5378b8c1b07de3b47  mhz-11aac2399780a1f7ea9f007b14af0464797d5cf1-br1.tar.gz

License file hash is missing here.

Quoted 6 lines
package/mhz/mhz.mk new file +0 -0
new file mode 100644
index 0000000000..924bf0793e

package/mhz/mhz.mk line 9

Quoted 9 lines
package/mhz/mhz.mk new file +9 -0
@@ -0,0 +1,21 @@
+################################################################################
+#
+# mhz
+#
+################################################################################
+
+MHZ_VERSION = 11aac2399780a1f7ea9f007b14af0464797d5cf1
+MHZ_SITE = https://github.com/wtarreau/mhz.git
+MHZ_SITE_METHOD = git

You should use the github helper instead. Something like

  MHZ_SITE = $(call github,wtarreau,mhz,$(MHZ_VERSION))

package/mhz/mhz.mk line 14

Quoted 5 lines
package/mhz/mhz.mk new file +5 -0
+MHZ_LICENSE = MIT/X11
+MHZ_LICENSE_FILES = LICENSE
+
+define MHZ_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) CC="$(TARGET_CC)" CFLAGS="$(TARGET_CFLAGS) $(TARGET_LDFLAGS)" -C $(@D)

Are you sure you need TARGET_LDFLAGS here?

baruch

Quoted 7 lines
package/mhz/mhz.mk new file +7 -0
+endef
+
+define MHZ_INSTALL_TARGET_CMDS
+	$(INSTALL) $(@D)/mhz $(TARGET_DIR)/usr/bin/mhz
+endef
+
+$(eval $(generic-package))
Signature · 7 lines
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - [email protected] - tel: +972.52.368.4656, http://www.tkos.co.il -
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw
Quoted 4 lines · On Mon, 31 Jul 2023 15:24:14 +0300 Baruch Siach <[email protected]> wrote:

package/mhz/mhz.mk line 14

Quoted 2 lines
package/mhz/mhz.mk new file +2 -0
+define MHZ_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) CC="$(TARGET_CC)" CFLAGS="$(TARGET_CFLAGS) $(TARGET_LDFLAGS)" -C $(@D)  

Are you sure you need TARGET_LDFLAGS here?

What about:

	$(TARGET_MAKE_ENV) $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D)

This will also pass LDFLAGS, which is used by the upstream Makefile.

Thoams

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#3 lore raw
In reply to Robert Marko

Hello Robert,

Quoted 10 lines · On Mon, 31 Jul 2023 14:20:22 +0200 Robert Marko <[email protected]> wrote:

mhz is a tool to mathematically calculate the real running CPU frequency and as such has proved as invaluable tool for developing CPUFreq and similar features in the kernel.

Its source finally got a license recently so it can be packaged.

---
Changes in v2:
* Use the Makefile from source and override CC and CFLAGS

Quoted 9 lines
---
 package/Config.in     |  1 +
 package/mhz/Config.in |  6 ++++++
 package/mhz/mhz.hash  |  2 ++
 package/mhz/mhz.mk    | 21 +++++++++++++++++++++
 4 files changed, 30 insertions(+)
 create mode 100644 package/mhz/Config.in
 create mode 100644 package/mhz/mhz.hash
 create mode 100644 package/mhz/mhz.mk

On top of what Baruch said, you also need to add an entry in the DEVELOPERS file.

package/mhz/mhz.mk line 18

Quoted 2 lines
package/mhz/mhz.mk new file +2 -0
+define MHZ_INSTALL_TARGET_CMDS
+	$(INSTALL) $(@D)/mhz $(TARGET_DIR)/usr/bin/mhz
	$(INSTALL) -D -m0755 $(@D)/mhz $(TARGET_DIR)/usr/bin/mhz

is preferred here.

Thanks!

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot