spl_net.c 851 B

123456789101112131415161718192021222324252627282930313233343536373839
  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(struct spl_boot_device *bootdev)
  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 (bootdev->boot_device_name)
  28. setenv("ethact", bootdev->boot_device_name);
  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(&spl_image,
  35. (struct image_header *)load_addr);
  36. }