332-mips-kexec-init-the-arguments-for-the-new-kernel-image.patch 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. From 49d07a29653b1f2c6ae273b3d8fe93d981f43004 Mon Sep 17 00:00:00 2001
  2. From: Wu Zhangjin <wuzhangjin@gmail.com>
  3. Date: Wed, 12 Jan 2011 20:59:32 +0000
  4. Subject: MIPS: Kexec: Init the arguments for the new kernel image
  5. Whenever the kexec-tools pass the command lines to the new kernel image,
  6. init the arguments as the ones for the 1st kernel image. This fixed the
  7. booting failure of Kexec on YeeLoong.
  8. Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
  9. ---
  10. --- a/arch/mips/kernel/machine_kexec.c
  11. +++ b/arch/mips/kernel/machine_kexec.c
  12. @@ -10,6 +10,7 @@
  13. #include <linux/mm.h>
  14. #include <linux/delay.h>
  15. +#include <asm/bootinfo.h>
  16. #include <asm/cacheflush.h>
  17. #include <asm/page.h>
  18. @@ -23,9 +24,30 @@ void (*relocated_kexec_smp_wait) (void *
  19. atomic_t kexec_ready_to_reboot = ATOMIC_INIT(0);
  20. #endif
  21. +static void machine_kexec_init_args(void)
  22. +{
  23. + kexec_args[0] = fw_arg0;
  24. + kexec_args[1] = fw_arg1;
  25. + kexec_args[2] = fw_arg2;
  26. + kexec_args[3] = fw_arg3;
  27. +
  28. + pr_info("kexec_args[0] (argc): %lu\n", kexec_args[0]);
  29. + pr_info("kexec_args[1] (argv): %p\n", (void *)kexec_args[1]);
  30. + pr_info("kexec_args[2] (env ): %p\n", (void *)kexec_args[2]);
  31. + pr_info("kexec_args[3] (desc): %p\n", (void *)kexec_args[3]);
  32. +}
  33. +
  34. int
  35. machine_kexec_prepare(struct kimage *kimage)
  36. {
  37. + /*
  38. + * Whenever arguments passed from kexec-tools, Init the arguments as
  39. + * the original ones to avoid booting failure.
  40. + *
  41. + * This can be overrided by _machine_kexec_prepare().
  42. + */
  43. + machine_kexec_init_args();
  44. +
  45. if (_machine_kexec_prepare)
  46. return _machine_kexec_prepare(kimage);
  47. return 0;