Skip to contentSkip to conversation

xen/arm: build as zImage

PATCH In review Stefano Stabellini 3 participants 4 messages Nov 27, 2012 – Nov 29, 2012

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 xen/arm: build as zImage

The zImage format is extremely simple: it only consists of a magic number and 2 addresses in a specific position (see
http://www.simtec.co.uk/products/SWLINUX/files/booting_article.html#d0e309).

Some bootloaders expect a zImage; considering that it doesn't cost us much to build Xen compatible with the format, make it so.

Changes in v3:
- pass the correct size;
- go back to the original no-ops plus branch for consistency with Linux.

Changes in v2:
- code style;
- pass 0 a start address.

xen/arch/arm/head.S +18 -0
index 25c4cfe..a78363b 100644
@@ -22,6 +22,8 @@
 #include <asm/processor-ca15.h>
 #include <asm/asm_defns.h>
 
+#define ZIMAGE_MAGIC_NUMBER 0x016f2818
+
 #define PT_PT  0xe7f /* nG=1, AF=1, SH=10, AP=01, NS=1, ATTR=111, T=1, P=1 */
 #define PT_MEM 0xe7d /* nG=1, AF=1, SH=10, AP=01, NS=1, ATTR=111, T=0, P=1 */
 #define PT_DEV 0xe71 /* nG=1, AF=1, SH=10, AP=01, NS=1, ATTR=100, T=0, P=1 */
@@ -52,6 +54,22 @@
 	 * or the initial pagetable code below will need adjustment. */
 	.global start
 start:
+
+	/* zImage magic header, see:
+	 * http://www.simtec.co.uk/products/SWLINUX/files/booting_article.html#d0e309
+	 */
+	.rept 7
+	mov   r0, r0
+	.endr
+	mov   r0, r0
+	b     past_zImage
+
+	.word ZIMAGE_MAGIC_NUMBER    /* Magic numbers to help the loader */
+	.word 0x00000000             /* absolute load/run zImage address or
+	                              * 0 for PiC */
+	.word (_end - _start)        /* zImage end address */
+
+past_zImage:
 	cpsid aif                    /* Disable all interrupts */
 
 	/* Save the bootloader arguments in less-clobberable registers */
#1 lore raw

Review

Quoted 1 line · Stefano Stabellini
(quoted diff) +1 -0
+	.word (_end - _start)        /* zImage end address */

Actually the assembler has problems digesting this expression. This patch actually compiles:

---

xen/arm: build as zImage

The zImage format is extremely simple: it only consists of a magic number and 2 addresses in a specific position (see
http://www.simtec.co.uk/products/SWLINUX/files/booting_article.html#d0e309).

Some bootloaders expect a zImage; considering that it doesn't cost us much to build Xen compatible with the format, make it so.

Changes in v3:
- pass the correct size;
- go back to the original no-ops plus branch for consistency with Linux.

Changes in v2:
- code style;
- pass 0 a start address.

xen/arch/arm/head.S +18 -0
index 25c4cfe..6cb5d1b 100644
@@ -22,6 +22,8 @@
 #include <asm/processor-ca15.h>
 #include <asm/asm_defns.h>
 
+#define ZIMAGE_MAGIC_NUMBER 0x016f2818
+
 #define PT_PT  0xe7f /* nG=1, AF=1, SH=10, AP=01, NS=1, ATTR=111, T=1, P=1 */
 #define PT_MEM 0xe7d /* nG=1, AF=1, SH=10, AP=01, NS=1, ATTR=111, T=0, P=1 */
 #define PT_DEV 0xe71 /* nG=1, AF=1, SH=10, AP=01, NS=1, ATTR=100, T=0, P=1 */
@@ -52,6 +54,22 @@
 	 * or the initial pagetable code below will need adjustment. */
 	.global start
 start:
+
+	/* zImage magic header, see:
+	 * http://www.simtec.co.uk/products/SWLINUX/files/booting_article.html#d0e309
+	 */
+	.rept 7
+	mov   r0, r0
+	.endr
+	mov   r0, r0
+	b     past_zImage
+
+	.word ZIMAGE_MAGIC_NUMBER    /* Magic numbers to help the loader */
+	.word 0x00000000             /* absolute load/run zImage address or
+	                              * 0 for PiC */
+	.word (_end - start)         /* zImage end address */
+
+past_zImage:
 	cpsid aif                    /* Disable all interrupts */
 
 	/* Save the bootloader arguments in less-clobberable registers */
Acked-by
#2 lore raw
Quoted 42 lines · Stefano Stabellini

Review

Quoted 1 line · Stefano Stabellini
(quoted diff) +1 -0
+	.word (_end - _start)        /* zImage end address */

Actually the assembler has problems digesting this expression. This patch actually compiles:

---

xen/arm: build as zImage

The zImage format is extremely simple: it only consists of a magic number and 2 addresses in a specific position (see
http://www.simtec.co.uk/products/SWLINUX/files/booting_article.html#d0e309).

Some bootloaders expect a zImage; considering that it doesn't cost us much to build Xen compatible with the format, make it so.

Changes in v3:
- pass the correct size;
- go back to the original no-ops plus branch for consistency with Linux.

Changes in v2:
- code style;
- pass 0 a start address.

xen/arch/arm/head.S +2 -0
index 25c4cfe..6cb5d1b 100644
@@ -22,6 +22,8 @@
 #include <asm/processor-ca15.h>
 #include <asm/asm_defns.h>
 
+#define ZIMAGE_MAGIC_NUMBER 0x016f2818
+
 #define PT_PT  0xe7f /* nG=1, AF=1, SH=10, AP=01, NS=1, ATTR=111, T=1, P=1 */
 #define PT_MEM 0xe7d /* nG=1, AF=1, SH=10, AP=01, NS=1, ATTR=111, T=0, P=1 */
 #define PT_DEV 0xe71 /* nG=1, AF=1, SH=10, AP=01, NS=1, ATTR=100, T=0, P=1 */
@@ -52,6 +54,22 @@
 	 * or the initial pagetable code below will need adjustment. */

xen/arch/arm/head.S line 64

Quoted 10 lines
xen/arch/arm/head.S +8 -0
 	.global start
 start:
+
+	/* zImage magic header, see:
+	 * http://www.simtec.co.uk/products/SWLINUX/files/booting_article.html#d0e309
+	 */
+	.rept 7
+	mov   r0, r0
+	.endr
+	mov   r0, r0

OK, with this changed to a .rept 8 and the singleton removed,

Quoted 16 lines
xen/arch/arm/head.S +8 -0
+	b     past_zImage
+
+	.word ZIMAGE_MAGIC_NUMBER    /* Magic numbers to help the loader */
+	.word 0x00000000             /* absolute load/run zImage address or
+	                              * 0 for PiC */
+	.word (_end - start)         /* zImage end address */
+
+past_zImage:
 	cpsid aif                    /* Disable all interrupts */
 
 	/* Save the bootloader arguments in less-clobberable registers */

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#3 lore raw
Quoted 10 lines · Tim Deegan

xen/arch/arm/head.S line 64

Quoted 7 lines
xen/arch/arm/head.S +7 -0
+	/* zImage magic header, see:
+	 * http://www.simtec.co.uk/products/SWLINUX/files/booting_article.html#d0e309
+	 */
+	.rept 7
+	mov   r0, r0
+	.endr
+	mov   r0, r0

OK, with this changed to a .rept 8 and the singleton removed,

And me, I've applied with this trivial modification.

Ian.