aboutsummaryrefslogtreecommitdiff
path: root/sys/conf/kern.post.mk
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2020-10-20 16:48:45 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2020-10-20 16:48:45 +0000
commitf54c6ef1000da0103df7b95b7c6454c326f984b5 (patch)
treec393eff7d699999591ac5afb5cc51ac68060eff5 /sys/conf/kern.post.mk
parent76ec6f51b933d748c795339a4bd1c676a13a0d12 (diff)
downloadsrc-f54c6ef1000da0103df7b95b7c6454c326f984b5.tar.gz
src-f54c6ef1000da0103df7b95b7c6454c326f984b5.zip
Use a template assembly file to generate the embedded MFS.
This uses the .incbin directive to pull in the MFS image contents. Using assembly directly ensures that symbols can be defined with the name and properties (such as .size) desired without having to rename symbols, etc. via a second objcopy invocation. Since it is compiled by the C compiler driver, it also avoids the need for all of the EMBEDFS* make variables. Suggested by: jrtc27 Reviewed by: kib, markj Obtained from: CheriBSD MFC after: 2 weeks Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D26781
Notes
Notes: svn path=/head/; revision=366897
Diffstat (limited to 'sys/conf/kern.post.mk')
-rw-r--r--sys/conf/kern.post.mk21
1 files changed, 3 insertions, 18 deletions
diff --git a/sys/conf/kern.post.mk b/sys/conf/kern.post.mk
index c9dce0e9f2f2..7df67e24f445 100644
--- a/sys/conf/kern.post.mk
+++ b/sys/conf/kern.post.mk
@@ -457,24 +457,9 @@ vnode_if_typedef.h:
.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