Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Bruno Bottazzini committed Aug 4, 2015
0 parents commit 56cb2d2
Show file tree
Hide file tree
Showing 31 changed files with 1,005 additions and 0 deletions.
8 changes: 8 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Anselmo L. S. Melo <[email protected]>
Bruno Bottazzini <[email protected]>
Gustavo Lima Chaves <[email protected]>
Gustavo Sverzut Barbieri <[email protected]>
Leandro Dorileo <[email protected]>
Luis Felipe Strano Moraes <[email protected]>
Rodrigo Chiossi <[email protected]>
Tomaz Canabrava <[email protected]>
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (C) 2015 Intel Corporation. All rights reserved.

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.
18 changes: 18 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
meta-soletta
==============

This is the soletta yocto meta-layer. Soletta Project is a framework for making
IoT devices. With Soletta Project's libraries developers can easily write
software for devices that control actuators/sensors and communicate using
standard technologies. It enables adding smartness even on the smallest edge
devices.

If you have any question or want to propose any a change contact the soletta
project on github: https://github.com/solettaproject/.

SmallOS
=============

SmallOS is a distribution based on poky adding what seems to be required for
soletta framework + IoT (i.e systemd, udev, and all needed to produce a minimal
linux system).
23 changes: 23 additions & 0 deletions conf/distro/smallos.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
require conf/distro/poky.conf

DISTRO = "smallos"
DISTRO_NAME = "SmallOS(Yocto based IoT Distro)"
DISTRO_VERSION = "0.1+snapshot-${DATE}"
DISTRO_CODENAME = "master"

SDK_VENDOR = "-smallossdk"
SDK_VERSION := "${@'${DISTRO_VERSION}'.replace('snapshot-${DATE}','snapshot')}"
SDK_NAME = "${DISTRO}-${TCLIBC}-${SDK_ARCH}-${IMAGE_BASENAME}-${TUNE_PKGARCH}"

MAINTAINER = "Soletta Project <https://github.com/solettaproject/>"

TARGET_VENDOR = "-smallos"

LOCALCONF_VERSION = "1"

DISTRO_FEATURES_append = " systemd"
VIRTUAL-RUNTIME_init_manager = "systemd"
DISTRO_FEATURES_BACKFILL_CONSIDERED = "sysvinit"

EXTRA_IMAGE_FEATURES =+ " tools-sdk"
EXTRA_IMAGE_FEATURES =+ " ssh-server-openssh"
10 changes: 10 additions & 0 deletions conf/layer.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
BBPATH .= ":${LAYERDIR}"

BBFILES += "${LAYERDIR}/recipes-*/*/*.bb ${LAYERDIR}/recipes-*/*/*.bbappend"

BBFILE_COLLECTIONS += "soletta"
BBFILE_PATTERN_soletta = "^${LAYERDIR}/"
BBFILE_PRIORITY_soletta = "1"

LAYERVERSION_soletta = "1"
LAYERDEPENDS_soletta = "core"
1 change: 1 addition & 0 deletions recipes-configure/kernel/files/ath9k_htc.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CONFIG_ATH9K_HTC=m
5 changes: 5 additions & 0 deletions recipes-configure/kernel/files/pwm.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
CONFIG_PWM=y
CONFIG_PWM_SYSFS=y
CONFIG_PWM_LPSS=m
CONFIG_PWM_LPSS_PCI=m
CONFIG_PWM_LPSS_PLATFORM=m
3 changes: 3 additions & 0 deletions recipes-configure/kernel/linux-yocto_3.19.bbappend
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
SRC_URI += "file://pwm.cfg \
file://ath9k_htc.cfg"
2 changes: 2 additions & 0 deletions recipes-configure/systemd/files/10-automount-usbstick.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ACTION=="add", KERNEL=="sd[a-z][0-9]", TAG+="systemd", ENV{SYSTEMD_WANTS}="automount-handler@%k"
ACTION=="remove", KERNEL=="sd[a-z][0-9]", TAG+="systemd", ENV{SYSTEMD_WANTS}="umount-handler@%k"
5 changes: 5 additions & 0 deletions recipes-configure/systemd/files/any.network
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[Match]
Name=en*

[Network]
DHCP=both
13 changes: 13 additions & 0 deletions recipes-configure/systemd/files/[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[Unit]
Description=Automount USB Stick
After=dev-%i.device
BindsTo=dev-%i.device

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStartPre=/bin/mkdir -p /media/usb-%I
ExecStart=/bin/mount /dev/%I /media/usb-%I

[Install]
WantedBy=multi-user.target
33 changes: 33 additions & 0 deletions recipes-configure/systemd/files/avahi_conf_gen.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#! /bin/sh
CONF_FILE="/etc/avahi/avahi-daemon.conf"
INTERFACE="enp2s0"
MAC_ADDRESS=`ifconfig $INTERFACE | grep "HWaddr" | awk '{print $NF}'`
if [ -z "$MAC_ADDRESS" ] ; then
echo "ERROR avahi_conf_gen: Failed to get MAC Address"
else
echo "# This file was auto generated" > "$CONF_FILE"
echo "[server]" >> "$CONF_FILE"
echo "host-name=$MAC_ADDRESS" >> "$CONF_FILE"
echo "use-ipv4=yes" >> "$CONF_FILE"
echo "use-ipv6=yes" >> "$CONF_FILE"
echo "" >> "$CONF_FILE"
echo "[wide-area]" >> "$CONF_FILE"
echo "enable-wide-area=yes" >> "$CONF_FILE"
echo "" >> "$CONF_FILE"
echo "[publish]" >> "$CONF_FILE"
echo "publish-addresses=yes" >> "$CONF_FILE"
echo "publish-workstation=yes" >> "$CONF_FILE"
echo "publish-domain=yes" >> "$CONF_FILE"
echo "publish-hinfo=yes" >> "$CONF_FILE"
echo "" >> "$CONF_FILE"
echo "[rlimits]" >> "$CONF_FILE"
echo "rlimit-core=0" >> "$CONF_FILE"
echo "rlimit-data=4194304" >> "$CONF_FILE"
echo "rlimit-fsize=0" >> "$CONF_FILE"
echo "rlimit-nofile=768" >> "$CONF_FILE"
echo "rlimit-stack=4194304" >> "$CONF_FILE"
echo "rlimit-nproc=3" >> "$CONF_FILE"
fi

systemctl enable avahi-daemon.socket
systemctl start avahi-daemon.socket
10 changes: 10 additions & 0 deletions recipes-configure/systemd/files/generate-avahi-name.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Unit]
Description=Autogenerate avahi name service
ConditionFirstBoot=yes

[Service]
Type=oneshot
ExecStart=/lib/systemd/system/avahi_conf_gen.sh

[Install]
WantedBy=multi-user.target
11 changes: 11 additions & 0 deletions recipes-configure/systemd/files/hostname-set.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[Unit]
Description=Autogenerate hostname with MAC ADDRESS
After=warn-boot.timer

[Service]
Type=oneshot
ExecStart=/lib/systemd/system/hostname-set.sh

[Install]
WantedBy=multi-user.target

4 changes: 4 additions & 0 deletions recipes-configure/systemd/files/hostname-set.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#! /bin/sh
INTERFACE="enp2s0"
MAC_ADDRESS=`ifconfig $INTERFACE | grep "HWaddr" | awk '{print $NF}'`
/usr/bin/hostnamectl set-hostname $MAC_ADDRESS
4 changes: 4 additions & 0 deletions recipes-configure/systemd/files/on_boot.fbp
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
bool(constant/boolean:value=0) OUT -> IN led_red(gpio/writer:pin=338)
bool2(constant/boolean:value=0) OUT -> IN led_blue(gpio/writer:pin=464)
bool3(constant/boolean:value=0) OUT -> IN led_gree(gpio/writer:pin=339)
bool3 OUT -> QUIT app(app/quit)
13 changes: 13 additions & 0 deletions recipes-configure/systemd/files/[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[Unit]
Description=Umount USB Stick
After=dev-%i.device
BindsTo=dev-%i.device

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStartPre=/bin/systemctl stop automount-handler@%I.service
ExecStart=/bin/umount /dev/%I

[Install]
WantedBy=multi-user.target
6 changes: 6 additions & 0 deletions recipes-configure/systemd/files/warn-boot.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[Unit]
Description=Warn user that the system was booted by turning off Calamari LED

[Service]
Type=simple
ExecStart=/usr/bin/sol-fbp-runner /lib/systemd/system/on_boot.fbp
10 changes: 10 additions & 0 deletions recipes-configure/systemd/files/warn-boot.timer
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Unit]
Description=Run service after booting up system

[Timer]
# Time to wait after booting before activation
OnBootSec=1sec
Unit=warn-boot.service

[Install]
WantedBy=multi-user.target
75 changes: 75 additions & 0 deletions recipes-configure/systemd/systemd_%.bbappend
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#
# 1- Appending DHCP configuration for networkd
# 2- Configuring to auto mount usb sticks
#

FILESEXTRAPATHS_prepend := "${THISDIR}/files:"

SRC_URI += "file://any.network \
file://10-automount-usbstick.rules \
file://[email protected] \
file://[email protected] \
file://on_boot.fbp \
file://warn-boot.service \
file://warn-boot.timer \
file://generate-avahi-name.service \
file://avahi_conf_gen.sh \
file://hostname-set.service \
file://hostname-set.sh"

#Configuring to autostart samba systemd service
AUTOSTART_SYSTEMD_DIR = "/etc/systemd/system/multi-user.target.wants"
SYSTEMD_DIR = "/lib/systemd/system"
SYSTEM_ETC_DIR = "/etc/systemd/system"
UDEV_DIR = "/lib/udev/rules.d"

FILES_${PN}-services-networkd += "{sysconfdir}/systemd/network/ethernet.network"

FILES_${PN} += "${UDEV_DIR}/10-automount-usbstick.rules \
${SYSTEMD_DIR}/[email protected] \
${SYSTEMD_DIR}/[email protected] \
${SYSTEMD_DIR}/on_boot.fbp \
${SYSTEMD_DIR}/warn-boot.service \
${SYSTEMD_DIR}/warn-boot.timer \
${SYSTEMD_DIR}/generate-avahi-name.service \
${SYSTEMD_DIR}/avahi_conf_gen.sh \
${SYSTEMD_DIR}/hostname-set.service \
${SYSTEMD_DIR}/hostname-set.sh"

EXTRA_OECONF := "${@oe_filter_out('--disable-kdbus', '${EXTRA_OECONF}', d)}"
EXTRA_OECONF += "--disable-blkid --enable-kdbus"

do_install_append(){
install -Dm0644 ${WORKDIR}/any.network ${D}${sysconfdir}/systemd/network/ethernet.network

#Auto mount rules
#Systemd Rules
install -m 0755 ${WORKDIR}/automount-handler@.service ${D}${SYSTEMD_DIR}
install -m 0755 ${WORKDIR}/umount-handler@.service ${D}${SYSTEMD_DIR}

#Auto Start
ln -sf ${SYSTEMD_DIR}/automount-handler@.service ${D}${AUTOSTART_SYSTEMD_DIR}/automount-handler@.service
ln -sf ${SYSTEMD_DIR}/umount-handler@.service ${D}${AUTOSTART_SYSTEMD_DIR}/umount-handler@.service
#Udev rules
install -m 0755 ${WORKDIR}/10-automount-usbstick.rules ${D}${UDEV_DIR}

#Service that will warn the user that system was booted
install -m 0755 ${WORKDIR}/on_boot.fbp ${D}${SYSTEMD_DIR}
install -m 0755 ${WORKDIR}/warn-boot.service ${D}${SYSTEMD_DIR}
install -m 0755 ${WORKDIR}/warn-boot.timer ${D}${SYSTEMD_DIR}
ln -sf ${SYSTEMD_DIR}/warn-boot.timer ${D}${AUTOSTART_SYSTEMD_DIR}/warn-boot.timer

#Autostart avahi services
ln -sf ${SYSTEMD_DIR}/avahi-daemon.socket ${D}${AUTOSTART_SOCKET_DIR}/avahi-daemon.socket

#Install and autostart avahi autogenerate name service
install -m 0755 ${WORKDIR}/avahi_conf_gen.sh ${D}${SYSTEMD_DIR}
install -m 0755 ${WORKDIR}/generate-avahi-name.service ${D}${SYSTEMD_DIR}
ln -sf ${SYSTEMD_DIR}/generate-avahi-name.service ${D}${AUTOSTART_SYSTEMD_DIR}/generate-avahi-name.service

#Install and autostart hostname service
install -m 0755 ${WORKDIR}/hostname-set.sh ${D}${SYSTEMD_DIR}
install -m 0755 ${WORKDIR}//hostname-set.service ${D}${SYSTEMD_DIR}
ln -sf ${SYSTEMD_DIR}/hostname-set.service ${D}${AUTOSTART_SYSTEMD_DIR}/hostname-set.service

}
4 changes: 4 additions & 0 deletions recipes-modules/jsonschema/python3-jsonschema-native_2.4.0.bb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
require python3-jsonschema.inc
inherit native

DEPENDS += " python3-native"
17 changes: 17 additions & 0 deletions recipes-modules/jsonschema/python3-jsonschema.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
DESCRIPTION = "An implementation of JSON-Schema validation for Python"
HOMEPAGE = "http://pypi.python.org/pypi/jsonschema"
SECTION = "devel/python"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://COPYING;md5=7a60a81c146ec25599a3e1dabb8610a8"

PR = "r0"
SRCNAME = "jsonschema"

SRC_URI = "http://pypi.python.org/packages/source/j/${SRCNAME}/${SRCNAME}-${PV}.zip"

SRC_URI[md5sum] = "f645c88123189976058fcf550c02e50f"
SRC_URI[sha256sum] = "acf1e360b4682d64ba6acc35dbc65d81d9bde68a291a97f14f16f4282733f5a4"

S = "${WORKDIR}/${SRCNAME}-${PV}"

inherit setuptools3
1 change: 1 addition & 0 deletions recipes-modules/jsonschema/python3-jsonschema_2.4.0.bb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require python3-jsonschema.inc
Loading

0 comments on commit 56cb2d2

Please sign in to comment.