1
0

adding-boards.txt 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. // -*- mode:doc; -*-
  2. // vim: set syntax=asciidoc:
  3. [[adding-boards]]
  4. Adding new embedded boards to OpenADK
  5. -------------------------------------
  6. This section covers how support for new embedded boards
  7. can be integrated into OpenADK.
  8. First step is to create a board description file in
  9. target/<arch>/systems with the short name of your embedded board.
  10. For example you would create following file for Raspberry PI 2 support:
  11. target/arm/systems/raspberry-pi2
  12. ---------------------
  13. config ADK_TARGET_SYSTEM_RASPBERRY_PI2
  14. bool "Raspberry PI 2"
  15. select ADK_CPU_CORTEX_A7
  16. select ADK_TARGET_LITTLE_ENDIAN
  17. select ADK_TARGET_CPU_WITH_NEON
  18. select ADK_TARGET_BOARD_BCM28XX
  19. select ADK_TARGET_WITH_VGA
  20. select ADK_TARGET_WITH_SERIAL
  21. select ADK_TARGET_WITH_CPU_FREQ
  22. select ADK_TARGET_WITH_USB
  23. select ADK_TARGET_WITH_INPUT
  24. select ADK_TARGET_WITH_SD
  25. select ADK_TARGET_WITH_I2C
  26. select ADK_TARGET_WITH_SPI
  27. select ADK_TARGET_WITH_SMP
  28. select ADK_PACKAGE_BCM28XX_BOOTLOADER
  29. select ADK_TARGET_WITH_ROOT_RW
  30. select ADK_TARGET_KERNEL_ZIMAGE
  31. help
  32. Raspberry PI 2
  33. ------------------------
  34. You need to select as a minimum a CPU type and Kernel format.
  35. If a bootloader is required you also need to select it.
  36. (ADK_PACKAGE_BCM28XX_BOOTLOADER) If the bootloader does not exist as a package
  37. in OpenADK, you need to port it first.
  38. The hardware capabilities are optional. (f.e. ADK_TARGET_WITH_SD), but
  39. required when you configure the driver configuration later.
  40. For architectures with a choice for endianess you should select either
  41. ADK_TARGET_LITTLE_ENDIAN or ADK_TARGET_BIG_ENDIAN.
  42. If the CPU type like in this example ADK_CPU_CORTEX_A7 is not yet available
  43. you need to add it to target/config/Config.in.cpu. For optimized code generation
  44. you should also add ADK_TARGET_GCC_CPU or ADK_TARGET_GCC_ARCH symbol for your CPU
  45. type. Furthermore you need to decide if your CPU has a MMU, FPU and NPTL support
  46. in the C library.
  47. After the creation of the file you can go into the menu based system and
  48. select your embedded board.
  49. The second step is to create a Kernel configuration file fragment, which contains
  50. only the basic support for your board to get serial console access.
  51. For example the snippet for Raspberry PI 2, the file name must match the embedded board
  52. name:
  53. target/arm/kernel/raspberry-pi2
  54. ------------------------
  55. CONFIG_ARM=y
  56. CONFIG_ARCH_BCM2709=y
  57. CONFIG_BCM2709_DT=y
  58. CONFIG_PHYS_OFFSET=0
  59. CONFIG_HAVE_ARM_ARCH_TIMER=y
  60. CONFIG_FIQ=y
  61. CONFIG_ATAGS=y
  62. CONFIG_KUSER_HELPERS=y
  63. CONFIG_ARM_ERRATA_643719=y
  64. CONFIG_BCM2708_NOL2CACHE=y
  65. CONFIG_RASPBERRYPI_FIRMWARE=y
  66. CONFIG_BRCM_CHAR_DRIVERS=y
  67. CONFIG_BCM2708_VCHIQ=y
  68. CONFIG_BCM2708_VCMEM=y
  69. CONFIG_MAILBOX=y
  70. CONFIG_BCM2835_MBOX=y
  71. CONFIG_OF=y
  72. CONFIG_OF_OVERLAY=y
  73. CONFIG_CMDLINE_FROM_BOOTLOADER=y
  74. ------------------------
  75. If the mainstream kernel from kernel.org does not contain support for your board
  76. you need to get a working kernel tree and create a patch.
  77. For example for Raspberry PI 2 we basically use following method to create a patch:
  78. ------------------------
  79. git clone https://github.com/raspberrypi/linux.git linux-rpi
  80. wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.18.9.tar.xz
  81. tar xvf linux-3.18.9.tar.xz
  82. find linux-3.18.9 linux-rpi -type l -delete
  83. rm -rf linux-rpi/.git
  84. diff -Nur linux-3.18.9 linux-rpi > target/arm/bcm28xx/patches/3.18.9/0001-bcm28xx-github.patch
  85. ------------------------
  86. Normally you use target/<arch>/<target system>/patches/<kernelversion>/0001-<target-system>.patch.
  87. In case of Raspberry PI 2 we have a single patch for Raspberry PI and Raspberry PI 2 and use
  88. the extra board name bcm28xx to describe the family of devices.
  89. After that you can build the toolchain, kernel and base system and write the resulting
  90. firmware from firmware/<target system>/ to your device or boot via netboot and NFS.
  91. If you have some special notes for your embedded board, please add some advise to
  92. target/<arch>/Makefile. You can add information for the different rootfilesystem types.
  93. If your system boots up fine to a shell, you can add the driver configuration.
  94. For example if you add SD card driver support to Raspberry PI 2 you
  95. would add following to target/linux/config/Config.in.block
  96. ------------------------
  97. config ADK_KERNEL_MMC_BCM2835
  98. bool "SD card support for BCM2835 boards"
  99. select ADK_KERNEL_SCSI
  100. select ADK_KERNEL_MMC
  101. select ADK_KERNEL_MMC_BLOCK
  102. select ADK_KERNEL_BLK_DEV
  103. select ADK_KERNEL_BLK_DEV_SD
  104. select ADK_KERNEL_MMC_SDHCI
  105. select ADK_KERNEL_MMC_SDHCI_PLTFM
  106. select ADK_KERNEL_MMC_BCM2835_DMA
  107. depends on ADK_TARGET_BOARD_BCM28XX
  108. default y if ADK_TARGET_BOARD_BCM28XX
  109. default n
  110. ------------------------
  111. We use the symbol prefix ADK_KERNEL instead of CONFIG. Otherwise the symbols are
  112. matching the kernel symbol names.
  113. Get again into the menu based system, enable the driver you added and recompile.
  114. If your driver is available as a kernel module use tristate.