All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] package/earlyoom: new package
@ 2020-05-29  1:54 Joseph Kogut
  2020-05-29 12:09 ` Matthew Weber
  2020-06-08 17:58 ` [Buildroot] [PATCH v2 " Joseph Kogut
  0 siblings, 2 replies; 9+ messages in thread
From: Joseph Kogut @ 2020-05-29  1:54 UTC (permalink / raw)
  To: buildroot

EarlyOOM daemon for triggering Linux OOM killer before running out of
memory, avoiding situations where the machine becomes unresponsive from
out of control swapping.

Signed-off-by: Joseph Kogut <joseph.kogut@gmail.com>
---
 DEVELOPERS                     |  1 +
 package/Config.in              |  1 +
 package/earlyoom/Config.in     |  9 +++++++++
 package/earlyoom/earlyoom.hash |  4 ++++
 package/earlyoom/earlyoom.mk   | 37 ++++++++++++++++++++++++++++++++++
 5 files changed, 52 insertions(+)
 create mode 100644 package/earlyoom/Config.in
 create mode 100644 package/earlyoom/earlyoom.hash
 create mode 100644 package/earlyoom/earlyoom.mk

diff --git a/DEVELOPERS b/DEVELOPERS
index 0f1574c930..3e749e764b 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1388,6 +1388,7 @@ N:	Joseph Kogut <joseph.kogut@gmail.com>
 F:	package/at-spi2-atk/
 F:	package/at-spi2-core/
 F:	package/clang/
+F:	package/earlyoom/
 F:	package/gconf/
 F:	package/libnss/
 F:	package/lld/
diff --git a/package/Config.in b/package/Config.in
index c245abbc42..0f1da74e0f 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -2338,6 +2338,7 @@ menu "System tools"
 	source "package/docker-containerd/Config.in"
 	source "package/docker-engine/Config.in"
 	source "package/docker-proxy/Config.in"
+	source "package/earlyoom/Config.in"
 	source "package/efibootmgr/Config.in"
 	source "package/efivar/Config.in"
 	source "package/emlog/Config.in"
diff --git a/package/earlyoom/Config.in b/package/earlyoom/Config.in
new file mode 100644
index 0000000000..abb720437c
--- /dev/null
+++ b/package/earlyoom/Config.in
@@ -0,0 +1,9 @@
+config BR2_PACKAGE_EARLYOOM
+	bool "earlyoom"
+	help
+	  Early OOM daemon for Linux.
+
+	  User space daemon for triggering Linux OOM killer
+	  before running out of memory, avoiding situations
+	  where the machine becomes unresponsive from out of
+	  control swapping.
diff --git a/package/earlyoom/earlyoom.hash b/package/earlyoom/earlyoom.hash
new file mode 100644
index 0000000000..4cafe50bc3
--- /dev/null
+++ b/package/earlyoom/earlyoom.hash
@@ -0,0 +1,4 @@
+# locally calculated
+sha256 b81804fc4470f996014d52252a87a1cf3b43d3d8754140035b10dcee349302b8  earlyoom-1.6.tar.gz
+# License files, locally calculated
+sha256 e730b3ec729de46d987ae73f30ed337e4cbe832f09205330acfa71848c6e0087  LICENSE
diff --git a/package/earlyoom/earlyoom.mk b/package/earlyoom/earlyoom.mk
new file mode 100644
index 0000000000..bea59bd416
--- /dev/null
+++ b/package/earlyoom/earlyoom.mk
@@ -0,0 +1,37 @@
+################################################################################
+#
+# earlyoom
+#
+################################################################################
+
+EARLYOOM_VERSION = 1.6
+EARLYOOM_SITE = $(call github,rfjakob,earlyoom,v$(EARLYOOM_VERSION))
+EARLYOOM_LICENSE = MIT
+EARLYOOM_LICENSE_FILES = LICENSE
+
+EARLYOOM_MAKE_OPTS = \
+	CC=$(TARGET_CC) \
+	DESTDIR=$(TARGET_DIR) \
+	VERSION=$(EARLYOOM_VERSION) \
+	PREFIX=/usr \
+	SYSTEMDUNITDIR=/usr/lib/systemd/system
+
+define EARLYOOM_CONFIGURE_CMDS
+	$(SED) "/systemctl/d" $(EARLYOOM_DIR)/Makefile
+	$(SED) "/chcon/d" $(EARLYOOM_DIR)/Makefile
+	$(SED) "/update-rc.d/d" $(EARLYOOM_DIR)/Makefile
+endef
+
+define EARLYOOM_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) earlyoom $(EARLYOOM_MAKE_OPTS)
+endef
+
+define EARLYOOM_INSTALL_INIT_SYSV
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) install-initscript $(EARLYOOM_MAKE_OPTS)
+endef
+
+define EARLYOOM_INSTALL_INIT_SYSTEMD
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) install $(EARLYOOM_MAKE_OPTS)
+endef
+
+$(eval $(generic-package))
-- 
2.26.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCH 1/1] package/earlyoom: new package
  2020-05-29  1:54 [Buildroot] [PATCH 1/1] package/earlyoom: new package Joseph Kogut
@ 2020-05-29 12:09 ` Matthew Weber
  2020-06-08 17:19   ` Joseph Kogut
  2020-06-08 17:58 ` [Buildroot] [PATCH v2 " Joseph Kogut
  1 sibling, 1 reply; 9+ messages in thread
From: Matthew Weber @ 2020-05-29 12:09 UTC (permalink / raw)
  To: buildroot

Joseph,

On Thu, May 28, 2020 at 8:58 PM Joseph Kogut <joseph.kogut@gmail.com> wrote:
>
> EarlyOOM daemon for triggering Linux OOM killer before running out of
> memory, avoiding situations where the machine becomes unresponsive from
> out of control swapping.
>

Could add a few references to where other distros are adding this in
by default.  I see Fedora has a pretty good scenario captured
https://fedoraproject.org/wiki/Changes/EnableEarlyoom

Reviewed-by: Matthew Weber <matthew.weber@rockwellcollins.com>

> Signed-off-by: Joseph Kogut <joseph.kogut@gmail.com>
> ---
>  DEVELOPERS                     |  1 +
>  package/Config.in              |  1 +
>  package/earlyoom/Config.in     |  9 +++++++++
>  package/earlyoom/earlyoom.hash |  4 ++++
>  package/earlyoom/earlyoom.mk   | 37 ++++++++++++++++++++++++++++++++++
>  5 files changed, 52 insertions(+)
>  create mode 100644 package/earlyoom/Config.in
>  create mode 100644 package/earlyoom/earlyoom.hash
>  create mode 100644 package/earlyoom/earlyoom.mk
>
> diff --git a/DEVELOPERS b/DEVELOPERS
> index 0f1574c930..3e749e764b 100644
> --- a/DEVELOPERS
> +++ b/DEVELOPERS
> @@ -1388,6 +1388,7 @@ N:        Joseph Kogut <joseph.kogut@gmail.com>
>  F:     package/at-spi2-atk/
>  F:     package/at-spi2-core/
>  F:     package/clang/
> +F:     package/earlyoom/
>  F:     package/gconf/
>  F:     package/libnss/
>  F:     package/lld/
> diff --git a/package/Config.in b/package/Config.in
> index c245abbc42..0f1da74e0f 100644
> --- a/package/Config.in
> +++ b/package/Config.in
> @@ -2338,6 +2338,7 @@ menu "System tools"
>         source "package/docker-containerd/Config.in"
>         source "package/docker-engine/Config.in"
>         source "package/docker-proxy/Config.in"
> +       source "package/earlyoom/Config.in"
>         source "package/efibootmgr/Config.in"
>         source "package/efivar/Config.in"
>         source "package/emlog/Config.in"
> diff --git a/package/earlyoom/Config.in b/package/earlyoom/Config.in
> new file mode 100644
> index 0000000000..abb720437c
> --- /dev/null
> +++ b/package/earlyoom/Config.in
> @@ -0,0 +1,9 @@
> +config BR2_PACKAGE_EARLYOOM
> +       bool "earlyoom"
> +       help
> +         Early OOM daemon for Linux.
> +
> +         User space daemon for triggering Linux OOM killer
> +         before running out of memory, avoiding situations
> +         where the machine becomes unresponsive from out of
> +         control swapping.

Add the github url

> diff --git a/package/earlyoom/earlyoom.hash b/package/earlyoom/earlyoom.hash
> new file mode 100644
> index 0000000000..4cafe50bc3
> --- /dev/null
> +++ b/package/earlyoom/earlyoom.hash
> @@ -0,0 +1,4 @@
> +# locally calculated
> +sha256 b81804fc4470f996014d52252a87a1cf3b43d3d8754140035b10dcee349302b8  earlyoom-1.6.tar.gz
> +# License files, locally calculated
> +sha256 e730b3ec729de46d987ae73f30ed337e4cbe832f09205330acfa71848c6e0087  LICENSE
> diff --git a/package/earlyoom/earlyoom.mk b/package/earlyoom/earlyoom.mk
> new file mode 100644
> index 0000000000..bea59bd416
> --- /dev/null
> +++ b/package/earlyoom/earlyoom.mk
> @@ -0,0 +1,37 @@
> +################################################################################
> +#
> +# earlyoom
> +#
> +################################################################################
> +
> +EARLYOOM_VERSION = 1.6
> +EARLYOOM_SITE = $(call github,rfjakob,earlyoom,v$(EARLYOOM_VERSION))
> +EARLYOOM_LICENSE = MIT
> +EARLYOOM_LICENSE_FILES = LICENSE
> +
> +EARLYOOM_MAKE_OPTS = \
> +       CC=$(TARGET_CC) \
> +       DESTDIR=$(TARGET_DIR) \
> +       VERSION=$(EARLYOOM_VERSION) \
> +       PREFIX=/usr \
> +       SYSTEMDUNITDIR=/usr/lib/systemd/system
> +
> +define EARLYOOM_CONFIGURE_CMDS
> +       $(SED) "/systemctl/d" $(EARLYOOM_DIR)/Makefile
> +       $(SED) "/chcon/d" $(EARLYOOM_DIR)/Makefile
> +       $(SED) "/update-rc.d/d" $(EARLYOOM_DIR)/Makefile
> +endef
> +
> +define EARLYOOM_BUILD_CMDS
> +       $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) earlyoom $(EARLYOOM_MAKE_OPTS)
> +endef
> +
> +define EARLYOOM_INSTALL_INIT_SYSV
> +       $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) install-initscript $(EARLYOOM_MAKE_OPTS)

Do we need to do anything to adjust the name of the installed script
(currently installs as /etc/init.d/earlyoom)?  Maybe a S01 or S02?

> +endef
> +
> +define EARLYOOM_INSTALL_INIT_SYSTEMD
> +       $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) install $(EARLYOOM_MAKE_OPTS)

I noticed the earlyoom.default was setting EARLYOOM_ARGS="-r 3600".
Do we need to 'make install-default' in both INSTALL_INIT steps?

Regards,
Matt

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCH 1/1] package/earlyoom: new package
  2020-05-29 12:09 ` Matthew Weber
@ 2020-06-08 17:19   ` Joseph Kogut
  0 siblings, 0 replies; 9+ messages in thread
From: Joseph Kogut @ 2020-06-08 17:19 UTC (permalink / raw)
  To: buildroot

On Fri, May 29, 2020 at 5:10 AM Matthew Weber <matthew.weber@collins.com> wrote:
>
> Joseph,
>
> On Thu, May 28, 2020 at 8:58 PM Joseph Kogut <joseph.kogut@gmail.com> wrote:
> >
> > EarlyOOM daemon for triggering Linux OOM killer before running out of
> > memory, avoiding situations where the machine becomes unresponsive from
> > out of control swapping.
> >
>
> Could add a few references to where other distros are adding this in
> by default.  I see Fedora has a pretty good scenario captured
> https://fedoraproject.org/wiki/Changes/EnableEarlyoom
>
> Reviewed-by: Matthew Weber <matthew.weber@rockwellcollins.com>
>
> > Signed-off-by: Joseph Kogut <joseph.kogut@gmail.com>
> > ---
> >  DEVELOPERS                     |  1 +
> >  package/Config.in              |  1 +
> >  package/earlyoom/Config.in     |  9 +++++++++
> >  package/earlyoom/earlyoom.hash |  4 ++++
> >  package/earlyoom/earlyoom.mk   | 37 ++++++++++++++++++++++++++++++++++
> >  5 files changed, 52 insertions(+)
> >  create mode 100644 package/earlyoom/Config.in
> >  create mode 100644 package/earlyoom/earlyoom.hash
> >  create mode 100644 package/earlyoom/earlyoom.mk
> >
> > diff --git a/DEVELOPERS b/DEVELOPERS
> > index 0f1574c930..3e749e764b 100644
> > --- a/DEVELOPERS
> > +++ b/DEVELOPERS
> > @@ -1388,6 +1388,7 @@ N:        Joseph Kogut <joseph.kogut@gmail.com>
> >  F:     package/at-spi2-atk/
> >  F:     package/at-spi2-core/
> >  F:     package/clang/
> > +F:     package/earlyoom/
> >  F:     package/gconf/
> >  F:     package/libnss/
> >  F:     package/lld/
> > diff --git a/package/Config.in b/package/Config.in
> > index c245abbc42..0f1da74e0f 100644
> > --- a/package/Config.in
> > +++ b/package/Config.in
> > @@ -2338,6 +2338,7 @@ menu "System tools"
> >         source "package/docker-containerd/Config.in"
> >         source "package/docker-engine/Config.in"
> >         source "package/docker-proxy/Config.in"
> > +       source "package/earlyoom/Config.in"
> >         source "package/efibootmgr/Config.in"
> >         source "package/efivar/Config.in"
> >         source "package/emlog/Config.in"
> > diff --git a/package/earlyoom/Config.in b/package/earlyoom/Config.in
> > new file mode 100644
> > index 0000000000..abb720437c
> > --- /dev/null
> > +++ b/package/earlyoom/Config.in
> > @@ -0,0 +1,9 @@
> > +config BR2_PACKAGE_EARLYOOM
> > +       bool "earlyoom"
> > +       help
> > +         Early OOM daemon for Linux.
> > +
> > +         User space daemon for triggering Linux OOM killer
> > +         before running out of memory, avoiding situations
> > +         where the machine becomes unresponsive from out of
> > +         control swapping.
>
> Add the github url
>
> > diff --git a/package/earlyoom/earlyoom.hash b/package/earlyoom/earlyoom.hash
> > new file mode 100644
> > index 0000000000..4cafe50bc3
> > --- /dev/null
> > +++ b/package/earlyoom/earlyoom.hash
> > @@ -0,0 +1,4 @@
> > +# locally calculated
> > +sha256 b81804fc4470f996014d52252a87a1cf3b43d3d8754140035b10dcee349302b8  earlyoom-1.6.tar.gz
> > +# License files, locally calculated
> > +sha256 e730b3ec729de46d987ae73f30ed337e4cbe832f09205330acfa71848c6e0087  LICENSE
> > diff --git a/package/earlyoom/earlyoom.mk b/package/earlyoom/earlyoom.mk
> > new file mode 100644
> > index 0000000000..bea59bd416
> > --- /dev/null
> > +++ b/package/earlyoom/earlyoom.mk
> > @@ -0,0 +1,37 @@
> > +################################################################################
> > +#
> > +# earlyoom
> > +#
> > +################################################################################
> > +
> > +EARLYOOM_VERSION = 1.6
> > +EARLYOOM_SITE = $(call github,rfjakob,earlyoom,v$(EARLYOOM_VERSION))
> > +EARLYOOM_LICENSE = MIT
> > +EARLYOOM_LICENSE_FILES = LICENSE
> > +
> > +EARLYOOM_MAKE_OPTS = \
> > +       CC=$(TARGET_CC) \
> > +       DESTDIR=$(TARGET_DIR) \
> > +       VERSION=$(EARLYOOM_VERSION) \
> > +       PREFIX=/usr \
> > +       SYSTEMDUNITDIR=/usr/lib/systemd/system
> > +
> > +define EARLYOOM_CONFIGURE_CMDS
> > +       $(SED) "/systemctl/d" $(EARLYOOM_DIR)/Makefile
> > +       $(SED) "/chcon/d" $(EARLYOOM_DIR)/Makefile
> > +       $(SED) "/update-rc.d/d" $(EARLYOOM_DIR)/Makefile
> > +endef
> > +
> > +define EARLYOOM_BUILD_CMDS
> > +       $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) earlyoom $(EARLYOOM_MAKE_OPTS)
> > +endef
> > +
> > +define EARLYOOM_INSTALL_INIT_SYSV
> > +       $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) install-initscript $(EARLYOOM_MAKE_OPTS)
>
> Do we need to do anything to adjust the name of the installed script
> (currently installs as /etc/init.d/earlyoom)?  Maybe a S01 or S02?
>

I can make this change.

> > +endef
> > +
> > +define EARLYOOM_INSTALL_INIT_SYSTEMD
> > +       $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) install $(EARLYOOM_MAKE_OPTS)
>
> I noticed the earlyoom.default was setting EARLYOOM_ARGS="-r 3600".
> Do we need to 'make install-default' in both INSTALL_INIT steps?
>

Reading the project's Makefile again, it looks like both install
targets depend on the 'install-default' target, so unless I'm missing
something, this shouldn't be necessary.

> Regards,
> Matt

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCH v2 1/1] package/earlyoom: new package
  2020-05-29  1:54 [Buildroot] [PATCH 1/1] package/earlyoom: new package Joseph Kogut
  2020-05-29 12:09 ` Matthew Weber
@ 2020-06-08 17:58 ` Joseph Kogut
  2020-06-10 21:20   ` Thomas Petazzoni
  2020-06-12 17:40   ` [Buildroot] [PATCH v3 " Joseph Kogut
  1 sibling, 2 replies; 9+ messages in thread
From: Joseph Kogut @ 2020-06-08 17:58 UTC (permalink / raw)
  To: buildroot

EarlyOOM daemon for triggering Linux OOM killer before running out of
memory, avoiding situations where the machine becomes unresponsive from
out of control swapping.

Some desktop distributions are installing and enabling this daemon by
default to prevent unresponsive machines in OOM scenarios.

https://fedoraproject.org/wiki/Changes/EnableEarlyoom
Signed-off-by: Joseph Kogut <joseph.kogut@gmail.com>
---
Changes v1 -> v2:
  * Amend commit message with additional information about usage by
    other distros
  * Add project URL to Config.in help section
  * Add runlevel to sysv init script

 DEVELOPERS                     |  1 +
 package/Config.in              |  1 +
 package/earlyoom/Config.in     | 11 ++++++++++
 package/earlyoom/earlyoom.hash |  4 ++++
 package/earlyoom/earlyoom.mk   | 39 ++++++++++++++++++++++++++++++++++
 5 files changed, 56 insertions(+)
 create mode 100644 package/earlyoom/Config.in
 create mode 100644 package/earlyoom/earlyoom.hash
 create mode 100644 package/earlyoom/earlyoom.mk

diff --git a/DEVELOPERS b/DEVELOPERS
index 88050349db..3f64853316 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1366,6 +1366,7 @@ N:	Joseph Kogut <joseph.kogut@gmail.com>
 F:	package/at-spi2-atk/
 F:	package/at-spi2-core/
 F:	package/clang/
+F:	package/earlyoom/
 F:	package/gconf/
 F:	package/libnss/
 F:	package/lld/
diff --git a/package/Config.in b/package/Config.in
index 85d7326361..9bda8419c0 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -2335,6 +2335,7 @@ menu "System tools"
 	source "package/docker-containerd/Config.in"
 	source "package/docker-engine/Config.in"
 	source "package/docker-proxy/Config.in"
+	source "package/earlyoom/Config.in"
 	source "package/efibootmgr/Config.in"
 	source "package/efivar/Config.in"
 	source "package/emlog/Config.in"
diff --git a/package/earlyoom/Config.in b/package/earlyoom/Config.in
new file mode 100644
index 0000000000..1df1cd8f63
--- /dev/null
+++ b/package/earlyoom/Config.in
@@ -0,0 +1,11 @@
+config BR2_PACKAGE_EARLYOOM
+	bool "earlyoom"
+	help
+	  Early OOM daemon for Linux.
+
+	  User space daemon for triggering Linux OOM killer
+	  before running out of memory, avoiding situations
+	  where the machine becomes unresponsive from out of
+	  control swapping.
+
+	  https://github.com/rfjakob/earlyoom
diff --git a/package/earlyoom/earlyoom.hash b/package/earlyoom/earlyoom.hash
new file mode 100644
index 0000000000..4cafe50bc3
--- /dev/null
+++ b/package/earlyoom/earlyoom.hash
@@ -0,0 +1,4 @@
+# locally calculated
+sha256 b81804fc4470f996014d52252a87a1cf3b43d3d8754140035b10dcee349302b8  earlyoom-1.6.tar.gz
+# License files, locally calculated
+sha256 e730b3ec729de46d987ae73f30ed337e4cbe832f09205330acfa71848c6e0087  LICENSE
diff --git a/package/earlyoom/earlyoom.mk b/package/earlyoom/earlyoom.mk
new file mode 100644
index 0000000000..af32054055
--- /dev/null
+++ b/package/earlyoom/earlyoom.mk
@@ -0,0 +1,39 @@
+################################################################################
+#
+# earlyoom
+#
+################################################################################
+
+EARLYOOM_VERSION = 1.6
+EARLYOOM_SITE = $(call github,rfjakob,earlyoom,v$(EARLYOOM_VERSION))
+EARLYOOM_LICENSE = MIT
+EARLYOOM_LICENSE_FILES = LICENSE
+
+EARLYOOM_MAKE_OPTS = \
+	CC=$(TARGET_CC) \
+	DESTDIR=$(TARGET_DIR) \
+	VERSION=$(EARLYOOM_VERSION) \
+	PREFIX=/usr \
+	SYSTEMDUNITDIR=/usr/lib/systemd/system
+
+define EARLYOOM_CONFIGURE_CMDS
+	$(SED) "/systemctl/d" $(EARLYOOM_DIR)/Makefile
+	$(SED) "/chcon/d" $(EARLYOOM_DIR)/Makefile
+	$(SED) "/update-rc.d/d" $(EARLYOOM_DIR)/Makefile
+	$(SED) "s/init.d\/earlyoom/init.d\/S01_earlyoom/" \
+		$(EARLYOOM_DIR)/Makefile
+endef
+
+define EARLYOOM_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) earlyoom $(EARLYOOM_MAKE_OPTS)
+endef
+
+define EARLYOOM_INSTALL_INIT_SYSV
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) install-initscript $(EARLYOOM_MAKE_OPTS)
+endef
+
+define EARLYOOM_INSTALL_INIT_SYSTEMD
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) install $(EARLYOOM_MAKE_OPTS)
+endef
+
+$(eval $(generic-package))
-- 
2.27.0

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCH v2 1/1] package/earlyoom: new package
  2020-06-08 17:58 ` [Buildroot] [PATCH v2 " Joseph Kogut
@ 2020-06-10 21:20   ` Thomas Petazzoni
  2020-06-10 21:31     ` Joseph Kogut
  2020-06-12 17:40   ` [Buildroot] [PATCH v3 " Joseph Kogut
  1 sibling, 1 reply; 9+ messages in thread
From: Thomas Petazzoni @ 2020-06-10 21:20 UTC (permalink / raw)
  To: buildroot

Hello Joseph,

On Mon,  8 Jun 2020 10:58:06 -0700
Joseph Kogut <joseph.kogut@gmail.com> wrote:

> diff --git a/package/earlyoom/Config.in b/package/earlyoom/Config.in
> new file mode 100644
> index 0000000000..1df1cd8f63
> --- /dev/null
> +++ b/package/earlyoom/Config.in
> @@ -0,0 +1,11 @@
> +config BR2_PACKAGE_EARLYOOM
> +	bool "earlyoom"

Are you sure there are not any dependency ? I'm pretty sure at least
"depends on BR2_USE_MMU" is needed, as the code uses fork(). Could you
do a test build with ./utils/test-pkg and see what results it gives ?


> +EARLYOOM_VERSION = 1.6
> +EARLYOOM_SITE = $(call github,rfjakob,earlyoom,v$(EARLYOOM_VERSION))
> +EARLYOOM_LICENSE = MIT
> +EARLYOOM_LICENSE_FILES = LICENSE
> +
> +EARLYOOM_MAKE_OPTS = \
> +	CC=$(TARGET_CC) \

Could you use:

	$(TARGET_CONFIGURE_OPTS)

instead ?

> +	DESTDIR=$(TARGET_DIR) \

Ideally, this should be passed at install time only.

> +	VERSION=$(EARLYOOM_VERSION) \
> +	PREFIX=/usr \
> +	SYSTEMDUNITDIR=/usr/lib/systemd/system
> +
> +define EARLYOOM_CONFIGURE_CMDS
> +	$(SED) "/systemctl/d" $(EARLYOOM_DIR)/Makefile
> +	$(SED) "/chcon/d" $(EARLYOOM_DIR)/Makefile
> +	$(SED) "/update-rc.d/d" $(EARLYOOM_DIR)/Makefile
> +	$(SED) "s/init.d\/earlyoom/init.d\/S01_earlyoom/" \
> +		$(EARLYOOM_DIR)/Makefile

Can we patch the Makefile instead? Ideally, a solution that is
acceptable upstream would be nice. Maybe just some checks in the
Makefile that sees if "make install" is executed as root, and if it is,
do the systemctl, chcon, update-rc.d calls, but not otherwise ?

> +endef
> +
> +define EARLYOOM_BUILD_CMDS
> +	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) earlyoom $(EARLYOOM_MAKE_OPTS)
> +endef
> +
> +define EARLYOOM_INSTALL_INIT_SYSV
> +	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) install-initscript $(EARLYOOM_MAKE_OPTS)
> +endef
> +
> +define EARLYOOM_INSTALL_INIT_SYSTEMD
> +	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) install $(EARLYOOM_MAKE_OPTS)
> +endef

Not a big fan of not having an INSTALL_TARGET_CMDS that installs the
binary. Also, the init script provided by earlyoom clearly doesn't work
with Buildroot. It does things such as:

. /lib/lsb/init-functions

which doesn't exist in Buildroot.

So I think I would prefer:

define EARLYOOM_INSTALL_TARGET_CMDS
	... $(MAKE) -C $(@D) DESTDIR=$(TARGET_DIR) install-bin
endef

define EARLYOOM_INSTALL_INIT_SYSTEMD
	manually install the earlyoom.service file
endef

define EARLYOOM_INSTALL_INIT_SYSV
	manually install an init script provided in package/earlyoom
endef

Could you look at adjusting your patch to this ?

Thanks a lot!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCH v2 1/1] package/earlyoom: new package
  2020-06-10 21:20   ` Thomas Petazzoni
@ 2020-06-10 21:31     ` Joseph Kogut
  2020-06-10 23:25       ` Joseph Kogut
  0 siblings, 1 reply; 9+ messages in thread
From: Joseph Kogut @ 2020-06-10 21:31 UTC (permalink / raw)
  To: buildroot

Hi Thomas,

Great feedback, thank you for taking the time.

On Wed, Jun 10, 2020 at 2:20 PM Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
>
> Hello Joseph,
>
> On Mon,  8 Jun 2020 10:58:06 -0700
> Joseph Kogut <joseph.kogut@gmail.com> wrote:
>
> > diff --git a/package/earlyoom/Config.in b/package/earlyoom/Config.in
> > new file mode 100644
> > index 0000000000..1df1cd8f63
> > --- /dev/null
> > +++ b/package/earlyoom/Config.in
> > @@ -0,0 +1,11 @@
> > +config BR2_PACKAGE_EARLYOOM
> > +     bool "earlyoom"
>
> Are you sure there are not any dependency ? I'm pretty sure at least
> "depends on BR2_USE_MMU" is needed, as the code uses fork(). Could you
> do a test build with ./utils/test-pkg and see what results it gives ?
>

I was either unaware of the existence of this tool, or had forgotten
about it. After checking the manual, it's clearly documented, so I'll
have to make sure to refer to that more.

>
> > +EARLYOOM_VERSION = 1.6
> > +EARLYOOM_SITE = $(call github,rfjakob,earlyoom,v$(EARLYOOM_VERSION))
> > +EARLYOOM_LICENSE = MIT
> > +EARLYOOM_LICENSE_FILES = LICENSE
> > +
> > +EARLYOOM_MAKE_OPTS = \
> > +     CC=$(TARGET_CC) \
>
> Could you use:
>
>         $(TARGET_CONFIGURE_OPTS)
>
> instead ?
>
> > +     DESTDIR=$(TARGET_DIR) \
>
> Ideally, this should be passed at install time only.
>
> > +     VERSION=$(EARLYOOM_VERSION) \
> > +     PREFIX=/usr \
> > +     SYSTEMDUNITDIR=/usr/lib/systemd/system
> > +
> > +define EARLYOOM_CONFIGURE_CMDS
> > +     $(SED) "/systemctl/d" $(EARLYOOM_DIR)/Makefile
> > +     $(SED) "/chcon/d" $(EARLYOOM_DIR)/Makefile
> > +     $(SED) "/update-rc.d/d" $(EARLYOOM_DIR)/Makefile
> > +     $(SED) "s/init.d\/earlyoom/init.d\/S01_earlyoom/" \
> > +             $(EARLYOOM_DIR)/Makefile
>
> Can we patch the Makefile instead? Ideally, a solution that is
> acceptable upstream would be nice. Maybe just some checks in the
> Makefile that sees if "make install" is executed as root, and if it is,
> do the systemctl, chcon, update-rc.d calls, but not otherwise ?
>

There are a few things I'd do differently with the Makefile. I'll see
if I can get those changes submitted upstream, as well as include that
patch in my next version of this package.

> > +endef
> > +
> > +define EARLYOOM_BUILD_CMDS
> > +     $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) earlyoom $(EARLYOOM_MAKE_OPTS)
> > +endef
> > +
> > +define EARLYOOM_INSTALL_INIT_SYSV
> > +     $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) install-initscript $(EARLYOOM_MAKE_OPTS)
> > +endef
> > +
> > +define EARLYOOM_INSTALL_INIT_SYSTEMD
> > +     $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) install $(EARLYOOM_MAKE_OPTS)
> > +endef
>
> Not a big fan of not having an INSTALL_TARGET_CMDS that installs the
> binary. Also, the init script provided by earlyoom clearly doesn't work
> with Buildroot. It does things such as:
>
> . /lib/lsb/init-functions
>
> which doesn't exist in Buildroot.
>
> So I think I would prefer:
>
> define EARLYOOM_INSTALL_TARGET_CMDS
>         ... $(MAKE) -C $(@D) DESTDIR=$(TARGET_DIR) install-bin
> endef
>
> define EARLYOOM_INSTALL_INIT_SYSTEMD
>         manually install the earlyoom.service file
> endef
>
> define EARLYOOM_INSTALL_INIT_SYSV
>         manually install an init script provided in package/earlyoom
> endef
>
> Could you look at adjusting your patch to this ?
>

Definitely, I'll revise and resubmit.


> Thanks a lot!
>
> Thomas
> --
> Thomas Petazzoni, CTO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCH v2 1/1] package/earlyoom: new package
  2020-06-10 21:31     ` Joseph Kogut
@ 2020-06-10 23:25       ` Joseph Kogut
  0 siblings, 0 replies; 9+ messages in thread
From: Joseph Kogut @ 2020-06-10 23:25 UTC (permalink / raw)
  To: buildroot

On Wed, Jun 10, 2020 at 2:31 PM Joseph Kogut <joseph.kogut@gmail.com> wrote:
>
> Hi Thomas,
>
> Great feedback, thank you for taking the time.
>
> On Wed, Jun 10, 2020 at 2:20 PM Thomas Petazzoni
> <thomas.petazzoni@bootlin.com> wrote:
> >
> > Hello Joseph,
> >
> > On Mon,  8 Jun 2020 10:58:06 -0700
> > Joseph Kogut <joseph.kogut@gmail.com> wrote:
> >
> > > diff --git a/package/earlyoom/Config.in b/package/earlyoom/Config.in
> > > new file mode 100644
> > > index 0000000000..1df1cd8f63
> > > --- /dev/null
> > > +++ b/package/earlyoom/Config.in
> > > @@ -0,0 +1,11 @@
> > > +config BR2_PACKAGE_EARLYOOM
> > > +     bool "earlyoom"
> >
> > Are you sure there are not any dependency ? I'm pretty sure at least
> > "depends on BR2_USE_MMU" is needed, as the code uses fork(). Could you
> > do a test build with ./utils/test-pkg and see what results it gives ?
> >

Looks like you were correct with the BR2_USE_MMU dependency. It also
requires C99 for some reason, which broke the build with the old (4.8)
codesourcery arm toolchain. I was able to remove this dependency with
a trivial patch, and I've submitted it upstream.

>
> I was either unaware of the existence of this tool, or had forgotten
> about it. After checking the manual, it's clearly documented, so I'll
> have to make sure to refer to that more.
>
> >
> > > +EARLYOOM_VERSION = 1.6
> > > +EARLYOOM_SITE = $(call github,rfjakob,earlyoom,v$(EARLYOOM_VERSION))
> > > +EARLYOOM_LICENSE = MIT
> > > +EARLYOOM_LICENSE_FILES = LICENSE
> > > +
> > > +EARLYOOM_MAKE_OPTS = \
> > > +     CC=$(TARGET_CC) \
> >
> > Could you use:
> >
> >         $(TARGET_CONFIGURE_OPTS)
> >
> > instead ?
> >
> > > +     DESTDIR=$(TARGET_DIR) \
> >
> > Ideally, this should be passed at install time only.
> >
> > > +     VERSION=$(EARLYOOM_VERSION) \
> > > +     PREFIX=/usr \
> > > +     SYSTEMDUNITDIR=/usr/lib/systemd/system
> > > +
> > > +define EARLYOOM_CONFIGURE_CMDS
> > > +     $(SED) "/systemctl/d" $(EARLYOOM_DIR)/Makefile
> > > +     $(SED) "/chcon/d" $(EARLYOOM_DIR)/Makefile
> > > +     $(SED) "/update-rc.d/d" $(EARLYOOM_DIR)/Makefile
> > > +     $(SED) "s/init.d\/earlyoom/init.d\/S01_earlyoom/" \
> > > +             $(EARLYOOM_DIR)/Makefile
> >
> > Can we patch the Makefile instead? Ideally, a solution that is
> > acceptable upstream would be nice. Maybe just some checks in the
> > Makefile that sees if "make install" is executed as root, and if it is,
> > do the systemctl, chcon, update-rc.d calls, but not otherwise ?
> >
>
> There are a few things I'd do differently with the Makefile. I'll see
> if I can get those changes submitted upstream, as well as include that
> patch in my next version of this package.
>
> > > +endef
> > > +
> > > +define EARLYOOM_BUILD_CMDS
> > > +     $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) earlyoom $(EARLYOOM_MAKE_OPTS)
> > > +endef
> > > +
> > > +define EARLYOOM_INSTALL_INIT_SYSV
> > > +     $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) install-initscript $(EARLYOOM_MAKE_OPTS)
> > > +endef
> > > +
> > > +define EARLYOOM_INSTALL_INIT_SYSTEMD
> > > +     $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) install $(EARLYOOM_MAKE_OPTS)
> > > +endef
> >
> > Not a big fan of not having an INSTALL_TARGET_CMDS that installs the
> > binary. Also, the init script provided by earlyoom clearly doesn't work
> > with Buildroot. It does things such as:
> >
> > . /lib/lsb/init-functions
> >
> > which doesn't exist in Buildroot.
> >
> > So I think I would prefer:
> >
> > define EARLYOOM_INSTALL_TARGET_CMDS
> >         ... $(MAKE) -C $(@D) DESTDIR=$(TARGET_DIR) install-bin
> > endef
> >
> > define EARLYOOM_INSTALL_INIT_SYSTEMD
> >         manually install the earlyoom.service file
> > endef
> >
> > define EARLYOOM_INSTALL_INIT_SYSV
> >         manually install an init script provided in package/earlyoom
> > endef
> >

It also looks as though the Makefile wouldn't need modifications to
check for root as mentioned above, as this approach would skip the
privileged commands to enable the service.

> > Could you look at adjusting your patch to this ?
> >
>
> Definitely, I'll revise and resubmit.
>
>
> > Thanks a lot!
> >
> > Thomas
> > --
> > Thomas Petazzoni, CTO, Bootlin
> > Embedded Linux and Kernel engineering
> > https://bootlin.com

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCH v3 1/1] package/earlyoom: new package
  2020-06-08 17:58 ` [Buildroot] [PATCH v2 " Joseph Kogut
  2020-06-10 21:20   ` Thomas Petazzoni
@ 2020-06-12 17:40   ` Joseph Kogut
  2020-06-14 15:42     ` Yann E. MORIN
  1 sibling, 1 reply; 9+ messages in thread
From: Joseph Kogut @ 2020-06-12 17:40 UTC (permalink / raw)
  To: buildroot

EarlyOOM daemon for triggering Linux OOM killer before running out of
memory, avoiding situations where the machine becomes unresponsive from
out of control swapping.

Some desktop distributions are installing and enabling this daemon by
default to prevent unresponsive machines in OOM scenarios.

https://fedoraproject.org/wiki/Changes/EnableEarlyoom
Signed-off-by: Joseph Kogut <joseph.kogut@gmail.com>
---
Changes v2 -> v3:
  * Depend on BR2_USE_MMU for fork()
  * Include BR specific sysv init script
  * Skip targets that call privileged commands
  * Package cleanups
  * Fix build on older versions of GCC by specifying required gnu99 dialect.
  * Fix version definition used during build

Changes v1 -> v2:
  * Amend commit message with additional information about usage by
    other distros
  * Add project URL to Config.in help section
  * Add runlevel to sysv init script

 DEVELOPERS                     |  1 +
 package/Config.in              |  1 +
 package/earlyoom/Config.in     | 12 +++++++++
 package/earlyoom/S02earlyoom   | 49 ++++++++++++++++++++++++++++++++++
 package/earlyoom/earlyoom.hash |  4 +++
 package/earlyoom/earlyoom.mk   | 40 +++++++++++++++++++++++++++
 6 files changed, 107 insertions(+)
 create mode 100644 package/earlyoom/Config.in
 create mode 100644 package/earlyoom/S02earlyoom
 create mode 100644 package/earlyoom/earlyoom.hash
 create mode 100644 package/earlyoom/earlyoom.mk

diff --git a/DEVELOPERS b/DEVELOPERS
index 88050349db..3f64853316 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1366,6 +1366,7 @@ N:	Joseph Kogut <joseph.kogut@gmail.com>
 F:	package/at-spi2-atk/
 F:	package/at-spi2-core/
 F:	package/clang/
+F:	package/earlyoom/
 F:	package/gconf/
 F:	package/libnss/
 F:	package/lld/
diff --git a/package/Config.in b/package/Config.in
index 85d7326361..9bda8419c0 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -2335,6 +2335,7 @@ menu "System tools"
 	source "package/docker-containerd/Config.in"
 	source "package/docker-engine/Config.in"
 	source "package/docker-proxy/Config.in"
+	source "package/earlyoom/Config.in"
 	source "package/efibootmgr/Config.in"
 	source "package/efivar/Config.in"
 	source "package/emlog/Config.in"
diff --git a/package/earlyoom/Config.in b/package/earlyoom/Config.in
new file mode 100644
index 0000000000..a3cac273f0
--- /dev/null
+++ b/package/earlyoom/Config.in
@@ -0,0 +1,12 @@
+config BR2_PACKAGE_EARLYOOM
+	bool "earlyoom"
+	depends on BR2_USE_MMU
+	help
+	  Early OOM daemon for Linux.
+
+	  User space daemon for triggering Linux OOM killer
+	  before running out of memory, avoiding situations
+	  where the machine becomes unresponsive from out of
+	  control swapping.
+
+	  https://github.com/rfjakob/earlyoom
diff --git a/package/earlyoom/S02earlyoom b/package/earlyoom/S02earlyoom
new file mode 100644
index 0000000000..c02495af90
--- /dev/null
+++ b/package/earlyoom/S02earlyoom
@@ -0,0 +1,49 @@
+#!/bin/sh
+
+DAEMON="earlyoom"
+PIDFILE="/var/run/$DAEMON.pid"
+
+EARLYOOM_ARGS=""
+
+[ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON"
+
+start() {
+	printf() 'Starting %s: ' "$DAEMON"
+	start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/bin/$DAEMON" \
+	       -- $EARLYOOM_ARGS
+	status=$?
+	if [ "$status" -eq 0 ]; then
+		echo "OK"
+	else
+		echo "FAIL"
+	fi
+	return "$status"
+}
+
+stop() {
+	printf 'Stopping %s: ' "$DAEMON"
+	start-stop-daemon -K -q -p "$PIDFILE"
+	status=$?
+	if [ "$status" -eq 0 ]; then
+		rm -f "$PIDFILE"
+		echo "OK"
+	else
+		echo "FAIL"
+	fi
+	return "$status"
+}
+
+restart() {
+	stop
+	start
+}
+
+case "$1" in
+	start|stop|restart)
+		"$1";;
+	reload)
+		restart;;
+	*)
+		echo "Usage: $0 {start|stop|restart|reload}"
+		exit 1
+esac
diff --git a/package/earlyoom/earlyoom.hash b/package/earlyoom/earlyoom.hash
new file mode 100644
index 0000000000..4cafe50bc3
--- /dev/null
+++ b/package/earlyoom/earlyoom.hash
@@ -0,0 +1,4 @@
+# locally calculated
+sha256 b81804fc4470f996014d52252a87a1cf3b43d3d8754140035b10dcee349302b8  earlyoom-1.6.tar.gz
+# License files, locally calculated
+sha256 e730b3ec729de46d987ae73f30ed337e4cbe832f09205330acfa71848c6e0087  LICENSE
diff --git a/package/earlyoom/earlyoom.mk b/package/earlyoom/earlyoom.mk
new file mode 100644
index 0000000000..066a479bd1
--- /dev/null
+++ b/package/earlyoom/earlyoom.mk
@@ -0,0 +1,40 @@
+################################################################################
+#
+# earlyoom
+#
+################################################################################
+
+EARLYOOM_VERSION = 1.6
+EARLYOOM_SITE = $(call github,rfjakob,earlyoom,v$(EARLYOOM_VERSION))
+EARLYOOM_LICENSE = MIT
+EARLYOOM_LICENSE_FILES = LICENSE
+
+EARLYOOM_BUILD_TARGETS = earlyoom.service earlyoom
+EARLYOOM_INSTALL_TARGETS = install-default install-bin
+EARLYOOM_CFLAGS = '$(TARGET_CFLAGS) -std=gnu99 -DVERSION=\"1.6\"'
+
+EARLYOOM_MAKE_OPTS = \
+	$(TARGET_CONFIGURE_OPTS) \
+	PREFIX=/usr
+
+define EARLYOOM_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) $(EARLYOOM_MAKE_OPTS) -C $(@D) \
+		$(EARLYOOM_BUILD_TARGETS) CFLAGS=$(EARLYOOM_CFLAGS)
+endef
+
+define EARLYOOM_INSTALL_TARGET_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) $(EARLYOOM_MAKE_OPTS) -C $(@D) \
+		$(EARLYOOM_INSTALL_TARGETS) DESTDIR=$(TARGET_DIR)
+endef
+
+define EARLYOOM_INSTALL_INIT_SYSV
+	$(INSTALL) -D -m 755 $(EARLYOOM_PKGDIR)/S02earlyoom \
+		$(TARGET_DIR)/etc/init.d/S02earlyoom
+endef
+
+define EARLYOOM_INSTALL_INIT_SYSTEMD
+	$(INSTALL) -D -m 644 $(@D)/earlyoom.service \
+		$(TARGET_DIR)/usr/lib/systemd/system/earlyoom.service
+endef
+
+$(eval $(generic-package))
-- 
2.27.0

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCH v3 1/1] package/earlyoom: new package
  2020-06-12 17:40   ` [Buildroot] [PATCH v3 " Joseph Kogut
@ 2020-06-14 15:42     ` Yann E. MORIN
  0 siblings, 0 replies; 9+ messages in thread
From: Yann E. MORIN @ 2020-06-14 15:42 UTC (permalink / raw)
  To: buildroot

Joseph, All,

On 2020-06-12 10:40 -0700, Joseph Kogut spake thusly:
> EarlyOOM daemon for triggering Linux OOM killer before running out of
> memory, avoiding situations where the machine becomes unresponsive from
> out of control swapping.
> 
> Some desktop distributions are installing and enabling this daemon by
> default to prevent unresponsive machines in OOM scenarios.
> 
> https://fedoraproject.org/wiki/Changes/EnableEarlyoom
> Signed-off-by: Joseph Kogut <joseph.kogut@gmail.com>

Applied to master, thanks.

Regards,
Yann E. MORIN.

> ---
> Changes v2 -> v3:
>   * Depend on BR2_USE_MMU for fork()
>   * Include BR specific sysv init script
>   * Skip targets that call privileged commands
>   * Package cleanups
>   * Fix build on older versions of GCC by specifying required gnu99 dialect.
>   * Fix version definition used during build
> 
> Changes v1 -> v2:
>   * Amend commit message with additional information about usage by
>     other distros
>   * Add project URL to Config.in help section
>   * Add runlevel to sysv init script
> 
>  DEVELOPERS                     |  1 +
>  package/Config.in              |  1 +
>  package/earlyoom/Config.in     | 12 +++++++++
>  package/earlyoom/S02earlyoom   | 49 ++++++++++++++++++++++++++++++++++
>  package/earlyoom/earlyoom.hash |  4 +++
>  package/earlyoom/earlyoom.mk   | 40 +++++++++++++++++++++++++++
>  6 files changed, 107 insertions(+)
>  create mode 100644 package/earlyoom/Config.in
>  create mode 100644 package/earlyoom/S02earlyoom
>  create mode 100644 package/earlyoom/earlyoom.hash
>  create mode 100644 package/earlyoom/earlyoom.mk
> 
> diff --git a/DEVELOPERS b/DEVELOPERS
> index 88050349db..3f64853316 100644
> --- a/DEVELOPERS
> +++ b/DEVELOPERS
> @@ -1366,6 +1366,7 @@ N:	Joseph Kogut <joseph.kogut@gmail.com>
>  F:	package/at-spi2-atk/
>  F:	package/at-spi2-core/
>  F:	package/clang/
> +F:	package/earlyoom/
>  F:	package/gconf/
>  F:	package/libnss/
>  F:	package/lld/
> diff --git a/package/Config.in b/package/Config.in
> index 85d7326361..9bda8419c0 100644
> --- a/package/Config.in
> +++ b/package/Config.in
> @@ -2335,6 +2335,7 @@ menu "System tools"
>  	source "package/docker-containerd/Config.in"
>  	source "package/docker-engine/Config.in"
>  	source "package/docker-proxy/Config.in"
> +	source "package/earlyoom/Config.in"
>  	source "package/efibootmgr/Config.in"
>  	source "package/efivar/Config.in"
>  	source "package/emlog/Config.in"
> diff --git a/package/earlyoom/Config.in b/package/earlyoom/Config.in
> new file mode 100644
> index 0000000000..a3cac273f0
> --- /dev/null
> +++ b/package/earlyoom/Config.in
> @@ -0,0 +1,12 @@
> +config BR2_PACKAGE_EARLYOOM
> +	bool "earlyoom"
> +	depends on BR2_USE_MMU
> +	help
> +	  Early OOM daemon for Linux.
> +
> +	  User space daemon for triggering Linux OOM killer
> +	  before running out of memory, avoiding situations
> +	  where the machine becomes unresponsive from out of
> +	  control swapping.
> +
> +	  https://github.com/rfjakob/earlyoom
> diff --git a/package/earlyoom/S02earlyoom b/package/earlyoom/S02earlyoom
> new file mode 100644
> index 0000000000..c02495af90
> --- /dev/null
> +++ b/package/earlyoom/S02earlyoom
> @@ -0,0 +1,49 @@
> +#!/bin/sh
> +
> +DAEMON="earlyoom"
> +PIDFILE="/var/run/$DAEMON.pid"
> +
> +EARLYOOM_ARGS=""
> +
> +[ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON"
> +
> +start() {
> +	printf() 'Starting %s: ' "$DAEMON"
> +	start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/bin/$DAEMON" \
> +	       -- $EARLYOOM_ARGS
> +	status=$?
> +	if [ "$status" -eq 0 ]; then
> +		echo "OK"
> +	else
> +		echo "FAIL"
> +	fi
> +	return "$status"
> +}
> +
> +stop() {
> +	printf 'Stopping %s: ' "$DAEMON"
> +	start-stop-daemon -K -q -p "$PIDFILE"
> +	status=$?
> +	if [ "$status" -eq 0 ]; then
> +		rm -f "$PIDFILE"
> +		echo "OK"
> +	else
> +		echo "FAIL"
> +	fi
> +	return "$status"
> +}
> +
> +restart() {
> +	stop
> +	start
> +}
> +
> +case "$1" in
> +	start|stop|restart)
> +		"$1";;
> +	reload)
> +		restart;;
> +	*)
> +		echo "Usage: $0 {start|stop|restart|reload}"
> +		exit 1
> +esac
> diff --git a/package/earlyoom/earlyoom.hash b/package/earlyoom/earlyoom.hash
> new file mode 100644
> index 0000000000..4cafe50bc3
> --- /dev/null
> +++ b/package/earlyoom/earlyoom.hash
> @@ -0,0 +1,4 @@
> +# locally calculated
> +sha256 b81804fc4470f996014d52252a87a1cf3b43d3d8754140035b10dcee349302b8  earlyoom-1.6.tar.gz
> +# License files, locally calculated
> +sha256 e730b3ec729de46d987ae73f30ed337e4cbe832f09205330acfa71848c6e0087  LICENSE
> diff --git a/package/earlyoom/earlyoom.mk b/package/earlyoom/earlyoom.mk
> new file mode 100644
> index 0000000000..066a479bd1
> --- /dev/null
> +++ b/package/earlyoom/earlyoom.mk
> @@ -0,0 +1,40 @@
> +################################################################################
> +#
> +# earlyoom
> +#
> +################################################################################
> +
> +EARLYOOM_VERSION = 1.6
> +EARLYOOM_SITE = $(call github,rfjakob,earlyoom,v$(EARLYOOM_VERSION))
> +EARLYOOM_LICENSE = MIT
> +EARLYOOM_LICENSE_FILES = LICENSE
> +
> +EARLYOOM_BUILD_TARGETS = earlyoom.service earlyoom
> +EARLYOOM_INSTALL_TARGETS = install-default install-bin
> +EARLYOOM_CFLAGS = '$(TARGET_CFLAGS) -std=gnu99 -DVERSION=\"1.6\"'
> +
> +EARLYOOM_MAKE_OPTS = \
> +	$(TARGET_CONFIGURE_OPTS) \
> +	PREFIX=/usr
> +
> +define EARLYOOM_BUILD_CMDS
> +	$(TARGET_MAKE_ENV) $(MAKE) $(EARLYOOM_MAKE_OPTS) -C $(@D) \
> +		$(EARLYOOM_BUILD_TARGETS) CFLAGS=$(EARLYOOM_CFLAGS)
> +endef
> +
> +define EARLYOOM_INSTALL_TARGET_CMDS
> +	$(TARGET_MAKE_ENV) $(MAKE) $(EARLYOOM_MAKE_OPTS) -C $(@D) \
> +		$(EARLYOOM_INSTALL_TARGETS) DESTDIR=$(TARGET_DIR)
> +endef
> +
> +define EARLYOOM_INSTALL_INIT_SYSV
> +	$(INSTALL) -D -m 755 $(EARLYOOM_PKGDIR)/S02earlyoom \
> +		$(TARGET_DIR)/etc/init.d/S02earlyoom
> +endef
> +
> +define EARLYOOM_INSTALL_INIT_SYSTEMD
> +	$(INSTALL) -D -m 644 $(@D)/earlyoom.service \
> +		$(TARGET_DIR)/usr/lib/systemd/system/earlyoom.service
> +endef
> +
> +$(eval $(generic-package))
> -- 
> 2.27.0
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-06-14 15:42 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-29  1:54 [Buildroot] [PATCH 1/1] package/earlyoom: new package Joseph Kogut
2020-05-29 12:09 ` Matthew Weber
2020-06-08 17:19   ` Joseph Kogut
2020-06-08 17:58 ` [Buildroot] [PATCH v2 " Joseph Kogut
2020-06-10 21:20   ` Thomas Petazzoni
2020-06-10 21:31     ` Joseph Kogut
2020-06-10 23:25       ` Joseph Kogut
2020-06-12 17:40   ` [Buildroot] [PATCH v3 " Joseph Kogut
2020-06-14 15:42     ` Yann E. MORIN

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.