linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* Changing default kernel load address
@ 2019-08-26 17:12 Noam Camus
  2019-08-27 11:02 ` Mark Rutland
  0 siblings, 1 reply; 4+ messages in thread
From: Noam Camus @ 2019-08-26 17:12 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

I wish to change an arm64 machine kernel load address and I hope this
forum can assist.

In my current setup the KERNEL_START macro (_text) equals 128.5MB:
KIMAGE_VADDR=128MB
TEXT_OFFSET=512KB

I wish to change kernel load address to reside on my internal RAM
which locates beyond 4GB.

Since CONFIG_RANDOMIZE_BASE uses only 16 bit I find it not helpful.

Can someone tell what changes I need to do so kernel load address will
be above 4GB.

Note: I use FIT image to provide U-Boot the kernel Load address.

Regards,
Noam

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Changing default kernel load address
  2019-08-26 17:12 Changing default kernel load address Noam Camus
@ 2019-08-27 11:02 ` Mark Rutland
  2019-08-30 11:09   ` Noam Camus
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Rutland @ 2019-08-27 11:02 UTC (permalink / raw)
  To: Noam Camus; +Cc: linux-arm-kernel

On Mon, Aug 26, 2019 at 08:12:27PM +0300, Noam Camus wrote:
> Hi,
> 
> I wish to change an arm64 machine kernel load address and I hope this
> forum can assist.
> 
> In my current setup the KERNEL_START macro (_text) equals 128.5MB:
> KIMAGE_VADDR=128MB
> TEXT_OFFSET=512KB
> 
> I wish to change kernel load address to reside on my internal RAM
> which locates beyond 4GB.

You shouldn't need to modify anything; the kernel can be loaded at any
2MiB-aligned physical address + TEXT_OFFSET. KERNEL_START and
KIMAGE_VADDR are virtual addresses and don't require a specific physical
address.

Please see:

  https://www.kernel.org/doc/html/latest/arm64/booting.html

> Can someone tell what changes I need to do so kernel load address will
> be above 4GB.
> 
> Note: I use FIT image to provide U-Boot the kernel Load address.

I don't know how FIT works, but the U-Boot "booti" command should do the
right thing if given an arm64 kernel Image.

Thanks,
Mark.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Changing default kernel load address
  2019-08-27 11:02 ` Mark Rutland
@ 2019-08-30 11:09   ` Noam Camus
  2019-08-30 11:19     ` Mark Rutland
  0 siblings, 1 reply; 4+ messages in thread
From: Noam Camus @ 2019-08-30 11:09 UTC (permalink / raw)
  To: Mark Rutland; +Cc: linux-arm-kernel

>‫בתאריך יום ג׳, 27 באוג׳ 2019 ב-14:02 מאת ‪Mark Rutland‬‏ <‪mark.rutland@arm.com‬‏>:‬
>>
>> On Mon, Aug 26, 2019 at 08:12:27PM +0300, Noam Camus wrote:
>> > Hi,
>> >
>> > I wish to change an arm64 machine kernel load address and I hope this
>> > forum can assist.
>> >
>> > In my current setup the KERNEL_START macro (_text) equals 128.5MB:
>> > KIMAGE_VADDR=128MB
>> > TEXT_OFFSET=512KB
>> >
>> > I wish to change kernel load address to reside on my internal RAM
>> > which locates beyond 4GB.
>>
>> You shouldn't need to modify anything; the kernel can be loaded at any
>> 2MiB-aligned physical address + TEXT_OFFSET. KERNEL_START and
>> KIMAGE_VADDR are virtual addresses and don't require a specific physical
>> address.
>>
>> Please see:
>>
>>   https://www.kernel.org/doc/html/latest/arm64/booting.html

I see that only when I match u-boot load address of kernel with the
begin of .text section address I manage to boot successfully,
otherwise just a blank screen.
Note that kernel is not compiled with, -fpic/-fPIC.
How can it be one may download kernel anywhere without linker script
being aware of the actual load address of kernel?

Thanks
Noam

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Changing default kernel load address
  2019-08-30 11:09   ` Noam Camus
@ 2019-08-30 11:19     ` Mark Rutland
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Rutland @ 2019-08-30 11:19 UTC (permalink / raw)
  To: Noam Camus; +Cc: linux-arm-kernel

On Fri, Aug 30, 2019 at 02:09:58PM +0300, Noam Camus wrote:
> >‫בתאריך יום ג׳, 27 באוג׳ 2019 ב-14:02 מאת ‪Mark Rutland‬‏ <‪mark.rutland@arm.com‬‏>:‬
> >>
> >> On Mon, Aug 26, 2019 at 08:12:27PM +0300, Noam Camus wrote:
> >> > Hi,
> >> >
> >> > I wish to change an arm64 machine kernel load address and I hope this
> >> > forum can assist.
> >> >
> >> > In my current setup the KERNEL_START macro (_text) equals 128.5MB:
> >> > KIMAGE_VADDR=128MB
> >> > TEXT_OFFSET=512KB
> >> >
> >> > I wish to change kernel load address to reside on my internal RAM
> >> > which locates beyond 4GB.
> >>
> >> You shouldn't need to modify anything; the kernel can be loaded at any
> >> 2MiB-aligned physical address + TEXT_OFFSET. KERNEL_START and
> >> KIMAGE_VADDR are virtual addresses and don't require a specific physical
> >> address.
> >>
> >> Please see:
> >>
> >>   https://www.kernel.org/doc/html/latest/arm64/booting.html
> 
> I see that only when I match u-boot load address of kernel with the
> begin of .text section address I manage to boot successfully,
> otherwise just a blank screen.

Ok. Have you tried loading it at another address matching the
constraints I described above?

U-Boot has code to do this automatically if using the "booti" command.
If booted as an EFI application, the kernel's EFI stub will handle this.

> Note that kernel is not compiled with, -fpic/-fPIC.
> How can it be one may download kernel anywhere without linker script
> being aware of the actual load address of kernel?

U-Boot loads the kernel at a *physical* address, but all the C code
executes at a *virtual* address.

The early assembly in head.S is position-independent regardless of
compiler options, and it creates page tables to map the kernel at a
suitable virtual address regarldess of the physical address, so long as
the constraints I described above are met.

The kernel can dynamically figure out the relationship between its
virtual address and physical address, and handle this as required.

Thanks,
Mark.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-08-30 11:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-26 17:12 Changing default kernel load address Noam Camus
2019-08-27 11:02 ` Mark Rutland
2019-08-30 11:09   ` Noam Camus
2019-08-30 11:19     ` Mark Rutland

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).