[PATCH v2 01/16] scripts: include: add definitions for printk and BUG()
Ahmad Fatoum
a.fatoum at pengutronix.de
Mon Nov 25 07:12:13 PST 2024
This is required for building files that are built for both host and
target systems and use these headers.
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
scripts/include/asm-generic/bug.h | 14 ++++++++++++++
scripts/include/linux/bug.h | 1 +
scripts/include/printk.h | 9 +++++++++
3 files changed, 24 insertions(+)
create mode 100644 scripts/include/asm-generic/bug.h
create mode 100644 scripts/include/linux/bug.h
create mode 100644 scripts/include/printk.h
diff --git a/scripts/include/asm-generic/bug.h b/scripts/include/asm-generic/bug.h
new file mode 100644
index 000000000000..c53ced628fcc
--- /dev/null
+++ b/scripts/include/asm-generic/bug.h
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef _ASM_GENERIC_BUG_H
+#define _ASM_GENERIC_BUG_H
+
+#include <printk.h>
+#include <stdlib.h>
+
+#define BUG() do { \
+ printf("BUG: failure at %s:%d/%s()!\n", __FILE__, __LINE__, __FUNCTION__); \
+ exit(41); \
+} while (0)
+
+#endif
diff --git a/scripts/include/linux/bug.h b/scripts/include/linux/bug.h
new file mode 100644
index 000000000000..b12fd89e42e9
--- /dev/null
+++ b/scripts/include/linux/bug.h
@@ -0,0 +1 @@
+#include <asm-generic/bug.h>
diff --git a/scripts/include/printk.h b/scripts/include/printk.h
new file mode 100644
index 000000000000..363d32f2e5cb
--- /dev/null
+++ b/scripts/include/printk.h
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+#ifndef __PRINTK_H
+#define __PRINTK_H
+
+#include <stdio.h>
+
+#define printk printf
+
+#endif
--
2.39.5
More information about the barebox
mailing list