Subject: Fixed kernel entry point suggestion

From: Adil Hafeez <[email-masked]>
Date: Wed, 28 Dec 2005 12:36:54 +0500

Hi,

Everytime we add/remove a feature from kernel location of entry_point symbol
changes. As a result we 've to recompile bootloader with new entry_point
location. Adding a simply jump instruction to kernel_entry point in
head.Scan solve this problem. Why dont we make this change permanent
in kernel.

- Adil

---

From: Dan Malek <[email-masked]>
Date: Wed, 28 Dec 2005 09:22:55 -0500

On Dec 28, 2005, at 2:36 AM, Adil Hafeez wrote:

> Everytime we add/remove a feature from kernel location of entry_point 
> symbol changes.

If you "wrap" the kernel image with a simple header and have a boot 
loader
that understands this, or even understands the ELF header, or download
S-records (yuk) as most systems do, I guess it isn't necessary to fix 
this.
I've been providing the compressed zImage patches for a long time that 
solves
this, as well as the u-boot uImage patches.  The process of building 
these
images not only locates the proper entry point, but it provides 
advantages
for embedded systems by creating smaller images and faster boot times.

>  .....   Adding a simply jump instruction to kernel_entry point in 
> head.S can solve this problem. Why dont we make this change permanent 
> in kernel.

:-)  It seems MIPS likes to be different from other architectures that 
have
solved these irritating little details years ago :-)  Submit a patch 
and see
what happens, as just complaining on the list isn't likely to make it
happen.

Thanks.

	-- Dan

---

From: Adil Hafeez <[email-masked]>
Date: Fri, 30 Dec 2005 14:36:22 +0500

Hi Dan,

Here is the patch.

diff --git a/arch/mips/kernel/head.S b/arch/mips/kernel/head.S
index eebdaa2..a5e6d4e 100644
--- a/arch/mips/kernel/head.S
+++ b/arch/mips/kernel/head.S
@@ -28,6 +28,7 @@
#include <asm/mipsregs.h>
#include <asm/stackframe.h>

+        j kernel_entry
.text
/*
* Reserved space for exception handlers.

> what happens, as just complaining on the list isn't likely to make it
diff --git a/arch/mips/kernel/head.S b/arch/mips/kernel/head.S
index eebdaa2..a5e6d4e 100644
--- a/arch/mips/kernel/head.S
+++ b/arch/mips/kernel/head.S
@@ -28,6 +28,7 @@
 #include <asm/mipsregs.h>
 #include <asm/stackframe.h>
 
+        j kernel_entry
 		.text
 		/*
 		 * Reserved space for exception handlers.

---

From: Thiemo Seufer <[email-masked]>
Date: Fri, 30 Dec 2005 10:47:51 +0100

> +++ b/arch/mips/kernel/head.S

But certainly not _before_ .text. Also, it shouldn't move the reserved
space, it would need "align" instead of "space" afterwards.

Thiemo

---

From: Adil Hafeez <[email-masked]>
Date: Fri, 30 Dec 2005 15:22:35 +0500

What about placing the jump instruction just after reserved space, like this

        .text
        /*
         * Reserved space for exception handlers.
         * Necessary for machines which link their kernels at KSEG0.
         */
        .fill   0x400

        /* The following two symbols are used for kernel profiling. */
        EXPORT(stext)
        EXPORT(_stext)
=>     j kernel_entry
        __INIT

I disassembled vmlinux binary and now jump instruction is placed after
reserved space

---

From: Thiemo Seufer <[email-masked]>
Date: Fri, 30 Dec 2005 22:04:27 +0100

> I disassembled vmlinux binary and now jump instruction is placed after

This only works iff the fill is done with NOPs. On a more general note,
it is usually considered to be the bootloader's job to find the correct
entry, not the kernel's one.

Thiemo