Initial Commit
- initial default booting image
This commit is contained in:
45
package/earlyoom/0001-main.c-fix-build-with-kernel-4.3.patch
Normal file
45
package/earlyoom/0001-main.c-fix-build-with-kernel-4.3.patch
Normal file
@@ -0,0 +1,45 @@
|
||||
From 499e81bfcdd9379bf4619a7c3ad85ed7f2b1dca5 Mon Sep 17 00:00:00 2001
|
||||
From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
|
||||
Date: Thu, 28 Jul 2022 10:05:18 +0200
|
||||
Subject: [PATCH] main.c: fix build with kernel < 4.3
|
||||
|
||||
PR_CAP_AMBIENT is only available since kernel 4.3 and
|
||||
https://github.com/torvalds/linux/commit/58319057b7847667f0c9585b9de0e8932b0fdb08
|
||||
resulting in the following build failure since version 1.7 and
|
||||
https://github.com/rfjakob/earlyoom/commit/9edc5cfc9ad794ed59baec5e6ee8d1060456a315:
|
||||
|
||||
main.c: In function 'main':
|
||||
main.c:119:11: error: 'PR_CAP_AMBIENT' undeclared (first use in this function)
|
||||
prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_CLEAR_ALL, 0, 0, 0);
|
||||
^
|
||||
|
||||
Fixes:
|
||||
- http://autobuild.buildroot.org/results/5a0ad7e1f6de3c37e40c37d8f583fc699a457753
|
||||
|
||||
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
|
||||
[Upstream status: https://github.com/rfjakob/earlyoom/pull/276]
|
||||
---
|
||||
main.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/main.c b/main.c
|
||||
index c068c7c..99ca9e2 100644
|
||||
--- a/main.c
|
||||
+++ b/main.c
|
||||
@@ -115,11 +115,13 @@ int main(int argc, char* argv[])
|
||||
fatal(4, "Could not cd to /proc: %s", strerror(errno));
|
||||
}
|
||||
|
||||
+#ifdef PR_CAP_AMBIENT
|
||||
// When systemd starts a daemon with capabilities, it uses ambient
|
||||
// capabilities to do so. If not dropped, the capabilities can spread
|
||||
// to any child process. This is usually not necessary and its a good
|
||||
// idea to drop them if not needed.
|
||||
prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_CLEAR_ALL, 0, 0, 0);
|
||||
+#endif
|
||||
|
||||
meminfo_t m = parse_meminfo();
|
||||
|
||||
--
|
||||
2.35.1
|
||||
|
||||
12
package/earlyoom/Config.in
Normal file
12
package/earlyoom/Config.in
Normal file
@@ -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
|
||||
49
package/earlyoom/S02earlyoom
Normal file
49
package/earlyoom/S02earlyoom
Normal file
@@ -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 "/usr/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
|
||||
4
package/earlyoom/earlyoom.hash
Normal file
4
package/earlyoom/earlyoom.hash
Normal file
@@ -0,0 +1,4 @@
|
||||
# locally calculated
|
||||
sha256 ebda1279a813d9b0f7860ce5029ccf5ea9f8868be070f2eaf40f90f2e64b6414 earlyoom-1.7.tar.gz
|
||||
# License files, locally calculated
|
||||
sha256 e730b3ec729de46d987ae73f30ed337e4cbe832f09205330acfa71848c6e0087 LICENSE
|
||||
40
package/earlyoom/earlyoom.mk
Normal file
40
package/earlyoom/earlyoom.mk
Normal file
@@ -0,0 +1,40 @@
|
||||
################################################################################
|
||||
#
|
||||
# earlyoom
|
||||
#
|
||||
################################################################################
|
||||
|
||||
EARLYOOM_VERSION = 1.7
|
||||
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=\"$(EARLYOOM_VERSION)\"'
|
||||
|
||||
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))
|
||||
Reference in New Issue
Block a user