package/earlyoom: new package
PATCH 1/1 package/earlyoom: new package
EarlyOOM daemon for triggering Linux OOM killer before running out of memory, avoiding situations where the machine becomes unresponsive from out of control swapping.
--- 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
DEVELOPERS +1 -0
@@ -1388,6 +1388,7 @@ N: Joseph Kogut <[email protected]> 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/
package/Config.in +1 -0
@@ -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"
package/earlyoom/Config.in new file +9 -0
@@ -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.
package/earlyoom/earlyoom.hash new file +4 -0
@@ -0,0 +1,4 @@ +# locally calculated +sha256 b81804fc4470f996014d52252a87a1cf3b43d3d8754140035b10dcee349302b8 earlyoom-1.6.tar.gz +# License files, locally calculated +sha256 e730b3ec729de46d987ae73f30ed337e4cbe832f09205330acfa71848c6e0087 LICENSE
package/earlyoom/earlyoom.mk new file +37 -0
@@ -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))
Signature · 1 line
2.26.2
PATCH 1/1 package/earlyoom: new package
Joseph,
Quoted 5 lines · Joseph Kogut
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
Quoted 42 lines
Signed-off-by Joseph Kogut <[email protected]>--- 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.mkDEVELOPERS +1
-0@@ -1388,6 +1388,7 @@ N: Joseph Kogut <[email protected]> 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/package/Config.in +1
-0@@ -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"package/earlyoom/Config.in new file +0
-0
package/earlyoom/Config.in line 9
Quoted 9 lines
package/earlyoom/Config.in new file +9
-0@@ -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
Quoted 36 lines
package/earlyoom/earlyoom.hash new file +4
-0@@ -0,0 +1,4 @@ +# locally calculated +sha256 b81804fc4470f996014d52252a87a1cf3b43d3d8754140035b10dcee349302b8 earlyoom-1.6.tar.gz +# License files, locally calculated +sha256 e730b3ec729de46d987ae73f30ed337e4cbe832f09205330acfa71848c6e0087 LICENSEpackage/earlyoom/earlyoom.mk new file +20
-0@@ -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
package/earlyoom/earlyoom.mk line 30
Quoted 10 lines
package/earlyoom/earlyoom.mk new file +10
-0+ $(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?
package/earlyoom/earlyoom.mk line 34
Quoted 4 lines
package/earlyoom/earlyoom.mk new file +4
-0+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
PATCH 1/1 package/earlyoom: new package
Quoted 111 lines · Matthew Weber
Joseph,
Quoted 5 lines · Joseph Kogut
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/EnableEarlyoomReviewed-by Matthew Weber <[email protected]>Quoted 42 lines
Signed-off-by Joseph Kogut <[email protected]>--- 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.mkDEVELOPERS +1
-0@@ -1388,6 +1388,7 @@ N: Joseph Kogut <[email protected]> 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/package/Config.in +1
-0@@ -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"package/earlyoom/Config.in new file +0
-0package/earlyoom/Config.in line 9
Quoted 9 lines
package/earlyoom/Config.in new file +9
-0@@ -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
Quoted 41 lines
package/earlyoom/earlyoom.hash new file +4
-0@@ -0,0 +1,4 @@ +# locally calculated +sha256 b81804fc4470f996014d52252a87a1cf3b43d3d8754140035b10dcee349302b8 earlyoom-1.6.tar.gz +# License files, locally calculated +sha256 e730b3ec729de46d987ae73f30ed337e4cbe832f09205330acfa71848c6e0087 LICENSEpackage/earlyoom/earlyoom.mk new file +25
-0@@ -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
Quoted 9 lines
package/earlyoom/earlyoom.mk line 30
Quoted 5 lines
package/earlyoom/earlyoom.mk new file +5
-0+ $(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.
Quoted 8 lines
package/earlyoom/earlyoom.mk line 34
Quoted 4 lines
package/earlyoom/earlyoom.mk new file +4
-0+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_INITsteps?
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.
Quoted 2 lines
Regards,
Matt
PATCH v2 1/1 package/earlyoom: new package
In reply to Joseph KogutEarlyOOM 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
---
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
DEVELOPERS +1 -0
@@ -1366,6 +1366,7 @@ N: Joseph Kogut <[email protected]> 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/
package/Config.in +1 -0
@@ -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"
package/earlyoom/Config.in new file +11 -0
@@ -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
package/earlyoom/earlyoom.hash new file +4 -0
@@ -0,0 +1,4 @@ +# locally calculated +sha256 b81804fc4470f996014d52252a87a1cf3b43d3d8754140035b10dcee349302b8 earlyoom-1.6.tar.gz +# License files, locally calculated +sha256 e730b3ec729de46d987ae73f30ed337e4cbe832f09205330acfa71848c6e0087 LICENSE
package/earlyoom/earlyoom.mk new file +39 -0
@@ -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))
Signature · 1 line
2.27.0
PATCH v2 1/1 package/earlyoom: new package
Hello Joseph,
package/earlyoom/Config.in line 2
Quoted 8 lines · On Mon, 8 Jun 2020 10:58:06 -0700 Joseph Kogut <[email protected]> wrote:
package/earlyoom/Config.in new file +2
-0@@ -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 ?
package/earlyoom/Config.in line 9
Quoted 7 lines
package/earlyoom/Config.in new file +7
-0+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 ?
package/earlyoom/Config.in line 10
Quoted 1 line
package/earlyoom/Config.in new file +1
-0+ DESTDIR=$(TARGET_DIR) \
Ideally, this should be passed at install time only.
package/earlyoom/Config.in
Quoted 10 lines
package/earlyoom/Config.in new file +10
-0+ 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 ?
package/earlyoom/Config.in
Quoted 13 lines
package/earlyoom/Config.in new file +13
-0+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
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH v2 1/1 package/earlyoom: new package
Hi Thomas,
Great feedback, thank you for taking the time.
Quoted 6 lines · Thomas Petazzoni
Hello Joseph,
On Mon, 8 Jun 2020 10:58:06 -0700
Joseph Kogut <[email protected]> wrote:
Quoted 13 lines
package/earlyoom/Config.in line 2
Quoted 8 lines
package/earlyoom/Config.in new file +2
-0@@ -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 usesfork(). 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.
Quoted 19 lines
package/earlyoom/Config.in line 9
Quoted 8 lines
package/earlyoom/Config.in new file +7
-0+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 ?
package/earlyoom/Config.in line 10
Quoted 1 line
package/earlyoom/Config.in new file +1
-0+ DESTDIR=$(TARGET_DIR) \Ideally, this should be passed at install time only.
Quoted 16 lines
package/earlyoom/Config.in
Quoted 10 lines
package/earlyoom/Config.in new file +10
-0+ 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)/MakefileCan we patch the
Makefileinstead? Ideally, a solution that is acceptable upstream would be nice. Maybe just some checks in theMakefilethat 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.
Quoted 32 lines
package/earlyoom/Config.in
Quoted 13 lines
package/earlyoom/Config.in new file +13
-0+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) +endefNot a big fan of not having an
INSTALL_TARGET_CMDSthat installs the binary. Also, the init script provided by earlyoom clearly doesn't work with Buildroot. It does things such as:.
/lib/lsb/init-functionswhich doesn't exist in Buildroot.
So I think I would prefer:
define
EARLYOOM_INSTALL_TARGET_CMDS... $(MAKE) -C $(@D) DESTDIR=$(TARGET_DIR) install-binendef
define
EARLYOOM_INSTALL_INIT_SYSTEMD
manually install the earlyoom.service file
endef
Quoted 6 lines
define
EARLYOOM_INSTALL_INIT_SYSV
manually install an init script provided in package/earlyoom
endefCould you look at adjusting your patch to this ?
Definitely, I'll revise and resubmit.
Quoted 7 lines
Thanks a lot!
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
PATCH v2 1/1 package/earlyoom: new package
Quoted 26 lines · Joseph Kogut
Hi Thomas,
Great feedback, thank you for taking the time.
Quoted 19 lines · Thomas Petazzoni
Hello Joseph,
package/earlyoom/Config.in line 2
Quoted 8 lines · On Mon, 8 Jun 2020 10:58:06 -0700 Joseph Kogut <[email protected]> wrote:
package/earlyoom/Config.in new file +2
-0@@ -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 usesfork(). 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.
Quoted 41 lines
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.
Quoted 19 lines
package/earlyoom/Config.in line 9
Quoted 8 lines
package/earlyoom/Config.in new file +7
-0+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 ?
package/earlyoom/Config.in line 10
Quoted 1 line
package/earlyoom/Config.in new file +1
-0+ DESTDIR=$(TARGET_DIR) \Ideally, this should be passed at install time only.
Quoted 16 lines
package/earlyoom/Config.in
Quoted 10 lines
package/earlyoom/Config.in new file +10
-0+ 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)/MakefileCan we patch the
Makefileinstead? Ideally, a solution that is acceptable upstream would be nice. Maybe just some checks in theMakefilethat sees if "make install" is executed as root, and if it is, do the systemctl, chcon, update-rc.d calls, but not otherwise ?
Quoted 40 lines
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.Quoted 36 lines
package/earlyoom/Config.in
Quoted 13 lines
package/earlyoom/Config.in new file +13
-0+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) +endefNot a big fan of not having an
INSTALL_TARGET_CMDSthat installs the binary. Also, the init script provided by earlyoom clearly doesn't work with Buildroot. It does things such as:.
/lib/lsb/init-functionswhich doesn't exist in Buildroot.
So I think I would prefer:
define
EARLYOOM_INSTALL_TARGET_CMDS... $(MAKE) -C $(@D) DESTDIR=$(TARGET_DIR) install-binendef
define
EARLYOOM_INSTALL_INIT_SYSTEMD
manually install the earlyoom.service file
endefdefine
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.
Quoted 13 lines
Quoted 2 lines
Could you look at adjusting your patch to this ?
Definitely, I'll revise and resubmit.
Quoted 7 lines
Thanks a lot!
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
PATCH v3 1/1 package/earlyoom: new package
In reply to Joseph KogutEarlyOOM 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
---
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
DEVELOPERS +1 -0
@@ -1366,6 +1366,7 @@ N: Joseph Kogut <[email protected]> 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/
package/Config.in +1 -0
@@ -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"
package/earlyoom/Config.in new file +12 -0
@@ -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
package/earlyoom/S02earlyoom new file +49 -0
49 lines not on this page · raw message
package/earlyoom/earlyoom.hash new file +4 -0
@@ -0,0 +1,4 @@ +# locally calculated +sha256 b81804fc4470f996014d52252a87a1cf3b43d3d8754140035b10dcee349302b8 earlyoom-1.6.tar.gz +# License files, locally calculated +sha256 e730b3ec729de46d987ae73f30ed337e4cbe832f09205330acfa71848c6e0087 LICENSE
package/earlyoom/earlyoom.mk new file +40 -0
@@ -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))
Signature · 1 line
2.27.0
Yann E. MORIN
AppliedPATCH v3 1/1 package/earlyoom: new package
Joseph, All,
On 2020-06-12 10:40 -0700, Joseph Kogut spake thusly:
Quoted 9 lines
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 <[email protected]>
Applied to master, thanks.
Regards,
Yann E. MORIN.
Quoted 187 lines
---
Changes v2 -> v3:
* Depend onBR2_USE_MMUforfork()
* 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 buildChanges 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 scriptDEVELOPERS | 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.mkDEVELOPERS +1
-0@@ -1366,6 +1366,7 @@ N: Joseph Kogut <[email protected]> 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/package/Config.in +1
-0@@ -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"package/earlyoom/Config.in new file +12
-0@@ -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/earlyoompackage/earlyoom/S02earlyoom new file +49
-0@@ -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 +esacpackage/earlyoom/earlyoom.hash new file +4
-0@@ -0,0 +1,4 @@ +# locally calculated +sha256 b81804fc4470f996014d52252a87a1cf3b43d3d8754140035b10dcee349302b8 earlyoom-1.6.tar.gz +# License files, locally calculated +sha256 e730b3ec729de46d987ae73f30ed337e4cbe832f09205330acfa71848c6e0087 LICENSEpackage/earlyoom/earlyoom.mk new file +40
-0@@ -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))Signature · 6 lines
2.27.0 _______________________________________________ buildroot mailing list buildroot at busybox.net http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | 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. | '------------------------------^-------^------------------^--------------------'