From 242d9e7531fbc394214d2a54d3ff56a5690f397a Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Mon, 14 Sep 2020 15:37:47 +0200 Subject: sandbox: implement actual sandbox reset via exec(2) On Linux, /proc/self/exe is a symlink to the originally exec(2)d executable. We can exec that with the original argv to simulate a reset. This is useful for shorter development cycles on sandbox and in future, could be used to test barebox behavior around resets (e.g. reset reason can be passed through via libc environment). We leave the original hanging reset in place though, because: - Many boards have multiple reset providers and incoming patches will allow users to select a specific one. Having this on sandbox as well makes testing easier. - /proc/self/exe is Linux-specific and wouldn't work when being run on e.g. BSDs or macOS Signed-off-by: Ahmad Fatoum Signed-off-by: Sascha Hauer --- arch/sandbox/Kconfig | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'arch/sandbox/Kconfig') diff --git a/arch/sandbox/Kconfig b/arch/sandbox/Kconfig index c4d0ab4dbc..b5213c662b 100644 --- a/arch/sandbox/Kconfig +++ b/arch/sandbox/Kconfig @@ -24,6 +24,13 @@ config SANDBOX_UNWIND select ARCH_HAS_STACK_DUMP depends on KASAN +config SANDBOX_REEXEC + prompt "exec(2) reset handler" + def_bool y + help + The normal reset handler hangs barebox. On Linux, barebox + instead can exec itself to simulate a reset. + config PHYS_ADDR_T_64BIT bool -- cgit v1.2.3