summaryrefslogtreecommitdiff
path: root/kexec/arch/arm
AgeCommit message (Collapse)Author
2015-11-24arm: use /sys/firmware/fdt in case without --atags and --dtbDave Young
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>
2015-11-24kexex: arm: create ATAGS_MEM tag from devicetree memory nodeAndreas Fenkart
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>
2015-10-30arm: add arch option --dt-no-old-rootdyoung@redhat.com
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>
2014-07-24kexec: align the extended size of dtbLiu Hua
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>
2014-06-06kexec: ARM: add LPAE supportLiu Hua
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>
2014-06-06kexec: iomem: accept u64 parameters for callbacksLiu Hua
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>
2014-05-30kexec-tools: add --page-offset option for ARMWang Nan
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>
2014-05-30kexec-tools: detect page_offset dynamicallyWang Nan
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>
2014-05-11zImage-arm: init modified_cmdline with zeroWang Nan
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>
2014-05-11zImage-arm: bugfix: kernel offset must be 0x8000Wang Nan
This patch fixs a problem introduced by commit e5d6a55 which make ARM kexec fails. Due to that commit, kernel is loaded at a dynamically offset: it computes extra_size using size of dtb, and load zImage at base + extra_size. When dtb size small (for example, 0x3000 bytes), kernel will be loaded at address like 0x60003000. For ARM zImage such address is incorrect. In kernel code arch/arm/boot/compressed/head.S, zImage builds a temporary page table at (pc & 0xf8000000) + TEXT_OFFSET - 0x4000. The related instructions sequence is: mov r4, pc and r4, r4, #0xf8000000 add r4, r4, #TEXT_OFFSET @ (TEXT_OFFSET == 0x8000 on most platforms) call cache_on ... call __armv7_mmu_cache_on ... call __setup_mmu sub r3, r4, #16384 @ Page directory size r3 becomes page table pointer. When kernel is loaded at 0x60003000, page table is still built at 0x60004000, which destroys kernel. This patch make extra_size a fix value (0x8000) to avoid the failure. For the problem commit e5d6a55 tries solve, this patch uses locate_holes() to find a place can hold initrd and dtb. Change from v1: - Coding style enhancements. Signed-off-by: Wang Nan <wangnan0@huawei.com> Tested-by: Daniel Mack <zonque@gmail.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2014-05-02zImage-arm: get rid of static offsetDaniel Mack
The code in arch/arm/kexec-zImage-arm.c currently enforces a hard limit on the maximum size a dtb blob can occupy. This limit is set to 32k, which is quite low for device tree blobs nowadays. Get rid of this assumption, and calculate the added size dynamically. For this, we need to slurp in the dtb file earlier in order to determine its size, because the memory hole allocation for 'base' takes this size into account. For ATAGs, we keep the current value of 32k, which should in fact be enough. With this change in place, the 'DTB too large!' error message can go away. Successfully tested on a AM335x board. Signed-off-by: Daniel Mack <zonque@gmail.com> [s.neumann@raumfeld.com: Fix ATAGs case] Reported-and-tested-by: Sven Neumann <s.neumann@raumfeld.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2014-03-28Pass initrd position by dtbWang Nan
This patch append the position of initrd to dtb when loading arm kernel and initrd without using atag. Signed-off-by: Wang Nan <wangnan0@huawei.com> Acked-by: Dave Young <dyoung@redhat.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2014-03-28Introduce setup_dtb_prop to make code clearWang Nan
This patch introduces setup_dtb_prop(), which is used for dtb operations. The code is extracted from zImage_arm_load, and this patch makes memory grown computation more accurate. Signed-off-by: Wang Nan <wangnan0@huawei.com> Acked-by: Dave Young <dyoung@redhat.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2014-03-20kexec: align initrd when no --image-size passedWang Nan
Before this patch, when no --image-size passed, initrd_base is caculated using base + len * 4, which is unaligned, and unable to pass check in add_segment_phys_virt(): if (base & (pagesize -1)) { die("Base address: 0x%lx is not page aligned\n", base); } This patch also uses getpagesize() instead of hard encoded 4096. Signed-off-by: Wang Nan <wangnan0@huawei.com> Acked-by: Dave Young <dyoung@redhat.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2014-01-14kexec: arm: Fix endianness in crashdump headerTaras Kondratiuk
Currently little-endian ELFDATA is hard-coded in crashdump header. This lead to a wrong header format if crashdump is generated on BE system. Set native endianness into ELFDATA field. Signed-off-by: Taras Kondratiuk <taras.kondratiuk@linaro.org> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-11-14arm: add command line option for the total image sizeDaniel Mack
Currently, kexec on arm assumes that it's safe to place binary images such as atags, dtb or initrd at an estimated offset after the load address. That estimated offset is set to 4 times the size of the compressed image, hence assuming a minimum compression ratio of 1:4. While that assumption matches what the in-kernel compressors are able to achive, it doesn't take into account the .bss section the kernel image carries, and which can grow to arbitrary sizes while not accounting to the compressed image size. After decompression, and before the execution of the compressed kernel, the .bss area is initialized to zeros, trampeling over the binary images in case they happen to live in that piece of memory. Unfortunately, determining the full image size is not easiliy possible at runtime, as it would include doing all possible ways of decompression and then walk the ELF sections by hand. For now, allow users to override the static offset with a new, arm specific command line argument. Users are supposed to set this, and determine a sane value by using 'arm-linux-size vmlinux'. Signed-off-by: Daniel Mack <zonque@gmail.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-10-03kexec: Remove unused -? option handlingGeoff Levand
The main kexec option code handles the -? option. Remove all the duplicate -? handlers in the arch code which are never used. Signed-off-by: Geoff Levand <geoff@infradead.org> for Huawei, Linaro Signed-off-by: Simon Horman <horms@verge.net.au>
2013-06-21arm: Fix out of tree build errorGeoff Levand
Prefix local include paths with $(srcdir)/. Fixes build errors like these when building for ARM out of the source tree: cc1: fatal error: kexec/arch/arm/crashdump-arm.h: No such file or directory Signed-off-by: Geoff Levand <geoff@infradead.org> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-03-14kexec: arm: use _ALIGN* to make the logic clearZhang Yanfei
By replacing all the explicit align opertion with marco _ALIGN*, the code logic could be more clear. Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-03-08kexec/uImage: Introduce uImage_probe_kernelSuzuki K. Poulose
uImage supports different types of payloads, including kernel, ramdisks etc. uImage_probe() as of now checks whether the supplied payload is of type KERNEL ( i.e, IH_TYPE_KERNEL or IH_TYPE_KERNEL_NOLOAD ). Change this behaviour to return the image type, if it is one of the supported payloads. This change is in prepartion to support ramdisks in uImage format. Introduce a uImage_probe_kernel() which can be used by the archs to check if the supplied payload is one of the KERNEL types. Signed-off-by: Suzuki K. Poulose <suzuki@in.ibm.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2012-12-23build: Restrict scope of per-arch compiler flagsSimon Horman
Restrict the scope of compiler flags set in per-arch Makefiles to the architecture the Makefile belongs to. Signed-off-by: Simon Horman <horms@verge.net.au>
2012-12-23kexec-zImage-arm: simply cmdline-related DTB resizingStephen Warren
When resizing a dtb to add the command-line, only resize the DTB once, rather than once to add the /chosen node, and once to add the bootargs property. Also, simply add 1K of overhead (beyond strlen(cmdline)) to the buffer, to avoid requiring precise knowledge of the size impact of the requested FTB changes. In particular, some padding is performed when setting property values, which was not accounted for in the current code, which caused failures to set the bootargs values in some cases. Cc: Daniel Mack <zonque@gmail.com> Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2012-12-14kexec-zImage-arm: add code to support --command-line along with --dtbDaniel Mack
If --dtb is called together with --command-line, we need to modify the binary dtb buffer. Luckily, we have libfdt functions available, so this is straight forward. Signed-off-by: Daniel Mack <zonque@gmail.com> Tested-by: Sven Neumann <s.neumann@raumfeld.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2012-09-12ARM: Add device tree support to the ARM platformMatthew Leach
To allow newer ARM platforms to use kexec, pass device tree information to the kernel during boot. By default the dtb is found from /proc/device-tree. A user can specify a dtb file or use legacy ATAGs Signed-off-by: Matthew Leach <matthew.leach@arm.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2012-09-12arm: Make use of memory_rangesSimon Horman
Make use of struct memory_ranges and provide a global usablemem_rgns. This is in preparation for adding device tree support. Signed-off-by: Simon Horman <horms@verge.net.au>
2012-08-02build: Avoid duplicate files in tarballSimon Horman
Signed-off-by: Simon Horman <horms@verge.net.au>
2012-03-29arm: move DEBUG code to --debugCong Wang
Like patch 1/5, this one moves code under #if DEBUG to --debug on arm arch. Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2010-07-13build: Include missing files in tarballSimon Horman
Signed-off-by: Simon Horman <horms@verge.net.au>
2010-05-19kexec-tools: Fix option/argument parsingMatt Evans
The argument parsing is currently a bit broken as main()'s getopt_long() knows nothing about either the architecture-specific options or, even more specifically, the architecture-and-loader-specific options. This patch introduces new #defines for all architectures, KEXEC_ALL_OPTIONS and KEXEC_ALL_OPT_STR. These contain all possible options for a given build, and the getopt_long() passes in main() and arch_process_options() will now recognise arch- and loader-specific options; these will not be re-ordered in argv[], there is no confusion over which argv[] entry is the kernel filename, and using '--opt=foo' and '--opt foo' both work. All architectures have command line options (and #define OPT_BLAHs) consolidated into their include/arch/option.h files. x86_64 builds parts of i386/ as well, so now both share a single option.h file (with a symlink). Signed-off-by: Matt Evans <matt@ozlabs.org> Signed-off-by: Simon Horman <horms@verge.net.au>
2010-05-19kexec: implement ARM crashdump supportMika Westerberg
Implement support for loading dump capture kernels for ARM architecture. ARM doesn't need any backup memory regions so only elfcore header is allocated from the top of the reserved memory region. Only zImages are supported. The dump capture kernel needs to be loaded to physical address corresponding to the memory region reserved with 'crashkernel=size@start' kernel command line parameter. Signed-off-by: Mika Westerberg <ext-mika.1.westerberg@nokia.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2010-05-13kexec-tools: remove unused code from arch_process_options (arm, cris, ia64, ↵Matt Evans
mips, ppc) These architectures don't have any architecture-specific options (note: distinct from loader options, which are more specific), yet their arch_process_options() functions contain getopts_long() calls followed by no argument processing. The code doesn't do anything, so this patch removes it. Signed-off-by: Matt Evans <matt@ozlabs.org> Signed-off-by: Simon Horman <horms@verge.net.au>
2010-05-11arm: place initrd to safer place according to zImage lengthEric Miao
The original fixed address of 0x800000 may be overwritten after the kernel is decompressed. Assume a maximum decompression ratio of 4 and place initrd right after that, just to be safer. Signed-off-by: Eric Miao <eric.miao@canonical.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2010-04-01Merge branch 'ppc32' of git://git.breakpoint.cc/bigeasy/kexec-toolsSimon Horman
2010-03-31Let SH adn ARM use common uImage probe codeSebastian Andrzej Siewior
The now generic probe function is more complete than the currently used. It seems that ARM's and SH's uImage are always uncompressed so it might be good to check for this. Cc: Paul Mundt <lethal@linux-sh.org> Cc: Marc Andre Tanner <mat@brain-dump.org> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
2010-03-24kexec-tools: Fix unused return value warning for freadAmeya Palande
Signed-off-by: Ameya Palande <ameya.palande@nokia.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2010-02-02arm: Initialise initrd_start in zImage_arm_load()Simon Horman
Although the following compiler warning is bogus it seems harmless to initialise initrd_start to NULL. # arm-unknown-linux-gnu-gcc --version arm-unknown-linux-gnu-gcc (GCC) 4.1.1 Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # make kexec/arch/arm/kexec-zImage-arm.c: In function 'zImage_arm_load': kexec/arch/arm/kexec-zImage-arm.c:135: warning: 'initrd_start' may be used uninitialized in this function Signed-off-by: Simon Horman <horms@verge.net.au>
2010-02-02arm: Include unistd.h for getpagesize()Simon Horman
Signed-off-by: Simon Horman <horms@verge.net.au>
2010-02-02Use C99 initialisersSimon Horman
Signed-off-by: Simon Horman <horms@verge.net.au>
2010-02-02Use casts to avoid ambiguity when comparing off_t and size_tSimon Horman
Signed-off-by: Simon Horman <horms@verge.net.au>
2010-02-02Remove some unused variablesSimon Horman
Signed-off-by: Simon Horman <horms@verge.net.au>
2010-02-02Mark unused parametersSimon Horman
Signed-off-by: Simon Horman <horms@verge.net.au>
2009-12-16kexec: Move the uImage header to a better place.Paul Mundt
This is a completely generic header for uImage support and has no place being hidden away in an architecture directory. Move it up to the top-level include so that other architectures can trivially tie in uImage support, too. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-11-26arm: fix architecture detectionSimon Horman
There are many variants of arm and it seems to be impractical to add them all to the arches array. Instead just match on the leading "arm" portion of the utsname. I have made this specific to arm for now, as I'm not sure what fallout might occur if it was made more generic. e.g. arch ppc matching utsname ppc64 is a concern. Based on variants of this patch submitted by Andrea Adami and Marc Andre Tanner, and feedback from Magnus Damm. Cc: Andrea Adami <andrea.adami@gmail.com> Cc: Marc Andre Tanner <mat@brain-dump.org> Cc: Magnus Damm <magnus.damm@gmail.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2009-11-21kexec-arm: add uImage supportMarc Andre Tanner
uImages are basically just zImages with a special header, we therefore just skip the header and let the normal zImage infrastructure do the actual work. Signed-off-by: Marc Andre Tanner <mat@brain-dump.org> Signed-off-by: Simon Horman <horms@verge.net.au>
2009-11-19add kexec-tools support for armv7l processorsMagnus Damm
Add kexec-tools support for arm processors identifying themselves as armv7l. This includes sh7377 and the omap3 on my beagle board. Signed-off-by: Magnus Damm <damm@opensource.se> Signed-off-by: Simon Horman <horms@verge.net.au>
2009-11-19add kexec-tools support for armv6l processorsMagnus Damm
Add kexec-tools support for arm processors identifying themselves as armv6l. Tested on a sh7367. Signed-off-by: Magnus Damm <damm@opensource.se> Signed-off-by: Simon Horman <horms@verge.net.au>
2008-08-27arm: asm/page.h is no longer exported to userspaceMarc Kleine-Budde
In recent kernels "asm/page.h" isn't exported to userspace anymore, thus the include is removed. Further this patch defines _XOPEN_SOURCE, in order to use getpagesize. Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Simon Horman <horms@verge.net.au>
2008-05-21Factor uname-based native architecture detection into a common function.Jamey Sharp
This code was copy-pasted into every architecture and was basically identical. Besides producing a nice net reduction in code, this factors a portability challenge into a single function that can be easily replaced at build-time. Signed-off-by: Jamey Sharp <jamey@thetovacompany.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2008-03-07arm: invalid initialisation of iomem in get_memory_ranges()Simon Horman
This fixes a regression introduced by me in changeset 2b0088bb881680c5e8b062a9b0f0a6ef1b88d52c "kexec-tools: [arm] use proc_iomem()". My bad :-( Signed-off-by: Simon Horman <horms@verge.net.au>
2008-03-04kexec-tools: [arm] use proc_iomem()Simon Horman
Use proc_iomem() on arm for consistency with other architectures. Signed-off-by: Simon Horman <horms@verge.net.au>