Skip to contentSkip to conversation

ieee1275: Include a.out header in assembly of sparc64 boot loader

PATCH In review John Paul Adrian Glaubitz 2 participants 6 messages Feb 9, 2019 – Feb 21, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ieee1275: Include a.out header in assembly of sparc64 boot loader

Recent versions of binutils dropped support for the a.out and COFF formats on sparc64 targets. Since the boot loader on sparc64 is supposed to be an a.out binary and the a.out header entries are rather simple to calculate in our case, we just write the header ourselves instead of relying on external tools to do that.

---
v2:
- fix grammar in long description
v3:
- fix formatting in assembly code
- update comment in boot loader for consistency

 grub-core/Makefile.core.def            |  6 ++----
 grub-core/boot/sparc64/ieee1275/boot.S | 18 +++++++++++++++---
 include/grub/sparc64/ieee1275/boot.h   |  3 +--
 3 files changed, 18 insertions(+), 9 deletions(-)
grub-core/Makefile.core.def +2 -4
index e16fb06ba..f9f845828 100644
@@ -402,8 +402,7 @@ image = {
   i386_qemu_ldflags = '$(TARGET_IMG_BASE_LDOPT),$(GRUB_BOOT_MACHINE_LINK_ADDR)';
   i386_qemu_ccasflags = '-DGRUB_BOOT_MACHINE_LINK_ADDR=$(GRUB_BOOT_MACHINE_LINK_ADDR)';
 
-  sparc64_ieee1275_objcopyflags = '-O a.out-sunos-big';
-  sparc64_ieee1275_ldflags = ' -Wl,-Ttext=0x4000';
+  sparc64_ieee1275_ldflags = ' -Wl,-Ttext=0x3fe0';
 
   objcopyflags = '-O binary';
   enable = i386_pc;
@@ -432,8 +431,7 @@ image = {
   i386_pc_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x7C00';
 
   sparc64_ieee1275 = boot/sparc64/ieee1275/boot.S;
-  sparc64_ieee1275_objcopyflags = '-O a.out-sunos-big';
-  sparc64_ieee1275_ldflags = ' -Wl,-Ttext=0x4000';
+  sparc64_ieee1275_ldflags = ' -Wl,-Ttext=0x3fe0';
   sparc64_ieee1275_cppflags = '-DCDBOOT=1';
 
   objcopyflags = '-O binary';
grub-core/boot/sparc64/ieee1275/boot.S +15 -3
index 9ea9b4e06..a534e1853 100644
@@ -21,6 +21,18 @@
 
 	.text
 	.align	4
+	/* We're writing the a.out header ourselves as newer
+	 * upstream versions of binutils no longer support
+	 * the a.out format on sparc64.
+	 */
+	.word	0x1030107                        /* magic number */
+	.word	512 - GRUB_BOOT_AOUT_HEADER_SIZE /* size of text segment */
+	.word	0                                /* size of initialized data */
+	.word	0                                /* size of uninitialized data */
+	.word	0                                /* size of symbol table || checksum */
+	.word	_start                           /* entry point */
+	.word	0                                /* size of text relocation */
+	.word	0                                /* size of data relocation */
 	.globl	_start
 _start:
 	/* OF CIF entry point arrives in %o4 */
@@ -41,9 +53,9 @@ pic_base:
 	 * After loading in that block we will execute it by jumping to the
 	 * load address plus the size of the prepended A.OUT header (32 bytes).
 	 */
-	.org GRUB_BOOT_MACHINE_BOOT_DEVPATH
+	.org GRUB_BOOT_MACHINE_BOOT_DEVPATH + GRUB_BOOT_AOUT_HEADER_SIZE
 boot_path:
-	.org GRUB_BOOT_MACHINE_KERNEL_BYTE
+	.org GRUB_BOOT_MACHINE_KERNEL_BYTE + GRUB_BOOT_AOUT_HEADER_SIZE
 boot_path_end:
 kernel_byte:		.xword (2 << 9)
 kernel_address:		.word  GRUB_BOOT_MACHINE_KERNEL_ADDR
@@ -52,7 +64,7 @@ kernel_address:		.word  GRUB_BOOT_MACHINE_KERNEL_ADDR
 #define boot_path_end (_start + 1024)
 #include <grub/offsets.h>
 
-	.org 8
+	.org 8 + GRUB_BOOT_AOUT_HEADER_SIZE
 kernel_byte:		.xword (2 << 9)
 kernel_size:	        .word  512
 kernel_address:		.word  GRUB_BOOT_SPARC64_IEEE1275_IMAGE_ADDRESS
include/grub/sparc64/ieee1275/boot.h +1 -2
index 02d53f28e..cc5a941e3 100644
@@ -46,8 +46,7 @@
 
 #define GRUB_BOOT_MACHINE_KERNEL_BYTE 0x80
 
-#define GRUB_BOOT_MACHINE_CODE_END \
-	(0x1fc - GRUB_BOOT_AOUT_HEADER_SIZE)
+#define GRUB_BOOT_MACHINE_CODE_END 0x1fc
 
 #define GRUB_BOOT_MACHINE_KERNEL_ADDR 0x4200
 
Signature · 1 line
2.20.1
#1 lore raw

This is supposed to be version 3. Forgot to edit the subject.

Adrian

Quoted 102 lines · John Paul Adrian Glaubitz

Recent versions of binutils dropped support for the a.out and COFF formats on sparc64 targets. Since the boot loader on sparc64 is supposed to be an a.out binary and the a.out header entries are rather simple to calculate in our case, we just write the header ourselves instead of relying on external tools to do that.

---
v2:
- fix grammar in long description
v3:
- fix formatting in assembly code
- update comment in boot loader for consistency

 grub-core/Makefile.core.def            |  6 ++----
 grub-core/boot/sparc64/ieee1275/boot.S | 18 +++++++++++++++---
 include/grub/sparc64/ieee1275/boot.h   |  3 +--
 3 files changed, 18 insertions(+), 9 deletions(-)
grub-core/Makefile.core.def +2 -4
index e16fb06ba..f9f845828 100644
@@ -402,8 +402,7 @@ image = {
   i386_qemu_ldflags = '$(TARGET_IMG_BASE_LDOPT),$(GRUB_BOOT_MACHINE_LINK_ADDR)';
   i386_qemu_ccasflags = '-DGRUB_BOOT_MACHINE_LINK_ADDR=$(GRUB_BOOT_MACHINE_LINK_ADDR)';
 
-  sparc64_ieee1275_objcopyflags = '-O a.out-sunos-big';
-  sparc64_ieee1275_ldflags = ' -Wl,-Ttext=0x4000';
+  sparc64_ieee1275_ldflags = ' -Wl,-Ttext=0x3fe0';
 
   objcopyflags = '-O binary';
   enable = i386_pc;
@@ -432,8 +431,7 @@ image = {
   i386_pc_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x7C00';
 
   sparc64_ieee1275 = boot/sparc64/ieee1275/boot.S;
-  sparc64_ieee1275_objcopyflags = '-O a.out-sunos-big';
-  sparc64_ieee1275_ldflags = ' -Wl,-Ttext=0x4000';
+  sparc64_ieee1275_ldflags = ' -Wl,-Ttext=0x3fe0';
   sparc64_ieee1275_cppflags = '-DCDBOOT=1';
 
   objcopyflags = '-O binary';
grub-core/boot/sparc64/ieee1275/boot.S +15 -3
index 9ea9b4e06..a534e1853 100644
@@ -21,6 +21,18 @@
 
 	.text
 	.align	4
+	/* We're writing the a.out header ourselves as newer
+	 * upstream versions of binutils no longer support
+	 * the a.out format on sparc64.
+	 */
+	.word	0x1030107                        /* magic number */
+	.word	512 - GRUB_BOOT_AOUT_HEADER_SIZE /* size of text segment */
+	.word	0                                /* size of initialized data */
+	.word	0                                /* size of uninitialized data */
+	.word	0                                /* size of symbol table || checksum */
+	.word	_start                           /* entry point */
+	.word	0                                /* size of text relocation */
+	.word	0                                /* size of data relocation */
 	.globl	_start
 _start:
 	/* OF CIF entry point arrives in %o4 */
@@ -41,9 +53,9 @@ pic_base:
 	 * After loading in that block we will execute it by jumping to the
 	 * load address plus the size of the prepended A.OUT header (32 bytes).
 	 */
-	.org GRUB_BOOT_MACHINE_BOOT_DEVPATH
+	.org GRUB_BOOT_MACHINE_BOOT_DEVPATH + GRUB_BOOT_AOUT_HEADER_SIZE
 boot_path:
-	.org GRUB_BOOT_MACHINE_KERNEL_BYTE
+	.org GRUB_BOOT_MACHINE_KERNEL_BYTE + GRUB_BOOT_AOUT_HEADER_SIZE
 boot_path_end:
 kernel_byte:		.xword (2 << 9)
 kernel_address:		.word  GRUB_BOOT_MACHINE_KERNEL_ADDR
@@ -52,7 +64,7 @@ kernel_address:		.word  GRUB_BOOT_MACHINE_KERNEL_ADDR
 #define boot_path_end (_start + 1024)
 #include <grub/offsets.h>
 
-	.org 8
+	.org 8 + GRUB_BOOT_AOUT_HEADER_SIZE
 kernel_byte:		.xword (2 << 9)
 kernel_size:	        .word  512
 kernel_address:		.word  GRUB_BOOT_SPARC64_IEEE1275_IMAGE_ADDRESS
include/grub/sparc64/ieee1275/boot.h +1 -2
index 02d53f28e..cc5a941e3 100644
@@ -46,8 +46,7 @@
 
 #define GRUB_BOOT_MACHINE_KERNEL_BYTE 0x80
 
-#define GRUB_BOOT_MACHINE_CODE_END \
-	(0x1fc - GRUB_BOOT_AOUT_HEADER_SIZE)
+#define GRUB_BOOT_MACHINE_CODE_END 0x1fc
 
 #define GRUB_BOOT_MACHINE_KERNEL_ADDR 0x4200
 
Signature · 4 lines
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - [email protected]
`. `'   Freie Universitaet Berlin - [email protected]
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
#2 lore raw
In reply to John Paul Adrian Glaubitz
Quoted 5 lines · John Paul Adrian Glaubitz

Recent versions of binutils dropped support for the a.out and COFF formats on sparc64 targets. Since the boot loader on sparc64 is supposed to be an a.out binary and the a.out header entries are rather simple to calculate in our case, we just write the header ourselves instead of relying on external tools to do that.

I am OK with the approach but:
- I would like to hear Eric's opinion about it; or even see his RB on the final version of the patch,
- I have a few comments below.

Quoted 18 lines

---
v2:
- fix grammar in long description
v3:
- fix formatting in assembly code
- update comment in boot loader for consistency

 grub-core/Makefile.core.def            |  6 ++----
 grub-core/boot/sparc64/ieee1275/boot.S | 18 +++++++++++++++---
 include/grub/sparc64/ieee1275/boot.h   |  3 +--
 3 files changed, 18 insertions(+), 9 deletions(-)
grub-core/Makefile.core.def +0 -0
index e16fb06ba..f9f845828 100644

grub-core/Makefile.core.def image = { · line 405

Quoted 6 lines
grub-core/Makefile.core.def +1 -2
@@ -402,8 +402,7 @@ image = {
   i386_qemu_ldflags = '$(TARGET_IMG_BASE_LDOPT),$(GRUB_BOOT_MACHINE_LINK_ADDR)';
   i386_qemu_ccasflags = '-DGRUB_BOOT_MACHINE_LINK_ADDR=$(GRUB_BOOT_MACHINE_LINK_ADDR)';
 
-  sparc64_ieee1275_objcopyflags = '-O a.out-sunos-big';
-  sparc64_ieee1275_ldflags = ' -Wl,-Ttext=0x4000';
+  sparc64_ieee1275_ldflags = ' -Wl,-Ttext=0x3fe0';

I would like to ask you to add the comment what this number means and why this number.

grub-core/Makefile.core.def image = { · line 434

Quoted 9 lines
grub-core/Makefile.core.def +1 -2
   objcopyflags = '-O binary';
   enable = i386_pc;
@@ -432,8 +431,7 @@ image = {
   i386_pc_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x7C00';
 
   sparc64_ieee1275 = boot/sparc64/ieee1275/boot.S;
-  sparc64_ieee1275_objcopyflags = '-O a.out-sunos-big';
-  sparc64_ieee1275_ldflags = ' -Wl,-Ttext=0x4000';
+  sparc64_ieee1275_ldflags = ' -Wl,-Ttext=0x3fe0';

Ditto.

Quoted 8 lines
grub-core/Makefile.core.def +0 -0
   sparc64_ieee1275_cppflags = '-DCDBOOT=1';
 
   objcopyflags = '-O binary';
grub-core/boot/sparc64/ieee1275/boot.S +0 -0
index 9ea9b4e06..a534e1853 100644

grub-core/boot/sparc64/ieee1275/boot.S line 29

Quoted 9 lines
grub-core/boot/sparc64/ieee1275/boot.S +6 -0
@@ -21,6 +21,18 @@
 
 	.text
 	.align	4
+	/* We're writing the a.out header ourselves as newer
+	 * upstream versions of binutils no longer support
+	 * the a.out format on sparc64.
+	 */
+	.word	0x1030107                        /* magic number */
+	.word	512 - GRUB_BOOT_AOUT_HEADER_SIZE /* size of text segment */

Why 512 - GRUB_BOOT_AOUT_HEADER_SIZE? Please add the comment.

grub-core/boot/sparc64/ieee1275/boot.S line 35

Quoted 6 lines
grub-core/boot/sparc64/ieee1275/boot.S +6 -0
+	.word	0                                /* size of initialized data */
+	.word	0                                /* size of uninitialized data */
+	.word	0                                /* size of symbol table || checksum */
+	.word	_start                           /* entry point */
+	.word	0                                /* size of text relocation */
+	.word	0                                /* size of data relocation */

I assume that 0 means that we do not care. Could you say it somewhere in the comments?

Quoted 16 lines
grub-core/boot/sparc64/ieee1275/boot.S +2 -2
 	.globl	_start
 _start:
 	/* OF CIF entry point arrives in %o4 */
@@ -41,9 +53,9 @@ pic_base:
 	 * After loading in that block we will execute it by jumping to the
 	 * load address plus the size of the prepended A.OUT header (32 bytes).
 	 */
-	.org GRUB_BOOT_MACHINE_BOOT_DEVPATH
+	.org GRUB_BOOT_MACHINE_BOOT_DEVPATH + GRUB_BOOT_AOUT_HEADER_SIZE
 boot_path:
-	.org GRUB_BOOT_MACHINE_KERNEL_BYTE
+	.org GRUB_BOOT_MACHINE_KERNEL_BYTE + GRUB_BOOT_AOUT_HEADER_SIZE
 boot_path_end:
 kernel_byte:		.xword (2 << 9)
 kernel_address:		.word  GRUB_BOOT_MACHINE_KERNEL_ADDR

grub-core/boot/sparc64/ieee1275/boot.S kernel_address: .word GRUB_BOOT_MACHINE_KERNEL_ADDR · line 67

Quoted 5 lines
grub-core/boot/sparc64/ieee1275/boot.S +1 -1
@@ -52,7 +64,7 @@ kernel_address:		.word  GRUB_BOOT_MACHINE_KERNEL_ADDR
 #define boot_path_end (_start + 1024)
 #include <grub/offsets.h>
 
-	.org 8
+	.org 8 + GRUB_BOOT_AOUT_HEADER_SIZE

If you touch code like that please add comment why 8 + GRUB_BOOT_AOUT_HEADER_SIZE. Or use a constant with meaningful name instead of 8.

Daniel

#3 lore raw

Hi Daniel!

Thanks for the review!

Quoted 10 lines · Daniel Kiper
Quoted 5 lines · John Paul Adrian Glaubitz

Recent versions of binutils dropped support for the a.out and COFF formats on sparc64 targets. Since the boot loader on sparc64 is supposed to be an a.out binary and the a.out header entries are rather simple to calculate in our case, we just write the header ourselves instead of relying on external tools to do that.

I am OK with the approach but:
- I would like to hear Eric's opinion about it; or even see his RB on the final version of the patch,

Ok.

Quoted 6 lines

grub-core/Makefile.core.def image = { · line 405

Quoted 3 lines
grub-core/Makefile.core.def +1 -2
-  sparc64_ieee1275_objcopyflags = '-O a.out-sunos-big';
-  sparc64_ieee1275_ldflags = ' -Wl,-Ttext=0x4000';
+  sparc64_ieee1275_ldflags = ' -Wl,-Ttext=0x3fe0';

I would like to ask you to add the comment what this number means and why this number.

This is just the offset of the text segment adjusted with the a.out header added to the beginning of the assembly code. As we're writing out the header in the assembly source ourselves, we have to adjust the offset.

The entry point is at 0x4000.

Quoted 11 lines

grub-core/Makefile.core.def image = { · line 434

Quoted 9 lines
   objcopyflags = '-O binary';
   enable = i386_pc;
grub-core/Makefile.core.def +1 -2
@@ -432,8 +431,7 @@ image = {
   i386_pc_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x7C00';
 
   sparc64_ieee1275 = boot/sparc64/ieee1275/boot.S;
-  sparc64_ieee1275_objcopyflags = '-O a.out-sunos-big';
-  sparc64_ieee1275_ldflags = ' -Wl,-Ttext=0x4000';
+  sparc64_ieee1275_ldflags = ' -Wl,-Ttext=0x3fe0';

Ditto.

Same here.

Quoted 9 lines
Quoted 9 lines
grub-core/Makefile.core.def +0 -0
   sparc64_ieee1275_cppflags = '-DCDBOOT=1';
 
   objcopyflags = '-O binary';
grub-core/boot/sparc64/ieee1275/boot.S +0 -0
index 9ea9b4e06..a534e1853 100644
@@ -21,6 +21,18 @@
 
Quoted 10 lines

grub-core/boot/sparc64/ieee1275/boot.S line 29

Quoted 8 lines
grub-core/boot/sparc64/ieee1275/boot.S +6 -0
 	.text
 	.align	4
+	/* We're writing the a.out header ourselves as newer
+	 * upstream versions of binutils no longer support
+	 * the a.out format on sparc64.
+	 */
+	.word	0x1030107                        /* magic number */
+	.word	512 - GRUB_BOOT_AOUT_HEADER_SIZE /* size of text segment */

Why 512 - GRUB_BOOT_AOUT_HEADER_SIZE? Please add the comment.

The complete sector size is 512 but we have to make space for the header.

Quoted 8 lines

grub-core/boot/sparc64/ieee1275/boot.S line 35

Quoted 6 lines
grub-core/boot/sparc64/ieee1275/boot.S +6 -0
+	.word	0                                /* size of initialized data */
+	.word	0                                /* size of uninitialized data */
+	.word	0                                /* size of symbol table || checksum */
+	.word	_start                           /* entry point */
+	.word	0                                /* size of text relocation */
+	.word	0                                /* size of data relocation */

I assume that 0 means that we do not care. Could you say it somewhere in the comments?

We just have a text section, nothing else. Hence everything else is zero.

Quoted 19 lines
Quoted 19 lines
grub-core/boot/sparc64/ieee1275/boot.S +2 -2
 	.globl	_start
 _start:
 	/* OF CIF entry point arrives in %o4 */
@@ -41,9 +53,9 @@ pic_base:
 	 * After loading in that block we will execute it by jumping to the
 	 * load address plus the size of the prepended A.OUT header (32 bytes).
 	 */
-	.org GRUB_BOOT_MACHINE_BOOT_DEVPATH
+	.org GRUB_BOOT_MACHINE_BOOT_DEVPATH + GRUB_BOOT_AOUT_HEADER_SIZE
 boot_path:
-	.org GRUB_BOOT_MACHINE_KERNEL_BYTE
+	.org GRUB_BOOT_MACHINE_KERNEL_BYTE + GRUB_BOOT_AOUT_HEADER_SIZE
 boot_path_end:
 kernel_byte:		.xword (2 << 9)
 kernel_address:		.word  GRUB_BOOT_MACHINE_KERNEL_ADDR
@@ -52,7 +64,7 @@ kernel_address:		.word  GRUB_BOOT_MACHINE_KERNEL_ADDR
 #define boot_path_end (_start + 1024)
 #include <grub/offsets.h>
 
Quoted 5 lines

grub-core/boot/sparc64/ieee1275/boot.S kernel_address: .word GRUB_BOOT_MACHINE_KERNEL_ADDR · line 67

Quoted 2 lines
grub-core/boot/sparc64/ieee1275/boot.S +1 -1
-	.org 8
+	.org 8 + GRUB_BOOT_AOUT_HEADER_SIZE

If you touch code like that please add comment why 8 + GRUB_BOOT_AOUT_HEADER_SIZE. Or use a constant with meaningful name instead of 8.

The 8 is already there. The offset is again just being adjusted to accommodate the a.out header size which we're now adding ourselves instead of letting binutils do it for us.

Adrian

Signature · 4 lines
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - [email protected]
`. `'   Freie Universitaet Berlin - [email protected]
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
#4 lore raw
Quoted 104 lines · John Paul Adrian Glaubitz

Hi Daniel!

Thanks for the review!

Quoted 10 lines · Daniel Kiper
Quoted 5 lines · John Paul Adrian Glaubitz

Recent versions of binutils dropped support for the a.out and COFF formats on sparc64 targets. Since the boot loader on sparc64 is supposed to be an a.out binary and the a.out header entries are rather simple to calculate in our case, we just write the header ourselves instead of relying on external tools to do that.

I am OK with the approach but:
- I would like to hear Eric's opinion about it; or even see his RB on the final version of the patch,

Ok.

Quoted 6 lines

grub-core/Makefile.core.def image = { · line 405

Quoted 3 lines
grub-core/Makefile.core.def +1 -2
-  sparc64_ieee1275_objcopyflags = '-O a.out-sunos-big';
-  sparc64_ieee1275_ldflags = ' -Wl,-Ttext=0x4000';
+  sparc64_ieee1275_ldflags = ' -Wl,-Ttext=0x3fe0';

I would like to ask you to add the comment what this number means and why this number.

This is just the offset of the text segment adjusted with the a.out header added to the beginning of the assembly code. As we're writing out the header in the assembly source ourselves, we have to adjust the offset.

The entry point is at 0x4000.

Quoted 11 lines

grub-core/Makefile.core.def image = { · line 434

Quoted 9 lines
   objcopyflags = '-O binary';
   enable = i386_pc;
grub-core/Makefile.core.def +1 -2
@@ -432,8 +431,7 @@ image = {
   i386_pc_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x7C00';
 
   sparc64_ieee1275 = boot/sparc64/ieee1275/boot.S;
-  sparc64_ieee1275_objcopyflags = '-O a.out-sunos-big';
-  sparc64_ieee1275_ldflags = ' -Wl,-Ttext=0x4000';
+  sparc64_ieee1275_ldflags = ' -Wl,-Ttext=0x3fe0';

Ditto.

Same here.

Quoted 9 lines
Quoted 9 lines
grub-core/Makefile.core.def +0 -0
   sparc64_ieee1275_cppflags = '-DCDBOOT=1';
 
   objcopyflags = '-O binary';
grub-core/boot/sparc64/ieee1275/boot.S +0 -0
index 9ea9b4e06..a534e1853 100644
@@ -21,6 +21,18 @@
 
Quoted 10 lines

grub-core/boot/sparc64/ieee1275/boot.S line 29

Quoted 8 lines
grub-core/boot/sparc64/ieee1275/boot.S +6 -0
 	.text
 	.align	4
+	/* We're writing the a.out header ourselves as newer
+	 * upstream versions of binutils no longer support
+	 * the a.out format on sparc64.
+	 */
+	.word	0x1030107                        /* magic number */
+	.word	512 - GRUB_BOOT_AOUT_HEADER_SIZE /* size of text segment */

Why 512 - GRUB_BOOT_AOUT_HEADER_SIZE? Please add the comment.

The complete sector size is 512 but we have to make space for the header.

Quoted 8 lines

grub-core/boot/sparc64/ieee1275/boot.S line 35

Quoted 6 lines
grub-core/boot/sparc64/ieee1275/boot.S +6 -0
+	.word	0                                /* size of initialized data */
+	.word	0                                /* size of uninitialized data */
+	.word	0                                /* size of symbol table || checksum */
+	.word	_start                           /* entry point */
+	.word	0                                /* size of text relocation */
+	.word	0                                /* size of data relocation */

I assume that 0 means that we do not care. Could you say it somewhere in the comments?

We just have a text section, nothing else. Hence everything else is zero.

Quoted 19 lines
Quoted 19 lines
grub-core/boot/sparc64/ieee1275/boot.S +2 -2
 	.globl	_start
 _start:
 	/* OF CIF entry point arrives in %o4 */
@@ -41,9 +53,9 @@ pic_base:
 	 * After loading in that block we will execute it by jumping to the
 	 * load address plus the size of the prepended A.OUT header (32 bytes).
 	 */
-	.org GRUB_BOOT_MACHINE_BOOT_DEVPATH
+	.org GRUB_BOOT_MACHINE_BOOT_DEVPATH + GRUB_BOOT_AOUT_HEADER_SIZE
 boot_path:
-	.org GRUB_BOOT_MACHINE_KERNEL_BYTE
+	.org GRUB_BOOT_MACHINE_KERNEL_BYTE + GRUB_BOOT_AOUT_HEADER_SIZE
 boot_path_end:
 kernel_byte:		.xword (2 << 9)
 kernel_address:		.word  GRUB_BOOT_MACHINE_KERNEL_ADDR
@@ -52,7 +64,7 @@ kernel_address:		.word  GRUB_BOOT_MACHINE_KERNEL_ADDR
 #define boot_path_end (_start + 1024)
 #include <grub/offsets.h>
 
Quoted 5 lines

grub-core/boot/sparc64/ieee1275/boot.S kernel_address: .word GRUB_BOOT_MACHINE_KERNEL_ADDR · line 67

Quoted 2 lines
grub-core/boot/sparc64/ieee1275/boot.S +1 -1
-	.org 8
+	.org 8 + GRUB_BOOT_AOUT_HEADER_SIZE

If you touch code like that please add comment why 8 + GRUB_BOOT_AOUT_HEADER_SIZE. Or use a constant with meaningful name instead of 8.

Quoted 3 lines

The 8 is already there. The offset is again just being adjusted to accommodate the a.out header size which we're now adding ourselves instead of letting binutils do it for us.

If you sprinkle the comments similar to above ones into the code then I will be happy with the patch.

And sorry for late reply but I am recovering after the travel.

Daniel

#5 lore raw

Hi Daniel!

Quoted 2 lines · Daniel Kiper

If you sprinkle the comments similar to above ones into the code then I will be happy with the patch.

Ok, thanks. I'll try to get around doing it tomorrow.

Quoted 1 line

And sorry for late reply but I am recovering after the travel.

No worries. I'm currently moving apartments and I don't have much time for the fun stuff at the moment either.

Adrian

Signature · 4 lines
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - [email protected]
`. `'   Freie Universitaet Berlin - [email protected]
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913