Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F148104441
D26781.id78221.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D26781.id78221.diff
View Options
Index: sys/conf/kern.post.mk
===================================================================
--- sys/conf/kern.post.mk
+++ sys/conf/kern.post.mk
@@ -457,24 +457,9 @@
.if ${MFS_IMAGE:Uno} != "no"
.if empty(MD_ROOT_SIZE_CONFIGURED)
-# Generate an object file from the file system image to embed in the kernel
-# via linking. Make sure the contents are in the mfs section and rename the
-# start/end/size variables to __start_mfs, __stop_mfs, and mfs_size,
-# respectively.
-embedfs_${MFS_IMAGE:T:R}.o: ${MFS_IMAGE}
- ${OBJCOPY} --input-target binary \
- --output-target ${EMBEDFS_FORMAT.${MACHINE_ARCH}} \
- --binary-architecture ${EMBEDFS_ARCH.${MACHINE_ARCH}} \
- ${MFS_IMAGE} ${.TARGET}
- ${OBJCOPY} \
- --rename-section .data=mfs,contents,alloc,load,readonly,data \
- --redefine-sym \
- _binary_${MFS_IMAGE:C,[^[:alnum:]],_,g}_size=__mfs_root_size \
- --redefine-sym \
- _binary_${MFS_IMAGE:C,[^[:alnum:]],_,g}_start=mfs_root \
- --redefine-sym \
- _binary_${MFS_IMAGE:C,[^[:alnum:]],_,g}_end=mfs_root_end \
- ${.TARGET}
+embedfs_${MFS_IMAGE:T:R}.o: ${MFS_IMAGE} $S/dev/md/embedfs.S
+ ${CC} ${CFLAGS} ${ACFLAGS} -DMFS_IMAGE="${MFS_IMAGE}" -c \
+ $S/dev/md/embedfs.S -o ${.TARGET}
.endif
.endif
Index: sys/conf/kern.pre.mk
===================================================================
--- sys/conf/kern.pre.mk
+++ sys/conf/kern.pre.mk
@@ -358,37 +358,6 @@
MKMODULESENV+= __MPATH="${__MPATH}"
.endif
-# Architecture and output format arguments for objcopy to convert image to
-# object file
-
-.if ${MFS_IMAGE:Uno} != "no"
-.if empty(MD_ROOT_SIZE_CONFIGURED)
-.if !defined(EMBEDFS_FORMAT.${MACHINE_ARCH})
-EMBEDFS_FORMAT.${MACHINE_ARCH}!= awk -F'"' '/OUTPUT_FORMAT/ {print $$2}' ${LDSCRIPT}
-.if empty(EMBEDFS_FORMAT.${MACHINE_ARCH})
-.undef EMBEDFS_FORMAT.${MACHINE_ARCH}
-.endif
-.endif
-
-.if !defined(EMBEDFS_ARCH.${MACHINE_ARCH})
-EMBEDFS_ARCH.${MACHINE_ARCH}!= sed -n '/OUTPUT_ARCH/s/.*(\(.*\)).*/\1/p' ${LDSCRIPT}
-.if empty(EMBEDFS_ARCH.${MACHINE_ARCH})
-.undef EMBEDFS_ARCH.${MACHINE_ARCH}
-.endif
-.endif
-
-EMBEDFS_FORMAT.arm?= elf32-littlearm
-EMBEDFS_FORMAT.armv6?= elf32-littlearm
-EMBEDFS_FORMAT.armv7?= elf32-littlearm
-EMBEDFS_FORMAT.aarch64?= elf64-littleaarch64
-EMBEDFS_FORMAT.mips?= elf32-tradbigmips
-EMBEDFS_FORMAT.mipsel?= elf32-tradlittlemips
-EMBEDFS_FORMAT.mips64?= elf64-tradbigmips
-EMBEDFS_FORMAT.mips64el?= elf64-tradlittlemips
-EMBEDFS_FORMAT.riscv64?= elf64-littleriscv
-.endif
-.endif
-
# Detect kernel config options that force stack frames to be turned on.
DDB_ENABLED!= grep DDB opt_ddb.h || true ; echo
DTR_ENABLED!= grep KDTRACE_FRAME opt_kdtrace.h || true ; echo
Index: sys/dev/md/embedfs.S
===================================================================
--- /dev/null
+++ sys/dev/md/embedfs.S
@@ -0,0 +1,44 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2020 John Baldwin <jhb@FreeBSD.org>
+ *
+ * This software was developed by SRI International and the University of
+ * Cambridge Computer Laboratory (Department of Computer Science and
+ * Technology) under DARPA contract HR0011-18-C-0016 ("ECATS"), as part of the
+ * DARPA SSITH research programme.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+
+ .section mfs, "a", @progbits
+ .globl mfs_root
+ .type mfs_root, @object
+mfs_root:
+ .incbin __XSTRING(MFS_IMAGE)
+ .size mfs_root, . - mfs_root
+ .globl mfs_root_end
+ .type mfs_root_end, @object
+mfs_root_end:
+ .size mfs_root_end, . - mfs_root_end
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Mar 16, 7:31 PM (15 h, 55 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29783865
Default Alt Text
D26781.id78221.diff (4 KB)
Attached To
Mode
D26781: Use a template assembly file to generate the embedded MFS.
Attached
Detach File
Event Timeline
Log In to Comment