Age | Commit message (Collapse) | Author |
|
Include the stack and malloc space in our calculation of the zImage
size, both of which must be avoided when locating the dtb.
Signed-off-by: Russell King <rmk@armlinux.org.uk>
|
|
Add further debugging of the kernel size
Signed-off-by: Russell King <rmk@armlinux.org.uk>
|
|
Signed-off-by: Russell King <rmk@armlinux.org.uk>
|
|
Read the new extension data which tells the boot agent about the
requirements for booting the kernel image, such as how much RAM
will be consumed by the kernel through decompression and booting.
This is necessary to control the placement of the DTB and
compressed RAM disk to avoid these objects being corrupted.
Tested-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Russell King <rmk@armlinux.org.uk>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
There is no difference in the way the initrd is handled between an
ATAG-based kernel and a DTB-based kernel. Therefore, this should be
handled identically in both cases.
Rearrange the code to achieve this.
Signed-off-by: Russell King <rmk@armlinux.org.uk>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
get_kernel_stext_sym() has been defined for both arm and i386. Other
architecture might need some other kernel symbol address. Therefore rewrite
this function as generic function to get any kernel symbol address.
More over, kallsyms is not arch specific representation, therefore have
common function for all arches.
Signed-off-by: Pratyush Anand <panand@redhat.com>
[created symbols.c]
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Tested-by: David Woodhouse <dwmw@amazon.co.uk>
Tested-by: Pratyush Anand <panand@redhat.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
MUSL doesn't support %L except for floating-point arguments; therefore,
%ll must be used instead with integer arguments.
Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
... and friends. Again, PPC never cared about the difference, while
ARM had to add an explicit cast to work around it, which we can remove
now.
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Implement get_crash_kernel_load_range() in support of
print crash kernel region size option.
Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
Signed-off-by: Eric DeVolder <eric.devolder@oracle.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Header files should be added to the distribution but not
used to derive targets for compilation. In this an attempt was
made to build iomem.o, but iomem.c does not exist so this fails.
Fixes: 1574ff1aae4f ("arm: include phys_to_virt.h and iomem.h in distribution")
Signed-off-by: Simon Horman <horms@verge.net.au>
Reviewed-by: Pratyush Anand <panand@redhat.com>
|
|
These files are required to build kexec-tools on arm.
Signed-off-by: Dave Young <dyoung@redhat.com>
[simon: added changelog]
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
We do not support zImage with an appended DTB as we need to supply our
own DTB to the kernel, and an appended DTB will override any that we
try to supply. To ensure that we do not load an appended DTB, clamp
the kernel size to the size specified in the zImage header.
Signed-off-by: Russell King <rmk@armlinux.org.uk>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
If a zImage is built with ARM_APPENDED_DTB enabled, the zImage will
look at the word following the zImage and check whether it contains
the DTB magic number.
Generally, kexec will clear the destination pages before copying the
zImage, but there is a corner case where the zImage is a multiple of
the page size, where the following page will not be touched. Should
the first word in this page contain the DTB magic number, the data
following will be interpreted as a DTB image.
In order to make this bullet-proof, we must always initialise the word
following the zImage. Arrange this by specifying the zImage memory
size one word bigger than the buffer size.
Signed-off-by: Russell King <rmk@armlinux.org.uk>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
If we want to assume that the compressed image will expand by a maximum
of 4x, we actually need to reserve 5x the space, since we need to keep
a copy of the compessed image around while decompressing.
Signed-off-by: Russell King <rmk@armlinux.org.uk>
Reviewed-by: Pratyush Anand <panand@redhat.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
The ARM kexec code was not taking account of the 32k text offset when
applying the size(s) of the kernel image. We need to take account of
this so when we decide to place the initrd at 4x the compressed image
length, it is appropriately placed.
Signed-off-by: Russell King <rmk@armlinux.org.uk>
Reviewed-by: Pratyush Anand <panand@redhat.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Report which ELF core format will be used to create the template ELF
core dump in the debug information.
Reviewed-by: Pratyush Anand <panand@redhat.com>
Signed-off-by: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Clean up the physical and page offset debug prints.
Reviewed-by: Pratyush Anand <panand@redhat.com>
Signed-off-by: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Some LPAE systems may have phys_offset above the 4GB mark. Hence, we
need phys_offset to be a 64-bit integer.
Reviewed-by: Pratyush Anand <panand@redhat.com>
Signed-off-by: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Add debug of the reserved and coredump memory ranges for validation.
Reviewed-by: Pratyush Anand <panand@redhat.com>
Signed-off-by: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Add support for detecting and using the boot-time crash kernel
resource, which is needed for systems which have special boot-time
memory views, such as Keystone 2.
Reviewed-by: Pratyush Anand <panand@redhat.com>
Signed-off-by: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Add support for reserving multiple memory regions rather than just a
single region.
Reviewed-by: Pratyush Anand <panand@redhat.com>
Signed-off-by: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Rename crash_reserved_mem to crash_kernel_mem as we want to support
multiple reserved memory ranges.
Reviewed-by: Pratyush Anand <panand@redhat.com>
Signed-off-by: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
When crashdumping, we need the boot memory alias of the crash kernel
region rather than the system view. Arrange to check for the boot
alias of the crash kernel region first, and if found, use it instead
of the main alias.
Reviewed-by: Pratyush Anand <panand@redhat.com>
Signed-off-by: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
The kexec API deals with boot-view addresses, rather than normal system
view addresses. This causes problems for platforms such as Keystone 2,
where the boot view is substantially different from the normal system
view.
This is because Keystone 2 boots from a memory alias in the lower 4GiB,
before switching to a high alias at 32GiB.
We handle this in a generic way by introducing boot alias resources in
/proc/iomem:
80000000-dfffffff : System RAM (boot alias)
9f800000-9fffffff : Crash kernel (boot alias)
800000000-85fffffff : System RAM
800008000-800790e37 : Kernel code
8007ec000-8008b856f : Kernel data
81f800000-81fffffff : Crash kernel
To allow kexec to load a kernel, we need to add the boot alias of RAM
to the memory ranges returned by get_memory_ranges(). Parse the
system RAM boot alias into the memory ranges.
Reviewed-by: Pratyush Anand <panand@redhat.com>
Signed-off-by: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Reviewed-by: Pratyush Anand <panand@redhat.com>
Signed-off-by: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Use the generic mem_region sorting implementation.
Reviewed-by: Pratyush Anand <panand@redhat.com>
Signed-off-by: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
We parse the crash kernel memory region in several locations in the
kexec tools - once to check that there's a region, another time for
real when we're locating the memory regions to dump, and another
while loading the image.
Move the real parsing step to is_crashkernel_mem_reserved(), which
matches what x86 is doing.
Reviewed-by: Pratyush Anand <panand@redhat.com>
Signed-off-by: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Add the maximum number of memory ranges to the list of usable memory
ranges, so that we don't have to carry this around.
Reviewed-by: Pratyush Anand <panand@redhat.com>
Signed-off-by: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Add the call to dbgprint_mem_range() into the ARM version of
get_memory_ranges().
Reviewed-by: Pratyush Anand <panand@redhat.com>
Signed-off-by: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Report an error if the crash kernel memory region is outside of the
boot-view memory range - this can happen with systems such as
Keystone 2.
Signed-off-by: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Return the proper error code (ENOCRASHKERNEL) for a missing crash
kernel region in /proc/iomem, so the error handling in kexec.c can
print the appropriate message.
Reviewed-by: Pratyush Anand <panand@redhat.com>
Signed-off-by: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Rather than using ULONG_MAX to decide whether to use the ELF64 or ELF32
core dump format, use UINT32_MAX instead - we include stdint.h, so we
might as well use a constant which is meaningful for the limits of
the 32-bit ELF format.
Signed-off-by: Russell King <rmk@arm.linux.org.uk>
Reviewed-by: Pratyush Anand <panand@redhat.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Fix get_kernel_stext_sym() so that it closes its file once it's
finsihed with it - there's no need to leak file descriptors.
Reviewed-by: Pratyush Anand <panand@redhat.com>
Signed-off-by: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
The memory range end is inclusive, not exclusive (see x86). We should
not be adding one to the value parsed from the /proc/iomem resources.
Reviewed-by: Pratyush Anand <panand@redhat.com>
Signed-off-by: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
kexec/arch/arm/kexec-uImage-arm.c: In function 'uImage_arm_probe':
kexec/arch/arm/kexec-uImage-arm.c:14:2: warning: pointer targets in passing argument 1 of 'uImage_probe_kernel' differ in signedness [-Wpointer-sign]
Reviewed-by: Pratyush Anand <panand@redhat.com>
Signed-off-by: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
crashdump-elf.c passes unsigned long long addresses into phys_to_virt()
so make phys_to_virt() accept such addresses without truncating them.
This is important for ARM LPAE systems.
Reviewed-by: Pratyush Anand <panand@redhat.com>
Signed-off-by: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
We need to use 64-bit file IO when mapping system memory and the core
dump file as we may be running on a LPAE system, otherwise we risk
mapping memory we shouldn't, and causing a kernel oops:
Unhandled fault: asynchronous external abort (0x211) at 0x00000000
pgd = edd2c740
[00000000] *pgd=82ec98003, *pmd=82dcd2003, *pte=00000000
Acked-by: Baoquan He <bhe@redhat.com>
Signed-off-by: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
setup_dtb_prop looks like a generic function that can find and add any
nodes, which need not be top-level in the DT. In practice though, the
function is only used for the top-level /chosen node, and it can't add
nodes for which the parent doesn't exist.
So far, so good - but for adding a new node to the DT, the parent offset
need be passed to fdt_add_subnode. Currently in setup_dtb_prop the
parent offset is unknown, and instead a bogus error code is passed to
fdt_add_subnode.
Fix that by adding the parent offset as an extra function argument to
setup_dtb_prop, and change the handling of the /chosen node to operate
on a relative path plus (zero) offset instead of an absolute path. This
aligns setup_dtb_prop to the libfdt API, where functions commonly
operate with a parent offset plus child node name.
Signed-off-by: Nikolaus Schulz <nikolaus.schulz@avionic-design.de>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Add very basic support for booting an android image. The ramdisk and
command line from the image are only used if none has been given on
the command line.
Signed-off-by: Alban Bedel <alban.bedel@avionic-design.de>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
When looking for a hole to put the initrd in the error check used the
wrong variable.
Signed-off-by: Alban Bedel <alban.bedel@avionic-design.de>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
On PowerPC64 ABIv2 we need to look at the symbol to determine
if it has a local entry point. Pass struct mem_sym into
machine_apply_elf_rel() so we can.
Signed-off-by: Anton Blanchard <anton@samba.org>
Tested-by: Dave Young <dyoung@redhat.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Latest linux kernel will create /sys/firmware/fdt file. It will be convenient
to use it in case one does not specify --atags and --dtb options.
Signed-off-by: Dave Young <dyoung@redhat.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
booting a non-devicetree kernel from a devicetree kernel failed,
since the memory layout wasn't passed.
Signed-off-by: Andreas Fenkart <andreas.fenkart@dev.digitalstrom.org>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
When createing fdt from /proc/device-tree, if there's local --command-line
option provided but there's no root= specified, kexec-tools will copy the root=
param from 1st kernel cmdline by default. In case one want kexec boot without
root= it will be impossible.
Thus add the new option so that one can provide --dt-no-old-root for above
mentioned case.
Signed-off-by: Dave Young <dyoung@redhat.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
When loading dtb on arm platform, we may need change strings in dtb
in function setup_dtb_prop. If length of new string is larger than that
of the old one. We should extend the dtb by "FDT_TAGALIGN"ed size.
If not, kexec may fail to load the capture kernel.
Signed-off-by: Liu Hua <sdu.liu@huawei.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
For 32-bit ARM systems with CONFIG_ARM_LPAE=y, when kexec utility
loads the crash kernel. 32-bit elf header is not enough if the
physical address exceeds 4G.
This patch checkes whether the largest physical address of the system
exceeds 4G. If so, kexec creates 64-bit elf header.Otherwise it
creates 32-bit elf header.
Signed-off-by: Wei Jitao <weijitao@huawei.com>
Signed-off-by: Liu Hua <sdu.liu@huawei.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Since "start" and "end" in kexec_iomem_for_each_line
are unsigned long long, this patch makes "callback"s
accept unsigned-long-long-type parameters.
Signed-off-by: Wei Jitao <weijitao@huawei.com>
Signed-off-by: Liu Hua <sdu.liu@huawei.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
When KALLSYMS is disabled or /proc is not mounted, this patch allows
--page-offset cmdline option for user to setup correct page_offset.
Signed-off-by: Wang Nan <wangnan0@huawei.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
ARM kernel can be compiled with CONFIG_VMSPLIT_1G, CONFIG_VMSPLIT_2G or
CONFIG_VMSPLIT_3G. This patch dynamically detects PAGE_OFFSET according
to _stext symbol from /proc/kallsyms.
Signed-off-by: Wang Nan <wangnan0@huawei.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
This patch memset modified_cmdline after it alloced.
Without this patch, the header of command line always contains random
value like following example:
kernel: 0x765fd008 kernel_size: 0x23b610
memory range: [0x60000000 - 0x6fffffff] (256M)
memory range: [0x78000000 - 0x9fffffff] (640M)
...
kernel command line: "°¥氥䐶# elfcorehdr=0x77f00000 mem=130048K"
Signed-off-by: Wang Nan <wangnan0@huawei.com>
Cc: Geng Hui <hui.geng@huawei.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|