README.am335x-network 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. USING AM335x NETBOOT FEATURE
  2. Some boards (like TI AM335x based ones) have quite big on-chip RAM and
  3. have support for booting via network in ROM. The following describes
  4. how to setup network booting and then optionally use this support to flash
  5. NAND and bricked (empty) board with only a network cable.
  6. I. Building the required images
  7. 1. You have to enable generic SPL configuration options (see
  8. doc/README.SPL) as well as CONFIG_SPL_NET_SUPPORT,
  9. CONFIG_ETH_SUPPORT, CONFIG_SPL_LIBGENERIC_SUPPORT and
  10. CONFIG_SPL_LIBCOMMON_SUPPORT in your board configuration file to build
  11. SPL with support for booting over the network. Also you have to enable
  12. the driver for the NIC used and CONFIG_SPL_BOARD_INIT option if your
  13. board needs some board-specific initialization (TI AM335x EVM does).
  14. If you want SPL to use some Vendor Class Identifier (VCI) you can set
  15. one with CONFIG_SPL_NET_VCI_STRING option. am335x_evm configuration
  16. comes with support for network booting preconfigured.
  17. 2. Define CONFIG_BOOTCOMMAND for your board to load and run debrick
  18. script after boot:
  19. #define CONFIG_BOOTCOMMAND \
  20. "setenv autoload no; " \
  21. "bootp; " \
  22. "if tftp 80000000 debrick.scr; then " \
  23. "source 80000000; " \
  24. "fi"
  25. (Or create additional board configuration with such option).
  26. 3. Build U-Boot as usual
  27. $ make <your_board_name>
  28. You will need u-boot.img and spl/u-boot.bin images to perform
  29. network boot. Copy them to u-boot-restore.img and
  30. u-boot-spl-restore.bin respectively to distinguish this version
  31. (with automatic restore running) from the main one.
  32. II. Host configuration.
  33. 1. Setup DHCP server (recommended server is ISC DHCPd).
  34. - Install DHCP server and setup it to listen on the interface you
  35. chose to connect to the board (usually configured in
  36. /etc/default/dhcpd or /etc/default/isc-dhcp-server). Make sure there
  37. are no other active DHCP servers in the same network segment.
  38. - Edit your dhcpd.conf and subnet declaration matching the address
  39. on the interface. Specify the range of assigned addresses and bootfile
  40. to use. IMPORTANT! Both RBL and SPL use the image filename provided
  41. in the BOOTP reply but obviously they need different images (RBL needs
  42. raw SPL image -- u-boot-spl-restore.bin while SPL needs main U-Boot
  43. image -- u-boot-restore.img). So you have to configure DHCP server to
  44. provide different image filenames to RBL and SPL (and possibly another
  45. one to main U-Boot). This can be done by checking Vendor Class
  46. Identifier (VCI) set by BOOTP client (RBL sets VCI to "DM814x ROM v1.0"
  47. and you can set VCI used by SPL with CONFIG_SPL_NET_VCI_STRING option,
  48. see above).
  49. - If you plan to use TFTP server on another machine you have to set
  50. server-name option to point to it.
  51. - Here is sample configuration for ISC DHCPd, assuming the interface
  52. used to connect to the board is eth0, and it has address 192.168.8.1:
  53. subnet 192.168.8.0 netmask 255.255.255.0 {
  54. range dynamic-bootp 192.168.8.100 192.168.8.199;
  55. if substring (option vendor-class-identifier, 0, 10) = "DM814x ROM" {
  56. filename "u-boot-spl-restore.bin";
  57. } elsif substring (option vendor-class-identifier, 0, 17) = "AM335x U-Boot SPL" {
  58. filename "u-boot-restore.img";
  59. } else {
  60. filename "uImage";
  61. }
  62. }
  63. May the ROM bootloader sends another "vendor-class-identifier"
  64. on the shc board with an AM335X it is:
  65. "AM335x ROM"
  66. 2. Setup TFTP server.
  67. Install TFTP server and put image files to it's root directory
  68. (likely /tftpboot or /var/lib/tftpboot or /srv/tftp). You will need
  69. u-boot.img and spl/u-boot-spl-bin files from U-Boot build directory.
  70. III. Reflashing (debricking) the board.
  71. 1. Write debrick script. You will need to write a script that will
  72. be executed after network boot to perform actual rescue actions. You
  73. can use usual U-Boot commands from this script: tftp to load additional
  74. files, nand erase/nand write to erase/write the NAND flash.
  75. 2. Create script image from your script. From U-Boot build directory:
  76. $ ./tools/mkimage -A arm -O U-Boot -C none -T script -d <your script> debrick.scr
  77. This will create debrick.scr file with your script inside.
  78. 3. Copy debrick.scr to TFTP root directory. You also need to copy
  79. there all the files your script tries to load via TFTP. Example script
  80. loads u-boot.img and MLO. You have to create these files doing regular
  81. (not restore_flash) build and copy them to tftpboot directory.
  82. 4. Boot the board from the network, U-Boot will load debrick script
  83. and run it after boot.