mirror of
https://github.com/lingble/meta-tegra.git
synced 2025-10-29 11:32:30 +00:00
tegra-flash-reboot: add recipe
to provide a small utility to reboot into recovery mode, which can't be done with busybox's reboot command. Signed-off-by: Matt Madison <matt@madison.systems>
This commit is contained in:
committed by
Matt Madison
parent
1523415228
commit
72124d7edf
@@ -0,0 +1,16 @@
|
||||
/* SPDX-License-Identifier: MIT */
|
||||
#include <linux/reboot.h>
|
||||
#include <sys/reboot.h>
|
||||
#include <sys/syscall.h>
|
||||
|
||||
static inline int sys_reboot(const void *arg) {
|
||||
return (int) syscall(SYS_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_RESTART2, arg);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
if (argc > 1)
|
||||
return sys_reboot(argv[1]);
|
||||
return sys_reboot("forced-recovery");
|
||||
}
|
||||
21
recipes-core/initrdscripts/tegra-flash-reboot_1.0.bb
Normal file
21
recipes-core/initrdscripts/tegra-flash-reboot_1.0.bb
Normal file
@@ -0,0 +1,21 @@
|
||||
DESCRIPTION = "Utility to force reboot into recovery mode"
|
||||
LICENSE = "MIT"
|
||||
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
|
||||
|
||||
SRC_URI = "file://reboot-recovery.c"
|
||||
|
||||
COMPATIBLE_MACHINE = "(tegra)"
|
||||
|
||||
S = "${WORKDIR}"
|
||||
B = "${WORKDIR}/build"
|
||||
|
||||
do_compile() {
|
||||
$CC $CFLAGS $LDFLAGS -o ${B}/reboot-recovery ${S}/reboot-recovery.c
|
||||
}
|
||||
|
||||
do_install() {
|
||||
install -d ${D}${bindir}
|
||||
install -m 0755 ${B}/reboot-recovery ${D}${bindir}/
|
||||
}
|
||||
|
||||
PACKAGE_ARCH = "${TEGRA_PKGARCH}"
|
||||
Reference in New Issue
Block a user