Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
The imports the SIMATIC IOT2000 board support package for Yocto in its
version 2.1.0.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
  • Loading branch information
jan-kiszka committed Oct 4, 2016
0 parents commit 5f60872
Show file tree
Hide file tree
Showing 92 changed files with 11,254 additions and 0 deletions.
7 changes: 7 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
The meta-iot2000 layers are generally made available under the MIT license
except for explicitly marked components, which are GPLv2. Please see

meta-iot2000-*/COPYING.MIT
meta-iot2000-*/COPYING.GPLv2

as well as separate COPYING files of components.
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
IOT2000 Board Support Package
=============================

This packages contains the following elements:

- meta-iot2000-bsp
- meta-iot2000-example

For updates, please visit https://github.com/siemens/meta-iot2000. We are
also accepting issue reports, feature suggestions and patches this way.


meta-iot2000-bsp
----------------

Use this Yocto layer to enable all hardware features of the IOT2000 device. It
allows to build standard Yocto images which will contain the required kernel,
configurations and tools and will emit a bootable SD card image.

For further details, see [BSP readme](meta-iot2000-bsp/README.md).


meta-iot2000-example
--------------------

This Yocto layer builds on top of meta-iot2000-bsp, providing an exemplary image
with additional tools and services to exploit features of the IOT2000
conveniently.

This layer shall only be considered as a starting point for own developments. It
is not configured to provide product-grade maturity and security.

For further details, see [example image readme](meta-iot2000-example/README.md).
339 changes: 339 additions & 0 deletions meta-iot2000-bsp/COPYING.GPLv2

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions meta-iot2000-bsp/COPYING.MIT
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
109 changes: 109 additions & 0 deletions meta-iot2000-bsp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
This README file contains information on building the meta-iot2000
BSP layer, and booting the images contained in the output directory.
Please see the corresponding sections below for details.


Dependencies
============

This layer depends on:

```
URI: git://git.yoctoproject.org/poky
layers: meta, meta-yocto, meta-yocto-bsp
branch: krogoth
URI: git://git.yoctoproject.org/meta-intel
layers: meta-intel
branch: master
```


Building the meta-iot2000 BSP Layer
===================================

This uses Yocto 2.1 (Krogoth) with the 4.4 Linux kernel provided by Yocto and
the meta-intel layer. The build has be tested successfully on Debian 8 and
OpenSuse 13.2, but other recent distros are expected to work as well.

## Prepare:

For setting up your host pc see the following description:
[3. Setting Up to Use the Yocto Project](http://www.yoctoproject.org/docs/2.1/mega-manual/mega-manual.html#yp-resources)

```shell
$ git clone git://git.yoctoproject.org/poky.git poky -b krogoth
$ git clone git://git.yoctoproject.org/meta-intel poky/meta-intel -b master
```

For the exact revision, you have to checkout these versions:

```shell
$ git -C poky checkout yocto-2.1
$ git -C poky/meta-intel checkout 9a06fc5bce05
```

You may update to a newer Yocto versions as needed (e.g. to include security
fixes), but be aware of potential breakages. Tests were performed only against
2.1 and the specified meta-intel revision so far.

## Download meta-iot2000 (unless already done):
```shell
$ git clone git://github.com/siemens/meta-iot2000 poky/meta-iot2000
```

## Enter Build Environment:

```shell
$ source poky/oe-init-build-env iot2000-build
```

## Configure:

```diff
--- conf/bblayers.conf.old
+++ conf/bblayers.conf
@@ -9,4 +9,6 @@
/home/build/poky/meta \
/home/build/poky/meta-poky \
/home/build/poky/meta-yocto-bsp \
+ /home/build/poky/meta-intel \
+ /home/build/poky/meta-iot2000/meta-iot2000-bsp \
"
```

```diff
--- conf/local.conf.old
+++ conf/local.conf
@@ -34,7 +34,7 @@
#MACHINE ?= "edgerouter"
#
# This sets the default machine to be qemux86 if no other machine is selected:
-MACHINE ??= "qemux86"
+MACHINE ??= "iot2000"

#
# Where to place downloads
```

## Create Minimal Image:

```shell
$ bitbake core-image-minimal
```


Booting the Image
=================

Under Linux, insert an unused SD card. Assuming the SD card takes device
/dev/mmcblk0, use dd to copy the image to it. For example:

```shell
$ sudo dd if=tmp/deploy/images/iot2000/core-image-minimal-iot2000.wic of=/dev/mmcblk0 bs=4M oflag=sync
```

If you want to ssh into the system, you can use the root terminal to
ifconfig the IP address and use that to ssh in. The root password is
empty, so to log in type 'root' for the user name and hit 'Enter' at
the Password prompt and you should be in.
13 changes: 13 additions & 0 deletions meta-iot2000-bsp/conf/layer.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# We have a conf and classes directory, add to BBPATH
BBPATH .= ":${LAYERDIR}"

# We have a recipes-* directories, add to BBFILES
BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
${LAYERDIR}/recipes-*/*/*.bbappend"

BBFILE_COLLECTIONS += "iot2000-bsp"
BBFILE_PATTERN_iot2000-bsp = "^${LAYERDIR}/"
BBFILE_PRIORITY_iot2000-bsp = "6"

IOT2000_MIT_LICENSE = "${LAYERDIR}/COPYING.MIT"
IOT2000_GPLv2_LICENSE = "${LAYERDIR}/COPYING.GPLv2"
31 changes: 31 additions & 0 deletions meta-iot2000-bsp/conf/machine/iot2000.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#@TYPE: Machine
#@NAME: iot2000

#@DESCRIPTION: Machine configuration for iot2000 systems

MACHINEOVERRIDES =. "intel-quark:"

require conf/machine/include/meta-intel.inc
require conf/machine/include/intel-quark-common.inc
require conf/machine/include/intel-common-pkgarch.inc

#Avoid pulling in GRUB
MACHINE_ESSENTIAL_EXTRA_RDEPENDS = ""

MACHINE_FEATURES = "efi usb intel-ucode"

MACHINE_EXTRA_RRECOMMENDS += "kernel-modules linux-firmware"

SERIAL_CONSOLE = "115200 ttyS1"
APPEND += "rootwait console=ttyS1,115200 console=tty0"

EFI_PROVIDER = "gummiboot"

# Ensure that the Lock prefix is omitted for the kernel"
KERNEL_EXTRA_ARGS = "EXTRA_CFLAGS=-Wa,-momit-lock-prefix=yes"

# Machine specific Image packages:
IMAGE_INSTALL_append = " kernel-modules"

# Package compatiblity:
PACKAGE_EXTRA_ARCHS_append = " intel-quark quark i586 x86"
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Assume a USB mouse and keyboard are connected
HAVE_TOUCHSCREEN=n
HAVE_KEYBOARD=n
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
IMAGE_FSTYPES_append_iot2000 = " wic"

do_image_wic[depends] += "${PN}:do_bootimg"
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
From 90eae7abbc0e5addb47ed7833de29636b1557cf4 Mon Sep 17 00:00:00 2001
From: Sascha Weisenberger <sascha.weisenberger@siemens.com>
Date: Wed, 6 Jul 2016 15:27:20 +0100
Subject: [PATCH 1/6] stmmac: adding support for platform IOT2000

IOT2000 covers both, IOT2020 and IOT2040, while only the IOT2040 has
two LAN ports.

Signed-off-by: Sascha Weisenberger <sascha.weisenberger@siemens.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
index d71a721..07e24ef 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
@@ -138,6 +138,16 @@ static struct stmmac_pci_dmi_data quark_pci_dmi_data[] = {
.func = 6,
.phy_addr = 1,
},
+ {
+ .name = "SIMATIC IOT2000",
+ .func = 6,
+ .phy_addr = 1,
+ },
+ {
+ .name = "SIMATIC IOT2000",
+ .func = 7,
+ .phy_addr = 1,
+ },
{}
};

--
2.1.4

Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
From ddf08cdaf2704e0c2a7f3898964e0b068937ee65 Mon Sep 17 00:00:00 2001
From: Jan Kiszka <jan.kiszka@siemens.com>
Date: Tue, 26 Jul 2016 20:31:09 +0200
Subject: [PATCH 2/6] serial: uapi: Add support for bus termination

The Siemens IOT2000 comes with a RS485 interface that allows to enable
or disable bus termination via software. Add a bit to the flags field of
serial_rs485 that applications can set in order to request this feature
from the hardware. This seems generic enough to add it for everyone.
Existing driver will simply ignore it when set.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
include/uapi/linux/serial.h | 3 +++
1 file changed, 3 insertions(+)

diff --git a/include/uapi/linux/serial.h b/include/uapi/linux/serial.h
index 25331f9..7934e32 100644
--- a/include/uapi/linux/serial.h
+++ b/include/uapi/linux/serial.h
@@ -121,6 +121,9 @@ struct serial_rs485 {
#define SER_RS485_RTS_AFTER_SEND (1 << 2) /* Logical level for
RTS pin after sent*/
#define SER_RS485_RX_DURING_TX (1 << 4)
+#define SER_RS485_TERMINATE_BUS (1 << 5) /* Enable bus
+ termination
+ (if supported) */
__u32 delay_rts_before_send; /* Delay before send (milliseconds) */
__u32 delay_rts_after_send; /* Delay after send (milliseconds) */
__u32 padding[5]; /* Memory is cheap, new structs
--
2.1.4

Loading

0 comments on commit 5f60872

Please sign in to comment.