spl_net.c 778 B

1234567891011121314151617181920212223242526272829303132333435363738
  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. * SPDX-License-Identifier: GPL-2.0+
  9. */
  10. #include <common.h>
  11. #include <errno.h>
  12. #include <spl.h>
  13. #include <net.h>
  14. DECLARE_GLOBAL_DATA_PTR;
  15. int spl_net_load_image(const char *device)
  16. {
  17. int rv;
  18. env_init();
  19. env_relocate();
  20. setenv("autoload", "yes");
  21. load_addr = CONFIG_SYS_TEXT_BASE - sizeof(struct image_header);
  22. rv = eth_initialize();
  23. if (rv == 0) {
  24. printf("No Ethernet devices found\n");
  25. return -ENODEV;
  26. }
  27. if (device)
  28. setenv("ethact", device);
  29. rv = net_loop(BOOTP);
  30. if (rv < 0) {
  31. printf("Problem booting with BOOTP\n");
  32. return rv;
  33. }
  34. return spl_parse_image_header((struct image_header *)load_addr);
  35. }