^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) .. SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) =============================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) Adding a new board to LinuxSH
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) =============================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) Paul Mundt <lethal@linux-sh.org>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) This document attempts to outline what steps are necessary to add support
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) for new boards to the LinuxSH port under the new 2.5 and 2.6 kernels. This
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) also attempts to outline some of the noticeable changes between the 2.4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) and the 2.5/2.6 SH backend.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) 1. New Directory Structure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) ==========================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) The first thing to note is the new directory structure. Under 2.4, most
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) of the board-specific code (with the exception of stboards) ended up
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) in arch/sh/kernel/ directly, with board-specific headers ending up in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) include/asm-sh/. For the new kernel, things are broken out by board type,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) companion chip type, and CPU type. Looking at a tree view of this directory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) hierarchy looks like the following:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) Board-specific code::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) .
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) |-- arch
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) | `-- sh
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) | `-- boards
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) | |-- adx
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) | | `-- board-specific files
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) | |-- bigsur
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) | | `-- board-specific files
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) | |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) | ... more boards here ...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) `-- include
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) `-- asm-sh
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) |-- adx
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) | `-- board-specific headers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) |-- bigsur
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) | `-- board-specific headers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) .. more boards here ...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) Next, for companion chips::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) .
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) `-- arch
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) `-- sh
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) `-- cchips
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) `-- hd6446x
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) `-- hd64461
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) `-- cchip-specific files
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) ... and so on. Headers for the companion chips are treated the same way as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) board-specific headers. Thus, include/asm-sh/hd64461 is home to all of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) hd64461-specific headers.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) Finally, CPU family support is also abstracted::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) .
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) |-- arch
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) | `-- sh
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) | |-- kernel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) | | `-- cpu
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) | | |-- sh2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) | | | `-- SH-2 generic files
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) | | |-- sh3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) | | | `-- SH-3 generic files
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) | | `-- sh4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) | | `-- SH-4 generic files
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) | `-- mm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) | `-- This is also broken out per CPU family, so each family can
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) | have their own set of cache/tlb functions.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) `-- include
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) `-- asm-sh
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) |-- cpu-sh2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) | `-- SH-2 specific headers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) |-- cpu-sh3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) | `-- SH-3 specific headers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) `-- cpu-sh4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) `-- SH-4 specific headers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) It should be noted that CPU subtypes are _not_ abstracted. Thus, these still
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) need to be dealt with by the CPU family specific code.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) 2. Adding a New Board
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) =====================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) The first thing to determine is whether the board you are adding will be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) isolated, or whether it will be part of a family of boards that can mostly
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) share the same board-specific code with minor differences.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) In the first case, this is just a matter of making a directory for your
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) board in arch/sh/boards/ and adding rules to hook your board in with the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) build system (more on this in the next section). However, for board families
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) it makes more sense to have a common top-level arch/sh/boards/ directory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) and then populate that with sub-directories for each member of the family.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) Both the Solution Engine and the hp6xx boards are an example of this.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) After you have setup your new arch/sh/boards/ directory, remember that you
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) should also add a directory in include/asm-sh for headers localized to this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) board (if there are going to be more than one). In order to interoperate
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) seamlessly with the build system, it's best to have this directory the same
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) as the arch/sh/boards/ directory name, though if your board is again part of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) a family, the build system has ways of dealing with this (via incdir-y
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) overloading), and you can feel free to name the directory after the family
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) member itself.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) There are a few things that each board is required to have, both in the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) arch/sh/boards and the include/asm-sh/ hierarchy. In order to better
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) explain this, we use some examples for adding an imaginary board. For
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) setup code, we're required at the very least to provide definitions for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) get_system_type() and platform_setup(). For our imaginary board, this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) might look something like::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) * arch/sh/boards/vapor/setup.c - Setup code for imaginary board
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) const char *get_system_type(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) return "FooTech Vaporboard";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) int __init platform_setup(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) * If our hardware actually existed, we would do real
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) * setup here. Though it's also sane to leave this empty
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) * if there's no real init work that has to be done for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) * this board.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) /* Start-up imaginary PCI ... */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) /* And whatever else ... */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) Our new imaginary board will also have to tie into the machvec in order for it
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) to be of any use.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) machvec functions fall into a number of categories:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) - I/O functions to IO memory (inb etc) and PCI/main memory (readb etc).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) - I/O mapping functions (ioport_map, ioport_unmap, etc).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) - a 'heartbeat' function.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) - PCI and IRQ initialization routines.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) - Consistent allocators (for boards that need special allocators,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) particularly for allocating out of some board-specific SRAM for DMA
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) handles).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) There are machvec functions added and removed over time, so always be sure to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) consult include/asm-sh/machvec.h for the current state of the machvec.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) The kernel will automatically wrap in generic routines for undefined function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) pointers in the machvec at boot time, as machvec functions are referenced
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) unconditionally throughout most of the tree. Some boards have incredibly
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) sparse machvecs (such as the dreamcast and sh03), whereas others must define
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) virtually everything (rts7751r2d).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) Adding a new machine is relatively trivial (using vapor as an example):
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) If the board-specific definitions are quite minimalistic, as is the case for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) the vast majority of boards, simply having a single board-specific header is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) sufficient.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) - add a new file include/asm-sh/vapor.h which contains prototypes for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) any machine specific IO functions prefixed with the machine name, for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) example vapor_inb. These will be needed when filling out the machine
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) vector.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) Note that these prototypes are generated automatically by setting
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) __IO_PREFIX to something sensible. A typical example would be::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) #define __IO_PREFIX vapor
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) #include <asm/io_generic.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) somewhere in the board-specific header. Any boards being ported that still
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) have a legacy io.h should remove it entirely and switch to the new model.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) - Add machine vector definitions to the board's setup.c. At a bare minimum,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) this must be defined as something like::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) struct sh_machine_vector mv_vapor __initmv = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) .mv_name = "vapor",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) ALIAS_MV(vapor)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) - finally add a file arch/sh/boards/vapor/io.c, which contains definitions of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) the machine specific io functions (if there are enough to warrant it).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 3. Hooking into the Build System
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) ================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) Now that we have the corresponding directories setup, and all of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) board-specific code is in place, it's time to look at how to get the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) whole mess to fit into the build system.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) Large portions of the build system are now entirely dynamic, and merely
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) require the proper entry here and there in order to get things done.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) The first thing to do is to add an entry to arch/sh/Kconfig, under the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) "System type" menu::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) config SH_VAPOR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) bool "Vapor"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) help
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) select Vapor if configuring for a FooTech Vaporboard.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) next, this has to be added into arch/sh/Makefile. All boards require a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) machdir-y entry in order to be built. This entry needs to be the name of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) the board directory as it appears in arch/sh/boards, even if it is in a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) sub-directory (in which case, all parent directories below arch/sh/boards/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) need to be listed). For our new board, this entry can look like::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) machdir-$(CONFIG_SH_VAPOR) += vapor
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) provided that we've placed everything in the arch/sh/boards/vapor/ directory.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) Next, the build system assumes that your include/asm-sh directory will also
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) be named the same. If this is not the case (as is the case with multiple
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) boards belonging to a common family), then the directory name needs to be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) implicitly appended to incdir-y. The existing code manages this for the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) Solution Engine and hp6xx boards, so see these for an example.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) Once that is taken care of, it's time to add an entry for the mach type.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) This is done by adding an entry to the end of the arch/sh/tools/mach-types
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) list. The method for doing this is self explanatory, and so we won't waste
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) space restating it here. After this is done, you will be able to use
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) implicit checks for your board if you need this somewhere throughout the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) common code, such as::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) /* Make sure we're on the FooTech Vaporboard */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) if (!mach_is_vapor())
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) also note that the mach_is_boardname() check will be implicitly forced to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) lowercase, regardless of the fact that the mach-types entries are all
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) uppercase. You can read the script if you really care, but it's pretty ugly,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) so you probably don't want to do that.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) Now all that's left to do is providing a defconfig for your new board. This
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) way, other people who end up with this board can simply use this config
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) for reference instead of trying to guess what settings are supposed to be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) used on it.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) Also, as soon as you have copied over a sample .config for your new board
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) (assume arch/sh/configs/vapor_defconfig), you can also use this directly as a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) build target, and it will be implicitly listed as such in the help text.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) Looking at the 'make help' output, you should now see something like:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) Architecture specific targets (sh):
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) ======================= =============================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) zImage Compressed kernel image (arch/sh/boot/zImage)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) adx_defconfig Build for adx
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) cqreek_defconfig Build for cqreek
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) dreamcast_defconfig Build for dreamcast
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) ...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) vapor_defconfig Build for vapor
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) ======================= =============================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) which then allows you to do::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) $ make ARCH=sh CROSS_COMPILE=sh4-linux- vapor_defconfig vmlinux
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) which will in turn copy the defconfig for this board, run it through
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) oldconfig (prompting you for any new options since the time of creation),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) and start you on your way to having a functional kernel for your new
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) board.