diff mbox series

[RESEND,1/1] package/davinci-bootcount: new package

Message ID 20211114175310.30573-1-dariobin@libero.it
State Accepted
Headers show
Series [RESEND,1/1] package/davinci-bootcount: new package | expand

Commit Message

Dario Binacchi Nov. 14, 2021, 5:53 p.m. UTC
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.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
---
 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

Comments

Arnout Vandecappelle Dec. 11, 2021, 9:02 a.m. UTC | #1
I always think, a simple package like this, should be easy to apply...

On 14/11/2021 18:53, Dario Binacchi via buildroot wrote:
> 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.
> 
> Signed-off-by: Dario Binacchi <dariobin@libero.it>

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


> ---
>   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.

>   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
> 
> diff --git a/package/Config.in b/package/Config.in
> index cb94e30be3..49a53d44da 100644
> --- a/package/Config.in
> +++ b/package/Config.in
> @@ -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"
> diff --git a/package/davinci-bootcount/Config.in b/package/davinci-bootcount/Config.in
> new file mode 100644
> index 0000000000..da3b3605a0
> --- /dev/null
> +++ b/package/davinci-bootcount/Config.in
> @@ -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.

> +	default n

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

> +	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.

> +
> +	  https://github.com/VoltServer/uboot-davinci-bootcount
> diff --git a/package/davinci-bootcount/davinci-bootcount.hash b/package/davinci-bootcount/davinci-bootcount.hash
> new file mode 100644
> index 0000000000..32140c6e62
> --- /dev/null
> +++ b/package/davinci-bootcount/davinci-bootcount.hash
> @@ -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.

> diff --git a/package/davinci-bootcount/davinci-bootcount.mk b/package/davinci-bootcount/davinci-bootcount.mk
> new file mode 100644
> index 0000000000..434da494d7
> --- /dev/null
> +++ b/package/davinci-bootcount/davinci-bootcount.mk
> @@ -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).

> +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.

> +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.

> +
> +$(eval $(autotools-package))
> 

[1] https://buildroot.org/downloads/manual/manual.html#DEVELOPERS
Thomas Petazzoni Dec. 11, 2021, 10:02 a.m. UTC | #2
Hello Arnout,

On Sat, 11 Dec 2021 10:02:31 +0100
Arnout Vandecappelle <arnout@mind.be> wrote:

> >   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.

>   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
diff mbox series

Patch

diff --git a/package/Config.in b/package/Config.in
index cb94e30be3..49a53d44da 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -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"
diff --git a/package/davinci-bootcount/Config.in b/package/davinci-bootcount/Config.in
new file mode 100644
index 0000000000..da3b3605a0
--- /dev/null
+++ b/package/davinci-bootcount/Config.in
@@ -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
diff --git a/package/davinci-bootcount/davinci-bootcount.hash b/package/davinci-bootcount/davinci-bootcount.hash
new file mode 100644
index 0000000000..32140c6e62
--- /dev/null
+++ b/package/davinci-bootcount/davinci-bootcount.hash
@@ -0,0 +1,2 @@ 
+# Locally calculated
+sha256 4e4243bfc773cf983db4b901520b0eb2728934d52d26fcf99f5e22f673373f6a  davinci-bootcount-0973689c7556a953d2b468e4d8d46758c6d467b4-br1.tar.gz
diff --git a/package/davinci-bootcount/davinci-bootcount.mk b/package/davinci-bootcount/davinci-bootcount.mk
new file mode 100644
index 0000000000..434da494d7
--- /dev/null
+++ b/package/davinci-bootcount/davinci-bootcount.mk
@@ -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))