| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 | // -*- mode:doc; -*-// vim: set syntax=asciidoc:[[adding-boards]]Adding new embedded boards to OpenADK-------------------------------------This section covers how support for new embedded boardscan be integrated into OpenADK. First step is to create a board description file intarget/<arch>/systems with the short name of your embedded board.For example you would create following file for Raspberry PI 2 support:target/arm/systems/raspberry-pi2---------------------config ADK_TARGET_SYSTEM_RASPBERRY_PI2        bool "Raspberry PI 2"        depends on ADK_TARGET_LITTLE_ENDIAN        select ADK_TARGET_CPU_ARM_CORTEX_A7        select ADK_TARGET_CPU_WITH_NEON        select ADK_TARGET_BOARD_BCM28XX        select ADK_TARGET_WITH_VGA        select ADK_TARGET_WITH_SERIAL        select ADK_TARGET_WITH_CPU_FREQ        select ADK_TARGET_WITH_USB        select ADK_TARGET_WITH_INPUT        select ADK_TARGET_WITH_SD        select ADK_TARGET_WITH_I2C        select ADK_TARGET_WITH_SPI        select ADK_TARGET_WITH_SMP        select ADK_PACKAGE_BCM28XX_BOOTLOADER        select ADK_TARGET_WITH_ROOT_RW        select ADK_TARGET_KERNEL_ZIMAGE        help          Raspberry PI 2------------------------You need to select as a minimum a CPU type and Kernel format. If a bootloader is required you also need to select it.(ADK_PACKAGE_BCM28XX_BOOTLOADER) If the bootloader does not exist as a packagein OpenADK, you need to port it first.The hardware capabilities are optional. (f.e. ADK_TARGET_WITH_SD), butrequired when you configure the driver configuration later.For architectures with a choice for endianess you should depends on eitherADK_TARGET_LITTLE_ENDIAN or ADK_TARGET_BIG_ENDIAN.If the CPU type like in this example ADK_TARGET_CPU_ARM_CORTEX_A7 is not yet availableyou need to add it to target/config/Config.in.cpu. For optimized code generationyou should also add ADK_TARGET_GCC_CPU or ADK_TARGET_GCC_ARCH symbol for your CPUtype. Furthermore you need to decide if your CPU has a MMU, FPU and NPTL supportin the C library.After the creation of the file you can go into the menu based system andselect your embedded board.The second step is to create a Kernel configuration file fragment, which containsonly the basic support for your board to get serial console access.For example the snippet for Raspberry PI 2, the file name must match the embedded boardname:target/arm/kernel/raspberry-pi2------------------------CONFIG_ARM=yCONFIG_ARCH_BCM2709=yCONFIG_BCM2709_DT=yCONFIG_PHYS_OFFSET=0CONFIG_HAVE_ARM_ARCH_TIMER=yCONFIG_FIQ=yCONFIG_ATAGS=yCONFIG_KUSER_HELPERS=yCONFIG_ARM_ERRATA_643719=yCONFIG_BCM2708_NOL2CACHE=yCONFIG_RASPBERRYPI_FIRMWARE=yCONFIG_BRCM_CHAR_DRIVERS=yCONFIG_BCM2708_VCHIQ=yCONFIG_BCM2708_VCMEM=yCONFIG_MAILBOX=yCONFIG_BCM2835_MBOX=yCONFIG_OF=yCONFIG_OF_OVERLAY=yCONFIG_CMDLINE_FROM_BOOTLOADER=y------------------------If the mainstream kernel from kernel.org does not contain support for your boardyou need to get a working kernel tree and create a patch.For example for Raspberry PI 2 we basically use following method to create a patch:------------------------git clone https://github.com/raspberrypi/linux.git linux-rpiwget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.18.9.tar.xztar xvf linux-3.18.9.tar.xzfind linux-3.18.9 linux-rpi -type l -deleterm -rf linux-rpi/.gitdiff -Nur linux-3.18.9 linux-rpi > target/arm/bcm28xx/patches/3.18.9/0001-bcm28xx-github.patch------------------------Normally you use target/<arch>/<target system>/patches/<kernelversion>/0001-<target-system>.patch.In case of Raspberry PI 2 we have a single patch for Raspberry PI and Raspberry PI 2 and usethe extra board name bcm28xx to describe the family of devices.After that you can build the toolchain, kernel and base system and write the resultingfirmware from firmware/<target system>/ to your device or boot via netboot and NFS.If you have some special notes for your embedded board, please add some advise totarget/<arch>/Makefile. You can add information for the different rootfilesystem types.If your system boots up fine to a shell, you can add the driver configuration.For example if you add SD card driver support to Raspberry PI 2 youwould add following to target/linux/config/Config.in.block------------------------config ADK_KERNEL_MMC_BCM2835        bool "SD card support for BCM2835 boards"        select ADK_KERNEL_SCSI        select ADK_KERNEL_MMC        select ADK_KERNEL_MMC_BLOCK        select ADK_KERNEL_BLK_DEV        select ADK_KERNEL_BLK_DEV_SD        select ADK_KERNEL_MMC_SDHCI        select ADK_KERNEL_MMC_SDHCI_PLTFM        select ADK_KERNEL_MMC_BCM2835_DMA        depends on ADK_TARGET_BOARD_BCM28XX        default y if ADK_TARGET_BOARD_BCM28XX        default n------------------------We use the symbol prefix ADK_KERNEL instead of CONFIG. Otherwise the symbols arematching the kernel symbol names.Get again into the menu based system, enable the driver you added and recompile.If your driver is available as a kernel module use tristate.
 |