cmdline.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * Based on Ocelot Linux port, which is
  3. * Copyright 2001 MontaVista Software Inc.
  4. * Author: jsun@mvista.com or jsun@junsun.net
  5. *
  6. * Copyright 2003 ICT CAS
  7. * Author: Michael Guo <guoyi@ict.ac.cn>
  8. *
  9. * Copyright (C) 2007 Lemote Inc. & Institute of Computing Technology
  10. * Author: Fuxin Zhang, zhangfx@lemote.com
  11. *
  12. * Copyright (C) 2009 Lemote Inc.
  13. * Author: Wu Zhangjin, wuzhangjin@gmail.com
  14. *
  15. * This program is free software; you can redistribute it and/or modify it
  16. * under the terms of the GNU General Public License as published by the
  17. * Free Software Foundation; either version 2 of the License, or (at your
  18. * option) any later version.
  19. */
  20. #include <asm/bootinfo.h>
  21. #include <loongson.h>
  22. void __init prom_init_cmdline(void)
  23. {
  24. int prom_argc;
  25. /* pmon passes arguments in 32bit pointers */
  26. int *_prom_argv;
  27. int i;
  28. long l;
  29. /* firmware arguments are initialized in head.S */
  30. prom_argc = fw_arg0;
  31. _prom_argv = (int *)fw_arg1;
  32. /* arg[0] is "g", the rest is boot parameters */
  33. arcs_cmdline[0] = '\0';
  34. for (i = 1; i < prom_argc; i++) {
  35. l = (long)_prom_argv[i];
  36. if (strlen(arcs_cmdline) + strlen(((char *)l) + 1)
  37. >= sizeof(arcs_cmdline))
  38. break;
  39. strcat(arcs_cmdline, ((char *)l));
  40. strcat(arcs_cmdline, " ");
  41. }
  42. prom_init_machtype();
  43. }