1
0

adding-boards.txt 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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:
  52. target/arm/kernel/raspberry-pi2
  53. ------------------------
  54. CONFIG_ARM=y
  55. CONFIG_ARM_PATCH_PHYS_VIRT=y
  56. CONFIG_ARCH_MULTI_V7=y
  57. CONFIG_ARCH_BCM2709=y
  58. CONFIG_MACH_BCM2709=y
  59. CONFIG_FIQ=y
  60. CONFIG_SERIAL_AMBA_PL011=y
  61. CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
  62. ------------------------
  63. The kernel file must be registered in target/config/Config.in.kernel
  64. ------------------------
  65. config ADK_TARGET_KERNEL_MINICONFIG
  66. string
  67. ...
  68. default "raspberry-pi2" if ADK_TARGET_SYSTEM_RASPBERRY_PI2
  69. ------------------------
  70. If the mainstream kernel from kernel.org does not contain support for your board
  71. you need to get a working kernel tree and create a patch.
  72. For example for Raspberry PI 2 we basically use following method to create a patch:
  73. ------------------------
  74. git clone https://github.com/raspberrypi/linux.git linux-rpi
  75. wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.18.9.tar.xz
  76. tar xvf linux-3.18.9.tar.xz
  77. find linux-3.18.9 linux-rpi -type l -delete
  78. rm -rf linux-rpi/.git
  79. diff -Nur linux-3.18.9 linux-rpi > target/arm/bcm28xx/patches/3.18.9/0000-raspberry-pi.patch
  80. ------------------------
  81. Normally you use target/<arch>/<target system>/patches/<kernelversion>/0000-<target-system>.patch.
  82. In case of Raspberry PI 2 we have a single patch for Raspberry PI and Raspberry PI 2 and use
  83. the extra board name bcm28xx to describe the family of devices.
  84. After that you can build the toolchain, kernel and base system and write the resulting
  85. firmware from firmware/<target system>/ to your device or boot via netboot and NFS.
  86. If you have some special notes for your embedded board, please add some advise to
  87. target/<arch>/Makefile. You can add information for the different rootfilesystem types.
  88. If your system boots up fine to a shell, you can add the driver configuration.
  89. For example if you add SD card driver support to Raspberry PI 2 you
  90. would add following to target/linux/config/Config.in.block
  91. ------------------------
  92. config ADK_KERNEL_MMC_BCM2835
  93. bool "SD card support for BCM2835 boards"
  94. select ADK_KERNEL_SCSI
  95. select ADK_KERNEL_MMC
  96. select ADK_KERNEL_MMC_BLOCK
  97. select ADK_KERNEL_BLK_DEV
  98. select ADK_KERNEL_BLK_DEV_SD
  99. select ADK_KERNEL_MMC_SDHCI
  100. select ADK_KERNEL_MMC_SDHCI_PLTFM
  101. select ADK_KERNEL_MMC_BCM2835_DMA
  102. depends on ADK_TARGET_BOARD_BCM28XX
  103. default y if ADK_TARGET_BOARD_BCM28XX
  104. default n
  105. ------------------------
  106. We use the symbol prefix ADK_KERNEL instead of CONFIG. Otherwise the symbols are
  107. matching the kernel symbol names.
  108. Get again into the menu based system, enable the driver you added and recompile.
  109. If your driver is available as kernel module use tristate.