Skip to contentSkip to conversation

package/davinci-bootcount: new package

PATCH RESEND Applied Dario Binacchi via buildroot 3 participants 3 messages Nov 14, 2021 – Dec 11, 2021

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 package/davinci-bootcount: new package

U-Boot implements a boot count scheme that can be used to detect multiple failed attempts to boot Linux. On Davinci platform (TI AM 335x) the `bootcount' value is stored in the RTC SCRATCH2 register. This tool allows to read and write this register from userspace.

---
 package/Config.in                                |  1 +
 package/davinci-bootcount/Config.in              | 11 +++++++++++
 package/davinci-bootcount/davinci-bootcount.hash |  2 ++
 package/davinci-bootcount/davinci-bootcount.mk   | 15 +++++++++++++++
 4 files changed, 29 insertions(+)
 create mode 100644 package/davinci-bootcount/Config.in
 create mode 100644 package/davinci-bootcount/davinci-bootcount.hash
 create mode 100644 package/davinci-bootcount/davinci-bootcount.mk
package/Config.in +1 -0
index cb94e30be3..49a53d44da 100644
@@ -452,6 +452,7 @@ endmenu
 	source "package/cwiid/Config.in"
 	source "package/dahdi-linux/Config.in"
 	source "package/dahdi-tools/Config.in"
+	source "package/davinci-bootcount/Config.in"
 	source "package/dbus/Config.in"
 	source "package/dbus-cpp/Config.in"
 	source "package/dbus-glib/Config.in"
package/davinci-bootcount/Config.in new file +11 -0
new file mode 100644
index 0000000000..da3b3605a0
@@ -0,0 +1,11 @@
+config BR2_PACKAGE_DAVINCI_BOOTCOUNT
+	bool "davinci bootcount"
+	default n
+	help
+	  U-Boot implements a boot count scheme that can be used to
+	  detect multiple failed attempts to boot Linux. On Davinci
+	  platform (TI AM 335x) the `bootcount' is stored in the RTC
+	  SCRATCH2 register. This tool allows to read and write this
+	  register from userspace.
+
+	  https://github.com/VoltServer/uboot-davinci-bootcount
package/davinci-bootcount/davinci-bootcount.hash new file +2 -0
new file mode 100644
index 0000000000..32140c6e62
@@ -0,0 +1,2 @@
+# Locally calculated
+sha256 4e4243bfc773cf983db4b901520b0eb2728934d52d26fcf99f5e22f673373f6a  davinci-bootcount-0973689c7556a953d2b468e4d8d46758c6d467b4-br1.tar.gz
package/davinci-bootcount/davinci-bootcount.mk new file +15 -0
new file mode 100644
index 0000000000..434da494d7
@@ -0,0 +1,15 @@
+################################################################################
+#
+# davinci-bootcount
+#
+################################################################################
+
+DAVINCI_BOOTCOUNT_VERSION = 0973689c7556a953d2b468e4d8d46758c6d467b4
+DAVINCI_BOOTCOUNT_SITE = "https://github.com/VoltServer/uboot-davinci-bootcount"
+DAVINCI_BOOTCOUNT_SITE_METHOD = git
+DAVINCI_BOOTCOUNT_INSTALL_TARGET = YES
+DAVINCI_BOOTCOUNT_LICENSE = GPL-3.0
+DAVINCI_BOOTCOUNT_LICENSE_FILES = COPYING
+DAVINCI_BOOTCOUNT_AUTORECONF = YES
+
+$(eval $(autotools-package))
Signature · 6 lines
2.17.1

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

I always think, a simple package like this, should be easy to apply...

Quoted 6 lines · Dario Binacchi via buildroot

U-Boot implements a boot count scheme that can be used to detect multiple failed attempts to boot Linux. On Davinci platform (TI AM 335x) the `bootcount' value is stored in the RTC SCRATCH2 register. This tool allows to read and write this register from userspace.

Applied to master, thanks, but with quite some changes.

Quoted 5 lines
---
  package/Config.in                                |  1 +
  package/davinci-bootcount/Config.in              | 11 +++++++++++
  package/davinci-bootcount/davinci-bootcount.hash |  2 ++
  package/davinci-bootcount/davinci-bootcount.mk   | 15 +++++++++++++++

It would be nice to add yourself to the DEVELOPERS file [1] for this package.
This way, you'll get an e-mail if the package fails in the autobuilders, or when a new version is released if the package is registered on release-monitoring.org.

Quoted 23 lines
  4 files changed, 29 insertions(+)

create mode 100644 package/davinci-bootcount/Config.in create mode 100644 package/davinci-bootcount/davinci-bootcount.hash create mode 100644 package/davinci-bootcount/davinci-bootcount.mk

package/Config.in +1 -0
index cb94e30be3..49a53d44da 100644
@@ -452,6 +452,7 @@ endmenu
  	source "package/cwiid/Config.in"
  	source "package/dahdi-linux/Config.in"
  	source "package/dahdi-tools/Config.in"
+	source "package/davinci-bootcount/Config.in"
  	source "package/dbus/Config.in"
  	source "package/dbus-cpp/Config.in"
  	source "package/dbus-glib/Config.in"
package/davinci-bootcount/Config.in new file +0 -0
new file mode 100644
index 0000000000..da3b3605a0

package/davinci-bootcount/Config.in line 2

Quoted 2 lines
package/davinci-bootcount/Config.in new file +2 -0
@@ -0,0 +1,11 @@
+config BR2_PACKAGE_DAVINCI_BOOTCOUNT
+	bool "davinci bootcount"

Unless there's a really good reason not to, the prompt should be identical to
the package name.

package/davinci-bootcount/Config.in line 3

Quoted 1 line
package/davinci-bootcount/Config.in new file +1 -0
+	default n

This is the default so it shouldn't be there.

package/davinci-bootcount/Config.in line 9

Quoted 6 lines
package/davinci-bootcount/Config.in new file +6 -0
+	help
+	  U-Boot implements a boot count scheme that can be used to
+	  detect multiple failed attempts to boot Linux. On Davinci
+	  platform (TI AM 335x) the `bootcount' is stored in the RTC
+	  SCRATCH2 register. This tool allows to read and write this
+	  register from userspace.

Great description!

Since this package is poking directly into /dev/mem, perhaps it would be good
to add an arch dependency to Config.in so it can only be built if it's the davinci CPU. I have no idea what the appropriate dependency would be, so I left it unchanged.

package/davinci-bootcount/davinci-bootcount.hash line 2

Quoted 10 lines
package/davinci-bootcount/Config.in new file +2 -0
+
+	  https://github.com/VoltServer/uboot-davinci-bootcount
package/davinci-bootcount/davinci-bootcount.hash new file +2 -0
new file mode 100644
index 0000000000..32140c6e62
@@ -0,0 +1,2 @@
+# Locally calculated
+sha256 4e4243bfc773cf983db4b901520b0eb2728934d52d26fcf99f5e22f673373f6a  davinci-bootcount-0973689c7556a953d2b468e4d8d46758c6d467b4-br1.tar.gz

Please use two spaces between the columns in the hash file (this is something
we haven't documented yet, unfortunately).

Also, you must include a hash for the license files.

Quoted 6 lines
package/davinci-bootcount/davinci-bootcount.mk new file +0 -0
new file mode 100644
index 0000000000..434da494d7

package/davinci-bootcount/davinci-bootcount.mk line 8

Quoted 8 lines
package/davinci-bootcount/davinci-bootcount.mk new file +8 -0
@@ -0,0 +1,15 @@
+################################################################################
+#
+# davinci-bootcount
+#
+################################################################################
+
+DAVINCI_BOOTCOUNT_VERSION = 0973689c7556a953d2b468e4d8d46758c6d467b4
+DAVINCI_BOOTCOUNT_SITE = "https://github.com/VoltServer/uboot-davinci-bootcount"

No quotes are needed.

Also, please use the github helper (which BTW also makes the SITE_METHOD
redundant, and of course changes the has).

package/davinci-bootcount/davinci-bootcount.mk line 10

Quoted 2 lines
package/davinci-bootcount/davinci-bootcount.mk new file +2 -0
+DAVINCI_BOOTCOUNT_SITE_METHOD = git
+DAVINCI_BOOTCOUNT_INSTALL_TARGET = YES

This is redundant because it is default. check-package reports that. Please
use check-package.

package/davinci-bootcount/davinci-bootcount.mk line 13

Quoted 3 lines
package/davinci-bootcount/davinci-bootcount.mk new file +3 -0
+DAVINCI_BOOTCOUNT_LICENSE = GPL-3.0
+DAVINCI_BOOTCOUNT_LICENSE_FILES = COPYING
+DAVINCI_BOOTCOUNT_AUTORECONF = YES

We (almost) always put a comment before the AUTORECONF to explain why it is
needed.

# sources fetched from github, no configure script

I made all of those changes, so please double-check that what is in master is
still OK. I did not, however, add you to DEVELOPERS or add an arch dependency.

package/davinci-bootcount/davinci-bootcount.mk line 15

Quoted 3 lines
package/davinci-bootcount/davinci-bootcount.mk new file +2 -0
+
+$(eval $(autotools-package))

[1] https://buildroot.org/downloads/manual/manual.html#DEVELOPERS

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

#2 lore raw

Hello Arnout,

Quoted 6 lines · On Sat, 11 Dec 2021 10:02:31 +0100 Arnout Vandecappelle <[email protected]> wrote:
Quoted 4 lines
  package/Config.in                                |  1 +
  package/davinci-bootcount/Config.in              | 11 +++++++++++
  package/davinci-bootcount/davinci-bootcount.hash |  2 ++
  package/davinci-bootcount/davinci-bootcount.mk   | 15 +++++++++++++++  

It would be nice to add yourself to the DEVELOPERS file [1] for this package.

I don't think it's "nice". To me, it is mandatory now to be added in the DEVELOPERS file when contributing a new package. When I merge a patch adding a new package, if the contributor has forgotten the entry in the DEVELOPERS file, I always add it when applying.

Quoted 2 lines

Please use two spaces between the columns in the hash file (this is something
we haven't documented yet, unfortunately).

It is documented. See
https://buildroot.org/downloads/manual/manual.html#adding-packages-hash
in the Buildroot manual, which states:

The format of this file is one line for each file for which to check the hash, each line with the following three fields separated by two spaces:

Best regards,

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