Skip to content

RFC MIPS: use kexec to load ELF linux images

Antony Pavlov barebox 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 RFC Latest8 patches 4 repliesIn review

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8MIPS: add virt_to_phys() and phys_to_virt()arch/mips/include/asm/io.h+35 -00 replies
2/8MIPS: c-r4k: add support for secondary cachearch/mips/include/asm/cacheops.h arch/mips/lib/c-r4k.c+23 -60 replies
3/8resource: add create_resource() helper functioncommon/resource.c include/linux/ioport.h+17 -00 replies
4/8import initial kexec stuffcommands/Kconfig common/Kconfig lib/Makefile +6 more+1205 -02 replies
5/8filetype: add ELF typecommon/filetype.c include/filetype.h+6 -00 replies
6/8bootm: add kexec ELF supportinclude/linux/reboot.h lib/kexec/Makefile lib/kexec/kexec-bootm-elf.c+52 -02 replies
7/8MIPS: add kexec ELF loading supportarch/mips/include/asm/elf.h arch/mips/lib/Makefile arch/mips/lib/kexec-mips.c +1 more+278 -10 replies
8/8MIPS: malta: enable kexecarch/mips/Kconfig arch/mips/mach-malta/Makefile arch/mips/mach-malta/reboot.c+106 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [RFC v2 0/8] MIPS: use kexec to load ELF linux images

This patchseries introduces a suitable way for loading ELF linux kernel images on MIPS. You can load normal vmlinux images or compressed self-extractable vmlinuz images.

The patchseries and additional patch with pre-compiled demo vmlinux image for MIPS Malta can be obtained here:
https://github.com/frantony/barebox/tree/20161205.malta-bootm-vmlinux
Please see this commit message
https://github.com/frantony/barebox/commit/23b24122a4bd1d59266ae585364c792dc9140ecb
for instructions.

The code for actual ELF loading and relocation is imported
from
kexec-tools (git://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools)
and
linux kernel (http://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git).

There is no common practice on passing cmdline to the linux kernel on MIPS machines. We have to realize it's own cmdline passing routine for every MIPS machine supported by barebox. The 'MIPS: malta: enable kexec' patch
demonstrates how to do it for MIPS Malta.

To separate common ELF handling routines and machine-specific cmdline handling the 'reboot()' call is introduced.
The common code checks and loads ELF-file, the MIPS-specific code arrange ELF segments in the appropriate memory places and tunes relocator; next reboot() is called and machine-specific code works on cmdline passing.

The 'import initial kexec stuff' contains some codes stealed from kexec-tools as-is. These codes have some checkpatch.pl issues.

Antony Pavlov (7):
MIPS: add virt_to_phys() and phys_to_virt()
resource: add create_resource() helper function
import initial kexec stuff
filetype: add ELF type
bootm: add kexec ELF support
MIPS: add kexec ELF loading support
MIPS: malta: enable kexec

Peter Mamonov (1):
MIPS: c-r4k: add support for secondary cache

Changes since RFC v1 (http://lists.infradead.org/pipermail/barebox/2014-April/018651.html):

* add 64 bit ELF support by Peter Mamonov;
* update relocate_new_kernel arguments passing mechanism;
* test with linux-4.9-rc8.

TODOs:

* add DT and initrd passing support.

 arch/mips/Kconfig                |   1 +
 arch/mips/include/asm/cacheops.h |  10 +
 arch/mips/include/asm/elf.h      |   8 +-
 arch/mips/include/asm/io.h       |  35 ++
 arch/mips/lib/Makefile           |   3 +
 arch/mips/lib/c-r4k.c            |  19 +-
 arch/mips/lib/kexec-mips.c       | 171 +++++++++
 arch/mips/lib/relocate_kernel.S  |  97 +++++
 arch/mips/mach-malta/Makefile    |   1 +
 arch/mips/mach-malta/reboot.c    | 104 ++++++
 commands/Kconfig                 |   7 +
 common/Kconfig                   |   3 +
 common/filetype.c                |   5 +
 common/resource.c                |  15 +
 include/filetype.h               |   1 +
 include/linux/ioport.h           |   2 +
 include/linux/reboot.h           |  14 +
 lib/Makefile                     |   1 +
 lib/kexec/Makefile               |   4 +
 lib/kexec/kexec-bootm-elf.c      |  37 ++
 lib/kexec/kexec-elf-exec.c       |  82 ++++
 lib/kexec/kexec-elf.c            | 783 +++++++++++++++++++++++++++++++++++++++
 lib/kexec/kexec-elf.h            |  86 +++++
 lib/kexec/kexec.c                | 151 ++++++++
 lib/kexec/kexec.h                |  89 +++++
 25 files changed, 1722 insertions(+), 7 deletions(-)
 create mode 100644 arch/mips/lib/kexec-mips.c
 create mode 100644 arch/mips/lib/relocate_kernel.S
 create mode 100644 arch/mips/mach-malta/reboot.c
 create mode 100644 include/linux/reboot.h
 create mode 100644 lib/kexec/Makefile
 create mode 100644 lib/kexec/kexec-bootm-elf.c
 create mode 100644 lib/kexec/kexec-elf-exec.c
 create mode 100644 lib/kexec/kexec-elf.c
 create mode 100644 lib/kexec/kexec-elf.h
 create mode 100644 lib/kexec/kexec.c
 create mode 100644 lib/kexec/kexec.h
Cc Peter Mamonov <[email protected]>
Signature · 7 lines
2.10.2


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox