aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/at91/image
Commit message (Collapse)AuthorAgeFilesLines
...
* Add support for u-bootClaudio Mignanti2010-07-2220-6490/+610
| | | | SVN-Revision: 22351
* revamp target: add support for netusg20 boardClaudio Mignanti2010-06-181-18/+1
| | | | SVN-Revision: 21838
* replace old quote stripping with calls to qstrip macroNicolas Thill2010-04-291-3/+3
| | | | SVN-Revision: 21242
* define a shared IMG_PREFIX variable used as a basename for image files, it ↵Nicolas Thill2010-04-121-4/+3
| | | | | | contains board & subtarget infos (if appropriate) allowing subtargets to share the same bin directory without overwriting each other's files SVN-Revision: 20834
* fix u-boot installationFlorian Fainelli2009-10-291-1/+1
| | | | SVN-Revision: 18208
* fix u-boot linking failure with an EABI toolchainFlorian Fainelli2009-10-291-0/+52
| | | | SVN-Revision: 18207
* fix dfboot linking failures (#5937)Florian Fainelli2009-10-291-1/+2
| | | | SVN-Revision: 18206
* make kernels use /etc/preinit by defaultImre Kaloz2009-05-145-16/+16
| | | | SVN-Revision: 15840
* get rid of $Id$ - it has never helped us and it has broken too many patches ;)Felix Fietkau2009-04-172-2/+0
| | | | SVN-Revision: 15242
* be politically correctImre Kaloz2008-04-281-2/+2
| | | | SVN-Revision: 10964
* make the image filenames a bit shorterFelix Fietkau2007-11-101-2/+2
| | | | SVN-Revision: 9533
* fix target names in image options (closes: #2357)Nicolas Thill2007-09-111-5/+5
| | | | SVN-Revision: 8749
* strip the kernel version suffix from target directories, except for brcm-2.4 ↵Felix Fietkau2007-09-0648-0/+22117
(the -2.4 will be included in the board name here). CONFIG_LINUX_<ver>_<board> becomes CONFIG_TARGET_<board>, same for profiles. SVN-Revision: 8653
ot convenient. Now, we accept the kernel parameters from the --command-line or --append option of the kexec-tools. But If not --command-line or --apend option indicated, will fall back to use the ones from the original bootloader. Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com> --- --- a/arch/mips/kernel/machine_kexec.c +++ b/arch/mips/kernel/machine_kexec.c @@ -13,6 +13,7 @@ #include <asm/bootinfo.h> #include <asm/cacheflush.h> #include <asm/page.h> +#include <asm/uaccess.h> int (*_machine_kexec_prepare)(struct kimage *) = NULL; void (*_machine_kexec_shutdown)(void) = NULL; @@ -35,6 +36,56 @@ static void machine_kexec_init_args(void pr_info("kexec_args[3] (desc): %p\n", (void *)kexec_args[3]); } +#define ARGV_MAX_ARGS (COMMAND_LINE_SIZE / 15) + +int machine_kexec_pass_args(struct kimage *image) +{ + int i, argc = 0; + char *bootloader = "kexec"; + int *kexec_argv = (int *)kexec_args[1]; + + for (i = 0; i < image->nr_segments; i++) { + if (!strncmp(bootloader, (char *)image->segment[i].buf, + strlen(bootloader))) { + /* + * convert command line string to array + * of parameters (as bootloader does). + */ + /* + * Note: we do treat the 1st string "kexec" as an + * argument ;-) so, argc here is 1. + */ + char *str = (char *)image->segment[i].buf; + char *ptr = strchr(str, ' '); + char *kbuf = (char *)kexec_argv[0]; + /* Whenever --command-line or --append used, "kexec" is copied */ + argc = 1; + /* Parse the offset */ + while (ptr && (ARGV_MAX_ARGS > argc)) { + *ptr = '\0'; + if (ptr[1] != ' ' && ptr[1] != '\0') { + int offt = (int)(ptr - str + 1); + kexec_argv[argc] = (int)kbuf + offt; + argc++; + } + ptr = strchr(ptr + 1, ' '); + } + if (argc > 1) { + /* Copy to kernel space */ + copy_from_user(kbuf, (char *)image->segment[i].buf, image->segment[i].bufsz); + fw_arg0 = kexec_args[0] = argc; + } + break; + } + } + + pr_info("argc = %lu\n", kexec_args[0]); + for (i = 0; i < kexec_args[0]; i++) + pr_info("argv[%d] = %p, %s\n", i, (char *)kexec_argv[i], (char *)kexec_argv[i]); + + return 0; +} + int machine_kexec_prepare(struct kimage *kimage) { @@ -45,6 +96,7 @@ machine_kexec_prepare(struct kimage *kim * This can be overrided by _machine_kexec_prepare(). */ machine_kexec_init_args(); + machine_kexec_pass_args(kimage); if (_machine_kexec_prepare) return _machine_kexec_prepare(kimage);