Skip to contentSkip to conversation

rtc-tools: Add a recipe

PATCH Khem Raj 3 participants 4 messages Jan 26, 2022 – Jan 27, 2022 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Khem Raj

author
#1 lore raw
Quoted 43 lines · Fabio Estevam

rtc-tools is a useful utility developed by Alexandre Belloni for testing RTC kernel drivers, such as y2038 support.

Based on the initial recipe from Heiko Schocher <[email protected]>.

---
Changes since v1:
- None: just sent it to oe-devel as suggested by Khem.

 .../0001-rtc-tools-Add-a-Makefile.patch       | 52 +++++++++++++++++++
 .../rtc-tools/rtc-tools_1.0.0.bb              | 19 +++++++
 2 files changed, 71 insertions(+)
 create mode 100644 meta-oe/recipes-support/rtc-tools/rtc-tools/0001-rtc-tools-Add-a-Makefile.patch
 create mode 100644 meta-oe/recipes-support/rtc-tools/rtc-tools_1.0.0.bb
meta-oe/recipes-support/rtc-tools/rtc-tools/0001-rtc-tools-Add-a-Makefile.patch new file +20 -0
new file mode 100644
index 000000000000..a372e390efb9
@@ -0,0 +1,52 @@
+From faa6dd2e4d063afcaa19f16740a3fc413a399e60 Mon Sep 17 00:00:00 2001
+From: Fabio Estevam <[email protected]>
+Date: Sun, 23 Jan 2022 09:22:19 -0300
+Subject: [PATCH rtc-tools] rtc-tools: Add a Makefile
+
+Add a Makefile to make installation and uninstallation
+process easier.
+
+Upstream-Status: Submitted [https://marc.info/?l=linux-rtc&m=164294073129803&w=2]
+Signed-off-by: Fabio Estevam <[email protected]>
+---
+ Makefile | 29 +++++++++++++++++++++++++++++
+ 1 file changed, 29 insertions(+)
+ create mode 100644 Makefile
+
+diff --git a/Makefile b/Makefile
+new file mode 100644
+index 000000000000..4f244d9289f1
+--- /dev/null
++++ b/Makefile

meta-oe/recipes-support/rtc-tools/rtc-tools/0001-rtc-tools-Add-a-Makefile.patch line 30

Quoted 10 lines
meta-oe/recipes-support/rtc-tools/rtc-tools/0001-rtc-tools-Add-a-Makefile.patch new file +10 -0
+@@ -0,0 +1,29 @@
++prefix ?= /usr
++bindir ?= $(prefix)/bin
++
++EXEC = rtc-range rtc rtc-sync
++
++all: $(EXEC)
++
++rtc-range: rtc-range.c
++      $(CC) $(CFLAGS) -o $@ rtc-range.c

perhaps you should also be using LDFLAGS here.

meta-oe/recipes-support/rtc-tools/rtc-tools/0001-rtc-tools-Add-a-Makefile.patch line 33

Quoted 3 lines
meta-oe/recipes-support/rtc-tools/rtc-tools/0001-rtc-tools-Add-a-Makefile.patch new file +3 -0
++
++rtc: rtc.c
++      $(CC) $(CFLAGS) -o $@ rtc.c

here

meta-oe/recipes-support/rtc-tools/rtc-tools/0001-rtc-tools-Add-a-Makefile.patch line 37

Quoted 4 lines
meta-oe/recipes-support/rtc-tools/rtc-tools/0001-rtc-tools-Add-a-Makefile.patch new file +4 -0
++
++rtc-sync: rtc-sync.c
++      $(CC) $(CFLAGS) -o $@ rtc-sync.c
++

and here

Quoted 23 lines
meta-oe/recipes-support/rtc-tools/rtc-tools/0001-rtc-tools-Add-a-Makefile.patch new file +15 -0
++clean:
++      rm -f $(EXEC)
++
++install: rtc-range rtc rtc-sync
++      mkdir -p '$(DESTDIR)$(bindir)'
++      install -m755 rtc-range '$(DESTDIR)$(bindir)/rtc-range'
++      install -m755 rtc '$(DESTDIR)$(bindir)/rtc'
++      install -m755 rtc-sync '$(DESTDIR)$(bindir)/rtc-sync'
++
++uninstall:
++      rm -rf '$(DESTDIR)$(bindir)/rtc-range'
++      rm -rf '$(DESTDIR)$(bindir)/rtc'
++      rm -rf '$(DESTDIR)$(bindir)/rtc-sync'
+--
+2.25.1
meta-oe/recipes-support/rtc-tools/rtc-tools_1.0.0.bb new file +2 -0
new file mode 100644
index 000000000000..8f0326829d8c
@@ -0,0 +1,19 @@
+DESCRIPTION = "Useful programs to test rtc drivers"
+LICENSE = "GPLv2"

meta-oe/recipes-support/rtc-tools/rtc-tools_1.0.0.bb line 12

Quoted 10 lines
meta-oe/recipes-support/rtc-tools/rtc-tools_1.0.0.bb new file +10 -0
+LIC_FILES_CHKSUM = "file://COPYING;md5=74274e8a218423e49eefdea80bc55038"
+
+SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/rtc-tools.git;protocol=https;branch=master \
+           file://0001-rtc-tools-Add-a-Makefile.patch \
+           "
+SRCREV ?= "acc442e7af4e1e783432a43d37f1a7938c692659"
+
+S = "${WORKDIR}/git"
+
+TARGET_CC_ARCH += "${LDFLAGS}"

this may not be needed if above changes are made.

meta-oe/recipes-support/rtc-tools/rtc-tools_1.0.0.bb line 14

Quoted 2 lines
meta-oe/recipes-support/rtc-tools/rtc-tools_1.0.0.bb new file +2 -0
+EXTRA_OEMAKE = " \
+       DESTDIR=${D} \

DESTDIR=${D} should perhaps already be part of oe_runmake

Quoted 8 lines
meta-oe/recipes-support/rtc-tools/rtc-tools_1.0.0.bb new file +5 -1
+       all \
+       "
+do_install() {
+       oe_runmake install
+}
--

2.25.1

#2 lore raw

Em qua., 26 de jan. de 2022 às 15:32, Khem Raj <[email protected]> escreveu:

Quoted 3 lines

Review

Quoted 3 lines
(quoted diff) +3 -0
+do_install() {
+       oe_runmake install
+}

IIRC this is the default so EXTRA_OEMAKE (removing this task) would just work.

Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9 9981-7854          Mobile: +1 (347) 903-9750
#3 lore raw
Quoted 10 lines

-----Original Message-----
From: [email protected] <openembedded- [email protected]> On Behalf Of Otavio Salvador
Sent: den 26 januari 2022 20:01
To: Khem Raj <[email protected]>
Cc: Fabio Estevam <[email protected]>; openembeded-devel <openembedded- [email protected]>; Heiko Schocher <[email protected]>; Alexandre BELLONI <[email protected]>
Subject: Re: [oe] [PATCH v2 meta-oe] rtc-tools: Add a recipe

Quoted 8 lines

Em qua., 26 de jan. de 2022 às 15:32, Khem Raj <[email protected]> escreveu:

Quoted 3 lines

Review

Quoted 3 lines
(quoted diff) +3 -0
+do_install() {
+       oe_runmake install
+}

IIRC this is the default so EXTRA_OEMAKE (removing this task) would just work.

No. There is a default base_do_compile() in base.bbclass that runs oe_runmake if a Makefile exists, but the default base_do_install() does nothing.

//Peter

#4 lore raw
In reply to Khem Raj
Quoted 68 lines

-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Khem Raj
Sent: den 26 januari 2022 19:33
To: Fabio Estevam <[email protected]>
Cc: openembeded-devel <[email protected]>; Otavio Salvador <[email protected]>; Heiko Schocher <[email protected]>; Alexandre BELLONI <[email protected]>
Subject: Re: [oe] [PATCH v2 meta-oe] rtc-tools: Add a recipe

Quoted 43 lines · Fabio Estevam

rtc-tools is a useful utility developed by Alexandre Belloni for testing RTC kernel drivers, such as y2038 support.

Based on the initial recipe from Heiko Schocher <[email protected]>.

---
Changes since v1:
- None: just sent it to oe-devel as suggested by Khem.

 .../0001-rtc-tools-Add-a-Makefile.patch       | 52 +++++++++++++++++++
 .../rtc-tools/rtc-tools_1.0.0.bb              | 19 +++++++
 2 files changed, 71 insertions(+)
 create mode 100644 meta-oe/recipes-support/rtc-tools/rtc-tools/0001-rtc-tools-Add-a-Makefile.patch
 create mode 100644 meta-oe/recipes-support/rtc-tools/rtc-tools_1.0.0.bb
meta-oe/recipes-support/rtc-tools/rtc-tools/0001-rtc-tools-Add-a-Makefile.patch new file +20 -0
new file mode 100644
index 000000000000..a372e390efb9
@@ -0,0 +1,52 @@
+From faa6dd2e4d063afcaa19f16740a3fc413a399e60 Mon Sep 17 00:00:00 2001
+From: Fabio Estevam <[email protected]>
+Date: Sun, 23 Jan 2022 09:22:19 -0300
+Subject: [PATCH rtc-tools] rtc-tools: Add a Makefile
+
+Add a Makefile to make installation and uninstallation
+process easier.
+
+Upstream-Status: Submitted [https://marc.info/?l=linux-rtc&m=164294073129803&w=2]
+Signed-off-by: Fabio Estevam <[email protected]>
+---
+ Makefile | 29 +++++++++++++++++++++++++++++
+ 1 file changed, 29 insertions(+)
+ create mode 100644 Makefile
+
+diff --git a/Makefile b/Makefile
+new file mode 100644
+index 000000000000..4f244d9289f1
+--- /dev/null
++++ b/Makefile

meta-oe/recipes-support/rtc-tools/rtc-tools/0001-rtc-tools-Add-a-Makefile.patch line 30

Quoted 10 lines
meta-oe/recipes-support/rtc-tools/rtc-tools/0001-rtc-tools-Add-a-Makefile.patch new file +10 -0
+@@ -0,0 +1,29 @@
++prefix ?= /usr
++bindir ?= $(prefix)/bin
++
++EXEC = rtc-range rtc rtc-sync
++
++all: $(EXEC)
++
++rtc-range: rtc-range.c
++      $(CC) $(CFLAGS) -o $@ rtc-range.c

perhaps you should also be using LDFLAGS here.

meta-oe/recipes-support/rtc-tools/rtc-tools/0001-rtc-tools-Add-a-Makefile.patch line 33

Quoted 3 lines
meta-oe/recipes-support/rtc-tools/rtc-tools/0001-rtc-tools-Add-a-Makefile.patch new file +3 -0
++
++rtc: rtc.c
++      $(CC) $(CFLAGS) -o $@ rtc.c
Quoted 8 lines

here

meta-oe/recipes-support/rtc-tools/rtc-tools/0001-rtc-tools-Add-a-Makefile.patch line 37

Quoted 4 lines
meta-oe/recipes-support/rtc-tools/rtc-tools/0001-rtc-tools-Add-a-Makefile.patch new file +4 -0
++
++rtc-sync: rtc-sync.c
++      $(CC) $(CFLAGS) -o $@ rtc-sync.c
++

and here

Actually, it is better to just remove the three rules above. Make has a built in rule to build a binary from a C source file.

Quoted 2 lines

meta-oe/recipes-support/rtc-tools/rtc-tools/0001-rtc-tools-Add-a-Makefile.patch line 39

Quoted 2 lines
meta-oe/recipes-support/rtc-tools/rtc-tools/0001-rtc-tools-Add-a-Makefile.patch new file +2 -0
++clean:
++      rm -f $(EXEC)

Change to:

clean:

	$(RM) $(EXEC)
Quoted 6 lines

meta-oe/recipes-support/rtc-tools/rtc-tools/0001-rtc-tools-Add-a-Makefile.patch line 45

Quoted 6 lines
meta-oe/recipes-support/rtc-tools/rtc-tools/0001-rtc-tools-Add-a-Makefile.patch new file +6 -0
++
++install: rtc-range rtc rtc-sync
++      mkdir -p '$(DESTDIR)$(bindir)'
++      install -m755 rtc-range '$(DESTDIR)$(bindir)/rtc-range'
++      install -m755 rtc '$(DESTDIR)$(bindir)/rtc'
++      install -m755 rtc-sync '$(DESTDIR)$(bindir)/rtc-sync'

Change to:

install:

	install -d $(DESTDIR)$(bindir)
	install $(EXEC) $(DESTDIR)$(bindir)

The install target should not have any dependencies or it might build them in pseudo context.

Quoted 5 lines

meta-oe/recipes-support/rtc-tools/rtc-tools/0001-rtc-tools-Add-a-Makefile.patch line 50

Quoted 5 lines
meta-oe/recipes-support/rtc-tools/rtc-tools/0001-rtc-tools-Add-a-Makefile.patch new file +5 -0
++
++uninstall:
++      rm -rf '$(DESTDIR)$(bindir)/rtc-range'
++      rm -rf '$(DESTDIR)$(bindir)/rtc'
++      rm -rf '$(DESTDIR)$(bindir)/rtc-sync'

Change to:

uninstall:

	$(RM) -r $(addprefix $(DESTDIR)$(bindir),$(EXEC))
Quoted 9 lines

meta-oe/recipes-support/rtc-tools/rtc-tools_1.0.0.bb line 1

Quoted 9 lines
meta-oe/recipes-support/rtc-tools/rtc-tools/0001-rtc-tools-Add-a-Makefile.patch new file +2 -0
+--
+2.25.1
meta-oe/recipes-support/rtc-tools/rtc-tools_1.0.0.bb new file +1 -0
new file mode 100644
index 000000000000..8f0326829d8c
@@ -0,0 +1,19 @@
+DESCRIPTION = "Useful programs to test rtc drivers"

Change "DESCRIPTION" to "SUMMARY".

Quoted 1 line

meta-oe/recipes-support/rtc-tools/rtc-tools_1.0.0.bb line 2

Quoted 1 line
meta-oe/recipes-support/rtc-tools/rtc-tools_1.0.0.bb new file +1 -0
+LICENSE = "GPLv2"

Change "GPLv2" to "GPL-2.0-only".

Quoted 3 lines

meta-oe/recipes-support/rtc-tools/rtc-tools_1.0.0.bb line 5

Quoted 3 lines
meta-oe/recipes-support/rtc-tools/rtc-tools_1.0.0.bb new file +3 -0
+LIC_FILES_CHKSUM = "file://COPYING;md5=74274e8a218423e49eefdea80bc55038"
+
+SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/rtc-tools.git;protocol=https;branch=master \

Change "rtc-tools" to "${BPN}".

Quoted 3 lines

meta-oe/recipes-support/rtc-tools/rtc-tools_1.0.0.bb line 8

Quoted 3 lines
meta-oe/recipes-support/rtc-tools/rtc-tools_1.0.0.bb new file +3 -0
+           file://0001-rtc-tools-Add-a-Makefile.patch \
+           "
+SRCREV ?= "acc442e7af4e1e783432a43d37f1a7938c692659"

Change "?=" to "=".

Quoted 6 lines

meta-oe/recipes-support/rtc-tools/rtc-tools_1.0.0.bb line 12

Quoted 4 lines
meta-oe/recipes-support/rtc-tools/rtc-tools_1.0.0.bb new file +4 -0
+
+S = "${WORKDIR}/git"
+
+TARGET_CC_ARCH += "${LDFLAGS}"

this may not be needed if above changes are made.

Correct. Remove it.

Quoted 4 lines

meta-oe/recipes-support/rtc-tools/rtc-tools_1.0.0.bb line 14

Quoted 2 lines
meta-oe/recipes-support/rtc-tools/rtc-tools_1.0.0.bb new file +2 -0
+EXTRA_OEMAKE = " \
+       DESTDIR=${D} \

DESTDIR=${D} should perhaps already be part of oe_runmake

No, it isn't by default.

Quoted 2 lines

meta-oe/recipes-support/rtc-tools/rtc-tools_1.0.0.bb line 15

Quoted 2 lines
meta-oe/recipes-support/rtc-tools/rtc-tools_1.0.0.bb new file +1 -0
+       all \

Remove "all", and rewrite this as:

EXTRA_OEMAKE = "DESTDIR=${D}"

Quoted 6 lines
Quoted 6 lines
meta-oe/recipes-support/rtc-tools/rtc-tools_1.0.0.bb new file +4 -1
+       "
+do_install() {
+       oe_runmake install
+}
--

2.25.1

//Peter