zimageboot.c 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * (C) Copyright 2010
  4. * Renesas Solutions Corp.
  5. * Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
  6. */
  7. /*
  8. * Linux SuperH zImage loading and boot
  9. */
  10. #include <common.h>
  11. #include <irq_func.h>
  12. #include <asm/io.h>
  13. #include <asm/zimage.h>
  14. int do_sh_zimageboot (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
  15. {
  16. ulong (*zboot_entry)(int, char * const []) = NULL;
  17. char *s0, *s1;
  18. unsigned char *param = NULL;
  19. char *cmdline;
  20. char *bootargs;
  21. disable_interrupts();
  22. if (argc >= 3) {
  23. /* argv[1] holds the address of the zImage */
  24. s0 = argv[1];
  25. /* argv[2] holds the address of zero page */
  26. s1 = argv[2];
  27. } else {
  28. goto exit;
  29. }
  30. if (s0)
  31. zboot_entry = (ulong (*)(int, char * const []))simple_strtoul(s0, NULL, 16);
  32. /* empty_zero_page */
  33. if (s1)
  34. param = (unsigned char*)simple_strtoul(s1, NULL, 16);
  35. /* Linux kernel command line */
  36. cmdline = (char *)param + COMMAND_LINE;
  37. bootargs = env_get("bootargs");
  38. /* Clear zero page */
  39. /* cppcheck-suppress nullPointer */
  40. memset(param, 0, 0x1000);
  41. /* Set commandline */
  42. strcpy(cmdline, bootargs);
  43. /* Boot */
  44. zboot_entry(0, NULL);
  45. exit:
  46. return -1;
  47. }
  48. U_BOOT_CMD(
  49. zimageboot, 3, 0, do_sh_zimageboot,
  50. "Boot zImage for Renesas SH",
  51. ""
  52. );