1
0

adding-boards.txt 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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_arm
  16. select ADK_raspberry_pi2
  17. select ADK_TARGET_LITTLE_ENDIAN
  18. select ADK_CPU_CORTEX_A7
  19. select ADK_TARGET_CPU_WITH_NEON
  20. select ADK_TARGET_BOARD_BCM28XX
  21. select ADK_TARGET_WITH_VGA
  22. select ADK_TARGET_WITH_SERIAL
  23. select ADK_TARGET_WITH_CPU_FREQ
  24. select ADK_TARGET_WITH_USB
  25. select ADK_TARGET_WITH_INPUT
  26. select ADK_TARGET_WITH_SD
  27. select ADK_TARGET_WITH_I2C
  28. select ADK_TARGET_WITH_SPI
  29. select ADK_TARGET_WITH_SMP
  30. select ADK_PACKAGE_BCM28XX_BOOTLOADER
  31. select ADK_TARGET_WITH_ROOT_RW
  32. select ADK_TARGET_KERNEL_ZIMAGE
  33. help
  34. Raspberry PI 2
  35. ------------------------
  36. You need to select as a minimum the architecture, target system name, CPU type
  37. and Kernel format. If a bootloader is required you also need to select it.
  38. (ADK_PACKAGE_BCM28XX_BOOTLOADER) If the bootloader does not exist as a package
  39. in OpenADK, you need to port it first.
  40. The hardware capabilities are optional. (f.e. ADK_TARGET_WITH_SD), but
  41. required when you configure the driver configuration later.
  42. For architectures with a choice for endianess you should select either
  43. ADK_TARGET_LITTLE_ENDIAN or ADK_TARGET_BIG_ENDIAN.
  44. If the CPU type like in this example ADK_CPU_CORTEX_A7 is not yet available
  45. you need to add it to target/config/Config.in.cpu. For optimized code generation
  46. you should also add ADK_TARGET_GCC_CPU or ADK_TARGET_GCC_ARCH symbol for your CPU
  47. type. Furthermore you need to decide if your CPU has a MMU, FPU and NPTL support
  48. in the C library.
  49. After the creation of the file you can go into the menu based system and
  50. select your embedded board.
  51. The second step is to create a Kernel configuration file fragment, which contains
  52. only the basic support for your board to get serial console access.
  53. For example the snippet for Raspberry PI 2:
  54. target/arm/kernel/raspberry-pi2
  55. ------------------------
  56. CONFIG_ARM=y
  57. CONFIG_ARM_PATCH_PHYS_VIRT=y
  58. CONFIG_ARCH_MULTI_V7=y
  59. CONFIG_ARCH_BCM2709=y
  60. CONFIG_MACH_BCM2709=y
  61. CONFIG_FIQ=y
  62. CONFIG_SERIAL_AMBA_PL011=y
  63. CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
  64. ------------------------
  65. The kernel file must be registered in target/config/Config.in.kernel
  66. ------------------------
  67. config ADK_TARGET_KERNEL_MINICONFIG
  68. string
  69. ...
  70. default "raspberry-pi2" if ADK_TARGET_SYSTEM_RASPBERRY_PI2
  71. ------------------------
  72. If the mainstream kernel from kernel.org does not contain support for your board
  73. you need to get a working kernel tree and create a patch.
  74. For example for Raspberry PI 2 we basically use following method to create a patch:
  75. ------------------------
  76. git clone https://github.com/raspberrypi/linux.git linux-rpi
  77. wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.18.9.tar.xz
  78. tar xvf linux-3.18.9.tar.xz
  79. find linux-3.18.9 linux-rpi -type l -delete
  80. rm -rf linux-rpi/.git
  81. diff -Nur linux-3.18.9 linux-rpi > target/arm/bcm28xx/patches/3.18.9/0000-raspberry-pi.patch
  82. ------------------------
  83. Normally you use target/<arch>/<target system>/patches/<kernelversion>/0000-<target-system>.patch.
  84. In case of Raspberry PI 2 we have a single patch for Raspberry PI and Raspberry PI 2 and use
  85. the extra board name bcm28xx to describe the family of devices.
  86. After that you can build the toolchain, kernel and base system and write the resulting
  87. firmware from firmware/<target system>/ to your device or boot via netboot and NFS.
  88. If you have some special notes for your embedded board, please add some advise to
  89. target/<arch>/Makefile. You can add information for the different rootfilesystem types.
  90. If your system boots up fine to a shell, you can add the driver configuration.
  91. For example if you add SD card driver support to Raspberry PI 2 you
  92. would add following to target/linux/config/Config.in.block
  93. ------------------------
  94. config ADK_KERNEL_MMC_BCM2835
  95. bool "SD card support for BCM2835 boards"
  96. select ADK_KERNEL_SCSI
  97. select ADK_KERNEL_MMC
  98. select ADK_KERNEL_MMC_BLOCK
  99. select ADK_KERNEL_BLK_DEV
  100. select ADK_KERNEL_BLK_DEV_SD
  101. select ADK_KERNEL_MMC_SDHCI
  102. select ADK_KERNEL_MMC_SDHCI_PLTFM
  103. select ADK_KERNEL_MMC_BCM2835_DMA
  104. depends on ADK_TARGET_BOARD_BCM28XX
  105. default y if ADK_TARGET_BOARD_BCM28XX
  106. default n
  107. ------------------------
  108. We use the symbol prefix ADK_KERNEL instead of CONFIG. Otherwise the symbols are
  109. matching the kernel symbol names.
  110. Get again into the menu based system, enable the driver you added and recompile.
  111. If your driver is available as kernel module use tristate and add an entry to
  112. mk/modules.mk.
  113. An entry might look like this:
  114. ------------------------
  115. $(eval $(call KMOD_template,SND_BCM2708_SOC_I2S,snd-bcm2708-soc-i2s,\
  116. $(MODULES_DIR)/kernel/sound/soc/bcm/snd-soc-bcm2708-i2s \
  117. ,60, kmod-snd-soc))
  118. ------------------------
  119. If the user choose the I2S driver for Raspberry PI 2, create a kmod package
  120. containing the file kernel/sound/soc/bcm/snd-soc-bcm2708-i2s.ko and generate
  121. a dependency to kmod-snd-soc when a package management (ipkg/opkg) is used.
  122. Furthermore a file with load instructions is created in /etc/modules.d/snd-bcm2708-soc-i2s
  123. on the target.