summaryrefslogtreecommitdiff
path: root/usr
diff options
context:
space:
mode:
Diffstat (limited to 'usr')
-rw-r--r--usr/Build.mk4
-rw-r--r--usr/initramfs.S17
2 files changed, 21 insertions, 0 deletions
diff --git a/usr/Build.mk b/usr/Build.mk
new file mode 100644
index 0000000..f734640
--- /dev/null
+++ b/usr/Build.mk
@@ -0,0 +1,4 @@
+targets += host/gen_init_cpio
+target.host/gen_init_cpio.kind := host-tool
+target.host/gen_init_cpio.sources := usr/gen_init_cpio.c
+target.host/gen_init_cpio.host-cflags := -Wno-sign-compare
diff --git a/usr/initramfs.S b/usr/initramfs.S
new file mode 100644
index 0000000..fa21553
--- /dev/null
+++ b/usr/initramfs.S
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+/*
+ * Embed the generated CPIO through the target assembler instead of converting
+ * it with `objcopy -I binary`. The resulting object inherits the target ABI
+ * attributes (notably RISC-V float ABI flags), which keeps both GNU ld and LLD
+ * strict-linking compatible.
+ */
+
+#ifndef INITRAMFS_IMAGE
+#error "INITRAMFS_IMAGE must name the generated CPIO archive"
+#endif
+
+ .section .init.ramfs, "a", @progbits
+ .balign 8
+ .incbin INITRAMFS_IMAGE
+