git: 7554a5b611fd - main - arm: Hack to make kernel.bin into a zImage

From: Warner Losh <imp_at_FreeBSD.org>
Date: Tue, 29 Apr 2025 05:54:20 UTC
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=7554a5b611fd8e9a97cb6937a1110079568d4fd3

commit 7554a5b611fd8e9a97cb6937a1110079568d4fd3
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2024-01-09 04:17:50 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2025-04-29 05:53:48 +0000

    arm: Hack to make kernel.bin into a zImage
    
    Add a the zImage header before start. This allows some boot loaders
    (including xen) to load kernel.bin as a zImage.
    
    I did this for someone who was doing some work on getting FreeBSD/armv7
    working on Xen. That never went anywhere, but this seems useful in its
    own right.
    
    Sponsored by:           Netflix
---
 sys/arm/arm/locore.S | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/sys/arm/arm/locore.S b/sys/arm/arm/locore.S
index 6acaaa8a7eb4..2947032531b1 100644
--- a/sys/arm/arm/locore.S
+++ b/sys/arm/arm/locore.S
@@ -98,6 +98,16 @@
 	.globl	btext
 btext:
 ASENTRY_NP(_start)
+	.rept 8			/* zImage header */
+	mov r0, r0
+	.endr
+
+	b start
+
+	.word 0x016f2818
+	.word 0                 /* absolute load/run zImage address or 0 or PIC */
+	.word (_edata - btext)
+start:
 	STOP_UNWINDING		/* Can't unwind into the bootloader! */
 
 	/* Make sure interrupts are disabled. */