Loading a simple "kernel" at the address other than default on Raspberry Pi 4
Mushahid Hussain
mushi.shar at gmail.com
Thu Nov 4 11:28:51 EDT 2021
>There's another number, set during the kernel build, that tells the
kernel what address it should expect to be loaded at.
Thank you for the reply. I have added a linker script specifying the same
load address as one one config.txt. The simple kernel(hello world) is only
able to run, when both addresses(in linker script and config.txt) are
0x80000. I don't know how that number can be set during the build other
than in the linker script. I would love to know about it. Can you point me
towards the resources to learn about it?
>You need to find some way to ensure that the boot loader and the initial
part
of the kernel (the one that proceeds to unpack the rest of the kernel, set
up
KASLR, and relocation if neded) agree on what address things start off at.
How can I set the load address for the initial part of the kernel other
than in the linker script?
On Wed, 3 Nov 2021 at 02:59, Valdis Klētnieks <valdis.kletnieks at vt.edu>
wrote:
> On Tue, 02 Nov 2021 17:13:16 +0500, Mushahid Hussain said:
>
> > I have written a simple kernel which prints Hello World to UART. The
> simple
> > kernel works successfully and prints Hello World to UART, if I load it at
> > 0x80000, which is the default load address for the 64-bit kernel.
> >
> > There's a configuration(config.txt)[1] kernel_address on Raspberry Pi 4
> but
> > whenever I change the load address by even 1 byte, the simple kernel
> would
> > not run. It is only able to run at 0x80000.
>
> The config.txt value is for the boot loader, to tell it where the kernel
> should
> be loaded. There's another number, set during the kernel build, that
> tells the
> kernel what address it should expect to be loaded at.
>
> So if your micro-kernel is build to load at 0x80000 and then you tell the
> boot
> loader to load at 0x80001, or vice versa, things will go badly.
>
> You need to find some way to ensure that the boot loader and the initial
> part
> of the kernel (the one that proceeds to unpack the rest of the kernel, set
> up
> KASLR, and relocation if neded) agree on what address things start off at.
>
--
Mushahid Hussain
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20211104/8aa4b491/attachment.html>
More information about the Kernelnewbies
mailing list