Skip to content
This repository has been archived by the owner on Jun 27, 2019. It is now read-only.

Board Detection

Murilo Belluzzo edited this page Apr 4, 2016 · 24 revisions

One of the Soletta's goals is to provide means for users to take the most of the hardware capabilities of the board in which is running. And since each board is different, it is necessary to know the underlying board in order to provide some features like pin reference by label and the capabilities of a given pin.

To keep instructions about a variety of boards in Soletta itself would be impossible and inefficient, so a board detection infrastructure was added instead. Making possible for Soletta to detect a new board without the need to recompile or update it.

In order to discover the underlying board, Soletta searches for the board name in the following places in the listed order:

  • SOL_BOARD_NAME environment variable (Linux)
  • BOARD_NAME value configured during the build
  • Detect the board by processing the rules of files found in PKGSYSCONFDIR/boards and SOL_DATADIR/boards (Linux)
    • Default folders: '/etc/soletta/boards' and '/usr/share/soletta/boards'
    • '99_board_detect.json' that is shipped with Soletta has rules for some boards like Intel Edison, Intel Galileo, Intel Minnowboard Max and Raspberry Pi

Board Detection File

Board detection files are JSON files that are in compliance with this json schema and allows one to describe a set of rules that are used to identify a given board. In general, the file is an array of 'boards', on which each element is a 'board definition' (or 'board entry'). Soletta traverses the list until a successful validation occurs and the order of the boards listed matters so pay close attention to use this fact in your favor. Here is possible to see an usage example.

Board Definition

A 'board definition' is composed by the board 'name' and a 'validation array'. A successfully validation occurs when each 'rule' in the 'validation array' succeed. Then, 'name' is used by Soletta as the current board name.

The following snippet is the 'board entry' to detect a Intel Galileo Gen1:

{
   "name": "intel-galileo-rev-d",
   "validation": [
      {
         "file_path": "/sys/devices/virtual/dmi/id/board_name",
         "match": [ "Galileo$" ]
      }
   ]
}

Validation Rule

A 'validation rule' or just 'rule' has three parts: file_path, match array, dont_match array. Only 'file_path' is required and in this case a rule succeed if the file exists.

'match' is an array of regular expressions that should have at least one match in the file pointed by 'file_path'. While 'dont_match' is the same except that the expressions cannot match the content of the file.

Clone this wiki locally