added my Recipes
This commit is contained in:
13
meta-openembedded/meta-oe/recipes-core/emlog/emlog.inc
Normal file
13
meta-openembedded/meta-oe/recipes-core/emlog/emlog.inc
Normal file
@@ -0,0 +1,13 @@
|
||||
DESCRIPTION = "emlog is a Linux kernel module that makes it easy to access the \
|
||||
most recent (and only the most recent) output from a process"
|
||||
LICENSE = "GPL-2.0-only"
|
||||
LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f"
|
||||
|
||||
SRC_URI = "git://github.com/nicupavel/emlog.git;protocol=https;branch=master"
|
||||
SRCREV = "aee53e8dee862f35291242ba41b0ca88010f6c71"
|
||||
|
||||
S = "${WORKDIR}/git"
|
||||
|
||||
EXTRA_OEMAKE += " \
|
||||
CFLAGS='${TARGET_CFLAGS}' \
|
||||
"
|
||||
@@ -0,0 +1,33 @@
|
||||
From fd0a4ee201b5c7b24da79dcd346ac121978951a0 Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Sun, 29 Mar 2020 19:58:36 -0700
|
||||
Subject: [PATCH] Remove modules_clean from clean target
|
||||
|
||||
This is needed when building applications (w/o module)
|
||||
Since OE will run 'make clean' before reconfiguring, this
|
||||
will try to run module_clean and will wrongly try to look for removing
|
||||
modules from /lib/modules
|
||||
|
||||
Upstream-Status: Inappropriate [ OE-Specific ]
|
||||
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
---
|
||||
Makefile | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index c60863f..fc897d5 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -23,7 +23,7 @@ all: modules nbcat mkemlog
|
||||
|
||||
install: modules_install nbcat_install mkemlog_install
|
||||
|
||||
-clean: modules_clean nbcat_clean mkemlog_clean
|
||||
+clean: nbcat_clean mkemlog_clean
|
||||
|
||||
modules:
|
||||
$(MAKE) -C $(KDIR) M=$(CURDIR) modules
|
||||
--
|
||||
2.26.0
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
From 41de28a92297f4cb0c5a8d7356cde9190176947b Mon Sep 17 00:00:00 2001
|
||||
From: Fabio Berton <fabio.berton@ossystems.com.br>
|
||||
Date: Thu, 14 Mar 2019 19:54:27 -0300
|
||||
Subject: [PATCH] Drop use of error.h
|
||||
Organization: O.S. Systems Software LTDA.
|
||||
|
||||
The error.h does not work with musl and this project being embedded
|
||||
friendly it makes sense to avoid glibc-specific code.
|
||||
|
||||
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
|
||||
Signed-off-by: Fabio Berton <fabio.berton@ossystems.com.br>
|
||||
---
|
||||
mkemlog.c | 29 ++++++++++++++---------------
|
||||
1 file changed, 14 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/mkemlog.c b/mkemlog.c
|
||||
index e3354ed..7bcdfce 100644
|
||||
--- a/mkemlog.c
|
||||
+++ b/mkemlog.c
|
||||
@@ -21,7 +21,6 @@
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdlib.h>
|
||||
-#include <error.h>
|
||||
#include <errno.h>
|
||||
|
||||
#define EMLOG_DEVICE "/dev/emlog"
|
||||
@@ -40,16 +39,16 @@ int main(int argc, char** argv) {
|
||||
FILE *max_size_file = NULL;
|
||||
uid_t uid = -1;
|
||||
if (argc < 2 || argc > 5) {
|
||||
- error(1 ,0, USAGE);
|
||||
+ fprintf(stderr, USAGE);
|
||||
}
|
||||
file = argv[1];
|
||||
|
||||
max_size_file = fopen("/sys/module/emlog/parameters/emlog_max_size", "r");
|
||||
if (max_size_file == NULL)
|
||||
- error(1, errno, "Emlog module not loaded\n");
|
||||
+ fprintf(stderr, "Emlog module not loaded\n");
|
||||
rc = fscanf(max_size_file, "%d", &emlog_max_size);
|
||||
if (rc != 1)
|
||||
- error(1, errno, "Unable to get emlog max size\n");
|
||||
+ fprintf(stderr, "Unable to get emlog max size\n");
|
||||
fclose(max_size_file);
|
||||
max_size_file = NULL;
|
||||
if (argc > 2 ) {
|
||||
@@ -57,13 +56,13 @@ int main(int argc, char** argv) {
|
||||
number = argv[2];
|
||||
size_of_buffer = strtol(number, &end_of_number, 10);
|
||||
if (errno) {
|
||||
- error(1, errno, "Invalid size provided\n" USAGE);
|
||||
+ fprintf(stderr, "Invalid size provided\n" USAGE);
|
||||
}
|
||||
if (end_of_number == number) {
|
||||
- error(1, 0, "Invalid size provided\n" USAGE);
|
||||
+ fprintf(stderr, "Invalid size provided\n" USAGE);
|
||||
}
|
||||
if (size_of_buffer < 1 || size_of_buffer > emlog_max_size) {
|
||||
- error(1, 0, "Invalid size provided must be a value between 1 and %d\n" USAGE, emlog_max_size);
|
||||
+ fprintf(stderr, "Invalid size provided must be a value between 1 and %d\n" USAGE, emlog_max_size);
|
||||
}
|
||||
}
|
||||
if (argc > 3 ) {
|
||||
@@ -71,10 +70,10 @@ int main(int argc, char** argv) {
|
||||
number = argv[3];
|
||||
mode = strtol(number, &end_of_number, 8);
|
||||
if (errno) {
|
||||
- error(1, errno, "Invalid mode provided\n" USAGE);
|
||||
+ fprintf(stderr, "Invalid mode provided\n" USAGE);
|
||||
}
|
||||
if (end_of_number == number || S_IFMT & mode) {
|
||||
- error(1, 0, "Invalid mode provided\n" USAGE);
|
||||
+ fprintf(stderr, "Invalid mode provided\n" USAGE);
|
||||
}
|
||||
}
|
||||
if (argc > 4 ) {
|
||||
@@ -82,27 +81,27 @@ int main(int argc, char** argv) {
|
||||
number = argv[4];
|
||||
uid = strtol(number, &end_of_number, 10);
|
||||
if (errno) {
|
||||
- error(1, errno, "Invalid uid provided\n" USAGE);
|
||||
+ fprintf(stderr, "Invalid uid provided\n" USAGE);
|
||||
}
|
||||
if (end_of_number == number) {
|
||||
- error(1, 0, "Invalid uid provided\n" USAGE);
|
||||
+ fprintf(stderr, "Invalid uid provided\n" USAGE);
|
||||
}
|
||||
}
|
||||
rc = stat(EMLOG_DEVICE, &emlog_stat);
|
||||
if (rc == -1) {
|
||||
- error(1, errno, "stat: " EMLOG_DEVICE);
|
||||
+ fprintf(stderr, "stat: " EMLOG_DEVICE);
|
||||
}
|
||||
if (!S_ISCHR(emlog_stat.st_mode)) {
|
||||
- error(1, 0, EMLOG_DEVICE " is not a valid emlog device\n");
|
||||
+ fprintf(stderr, EMLOG_DEVICE " is not a valid emlog device\n");
|
||||
}
|
||||
rc = mknod(file, mode | S_IFCHR, makedev(major(emlog_stat.st_rdev),size_of_buffer));
|
||||
if (rc == -1) {
|
||||
- error(1, errno, "mknod: %s", file);
|
||||
+ fprintf(stderr, "mknod: %s", file);
|
||||
}
|
||||
if (uid != -1) {
|
||||
rc = chown(file, uid, -1);
|
||||
if (rc == -1) {
|
||||
- error(1, errno, "chown: %s", file);
|
||||
+ fprintf(stderr, "chown: %s", file);
|
||||
}
|
||||
}
|
||||
printf("Log device %s created with buffer size of %d KiB\n", file, size_of_buffer);
|
||||
--
|
||||
2.20.1
|
||||
@@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
PATH=/sbin:/usr/sbin:/bin:/usr/bin
|
||||
|
||||
[ -r /etc/default/emlog ] && . /etc/default/emlog
|
||||
|
||||
do_start() {
|
||||
:
|
||||
}
|
||||
|
||||
do_stop() {
|
||||
nbcat /dev/emlog > /data/emlog
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
do_start || exit $?
|
||||
;;
|
||||
stop)
|
||||
do_stop || exit $?
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {stop}" >&2
|
||||
exit 3
|
||||
;;
|
||||
esac
|
||||
37
meta-openembedded/meta-oe/recipes-core/emlog/emlog_git.bb
Normal file
37
meta-openembedded/meta-oe/recipes-core/emlog/emlog_git.bb
Normal file
@@ -0,0 +1,37 @@
|
||||
require ${BPN}.inc
|
||||
|
||||
SRC_URI += "file://${BPN}.initd \
|
||||
file://0001-Remove-modules_clean-from-clean-target.patch \
|
||||
"
|
||||
|
||||
SRC_URI:append:libc-musl = " file://Drop-use-of-error-h.patch"
|
||||
|
||||
inherit update-rc.d
|
||||
|
||||
INITSCRIPT_NAME = "${BPN}"
|
||||
|
||||
|
||||
|
||||
do_compile() {
|
||||
oe_runmake nbcat
|
||||
oe_runmake mkemlog
|
||||
}
|
||||
|
||||
do_install() {
|
||||
install -Dm 0755 ${WORKDIR}/${BPN}.initd ${D}${sysconfdir}/init.d/${BPN}
|
||||
install -Dm 0755 ${S}/nbcat ${D}${bindir}/nbcat
|
||||
install -Dm 0755 ${S}/mkemlog ${D}${bindir}/mkemlog
|
||||
}
|
||||
|
||||
RRECOMMENDS:${PN} += "kernel-module-emlog"
|
||||
|
||||
# The NVD database doesn't have a CPE for this product,
|
||||
# the name of this product is exactly the same as github.com/emlog/emlog
|
||||
# but it's not related in any way. The following CVEs are from that project
|
||||
# so they can be safely ignored
|
||||
CVE_CHECK_IGNORE += "\
|
||||
CVE-2019-16868 \
|
||||
CVE-2019-17073 \
|
||||
CVE-2021-44584 \
|
||||
CVE-2022-1526 \
|
||||
"
|
||||
@@ -0,0 +1,10 @@
|
||||
require emlog.inc
|
||||
|
||||
inherit module
|
||||
|
||||
EXTRA_OEMAKE += " \
|
||||
KDIR=${STAGING_KERNEL_DIR} \
|
||||
KVER=${KERNEL_VERSION} \
|
||||
"
|
||||
|
||||
MAKE_TARGETS = "modules"
|
||||
Reference in New Issue
Block a user