arm64: Use new arm_kernel_boothdr script for generating booti images.

This commit is contained in:
Michal Meloun 2020-12-25 19:48:33 +01:00
parent e163cae76e
commit 28482babd0
2 changed files with 20 additions and 47 deletions

View File

@ -43,22 +43,6 @@
.globl kernbase
.set kernbase, KERNBASE
/* U-Boot booti related constants. */
#if defined(LINUX_BOOT_ABI)
#ifndef UBOOT_IMAGE_OFFSET
#define UBOOT_IMAGE_OFFSET 0 /* Image offset from start of */
#endif /* 2 MiB page */
#ifndef UBOOT_IMAGE_SIZE /* Total size of image */
#define UBOOT_IMAGE_SIZE _end - _start
#endif
#ifndef UBOOT_IMAGE_FLAGS
#define UBOOT_IMAGE_FLAGS 0 /* LE kernel, unspecified */
#endif /* page size */
#endif /* defined(LINUX_BOOT_ABI) */
/*
* We assume:
* MMU on with an identity map, or off
@ -68,21 +52,6 @@
*/
ENTRY(_start)
#if defined(LINUX_BOOT_ABI)
/* U-boot image header */
b 1f /* code 0 */
.long 0 /* code 1 */
.quad UBOOT_IMAGE_OFFSET /* Image offset in 2 MiB page, LE */
.quad UBOOT_IMAGE_SIZE /* Image size, LE */
.quad UBOOT_IMAGE_FLAGS /* Flags for kernel. LE */
.quad 0 /* Reserved */
.quad 0 /* Reserved */
.quad 0 /* Reserved */
.long 0x644d5241 /* Magic "ARM\x64", LE */
.long 0 /* Reserved for PE COFF offset*/
1:
#endif /* defined(LINUX_BOOT_ABI) */
/* Drop to EL1 */
bl drop_to_el1

View File

@ -40,25 +40,11 @@ SYSTEM_LD= \
--strip-symbol='$$[adtx]*' \
${.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.
# Generate the .bin (booti images) kernel as an extra build output.
# The targets and rules to generate these appear near the end of the file.
KERNEL_EXTRA+= ${KERNEL_KO}.bin
KERNEL_EXTRA_INSTALL+= ${KERNEL_KO}.bin
${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='$$[adtx]*' \
--output-target=binary \
${.TARGET}
@chmod 755 ${.TARGET}
.if !empty(DDB_ENABLED)
CFLAGS += -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer
.endif
@ -79,3 +65,21 @@ CLEAN+= ${KERNEL_KO}.bin
%RULES
.include "$S/conf/kern.post.mk"
# Create a kernel.bin file...
# Copy the kernel to u-boot's booti image format (the elf headers are
# stripped and a custom binary head blob 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 ${.ALLSRC} ${.TARGET}.temp
@{ readelf -s ${.ALLSRC} | \
${AWK} -f $S/tools/arm_kernel_boothdr.awk -v hdrtype=v8booti && \
cat ${.TARGET}.temp; \
} > ${.TARGET}
@rm ${.TARGET}.temp
@echo "created ${.TARGET} from ${.ALLSRC}"