spl_net.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * (C) Copyright 2000-2004
  3. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  4. *
  5. * (C) Copyright 2012
  6. * Ilya Yanok <ilya.yanok@gmail.com>
  7. *
  8. * See file CREDITS for list of people who contributed to this
  9. * project.
  10. *
  11. * This program is free software; you can redistribute it and/or
  12. * modify it under the terms of the GNU General Public License as
  13. * published by the Free Software Foundation; either version 2 of
  14. * the License, or (at your option) any later version.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program; if not, write to the Free Software
  23. * Foundation, Inc.
  24. */
  25. #include <common.h>
  26. #include <spl.h>
  27. #include <net.h>
  28. DECLARE_GLOBAL_DATA_PTR;
  29. void spl_net_load_image(const char *device)
  30. {
  31. int rv;
  32. env_init();
  33. env_relocate();
  34. setenv("autoload", "yes");
  35. load_addr = CONFIG_SYS_TEXT_BASE - sizeof(struct image_header);
  36. rv = eth_initialize(gd->bd);
  37. if (rv == 0) {
  38. printf("No Ethernet devices found\n");
  39. hang();
  40. }
  41. if (device)
  42. setenv("ethact", device);
  43. rv = NetLoop(BOOTP);
  44. if (rv < 0) {
  45. printf("Problem booting with BOOTP\n");
  46. hang();
  47. }
  48. spl_parse_image_header((struct image_header *)load_addr);
  49. }