aboutsummaryrefslogtreecommitdiff
path: root/sys/conf/Makefile.arm
diff options
context:
space:
mode:
Diffstat (limited to 'sys/conf/Makefile.arm')
-rw-r--r--sys/conf/Makefile.arm36
1 files changed, 20 insertions, 16 deletions
diff --git a/sys/conf/Makefile.arm b/sys/conf/Makefile.arm
index 5416aff76666..8e98e5b07648 100644
--- a/sys/conf/Makefile.arm
+++ b/sys/conf/Makefile.arm
@@ -57,6 +57,7 @@ KERNVIRTADDR= 0xc0000000
# "ELF for the ARM architecture" for more info on the mapping symbols.
SYSTEM_LD= \
${SYSTEM_LD_BASECMD} \
+ --Map=/usr2/Meloun/ld.map \
--defsym='text_start=kernbase + SIZEOF_HEADERS' \
-o ${.TARGET} ${SYSTEM_OBJS} vers.o; \
$(OBJCOPY) \
@@ -64,22 +65,6 @@ SYSTEM_LD= \
--strip-symbol='$$[adt]*' \
${.TARGET}
-# Generate the .bin (no elf headers) kernel as an extra build output.
-# We must relink to generate the .bin kernel, because without headers the
-# location of everything changes. We also strip the ARM marker symbols.
-${KERNEL_KO}.bin: ${SYSTEM_DEP} vers.o
- @echo "linking ${.TARGET}"
- @${SYSTEM_LD_BASECMD} \
- --defsym='text_start=kernbase' \
- -o ${.TARGET} ${SYSTEM_OBJS} vers.o
- ${SIZE} ${.TARGET}
- @${OBJCOPY} \
- --wildcard \
- --strip-symbol='$$[adt]*' \
- --output-target=binary \
- ${.TARGET}
- @chmod 755 ${.TARGET}
-
# hack because genassym.c includes sys/bus.h which includes these.
genassym.o: bus_if.h device_if.h
@@ -98,3 +83,22 @@ genassym.o: bus_if.h device_if.h
%RULES
.include "$S/conf/kern.post.mk"
+
+# Generate the .bin (no elf headers) kernel
+# Copy the kernel to directly executable format (the elf headers are
+# stripped and a binary head blob with jump to kernel start address is
+# prepended), saving the output in a temp file.
+# We also strip arm "marker" symbols which are used only by elf toolchains. Read
+# the symbols from kernel.full and pass them to arm_kernel_boothdr.awk, which
+# generates a binary header blob that goes on the front of the stripped kernel.
+# Cat the header blob and the temp file together to make the kernel.bin file.
+${KERNEL_KO}.bin: ${FULLKERNEL}
+ @${OBJCOPY} --wildcard --strip-symbol='$$[adtx]*' \
+ --output-target=binary ${FULLKERNEL} ${.TARGET}.temp
+ @{ ${NM} ${FULLKERNEL} | \
+ LC_ALL=C \
+ ${AWK} -f $S/tools/arm_kernel_boothdr.awk -v hdrtype=v7jump && \
+ cat ${.TARGET}.temp; \
+ } > ${.TARGET}
+ @rm ${.TARGET}.temp
+ @echo "created ${.TARGET} from ${.ALLSRC}"