Rather than appending it at the end of the kernel build process, give the
ELF trampoline build its own target, "trampoline". It makes it possible to construct a bootable gzipped kernel without having to build in the same process.
This commit is contained in:
parent
5a09b5d83f
commit
97736242bb
@ -58,40 +58,39 @@ SYSTEM_LD_TAIL +=;sed s/" + SIZEOF_HEADERS"// ldscript.$M\
|
||||
${OBJCOPY} -S -O binary ${FULLKERNEL}.noheader \
|
||||
${KERNEL_KO}.bin; \
|
||||
rm ${FULLKERNEL}.noheader
|
||||
.if ${DDB_ENABLED} != "" || defined(BUILD_ELF_TRAMPOLINE)
|
||||
SYSTEM_LD_TAIL += ;echo "\#define KERNNAME \"${KERNEL_KO}.tmp\"" \
|
||||
>opt_kernname.h ;\
|
||||
sed s/${KERNVIRTADDR}/${KERNPHYSADDR}/ ldscript.$M > \
|
||||
ldscript.$M.tramp; \
|
||||
|
||||
trampoline: ${KERNEL_KO}.tramp
|
||||
${KERNEL_KO}.tramp: ${KERNEL_KO}
|
||||
echo "#define KERNNAME \"${KERNEL_KO}.tmp\"" >opt_kernname.h
|
||||
sed s/${KERNVIRTADDR}/${KERNPHYSADDR}/ ldscript.$M > ldscript.$M.tramp
|
||||
sed s/" + SIZEOF_HEADERS"// ldscript.$M.tramp > \
|
||||
ldscript.$M.tramp.noheader; \
|
||||
ldscript.$M.tramp.noheader
|
||||
${OBJCOPY} --strip-symbol '$$d' --strip-symbol '$$a' \
|
||||
-g --strip-symbol '$$t' ${FULLKERNEL} ${KERNEL_KO}.tmp;\
|
||||
-g --strip-symbol '$$t' ${FULLKERNEL} ${KERNEL_KO}.tmp
|
||||
${CC} -O -nostdlib -I. -Xlinker -T -Xlinker ldscript.$M.tramp \
|
||||
$S/$M/$M/elf_trampoline.c $S/$M/$M/inckern.S -o ${KERNEL_KO}.tramp;\
|
||||
$S/$M/$M/elf_trampoline.c $S/$M/$M/inckern.S -o ${KERNEL_KO}.tramp
|
||||
${CC} -O -nostdlib -I. -Xlinker -T -Xlinker ldscript.$M.tramp.noheader \
|
||||
$S/$M/$M/elf_trampoline.c $S/$M/$M/inckern.S -o \
|
||||
${KERNEL_KO}.tramp.noheader; \
|
||||
${KERNEL_KO}.tramp.noheader
|
||||
${OBJCOPY} -S -O binary ${KERNEL_KO}.tramp.noheader \
|
||||
${KERNEL_KO}.tramp.bin; \
|
||||
${OBJCOPY} ${STRIP_FLAGS} ${KERNEL_KO}.tmp; \
|
||||
echo "\#define KERNNAME \"${KERNEL_KO}.tmp.gz\"" \
|
||||
>opt_kernname.h ;\
|
||||
gzip -9 ${KERNEL_KO}.tmp; \
|
||||
${KERNEL_KO}.tramp.bin
|
||||
${OBJCOPY} ${STRIP_FLAGS} ${KERNEL_KO}.tmp
|
||||
echo "#define KERNNAME \"${KERNEL_KO}.tmp.gz\"" \
|
||||
>opt_kernname.h
|
||||
gzip -9 ${KERNEL_KO}.tmp
|
||||
eval $$(stat -s ${KERNEL_KO}.tmp.gz) && \
|
||||
echo "\#define KERNSIZE $$st_size" >>opt_kernname.h;\
|
||||
${CC} -O2 -DKZIP -I. -c $S/kern/inflate.c -o inflate-tramp.o; \
|
||||
echo "#define KERNSIZE $$st_size" >>opt_kernname.h
|
||||
${CC} -O2 -DKZIP -I. -c $S/kern/inflate.c -o inflate-tramp.o
|
||||
${CC} -O -nostdlib -I. -Xlinker -T -Xlinker ldscript.$M.tramp \
|
||||
-DKZIP $S/$M/$M/elf_trampoline.c inflate-tramp.o $S/$M/$M/inckern.S \
|
||||
-o ${KERNEL_KO}.gz.tramp;\
|
||||
-o ${KERNEL_KO}.gz.tramp
|
||||
${CC} -O -nostdlib -I. -Xlinker -T -Xlinker ldscript.$M.tramp.noheader \
|
||||
-DKZIP $S/$M/$M/elf_trampoline.c inflate-tramp.o $S/$M/$M/inckern.S \
|
||||
-o ${KERNEL_KO}.tramp.noheader; \
|
||||
-o ${KERNEL_KO}.tramp.noheader
|
||||
${OBJCOPY} -S -O binary ${KERNEL_KO}.tramp.noheader \
|
||||
${KERNEL_KO}.gz.tramp.bin; \
|
||||
${KERNEL_KO}.gz.tramp.bin
|
||||
rm ${KERNEL_KO}.tmp.gz ${KERNEL_KO}.tramp.noheader opt_kernname.h \
|
||||
inflate-tramp.o;
|
||||
.endif
|
||||
inflate-tramp.o
|
||||
|
||||
%BEFORE_DEPEND
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user