Base address at which the linux kernel is loaded

user277465 picture user277465 · Nov 7, 2015 · Viewed 9.6k times · Source

I have a couple of doubts about how the kernel is loaded into memory. Upon inspecting /proc/kallsyms I'm able to find the address of various symbols in the kernel.

$ cat /proc/kallsyms | head -n 10
00000000 t __vectors_start
80008240 T asm_do_IRQ
80008240 T _stext
80008240 T __exception_text_start
80008244 T do_undefinstr
80008408 T do_IPI
8000840c T do_DataAbort
800084a8 T do_PrefetchAbort
80008544 t gic_handle_irq
800085a0 T secondary_startup
  1. Is there any way I can find the base address at which the kernel is loaded?
  2. In userspace, suppose I use a libc with say the puts function at an offset of 0x200. When loaded into memory at say the address 0x8048000, I would be able to find the resolved puts at 0x8048000 + 0x200. Would the same hold for the kernel? i.e. is the kernel image loaded up into memory as 1 contiguous .text section?

Answer

Oleg Kokorin picture Oleg Kokorin · Apr 5, 2017

for MIPS architecture

file Platform contain the field/variable "load-..." assigned with the location in physical address space.

example:

openwrt/build_dir/target-mips_mips32_musl-1.1.16/linux-brcm63xx_smp/linux-4.4.14/arch/mips/bcm63xx/Platform

#
# Broadcom BCM63XX boards
#
platform-$(CONFIG_BCM63XX)  += bcm63xx/
cflags-$(CONFIG_BCM63XX)    +=                  \
    -I$(srctree)/arch/mips/include/asm/mach-bcm63xx/
load-$(CONFIG_BCM63XX)      := 0xffffffff80010000

for ARM architecture

file Makefile.boot contain the field/variable "zreladdr-y" assigned with the location in physical address space.

example:

openwrt/build_dir/target-mips_mips32_musl-1.1.16/linux-brcm63xx_smp/linux-4.4.14/arch/arm/mach-omap1/Makefile.boot

   zreladdr-y       += 0x10008000
params_phys-y       := 0x10000100
initrd_phys-y       := 0x10800000

for Microblaze architecture

file Makefile contain the field/variable "UIMAGE_LOADADDR" assigned with the location in physical address space (exported from Xilinx ISE).

example:

openwrt/build_dir/target-mips_mips32_musl-1.1.16/linux-brcm63xx_smp/linux-4.4.14/arch/microblaze/boot/Makefile

UIMAGE_LOADADDR = $(CONFIG_KERNEL_BASE_ADDR)