成功案例:

成功案例:

摘要:Crashkernel 在 RAM 中的 512MB 地址处启动,kexec -e/-l但不是kexec -p- 为什么?

采用 Marvell Armada XP (MV78460)(4 核 ARMv7)和 1GB RAM 的嵌入式平台。

  • 生产内核:定制Linux 3.4.91
  • 救援内核:clean kernel.org-Linux (4.2.3)(我知道它使用设备树,但通过将 DTB 附加到 zImage 可以正常工作)
  • 在用户空间中,我使用的是最新的kexec-tools(2.0.10)

    历史记录:使用kexec -l(使用 3.4.91-kernel 中的 ramdisk 和命令行参数,以及--atags)和kexec -e,救援内核启动得很好,并且似乎将自身放置在 RAM 的开头(根据),无论通过和/proc/iomem设置了什么。当使用 boot-option 保留 RAM 空间时,我必须使用高内存地址,否则它会告诉我所请求的区域已在使用中。所以我们设定。内核不使用.--mem-min--mem-maxcrashkernelcrashkernel=128M@512Mkexec -p

    目前状态:我知道可重定位内核 ( CONFIG_AUTO_ZRELADDR=y) 必须驻留在顶部 128MB 内,这对我们来说是不可能的。因此,我围绕标准内核配置进行了工作,并强制CONFIG_ARM_PATCH_PHYS_VIRT执行no和。我必须为我设置的机器添加一个。现在内核仍然可以使用和并根据正常启动。我可以看到它的大小为 512MB。然而,配置它并导致恐慌,控制台会说并永远保持沉默。CONFIG_PHYS_OFFSET0x20000000Makefile.bootzreladdr-y := 0x20008000, params_phys-y := 0x20000100, initrd_phys-y := 0x20800000kexec -lkexec -e--mem-min-pLoading crashdump kernel... Bye!

    所有文件和所有内容都仅位于 RAM 中。

    我可能做错了什么?我应该担心解压错误(即使在良好的情况下)吗?

    From dmesg:
    Reserving 128MB of memory at 512MB for crashkernel (System RAM: 760MB)
    
    root@host:~# cat /proc/iomem
    00000000-3bff9fff : System RAM
      00008000-00724f43 : Kernel code
      0076e000-0087553f : Kernel data
      20000000-27ffffff : Crash kernel
    (some RAM at the end is reserved for persistent storage, that's why it doesn't add up to 1GB)
    

    成功案例:

    root@host:~# kexec -l -t zImage --command-line="console=ttyS0,38400 earlyprintk=ttyS0 root=/dev/ram rdinit=/sbin/init rw irqpoll maxcpus=1 reset_devices" --atags --initrd=./initramfs.cpio.gz -d --mem-min=0x20000000 --mem-max=0x28000000 ./zImage_fixed_addr
    Try gzip decompression.
    Try LZMA decompression.
    lzma_decompress_file: read on ./zImage_fixed_addr of 65536 bytes failed
    kernel: 0xb6c06008 kernel_size: 0x3db659
    kexec_load: entry = 0x20008000 flags = 0x280000
    nr_segments = 3
    segment[0].buf   = 0x40e98
    segment[0].bufsz = 0x3f0
    segment[0].mem   = 0x20001000
    segment[0].memsz = 0x1000
    segment[1].buf   = 0xb6c06008
    segment[1].bufsz = 0x3db659
    segment[1].mem   = 0x20008000
    segment[1].memsz = 0x3dc000
    segment[2].buf   = 0xb5ade008
    segment[2].bufsz = 0x1127516
    segment[2].mem   = 0x20f6e000
    segment[2].memsz = 0x1128000
    root@host:~# kexec -e
    Starting new kernel
    Booting Linux on physical CPU 0x0
    ...
    

    开机后:

    root@vanilla:~# cat /proc/iomem
    20000000-3fffffff : System RAM
      20008000-206dd237 : Kernel code
      20720000-2078f54f : Kernel data
    

    不成功案例:

    root@host:~# kexec -p -t zImage --command-line="console=ttyS0,38400 earlyprintk=ttyS0 root=/dev/ram rdinit=/sbin/init rw irqpoll maxcpus=1 reset_devices" --atags --initrd=./initramfs.cpio.gz -d ./zImage_fixed_addr
    Try gzip decompression
    Try LZMA decompression.
    lzma_decompress_file: read on ./zImage_fixed_addr of 65536 bytes failed
    kernel: 0xb6b69008 kernel_size: 0x3db659
    phys_offset: 0
    kernel symbol _stext vaddr =         c0008240
    page_offset is set to c0000000
    get_crash_notes_per_cpu: crash_notes addr = 10f525c, size = 1024
    Elf header: p_type = 4, p_offset = 0x10f525c p_paddr = 0x10f525c p_vaddr = 0x0 p_filesz = 0x400 p_memsz = 0x400
    get_crash_notes_per_cpu: crash_notes addr = 10ff25c, size = 1024
    Elf header: p_type = 4, p_offset = 0x10ff25c p_paddr = 0x10ff25c p_vaddr = 0x0 p_filesz = 0x400 p_memsz = 0x400
    get_crash_notes_per_cpu: crash_notes addr = 110925c, size = 1024
    Elf header: p_type = 4, p_offset = 0x110925c p_paddr = 0x110925c p_vaddr = 0x0 p_filesz = 0x400 p_memsz = 0x400
    get_crash_notes_per_cpu: crash_notes addr = 111325c, size = 1024
    Elf header: p_type = 4, p_offset = 0x111325c p_paddr = 0x111325c p_vaddr = 0x0 p_filesz = 0x400 p_memsz = 0x400
    vmcoreinfo header: p_type = 4, p_offset = 0x7f1330 p_paddr = 0x7f1330 p_vaddr = 0x0 p_filesz = 0x1000 p_memsz = 0x1000
    Elf header: p_type = 1, p_offset = 0x0 p_paddr = 0x0 p_vaddr = 0xc0000000 p_filesz = 0x20000000 p_memsz = 0x20000000
    Elf header: p_type = 1, p_offset = 0x28000000 p_paddr = 0x28000000 p_vaddr = 0xe8000000 p_filesz = 0x13ffa000 p_memsz = 0x13ffa000
    elfcorehdr: 0x27f00000
    crashkernel: [0x20000000 - 0x27ffffff] (128M)
    memory range: [0 - 0x1fffffff] (512M)
    memory range: [0x28000000 - 0x3bff9fff] (319M)
    kernel command line: "console=ttyS0,38400 earlyprintk=ttyS0 root=/dev/ram rdinit=/sbin/init rw irqpoll maxcpus=1 reset_devices elfcorehdr=0x27f00000 mem=130048K"
    kexec_load: entry = 0x20008000 flags = 0x280001
    nr_segments = 4
    segment[0].buf   = 0x416e0
    segment[0].bufsz = 0x410
    segment[0].mem   = 0x20001000
    segment[0].memsz = 0x1000
    segment[1].buf   = 0xb6b69008
    segment[1].bufsz = 0x3db659
    segment[1].mem   = 0x20008000
    segment[1].memsz = 0x3dc000
    segment[2].buf   = 0xb5a41008
    segment[2].bufsz = 0x1127516
    segment[2].mem   = 0x20f6e000
    segment[2].memsz = 0x1128000
    segment[3].buf   = 0x412a0
    segment[3].bufsz = 0x400
    segment[3].mem   = 0x27f00000
    segment[3].memsz = 0x1000
    
    <cause crash via SysRq>
    
    Loading crashdump kernel...
    Bye!
    
  • 相关内容