From 482c08e442ecb38f657979c078623c7d45989029 Mon Sep 17 00:00:00 2001 From: Thomas Klaehn Date: Tue, 13 Jun 2017 14:55:28 +0200 Subject: [PATCH] meta-rpi: initial commit Signed-off-by: Thomas Klaehn --- COPYING.MIT | 17 ++++ README | 64 +++++++++++++ Readme.md | 4 + buildconf/bblayers.conf.sample | 17 ++++ buildconf/conf-notes.txt | 8 ++ buildconf/local.conf.sample | 46 +++++++++ buildconf/rpi-init-build-env | 33 +++++++ conf/layer.conf | 14 +++ images/console-image.bb | 96 +++++++++++++++++++ .../wpa-supplicant/files/wpa_supplicant.conf | 17 ++++ .../wpa-supplicant_2.6.bbappend | 6 ++ .../base-files/base-files_3.0.14.bbappend | 2 + recipes-core/base-files/files/motd | 12 +++ .../init-ifupdown-1.0/files/interfaces | 22 +++++ .../init-ifupdown_1.0.bbappend | 2 + recipes-devtools/opkg/files/opkg.conf | 32 +++++++ recipes-devtools/opkg/opkg_0.%.bbappend | 2 + recipes-support/ntp/files/ntp.conf | 19 ++++ recipes-support/ntp/ntp_%.bbappend | 2 + tools/scripts/flash_bbb.sh | 40 ++++++++ tools/scripts/sync_ipk_up.sh | 9 ++ tools/scripts/sync_src_up.sh | 3 + 22 files changed, 467 insertions(+) create mode 100644 COPYING.MIT create mode 100644 README create mode 100644 Readme.md create mode 100644 buildconf/bblayers.conf.sample create mode 100644 buildconf/conf-notes.txt create mode 100644 buildconf/local.conf.sample create mode 100644 buildconf/rpi-init-build-env create mode 100644 conf/layer.conf create mode 100644 images/console-image.bb create mode 100644 recipes-connectivity/wpa-supplicant/files/wpa_supplicant.conf create mode 100644 recipes-connectivity/wpa-supplicant/wpa-supplicant_2.6.bbappend create mode 100644 recipes-core/base-files/base-files_3.0.14.bbappend create mode 100644 recipes-core/base-files/files/motd create mode 100644 recipes-core/init-ifupdown-1.0/files/interfaces create mode 100644 recipes-core/init-ifupdown-1.0/init-ifupdown_1.0.bbappend create mode 100644 recipes-devtools/opkg/files/opkg.conf create mode 100644 recipes-devtools/opkg/opkg_0.%.bbappend create mode 100644 recipes-support/ntp/files/ntp.conf create mode 100644 recipes-support/ntp/ntp_%.bbappend create mode 100755 tools/scripts/flash_bbb.sh create mode 100755 tools/scripts/sync_ipk_up.sh create mode 100755 tools/scripts/sync_src_up.sh diff --git a/COPYING.MIT b/COPYING.MIT new file mode 100644 index 0000000..89de354 --- /dev/null +++ b/COPYING.MIT @@ -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. diff --git a/README b/README new file mode 100644 index 0000000..b6a9ef8 --- /dev/null +++ b/README @@ -0,0 +1,64 @@ +This README file contains information on the contents of the +meta-bbb layer. + +Please see the corresponding sections below for details. + + +Dependencies +============ + +This layer depends on: + + URI: git://git.openembedded.org/bitbake + branch: master + + URI: git://git.openembedded.org/openembedded-core + layers: meta + branch: master + + URI: git://git.yoctoproject.org/xxxx + layers: xxxx + branch: master + + +Patches +======= + +Please submit any patches against the meta-bbb layer to the +xxxx mailing list (xxxx@zzzz.org) and cc: the maintainer: + +Maintainer: XXX YYYYYY + + +Table of Contents +================= + + I. Adding the meta-bbb layer to your build + II. Misc + + +I. Adding the meta-bbb layer to your build +================================================= + +--- replace with specific instructions for the meta-bbb layer --- + +In order to use this layer, you need to make the build system aware of +it. + +Assuming the meta-bbb layer exists at the top-level of your +yocto build tree, you can add it to the build system by adding the +location of the meta-bbb layer to bblayers.conf, along with any +other layers needed. e.g.: + + BBLAYERS ?= " \ + /path/to/yocto/meta \ + /path/to/yocto/meta-poky \ + /path/to/yocto/meta-yocto-bsp \ + /path/to/yocto/meta-meta-bbb \ + " + + +II. Misc +======== + +--- replace with specific information about the meta-bbb layer --- diff --git a/Readme.md b/Readme.md new file mode 100644 index 0000000..7a52023 --- /dev/null +++ b/Readme.md @@ -0,0 +1,4 @@ +# meta-bbb +Yocto meta layer to customize the beaglebone black yocto distribution. + + diff --git a/buildconf/bblayers.conf.sample b/buildconf/bblayers.conf.sample new file mode 100644 index 0000000..f8c3d6d --- /dev/null +++ b/buildconf/bblayers.conf.sample @@ -0,0 +1,17 @@ +# POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf +# changes incompatibly +POKY_BBLAYERS_CONF_VERSION = "2" + +BBPATH = "${TOPDIR}" +BBFILES ?= "" + +BBLAYERS ?= " \ + ${TOPDIR}/../layers/poky/meta \ + ${TOPDIR}/../layers/poky/meta-poky \ + ${TOPDIR}/../layers/poky/meta-yocto-bsp \ + ${TOPDIR}/../layers/meta-openembedded/meta-oe \ + ${TOPDIR}/../layers/meta-openembedded/meta-networking \ + ${TOPDIR}/../layers/meta-openembedded/meta-python \ + ${TOPDIR}/../layers/meta-raspberrypi \ + ${TOPDIR}/../layers/meta-rpi \ + " diff --git a/buildconf/conf-notes.txt b/buildconf/conf-notes.txt new file mode 100644 index 0000000..36009da --- /dev/null +++ b/buildconf/conf-notes.txt @@ -0,0 +1,8 @@ +Common targets are: + console-image + core-image-minimal + core-image-sato + meta-toolchain + adt-installer + meta-ide-support + diff --git a/buildconf/local.conf.sample b/buildconf/local.conf.sample new file mode 100644 index 0000000..3c19645 --- /dev/null +++ b/buildconf/local.conf.sample @@ -0,0 +1,46 @@ +MACHINE ?= "raspberrypi3-64" + +#DL_DIR ?= "${TOPDIR}/../../downloads" +#SSTATE_DIR ?= "${TOPDIR}/../../sstate-cache" +#TMPDIR = "${TOPDIR}/tmp" + +DISTRO ?= "poky" +PACKAGE_CLASSES ?= "package_ipk" + +#SDKMACHINE ?= "i686" + +#EXTRA_IMAGE_FEATURES ?= "debug-tweaks" + +USER_CLASSES ?= "buildstats image-mklibs image-prelink" + +#IMAGE_BOOT_FILES_append = " uEnv.txt" + +PATCHRESOLVE = "noop" + +BB_DISKMON_DIRS = "\ + STOPTASKS,${TMPDIR},1G,100K \ + STOPTASKS,${DL_DIR},1G,100K \ + STOPTASKS,${SSTATE_DIR},1G,100K \ + STOPTASKS,/tmp,100M,100K \ + ABORT,${TMPDIR},100M,1K \ + ABORT,${DL_DIR},100M,1K \ + ABORT,${SSTATE_DIR},100M,1K \ + ABORT,/tmp,10M,1K" + +#SSTATE_MIRRORS ?= "\ +#file://.* http://someserver.tld/share/sstate/PATH;downloadfilename=PATH \n \ +#file://.* file:///some/local/dir/sstate/PATH" + +CONF_VERSION = "1" + +INHERIT += "rm_work" + +#INHERIT += "icecc" +#ICECC_PATH = "/usr/bin/icecc" +#ICECC_PARALLEL_MAKE = "-j 20" + +INHERIT += "own-mirrors" +SOURCE_MIRROR_URL = "https://files.blackfinn.de/mirror/sources" +BB_GENERATE_MIRROR_TARBALLS = "1" + +export BB_ENV_EXTRAWHITE="$BB_ENV_EXTRAWHITE DL_DIR" diff --git a/buildconf/rpi-init-build-env b/buildconf/rpi-init-build-env new file mode 100644 index 0000000..79eec68 --- /dev/null +++ b/buildconf/rpi-init-build-env @@ -0,0 +1,33 @@ +# Defaults +OPT_M=raspberrypi3-64 +BUILD_DIR=build + +# +# MAIN +# +OPTIND=1 +shift $((OPTIND-1)) +for NOPTARG in $*; do + BUILD_DIR="$NOPTARG" +done + +export TEMPLATECONF="../meta-rpi/buildconf" + +export MACHINE=$OPT_M +rm -f build/conf/bblayers.conf \ + build/conf/templateconf.cfg + +mkdir -p $BUILD_DIR + +if [ ! -h $BUILD_DIR/sync_ipk_up.sh ]; then + ln -s ../layers/meta-rpi/tools/scripts/sync_ipk_up.sh $BUILD_DIR/sync_ipk_up.sh +fi + +if [ ! -h $BUILD_DIR/sync_src_up.sh ]; then + ln -s ../layers/meta-rpi/tools/scripts/sync_src_up.sh $BUILD_DIR/sync_src_up.sh +fi + +source layers/poky/oe-init-build-env $BUILD_DIR + +return 0 + diff --git a/conf/layer.conf b/conf/layer.conf new file mode 100644 index 0000000..6cbb366 --- /dev/null +++ b/conf/layer.conf @@ -0,0 +1,14 @@ +# We have a conf and classes directory, add to BBPATH +BBPATH .= ":${LAYERDIR}" + +# We have recipes-* directories, add to BBFILES +BBFILES += " \ + ${LAYERDIR}/recipes-*/*/*.bb \ + ${LAYERDIR}/images/*.bb \ + ${LAYERDIR}/recipes-*/*/*.bbappend \ +" + +BBFILE_COLLECTIONS += "meta-rpi" +BBFILE_PATTERN_meta-rpi = "^${LAYERDIR}/" +BBFILE_PRIORITY_meta-rpi = "7" + diff --git a/images/console-image.bb b/images/console-image.bb new file mode 100644 index 0000000..6027480 --- /dev/null +++ b/images/console-image.bb @@ -0,0 +1,96 @@ +SUMMARY = "A console image with some additional tools" +HOMEPAGE = "https://blackfinn.de" +LICENSE = "MIT" + +inherit core-image extrausers + +IMAGE_FEATURES += "package-management" + +# Encrypt the password with: echo "" | openssl passwd -1 -stdin +EXTRA_USERS_PARAMS = " \ + usermod -p '\$1\$4h5Qdc3i\$Vke4J2Ci5z.D3TtFDmV9r/' root; \ + useradd -p '\$1\$4h5Qdc3i\$Vke4J2Ci5z.D3TtFDmV9r/' tkl; \ +" + +CORE_OS = " \ + openssh \ + openssh-keygen \ + openssh-sftp-server \ + psplash \ + tzdata \ +" + +KERNEL_EXTRA_INSTALL = " \ + kernel-modules \ + " + +WIFI_SUPPORT = " \ + iw \ + linux-firmware-rtl8192cu \ + wireless-tools \ + wpa-supplicant \ + " + +DEV_SDK_INSTALL = " \ + file \ + git \ + make \ + perl-modules \ + pkgconfig \ + python-modules \ + " + +EXTRA_TOOLS_INSTALL = " \ + acpid \ + bc \ + bzip2 \ + dosfstools \ + e2fsprogs-mke2fs \ + ethtool \ + findutils \ + htop \ + i2c-tools \ + less \ + mc \ + procps \ + rsync \ + sysfsutils \ + unzip \ + util-linux \ + util-linux-blkid \ + vim \ + wget \ + curl \ + zip \ + ntp \ + " + +MQTT = " \ + python-paho-mqtt \ +" + + +IMAGE_INSTALL += " \ + ${CORE_OS} \ + ${DEV_SDK_INSTALL} \ + ${EXTRA_TOOLS_INSTALL} \ + ${KERNEL_EXTRA_INSTALL} \ + ${WIFI_SUPPORT} \ + ${MQTT} \ +" + +set_local_timezone() { + ln -sf /usr/share/zoneinfo/Etc/UTC ${IMAGE_ROOTFS}/etc/localtime +} + +disable_bootlogd() { + echo BOOTLOGD_ENABLE=no > ${IMAGE_ROOTFS}/etc/default/bootlogd +} + +ROOTFS_POSTPROCESS_COMMAND += " \ + set_local_timezone ; \ + disable_bootlogd ; \ + " + +export IMAGE_BASENAME = "console-image" + diff --git a/recipes-connectivity/wpa-supplicant/files/wpa_supplicant.conf b/recipes-connectivity/wpa-supplicant/files/wpa_supplicant.conf new file mode 100644 index 0000000..671c8a1 --- /dev/null +++ b/recipes-connectivity/wpa-supplicant/files/wpa_supplicant.conf @@ -0,0 +1,17 @@ +#create encrypted passphrase with: wpa_passphrase '' '' +country=DE +ctrl_interface=DIR=/var/run/wpa_supplicant +update_config=1 +network={ + ssid="FRITZ!Box 7330_EXT" + psk=6bee2296d336ab07a1aca9f210be55095896e740225d920c0d7f15906dc35846 + id_str="home_outdoor" + priority=1 +} +network={ + ssid="FRITZ!Box 7330" + psk=44df1640e42b8f4e4b424a39af700c817bc2b89f13c324d29c10bf7ba3028258 + id_str="home_indoor" + priority=2 +} + diff --git a/recipes-connectivity/wpa-supplicant/wpa-supplicant_2.6.bbappend b/recipes-connectivity/wpa-supplicant/wpa-supplicant_2.6.bbappend new file mode 100644 index 0000000..70bc231 --- /dev/null +++ b/recipes-connectivity/wpa-supplicant/wpa-supplicant_2.6.bbappend @@ -0,0 +1,6 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" + +do_install_append () { + install -m 0644 ${WORKDIR}/wpa_supplicant.conf ${D}${sysconfdir}/wpa_supplicant.conf +} + diff --git a/recipes-core/base-files/base-files_3.0.14.bbappend b/recipes-core/base-files/base-files_3.0.14.bbappend new file mode 100644 index 0000000..869d60a --- /dev/null +++ b/recipes-core/base-files/base-files_3.0.14.bbappend @@ -0,0 +1,2 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" + diff --git a/recipes-core/base-files/files/motd b/recipes-core/base-files/files/motd new file mode 100644 index 0000000..090ade3 --- /dev/null +++ b/recipes-core/base-files/files/motd @@ -0,0 +1,12 @@ + + +______ _ ______ _ +| ___ \ | | | ___ (_) +| |_/ /__ _ ___ _ __ | |__ ___ _ __ _ __ _ _| |_/ /_ +| // _` / __| '_ \| '_ \ / _ \ '__| '__| | | | __/| | +| |\ \ (_| \__ \ |_) | |_) | __/ | | | | |_| | | | | +\_| \_\__,_|___/ .__/|_.__/ \___|_| |_| \__, \_| |_| + | | __/ | + |_| |___/ + + diff --git a/recipes-core/init-ifupdown-1.0/files/interfaces b/recipes-core/init-ifupdown-1.0/files/interfaces new file mode 100644 index 0000000..c3608b2 --- /dev/null +++ b/recipes-core/init-ifupdown-1.0/files/interfaces @@ -0,0 +1,22 @@ +# The loopback interface +auto lo +iface lo inet loopback + +# Wireless interface +allow-hotplug wlan0 +auto wlan0 +iface wlan0 inet dhcp + wireless_mode managed + wireless_essid any + wpa-driver nl80211 + wpa-conf /etc/wpa_supplicant.conf +wireless-power off + + +# Wired interface +auto eth0 +iface eth0 inet dhcp + +# Bluetooth networking +iface bnep0 inet dhcp + diff --git a/recipes-core/init-ifupdown-1.0/init-ifupdown_1.0.bbappend b/recipes-core/init-ifupdown-1.0/init-ifupdown_1.0.bbappend new file mode 100644 index 0000000..869d60a --- /dev/null +++ b/recipes-core/init-ifupdown-1.0/init-ifupdown_1.0.bbappend @@ -0,0 +1,2 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" + diff --git a/recipes-devtools/opkg/files/opkg.conf b/recipes-devtools/opkg/files/opkg.conf new file mode 100644 index 0000000..2172529 --- /dev/null +++ b/recipes-devtools/opkg/files/opkg.conf @@ -0,0 +1,32 @@ +# Must have one or more source entries of the form: +# +# src +# +# and one or more destination entries of the form: +# +# dest +# +# where and are identifiers that +# should match [a-zA-Z0-9._-]+, should be a +# URL that points to a directory containing a Familiar +# Packages file, and should be a directory +# that exists on the target system. + +# Proxy Support +#option http_proxy http://proxy.tld:3128 +#option ftp_proxy http://proxy.tld:3128 +#option proxy_username +#option proxy_password + +# Enable GPGME signature +# option check_signature 1 + +# Offline mode (for use in constructing flash images offline) +#option offline_root target + +src/gz all https://opkg.blackfinn.de/sumo/all +src/gz beaglebone https://opkg.blackfinn.de/sumo/raspberrypi3_64 +src/gz cortexa8hf-neon https://opkg.blackfinn.de/sumo/aarch64 + +# Default destination for installed packages +dest root / diff --git a/recipes-devtools/opkg/opkg_0.%.bbappend b/recipes-devtools/opkg/opkg_0.%.bbappend new file mode 100644 index 0000000..869d60a --- /dev/null +++ b/recipes-devtools/opkg/opkg_0.%.bbappend @@ -0,0 +1,2 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" + diff --git a/recipes-support/ntp/files/ntp.conf b/recipes-support/ntp/files/ntp.conf new file mode 100644 index 0000000..6efc6de --- /dev/null +++ b/recipes-support/ntp/files/ntp.conf @@ -0,0 +1,19 @@ +# This is the most basic ntp configuration file +# The driftfile must remain in a place specific to this +# machine - it records the machine specific clock error +driftfile /var/lib/ntp/drift +# This should be a server that is close (in IP terms) +# to the machine. Add other servers as required. +# Unless you un-comment the line below ntpd will sync +# only against the local system clock. +# +# server time.server.example.com +server 192.168.178.1 +# +# Using local hardware clock as fallback +# Disable this when using ntpd -q -g -x as ntpdate or it will sync to itself +server 127.127.1.0 +fudge 127.127.1.0 stratum 14 +# Defining a default security setting +restrict default + diff --git a/recipes-support/ntp/ntp_%.bbappend b/recipes-support/ntp/ntp_%.bbappend new file mode 100644 index 0000000..869d60a --- /dev/null +++ b/recipes-support/ntp/ntp_%.bbappend @@ -0,0 +1,2 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" + diff --git a/tools/scripts/flash_bbb.sh b/tools/scripts/flash_bbb.sh new file mode 100755 index 0000000..932fa94 --- /dev/null +++ b/tools/scripts/flash_bbb.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +# Remove old partitions on emmc. +dd if=/dev/zero of=/dev/mmcblk1 bs=512 count=1 + +# Create new partition table. +echo "n +p +1 + ++70M +a +t +c +n +p + + + +w" | fdisk /dev/mmcblk1 + +# Create file systems. +mkfs.vfat -F 32 -n "boot" /dev/mmcblk1p1 +yes | mkfs.ext4 -L "rootfs" /dev/mmcblk1p2 + + +# Flash boot partition. +mount /dev/mmcblk1p1 /media +cp MLO /media +cp u-boot.img /media +cp uExt.txt /media +sync +umount /dev/mmcblk1p1 + +# Flash rootfs partition +mount /dev/mmcblk1p2 /media +tar -C /media -xf rootfs.tar.bz2 +sync +umount /dev/mmcblk1p2 + diff --git a/tools/scripts/sync_ipk_up.sh b/tools/scripts/sync_ipk_up.sh new file mode 100755 index 0000000..0ea03aa --- /dev/null +++ b/tools/scripts/sync_ipk_up.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +if [ -n "$1" ]; then + rsync -avz -e "ssh -o StrictHostKeyChecking=no" --progress tmp/deploy/ipk/ tkl@e320:/srv/ipk/$1 +else + echo "Which branch?" + exit -1 +fi + diff --git a/tools/scripts/sync_src_up.sh b/tools/scripts/sync_src_up.sh new file mode 100755 index 0000000..9710d5b --- /dev/null +++ b/tools/scripts/sync_src_up.sh @@ -0,0 +1,3 @@ +#!/bin/bash +rsync -avz -e "ssh -o StrictHostKeyChecking=no" --progress downloads/ tkl@e320:/srv/files/mirror/sources +