// -*- mode:doc; -*- // vim: set syntax=asciidoc: [[adding-boards]] Adding new embedded boards to OpenADK ------------------------------------- This section covers how support for new embedded boards can be integrated into OpenADK. First step is to create a board description file in target//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 package in OpenADK, you need to port it first. The hardware capabilities are optional. (f.e. ADK_TARGET_WITH_SD), but required when you configure the driver configuration later. For architectures with a choice for endianess you should depends on either ADK_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 available you need to add it to target/config/Config.in.cpu. For optimized code generation you should also add ADK_TARGET_GCC_CPU or ADK_TARGET_GCC_ARCH symbol for your CPU type. Furthermore you need to decide if your CPU has a MMU, FPU and NPTL support in the C library. After the creation of the file you can go into the menu based system and select your embedded board. The second step is to create a Kernel configuration file fragment, which contains only 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 board name: target/arm/kernel/raspberry-pi2 ------------------------ CONFIG_ARM=y CONFIG_ARCH_BCM2709=y CONFIG_BCM2709_DT=y CONFIG_PHYS_OFFSET=0 CONFIG_HAVE_ARM_ARCH_TIMER=y CONFIG_FIQ=y CONFIG_ATAGS=y CONFIG_KUSER_HELPERS=y CONFIG_ARM_ERRATA_643719=y CONFIG_BCM2708_NOL2CACHE=y CONFIG_RASPBERRYPI_FIRMWARE=y CONFIG_BRCM_CHAR_DRIVERS=y CONFIG_BCM2708_VCHIQ=y CONFIG_BCM2708_VCMEM=y CONFIG_MAILBOX=y CONFIG_BCM2835_MBOX=y CONFIG_OF=y CONFIG_OF_OVERLAY=y CONFIG_CMDLINE_FROM_BOOTLOADER=y ------------------------ If the mainstream kernel from kernel.org does not contain support for your board you 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-rpi wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.18.9.tar.xz tar xvf linux-3.18.9.tar.xz find linux-3.18.9 linux-rpi -type l -delete rm -rf linux-rpi/.git diff -Nur linux-3.18.9 linux-rpi > target/arm/bcm28xx/patches/3.18.9/0001-bcm28xx-github.patch ------------------------ Normally you use target///patches//0001-.patch. In case of Raspberry PI 2 we have a single patch for Raspberry PI and Raspberry PI 2 and use the extra board name bcm28xx to describe the family of devices. After that you can build the toolchain, kernel and base system and write the resulting firmware from firmware// to your device or boot via netboot and NFS. If you have some special notes for your embedded board, please add some advise to target//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 you would 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 are matching 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.