meta-rpi: initial commit

Signed-off-by: Thomas Klaehn <tkl@blackfinn.de>
This commit is contained in:
Thomas Klaehn 2017-06-13 14:55:28 +02:00 committed by Thomas Klaehn
commit c6a9a1632d
22 changed files with 484 additions and 0 deletions

17
COPYING.MIT Normal file
View File

@ -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.

64
README Normal file
View File

@ -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 <xxx.yyyyyy@zzzzz.com>
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 ---

4
Readme.md Normal file
View File

@ -0,0 +1,4 @@
# meta-bbb
Yocto meta layer to customize the beaglebone black yocto distribution.

View File

@ -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 \
"

8
buildconf/conf-notes.txt Normal file
View File

@ -0,0 +1,8 @@
Common targets are:
console-image
core-image-minimal
core-image-sato
meta-toolchain
adt-installer
meta-ide-support

View File

@ -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"

View File

@ -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

14
conf/layer.conf Normal file
View File

@ -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"

103
images/console-image.bb Normal file
View File

@ -0,0 +1,103 @@
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 "<password>" | 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 \
"
PYTHON_LIBS = " \
pypio \
pywm \
ultrasonic-distance \
"
IMAGE_INSTALL += " \
${CORE_OS} \
${DEV_SDK_INSTALL} \
${EXTRA_TOOLS_INSTALL} \
${KERNEL_EXTRA_INSTALL} \
${WIFI_SUPPORT} \
${MQTT} \
${PYTHON_LIBS} \
vl53l0x-api \
"
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"

View File

@ -0,0 +1,17 @@
#create encrypted passphrase with: wpa_passphrase '<ssid>' '<decrypted_key>'
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
}

View File

@ -0,0 +1,6 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
do_install_append () {
install -m 0644 ${WORKDIR}/wpa_supplicant.conf ${D}${sysconfdir}/wpa_supplicant.conf
}

View File

@ -0,0 +1,2 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"

View File

@ -0,0 +1,12 @@
______ _ ______ _
| ___ \ | | | ___ (_)
| |_/ /__ _ ___ _ __ | |__ ___ _ __ _ __ _ _| |_/ /_
| // _` / __| '_ \| '_ \ / _ \ '__| '__| | | | __/| |
| |\ \ (_| \__ \ |_) | |_) | __/ | | | | |_| | | | |
\_| \_\__,_|___/ .__/|_.__/ \___|_| |_| \__, \_| |_|
| | __/ |
|_| |___/

View File

@ -0,0 +1,32 @@
# The loopback interface
auto lo
iface lo inet loopback
# Wireless interfaces
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
#iface atml0 inet dhcp
# Wired or wireless interfaces
auto eth0
iface eth0 inet dhcp
iface eth1 inet dhcp
# Ethernet/RNDIS gadget (g_ether)
# ... or on host side, usbnet and random hwaddr
iface usb0 inet static
address 192.168.7.2
netmask 255.255.255.0
network 192.168.7.0
gateway 192.168.7.1
# Bluetooth networking
iface bnep0 inet dhcp

View File

@ -0,0 +1,2 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"

View File

@ -0,0 +1,32 @@
# Must have one or more source entries of the form:
#
# src <src-name> <source-url>
#
# and one or more destination entries of the form:
#
# dest <dest-name> <target-path>
#
# where <src-name> and <dest-names> are identifiers that
# should match [a-zA-Z0-9._-]+, <source-url> should be a
# URL that points to a directory containing a Familiar
# Packages file, and <target-path> 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 <username>
#option proxy_password <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/rocko/all
src/gz beaglebone https://opkg.blackfinn.de/rocko/beaglebone
src/gz cortexa8hf-neon https://opkg.blackfinn.de/rocko/cortexa8hf-neon
# Default destination for installed packages
dest root /

View File

@ -0,0 +1,2 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"

View File

@ -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

View File

@ -0,0 +1,2 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"

40
tools/scripts/flash_bbb.sh Executable file
View File

@ -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

9
tools/scripts/sync_ipk_up.sh Executable file
View File

@ -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

3
tools/scripts/sync_src_up.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
rsync -avz -e "ssh -o StrictHostKeyChecking=no" --progress downloads/ tkl@e320:/srv/files/mirror/sources