The branch main has been updated by mmel:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=28482babd08afdee79a6d42bd4f54d57f176dc8a

commit 28482babd08afdee79a6d42bd4f54d57f176dc8a
Author:     Michal Meloun <[email protected]>
AuthorDate: 2020-12-25 18:48:33 +0000
Commit:     Michal Meloun <[email protected]>
CommitDate: 2020-12-30 12:56:11 +0000

    arm64: Use new arm_kernel_boothdr script for generating booti images.
---
 sys/arm64/arm64/locore.S | 31 -------------------------------
 sys/conf/Makefile.arm64  | 36 ++++++++++++++++++++----------------
 2 files changed, 20 insertions(+), 47 deletions(-)

diff --git a/sys/arm64/arm64/locore.S b/sys/arm64/arm64/locore.S
index 3e7ea7b44b70..c62a2a5bd626 100644
--- a/sys/arm64/arm64/locore.S
+++ b/sys/arm64/arm64/locore.S
@@ -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
 
diff --git a/sys/conf/Makefile.arm64 b/sys/conf/Makefile.arm64
index 057f4feb3d38..1f5760021f3e 100644
--- a/sys/conf/Makefile.arm64
+++ b/sys/conf/Makefile.arm64
@@ -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}"
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "[email protected]"

Reply via email to