summaryrefslogtreecommitdiff
path: root/docs/adding-boards.txt
blob: 4f18dbc0840134e9b127882e0be37252ed3bdc42 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
// -*- 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/<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 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/<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 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/<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 to
target/<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 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.