developerbox.rst 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. .. SPDX-License-Identifier: GPL-2.0+
  2. Introduction
  3. ============
  4. DeveloperBox is a certified 96boards Enterprise Edition board. The board/SoC has: -
  5. * Socionext SC2A11 24-cores ARM Cortex-A53 on tbe Mini-ATX form factor motherboard
  6. * 4 DIMM slots (4GB DDR4-2400 UDIMM shipped by default)
  7. * 1 4xPCIe Gen2 slot and 2 1xPCIe Gen2 slots
  8. (1x slots are connected via PCIe bridge chip)
  9. * 4 USB-3.0 ports
  10. * 2 SATA ports
  11. * 1 GbE network port
  12. * 1 USB-UART serial port (micro USB)
  13. * 64MB SPI NOR Flash
  14. * 8GB eMMC Flash Storage
  15. * 96boards LS connector
  16. The DeveloperBox schematic can be found here: -
  17. https://www.96boards.org/documentation/enterprise/developerbox/hardware-docs/mzsc2am_v03_20180115_a.pdf
  18. And the other documents can be found here: -
  19. https://www.96boards.org/documentation/enterprise/developerbox/
  20. Currently, the U-Boot port supports: -
  21. * USB
  22. * eMMC
  23. * SPI-NOR
  24. * SATA
  25. * GbE
  26. The DeveloperBox boots the TF-A and EDK2 as a main bootloader by default.
  27. The DeveloperBox U-Boot port will replace the EDK2 and boot from TF-A as
  28. BL33, but no need to combine with it.
  29. Compile from source
  30. ===================
  31. You can build U-Boot without any additinal source code.::
  32. cd u-boot
  33. export ARCH=arm64
  34. export CROSS_COMPILE=aarch64-linux-gnu-
  35. make SynQuacer_defconfig
  36. make -j `noproc`
  37. Then, expand the binary to 1MB for preparing flash.::
  38. cp u-boot.bin SPI_NOR_UBOOT.fd
  39. truncate -s 1M SPI_NOR_UBOOT.fd
  40. Installation
  41. ============
  42. You can install the SNI_NOR_UBOOT.fd via NOR flash writer.
  43. Flashing the U-Boot image on DeveloperBox requires a 96boards UART mezzanine
  44. or other mezzanine which can connect to the LS-UART0 port.
  45. Connect USB cable from host to the LS-UART0 and set DSW2-7 to ON, and turn the
  46. board on again. The flash writer program will be started automatically;
  47. don't forget to turn the DSW2-7 off again after flashing.
  48. *!!CAUTION!! If you write the U-Boot image on wrong address, the board can
  49. be bricked. See below page if you need to recover the bricked board. See
  50. the following page for more details*
  51. https://www.96boards.org/documentation/enterprise/developerbox/installation/board-recovery.md.html
  52. When the serial flasher is running correctly it will show the following boot
  53. messages printed to the LS-UART0 console::
  54. /*------------------------------------------*/
  55. /* SC2A11 "SynQuacer" series Flash writer */
  56. /* */
  57. /* Version: cd254ac */
  58. /* Build: 12/15/17 11:25:45 */
  59. /*------------------------------------------*/
  60. Command Input >
  61. Once the flasher tool is running we are ready flash the UEFI image::
  62. flash rawwrite 200000 100000
  63. >> Send SPI_NOR_UBOOT.fd via XMODEM (Control-A S in minicom) <<
  64. *!!NOTE!! The flasher command parameter is different from the command for
  65. board recovery. U-Boot uses the offset 200000 (2-five-0, 2M in hex) and the
  66. size 100000 (1-five-0, 1M in hex).*
  67. After transferring the SPI_NOR_UBOOT.fd, turn off the DSW2-7 and
  68. reset the board.
  69. Enable FWU Multi Bank Update
  70. ============================
  71. DeveloperBox supports the FWU Multi Bank Update. You *MUST* update both
  72. *SCP firmware* and *TF-A* for this feature. This will change the layout and
  73. the boot process but you can switch back to the normal one by changing
  74. the DSW 1-4 off.
  75. Configure U-Boot
  76. ----------------
  77. To enable the FWU Multi Bank Update on the DeveloperBox board the
  78. configs/synquacer_developerbox_defconfig enables default FWU configuration ::
  79. CONFIG_FWU_MULTI_BANK_UPDATE=y
  80. CONFIG_FWU_MDATA=y
  81. CONFIG_FWU_MDATA_MTD=y
  82. CONFIG_FWU_NUM_BANKS=2
  83. CONFIG_FWU_NUM_IMAGES_PER_BANK=1
  84. CONFIG_CMD_FWU_METADATA=y
  85. And build it::
  86. cd u-boot/
  87. export ARCH=arm64
  88. export CROSS_COMPILE=aarch64-linux-gnu-
  89. make synquacer_developerbox_defconfig
  90. make -j `noproc`
  91. cd ../
  92. By default, the CONFIG_FWU_NUM_BANKS and CONFIG_FWU_NUM_IMAGES_PER_BANKS are
  93. set to 2 and 1 respectively. This uses FIP (Firmware Image Package) type image
  94. which contains TF-A, U-Boot and OP-TEE (the OP-TEE is optional).
  95. You can use fiptool to compose the FIP image from those firmware images.
  96. Rebuild SCP firmware
  97. --------------------
  98. Rebuild SCP firmware which supports FWU Multi Bank Update as below::
  99. cd SCP-firmware/
  100. OUT=./build/product/synquacer
  101. ROMFW_FILE=$OUT/scp_romfw/$SCP_BUILD_MODE/bin/scp_romfw.bin
  102. RAMFW_FILE=$OUT/scp_ramfw/$SCP_BUILD_MODE/bin/scp_ramfw.bin
  103. ROMRAMFW_FILE=scp_romramfw_release.bin
  104. make CC=arm-none-eabi-gcc PRODUCT=synquacer MODE=release
  105. tr "\000" "\377" < /dev/zero | dd of=${ROMRAMFW_FILE} bs=1 count=196608
  106. dd if=${ROMFW_FILE} of=${ROMRAMFW_FILE} bs=1 conv=notrunc seek=0
  107. dd if=${RAMFW_FILE} of=${ROMRAMFW_FILE} bs=1 seek=65536
  108. cd ../
  109. And you can get the `scp_romramfw_release.bin` file.
  110. Rebuild OPTEE firmware
  111. ----------------------
  112. Rebuild OPTEE to use in new-layout FIP as below::
  113. cd optee_os/
  114. make -j`nproc` PLATFORM=synquacer ARCH=arm \
  115. CROSS_COMPILE64=aarch64-linux-gnu- CFG_ARM64_core=y \
  116. CFG_CRYPTO_WITH_CE=y CFG_CORE_HEAP_SIZE=524288 CFG_CORE_DYN_SHM=y \
  117. CFG_CORE_ARM64_PA_BITS=48 CFG_TEE_CORE_LOG_LEVEL=1 CFG_TEE_TA_LOG_LEVEL=1
  118. cp out/arm-plat-synquacer/core/tee-pager_v2.bin ../arm-trusted-firmware/
  119. The produced `tee-pager_v2.bin` is to be used while building TF-A next.
  120. Rebuild TF-A and FIP
  121. --------------------
  122. Rebuild TF-A which supports FWU Multi Bank Update as below::
  123. cd arm-trusted-firmware/
  124. make CROSS_COMPILE=aarch64-linux-gnu- -j`nproc` PLAT=synquacer \
  125. TRUSTED_BOARD_BOOT=1 SPD=opteed SQ_RESET_TO_BL2=1 GENERATE_COT=1 \
  126. MBEDTLS_DIR=../mbedtls BL32=tee-pager_v2.bin \
  127. BL33=../u-boot/u-boot.bin all fip fiptool
  128. And make a FIP image.::
  129. cp build/synquacer/release/fip.bin SPI_NOR_NEWFIP.fd
  130. tools/fiptool/fiptool update --tb-fw build/synquacer/release/bl2.bin SPI_NOR_NEWFIP.fd
  131. UUIDs for the FWU Multi Bank Update
  132. -----------------------------------
  133. FWU multi-bank update requires some UUIDs. The DeveloperBox platform uses
  134. following UUIDs.
  135. - Location UUID for the FIP image: 17e86d77-41f9-4fd7-87ec-a55df9842de5
  136. - Image type UUID for the FIP image: 10c36d7d-ca52-b843-b7b9-f9d6c501d108
  137. - Image UUID for Bank0 : 5a66a702-99fd-4fef-a392-c26e261a2828
  138. - Image UUID for Bank1 : a8f868a1-6e5c-4757-878d-ce63375ef2c0
  139. These UUIDs are used for making a FWU metadata image.
  140. u-boot$ ./tools/mkfwumdata -i 1 -b 2 \
  141. 17e86d77-41f9-4fd7-87ec-a55df9842de5,10c36d7d-ca52-b843-b7b9-f9d6c501d108,5a66a702-99fd-4fef-a392-c26e261a2828,a8f868a1-6e5c-4757-878d-ce63375ef2c0 \
  142. ../devbox-fwu-mdata.img
  143. Create Accept & Revert capsules
  144. u-boot$ ./tools/mkeficapsule -A -g 7d6dc310-52ca-43b8-b7b9-f9d6c501d108 NEWFIP_accept.Cap
  145. u-boot$ ./tools/mkeficapsule -R NEWFIP_revert.Cap
  146. Install via flash writer
  147. ------------------------
  148. As explained in above section, the new FIP image and the FWU metadata image
  149. can be installed via NOR flash writer.
  150. Once the flasher tool is running we are ready to flash the images.::
  151. Write the FIP image to the Bank-0 & 1 at 6MB and 10MB offset.::
  152. flash rawwrite 600000 180000
  153. flash rawwrite a00000 180000
  154. >> Send SPI_NOR_NEWFIP.fd via XMODEM (Control-A S in minicom) <<
  155. flash rawwrite 500000 1000
  156. flash rawwrite 530000 1000
  157. >> Send devbox-fwu-mdata.img via XMODEM (Control-A S in minicom) <<
  158. And write the new SCP firmware.::
  159. flash write cm3
  160. >> Send scp_romramfw_release.bin via XMODEM (Control-A S in minicom) <<
  161. At last, turn on the DSW 3-4 on the board, and reboot.
  162. Note that if DSW 3-4 is turned off, the DeveloperBox will boot from
  163. the original EDK2 firmware (or non-FWU U-Boot if you already installed).