mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH v2 01/16] scripts: include: add definitions for printk and BUG()
Date: Mon, 25 Nov 2024 16:12:13 +0100	[thread overview]
Message-ID: <20241125151228.341441-2-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20241125151228.341441-1-a.fatoum@pengutronix.de>

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@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




  reply	other threads:[~2024-11-25 15:13 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-25 15:12 [PATCH v2 00/16] Remove dependency on ld --gc-section in PBL Ahmad Fatoum
2024-11-25 15:12 ` Ahmad Fatoum [this message]
2024-11-25 15:12 ` [PATCH v2 02/16] xfuncs: include <malloc.h> for free definition Ahmad Fatoum
2024-11-25 15:12 ` [PATCH v2 03/16] pbl: define IN_PBL & IN_PROPER macros globally Ahmad Fatoum
2024-11-25 15:12 ` [PATCH v2 04/16] treewide: replace inverted check for PBL with new IN_PROPER macro Ahmad Fatoum
2024-11-25 15:12 ` [PATCH v2 05/16] lib: random: add stubs for PBL Ahmad Fatoum
2024-11-25 15:12 ` [PATCH v2 06/16] bootsource: stub out when in PBL Ahmad Fatoum
2024-11-25 15:12 ` [PATCH v2 07/16] crypto: provide crypto_memneq for PBL Ahmad Fatoum
2024-11-25 15:12 ` [PATCH v2 08/16] cdev: stub out cdev_read/write " Ahmad Fatoum
2024-11-25 15:12 ` [PATCH v2 09/16] libfile: stub out file descriptor API " Ahmad Fatoum
2024-11-25 15:12 ` [PATCH v2 10/16] environment: stub out environment " Ahmad Fatoum
2024-11-25 15:12 ` [PATCH v2 11/16] of: stub out live tree API when using PBL Ahmad Fatoum
2024-11-25 15:12 ` [PATCH v2 12/16] errno: stub out perror/strerror API when built for PBL Ahmad Fatoum
2024-11-25 15:12 ` [PATCH v2 13/16] xfuncs: stub out " Ahmad Fatoum
2024-11-25 15:12 ` [PATCH v2 14/16] stdio: stub out basprintf and friends " Ahmad Fatoum
2024-11-25 15:12 ` [PATCH v2 15/16] memory: stub out request_barebox_region " Ahmad Fatoum
2024-11-25 15:12 ` [PATCH v2 16/16] malloc: add PBL stubs Ahmad Fatoum

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241125151228.341441-2-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox