加载Linux内核的基址 [英] Base address at which the linux kernel is loaded

查看:224
本文介绍了加载Linux内核的基址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于将内核如何加载到内存中,我有一些疑问.检查/proc/kallsyms后,我可以找到内核中各种符号的地址.

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. 有什么办法可以找到加载内核的基址吗?
  2. 在用户空间中,假设我使用的libc带有puts函数,其偏移量为0x200.当加载到内存中,例如地址0x8048000时,我将能够在0x8048000 + 0x200处找到已解析的puts.内核会保持不变吗?即内核映像是否作为1个连续的.text部分加载到内存中?
  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?

推荐答案

用于 MIPS 体系结构

文件平台包含分配有物理地址空间中位置的字段/变量"load -...".

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

示例:

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

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

用于 ARM 体系结构

文件 Makefile.boot 包含分配有物理地址空间中位置的字段/变量"zreladdr-y".

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

示例:

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

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

用于 Microblaze 体系结构

文件 Makefile 包含分配有物理地址空间中位置的字段/变量"UIMAGE_LOADADDR"(从Xilinx ISE导出).

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

示例:

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

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)

这篇关于加载Linux内核的基址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆