From f655d5f14b2716262c99a0396c01f46619ae893e Mon Sep 17 00:00:00 2001 From: Thomas Klaehn Date: Mon, 20 Jan 2020 15:09:26 +0100 Subject: [PATCH 1/4] Add docker-image in order to launch a base system capable of running docker daemon --- buildconf/bananapi-m3/conf-notes.txt | 1 + buildconf/bananapi-m3/local.conf.sample | 2 +- .../beaglebone-yocto/bblayers.conf.sample | 5 +- buildconf/beaglebone-yocto/conf-notes.txt | 2 + buildconf/beaglebone-yocto/local.conf.sample | 2 +- buildconf/raspberrypi3-64/conf-notes.txt | 1 + buildconf/raspberrypi3-64/local.conf.sample | 2 +- conf/distro/roro.conf | 18 +++ conf/distro/tkl.conf | 15 -- .../docker/docker-ce_git.bbappend | 7 + recipes-containers/docker/files/docker.init | 131 ++++++++++++++++++ recipes-core/images/docker-image.bb | 10 ++ recipes-core/images/tiny-image-base.inc | 48 +++++++ recipes-core/images/tiny-image.bb | 8 ++ recipes-core/images/users.inc | 8 ++ .../files/beaglebone-yocto/enable_cgroups.cfg | 4 + recipes-kernel/linux/linux-yocto_5.2.bbappend | 1 + 17 files changed, 246 insertions(+), 19 deletions(-) create mode 100644 conf/distro/roro.conf delete mode 100644 conf/distro/tkl.conf create mode 100644 recipes-containers/docker/docker-ce_git.bbappend create mode 100644 recipes-containers/docker/files/docker.init create mode 100644 recipes-core/images/docker-image.bb create mode 100644 recipes-core/images/tiny-image-base.inc create mode 100644 recipes-core/images/tiny-image.bb create mode 100644 recipes-core/images/users.inc create mode 100644 recipes-kernel/linux/files/beaglebone-yocto/enable_cgroups.cfg diff --git a/buildconf/bananapi-m3/conf-notes.txt b/buildconf/bananapi-m3/conf-notes.txt index 5759f0d..df80596 100644 --- a/buildconf/bananapi-m3/conf-notes.txt +++ b/buildconf/bananapi-m3/conf-notes.txt @@ -1,6 +1,7 @@ Common targets are: console-image console-dev-image + tiny-image core-image-minimal core-image-sato meta-toolchain diff --git a/buildconf/bananapi-m3/local.conf.sample b/buildconf/bananapi-m3/local.conf.sample index f73d44b..ce418bd 100644 --- a/buildconf/bananapi-m3/local.conf.sample +++ b/buildconf/bananapi-m3/local.conf.sample @@ -4,7 +4,7 @@ MACHINE ?= "bananapi-m3" #SSTATE_DIR ?= "${TOPDIR}/../../sstate-cache" #TMPDIR = "${TOPDIR}/tmp" -DISTRO ?= "poky" +DISTRO ?= "roro" PACKAGE_CLASSES ?= "package_ipk" #SDKMACHINE ?= "i686" diff --git a/buildconf/beaglebone-yocto/bblayers.conf.sample b/buildconf/beaglebone-yocto/bblayers.conf.sample index 2604ba7..5574c58 100644 --- a/buildconf/beaglebone-yocto/bblayers.conf.sample +++ b/buildconf/beaglebone-yocto/bblayers.conf.sample @@ -1,6 +1,6 @@ # POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf # changes incompatibly -POKY_BBLAYERS_CONF_VERSION = "2" +POKY_BBLAYERS_CONF_VERSION = "3" BBPATH = "${TOPDIR}" BBFILES ?= "" @@ -9,8 +9,11 @@ BBLAYERS ?= " \ ${TOPDIR}/../layers/poky/meta \ ${TOPDIR}/../layers/poky/meta-poky \ ${TOPDIR}/../layers/poky/meta-yocto-bsp \ + ${TOPDIR}/../layers/meta-openembedded/meta-filesystems \ ${TOPDIR}/../layers/meta-openembedded/meta-oe \ ${TOPDIR}/../layers/meta-openembedded/meta-networking \ ${TOPDIR}/../layers/meta-openembedded/meta-python \ + ${TOPDIR}/../layers/meta-virtualization \ ${TOPDIR}/../layers/meta-blackfinn \ " + diff --git a/buildconf/beaglebone-yocto/conf-notes.txt b/buildconf/beaglebone-yocto/conf-notes.txt index 5759f0d..c24917c 100644 --- a/buildconf/beaglebone-yocto/conf-notes.txt +++ b/buildconf/beaglebone-yocto/conf-notes.txt @@ -1,6 +1,8 @@ Common targets are: console-image console-dev-image + docker-image + tiny-image core-image-minimal core-image-sato meta-toolchain diff --git a/buildconf/beaglebone-yocto/local.conf.sample b/buildconf/beaglebone-yocto/local.conf.sample index b7fd35e..229fe51 100644 --- a/buildconf/beaglebone-yocto/local.conf.sample +++ b/buildconf/beaglebone-yocto/local.conf.sample @@ -4,7 +4,7 @@ MACHINE ?= "beaglebone-yocto" #SSTATE_DIR ?= "${TOPDIR}/../../sstate-cache" #TMPDIR = "${TOPDIR}/tmp" -DISTRO ?= "poky" +DISTRO ?= "roro" PACKAGE_CLASSES ?= "package_ipk" #SDKMACHINE ?= "i686" diff --git a/buildconf/raspberrypi3-64/conf-notes.txt b/buildconf/raspberrypi3-64/conf-notes.txt index 5759f0d..df80596 100644 --- a/buildconf/raspberrypi3-64/conf-notes.txt +++ b/buildconf/raspberrypi3-64/conf-notes.txt @@ -1,6 +1,7 @@ Common targets are: console-image console-dev-image + tiny-image core-image-minimal core-image-sato meta-toolchain diff --git a/buildconf/raspberrypi3-64/local.conf.sample b/buildconf/raspberrypi3-64/local.conf.sample index e3407a1..f0e4959 100644 --- a/buildconf/raspberrypi3-64/local.conf.sample +++ b/buildconf/raspberrypi3-64/local.conf.sample @@ -1,6 +1,6 @@ MACHINE ?= "raspberrypi3-64" -DISTRO ?= "poky" +DISTRO ?= "roro" PACKAGE_CLASSES ?= "package_ipk" #SDKMACHINE ?= "i686" diff --git a/conf/distro/roro.conf b/conf/distro/roro.conf new file mode 100644 index 0000000..da50503 --- /dev/null +++ b/conf/distro/roro.conf @@ -0,0 +1,18 @@ +require conf/distro/poky.conf +# distro name +DISTRO = "roro" +DISTRO_NAME = "roro distribution" +DISTRO_VERSION = "1.0" +DISTRO_CODENAME = "roro" +#DISTRO_FEATURES_append = " alsa usbhost usbgadget keyboard bluetooth" + +POKY_DEFAULT_DISTRO_FEATURES = "largefile" +POKY_DEFAULT_EXTRA_RDEPENDS = "packagegroup-core-boot" +POKY_DEFAULT_EXTRA_RRECOMMENDS = "kernel-module-af-packet" +DISTRO_FEATURES_DEFAULT = "ipv4 ipv6 largefile usbhost wifi zeroconf virtualization" + +SDK_VENDOR = "-rorodistsdk" +SDK_VERSION := "${@'${DISTRO_VERSION}'.replace('snapshot-${DATE}','snapshot')}" +MAINTAINER = "rorodist " +INHERIT += "buildhistory" +BUILDHISTORY_COMMIT = "1" diff --git a/conf/distro/tkl.conf b/conf/distro/tkl.conf deleted file mode 100644 index 960e2df..0000000 --- a/conf/distro/tkl.conf +++ /dev/null @@ -1,15 +0,0 @@ -require conf/distro/poky.conf -# distro name -DISTRO = "tkl" -DISTRO_NAME = "tkl distribution" -DISTRO_VERSION = "1.0" -DISTRO_CODENAME = "tkl" -#DISTRO_FEATURES_append = " alsa usbhost usbgadget keyboard bluetooth" - -PREFERRED_VERSION_mypy = "0.4.2" - -SDK_VENDOR = "-tkldistsdk" -SDK_VERSION := "${@'${DISTRO_VERSION}'.replace('snapshot-${DATE}','snapshot')}" -MAINTAINER = "tkldist " -INHERIT += "buildhistory" -BUILDHISTORY_COMMIT = "1" diff --git a/recipes-containers/docker/docker-ce_git.bbappend b/recipes-containers/docker/docker-ce_git.bbappend new file mode 100644 index 0000000..89cf576 --- /dev/null +++ b/recipes-containers/docker/docker-ce_git.bbappend @@ -0,0 +1,7 @@ +LICENSE = "GPLv2" +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" + +SRC_URI += " \ + file://docker.init \ +" + diff --git a/recipes-containers/docker/files/docker.init b/recipes-containers/docker/files/docker.init new file mode 100644 index 0000000..d4b6a88 --- /dev/null +++ b/recipes-containers/docker/files/docker.init @@ -0,0 +1,131 @@ +#!/bin/sh +# +# /etc/rc.d/init.d/docker +# +# Daemon for docker.com +# +# chkconfig: 2345 95 95 +# description: Daemon for docker.com + +### BEGIN INIT INFO +# Provides: docker +# Required-Start: $network cgconfig +# Required-Stop: +# Should-Start: +# Should-Stop: +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: start and stop docker +# Description: Daemon for docker.com +### END INIT INFO + +# Source function library. +. /etc/init.d/functions + +prog="dockerd" +unshare=/usr/bin/unshare +exec="/usr/bin/$prog" +pidfile="/var/run/$prog.pid" +lockfile="/var/lock/subsys/$prog" +logfile="/var/log/$prog" +other_args="--pidfile $pidfile --registry-mirror=http://localhost:5000 --insecure-registry=http://localhost:5000 --raw-logs" + +[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog + +start() { + [ -x $exec ] || exit 5 + + check_for_cleanup + + if ! [ -f $pidfile ]; then + printf "Starting $prog:\t" + echo -e "\n$(date)\n" >> $logfile + "$unshare" -m -- $exec $other_args & >> $logfile & + pid=$! + touch $lockfile + # wait up to 10 seconds for the pidfile to exist. see + # https://github.com/docker/docker/issues/5359 + tries=0 + while [ ! -f $pidfile -a $tries -lt 10 ]; do + sleep 1 + tries=$((tries + 1)) + done + success + echo + else + failure + echo + printf "$pidfile still exists...\n" + exit 7 + fi +} + +stop() { + echo -n $"Stopping $prog: " + killproc $prog + retval=$? + echo + [ $retval -eq 0 ] && rm -f $lockfile + return $retval +} + +restart() { + stop + start +} + +reload() { + restart +} + +force_reload() { + restart +} + +rh_status() { + status $prog +} + +rh_status_q() { + rh_status >/dev/null 2>&1 +} + + +check_for_cleanup() { + if [ -f ${pidfile} ]; then + /bin/ps -fp $(cat ${pidfile}) > /dev/null || rm ${pidfile} + fi +} + +case "$1" in + start) + rh_status_q && exit 0 + $1 + ;; + stop) + rh_status_q || exit 0 + $1 + ;; + restart) + $1 + ;; + reload) + rh_status_q || exit 7 + $1 + ;; + force-reload) + force_reload + ;; + status) + rh_status + ;; + condrestart|try-restart) + rh_status_q || exit 0 + restart + ;; + *) + echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" + exit 2 +esac + +exit $? diff --git a/recipes-core/images/docker-image.bb b/recipes-core/images/docker-image.bb new file mode 100644 index 0000000..5386270 --- /dev/null +++ b/recipes-core/images/docker-image.bb @@ -0,0 +1,10 @@ +SUMMARY = "A tiny image" +HOMEPAGE = "https://blackfinn.de" +LICENSE = "MIT" + +require tiny-image-base.inc + +IMAGE_INSTALL_append = " docker" + +export IMAGE_BASENAME = "tiny-image" + diff --git a/recipes-core/images/tiny-image-base.inc b/recipes-core/images/tiny-image-base.inc new file mode 100644 index 0000000..16786b0 --- /dev/null +++ b/recipes-core/images/tiny-image-base.inc @@ -0,0 +1,48 @@ +inherit core-image + +require users.inc + +IMAGE_FEATURES += "package-management" + +CORE_OS = " \ + openssh \ + openssh-keygen \ + openssh-sftp-server \ + psplash \ + tzdata \ +" + +KERNEL_EXTRA_INSTALL = " \ + kernel-modules \ +" + +WIFI_SUPPORT = " \ + wpa-supplicant \ +" + +EXTRA_TOOLS_INSTALL = " \ +" + +IMAGE_INSTALL += " \ + ${CORE_OS} \ + ${EXTRA_TOOLS_INSTALL} \ + ${KERNEL_EXTRA_INSTALL} \ + ${WIFI_SUPPORT} \ +" + +IMAGE_INSTALL_append_beaglebone-yocto = " linux-firmware-rtl8192cu" +IMAGE_INSTALL_append_bananapi-m3 += " linux-firmware-bcm43430" + +set_local_timezone() { + ln -sf /usr/share/zoneinfo/Europe/Berlin ${IMAGE_ROOTFS}/etc/localtime +} + +disable_bootlogd() { + echo BOOTLOGD_ENABLE=no > ${IMAGE_ROOTFS}/etc/default/bootlogd +} + +ROOTFS_POSTPROCESS_COMMAND += " \ + set_local_timezone ; \ + disable_bootlogd ; \ + " + diff --git a/recipes-core/images/tiny-image.bb b/recipes-core/images/tiny-image.bb new file mode 100644 index 0000000..364e5eb --- /dev/null +++ b/recipes-core/images/tiny-image.bb @@ -0,0 +1,8 @@ +SUMMARY = "A tiny image" +HOMEPAGE = "https://blackfinn.de" +LICENSE = "MIT" + +require tiny-image-base.inc + +export IMAGE_BASENAME = "tiny-image" + diff --git a/recipes-core/images/users.inc b/recipes-core/images/users.inc new file mode 100644 index 0000000..0894f1b --- /dev/null +++ b/recipes-core/images/users.inc @@ -0,0 +1,8 @@ +inherit extrausers + +# 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; \ +" + diff --git a/recipes-kernel/linux/files/beaglebone-yocto/enable_cgroups.cfg b/recipes-kernel/linux/files/beaglebone-yocto/enable_cgroups.cfg new file mode 100644 index 0000000..663ab12 --- /dev/null +++ b/recipes-kernel/linux/files/beaglebone-yocto/enable_cgroups.cfg @@ -0,0 +1,4 @@ +CONFIG_DEBUG_BLK_CGROUP=y +CONFIG_CFS_BANDWIDTH=y +CONFIG_CGROUP_RDMA=y + diff --git a/recipes-kernel/linux/linux-yocto_5.2.bbappend b/recipes-kernel/linux/linux-yocto_5.2.bbappend index 1af34f6..dae764d 100644 --- a/recipes-kernel/linux/linux-yocto_5.2.bbappend +++ b/recipes-kernel/linux/linux-yocto_5.2.bbappend @@ -14,5 +14,6 @@ KERNEL_CONFIG_FRAGMENTS_append_ti33x = " \ ${WORKDIR}/rtl8192cu.cfg \ ${WORKDIR}/enable_onboard_leds.cfg \ ${WORKDIR}/enable_hostap_wext.cfg \ + ${WORKDIR}/enable_cgroups.cfg \ " From 2ea40c1e8aea2a92670adf95cd8a7fd4c105e57d Mon Sep 17 00:00:00 2001 From: Thomas Klaehn Date: Thu, 23 Jan 2020 18:58:15 +0100 Subject: [PATCH 2/4] docker image for rpi3_64 --- .../raspberrypi3-64/bblayers.conf.sample | 4 ++- buildconf/raspberrypi3-64/conf-notes.txt | 1 + buildconf/raspberrypi3-64/local.conf.sample | 4 +++ conf/distro/roro.conf | 30 +++++++++++++++++-- .../docker/docker-ce_git.bbappend | 11 +++++++ .../docker/files/S49cgroups_mount.sh | 12 ++++++++ recipes-core/busybox/busybox_%.bbappend | 19 ++++++++++++ recipes-core/busybox/files/S20load_modules.sh | 26 ++++++++++++++++ recipes-core/busybox/files/fragments.cfg | 5 ++++ recipes-core/busybox/files/ntp.conf | 5 ++++ recipes-core/busybox/files/ntpd | 12 ++++++++ recipes-core/images/docker-image.bb | 4 +-- recipes-core/images/tiny-image-base.inc | 1 + .../init-ifupdown_1.0.bbappend | 6 ++++ .../linux-firmware/linux-firmware_%.bbappend | 10 +++++++ .../linux/linux-raspberrypi_%.bbappend | 2 ++ 16 files changed, 147 insertions(+), 5 deletions(-) create mode 100644 recipes-containers/docker/files/S49cgroups_mount.sh create mode 100644 recipes-core/busybox/busybox_%.bbappend create mode 100644 recipes-core/busybox/files/S20load_modules.sh create mode 100644 recipes-core/busybox/files/fragments.cfg create mode 100644 recipes-core/busybox/files/ntp.conf create mode 100644 recipes-core/busybox/files/ntpd create mode 100644 recipes-kernel/linux-firmware/linux-firmware_%.bbappend create mode 100644 recipes-kernel/linux/linux-raspberrypi_%.bbappend diff --git a/buildconf/raspberrypi3-64/bblayers.conf.sample b/buildconf/raspberrypi3-64/bblayers.conf.sample index dba7e85..8c65ece 100644 --- a/buildconf/raspberrypi3-64/bblayers.conf.sample +++ b/buildconf/raspberrypi3-64/bblayers.conf.sample @@ -1,6 +1,6 @@ # POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf # changes incompatibly -POKY_BBLAYERS_CONF_VERSION = "2" +POKY_BBLAYERS_CONF_VERSION = "3" BBPATH = "${TOPDIR}" BBFILES ?= "" @@ -9,9 +9,11 @@ BBLAYERS ?= " \ ${TOPDIR}/../layers/poky/meta \ ${TOPDIR}/../layers/poky/meta-poky \ ${TOPDIR}/../layers/poky/meta-yocto-bsp \ + ${TOPDIR}/../layers/meta-openembedded/meta-filesystems \ ${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-virtualization \ ${TOPDIR}/../layers/meta-blackfinn \ " diff --git a/buildconf/raspberrypi3-64/conf-notes.txt b/buildconf/raspberrypi3-64/conf-notes.txt index df80596..48af6bd 100644 --- a/buildconf/raspberrypi3-64/conf-notes.txt +++ b/buildconf/raspberrypi3-64/conf-notes.txt @@ -2,6 +2,7 @@ Common targets are: console-image console-dev-image tiny-image + docker-image core-image-minimal core-image-sato meta-toolchain diff --git a/buildconf/raspberrypi3-64/local.conf.sample b/buildconf/raspberrypi3-64/local.conf.sample index f0e4959..e6fcd5c 100644 --- a/buildconf/raspberrypi3-64/local.conf.sample +++ b/buildconf/raspberrypi3-64/local.conf.sample @@ -27,6 +27,10 @@ BB_DISKMON_DIRS = "\ CONF_VERSION = "1" +ENABLE_UART = "1" +ENABLE_SPI = "1" +ENABLE_I2C = "1" + INHERIT += "rm_work" INHERIT += "own-mirrors" diff --git a/conf/distro/roro.conf b/conf/distro/roro.conf index da50503..e7bf956 100644 --- a/conf/distro/roro.conf +++ b/conf/distro/roro.conf @@ -6,10 +6,36 @@ DISTRO_VERSION = "1.0" DISTRO_CODENAME = "roro" #DISTRO_FEATURES_append = " alsa usbhost usbgadget keyboard bluetooth" -POKY_DEFAULT_DISTRO_FEATURES = "largefile" +# Comment out any of the lines below to disable them in the build +# DISTRO_FEATURES options: +# alsa bluetooth ext2 pcmcia usbgadget usbhost wifi nfs zeroconf pci +DISTRO_FEATURES_TINY = "largefile zeroconf virtualization" +DISTRO_FEATURES_NET = "ipv4 ipv6" +DISTRO_FEATURES_USB = "usbhost" +DISTRO_FEATURES_WIFI = "wifi" + +DISTRO_FEATURES = " \ + ${DISTRO_FEATURES_TINY} \ + ${DISTRO_FEATURES_NET} \ + ${DISTRO_FEATURES_USB} \ + ${DISTRO_FEATURES_WIFI} \ +" + POKY_DEFAULT_EXTRA_RDEPENDS = "packagegroup-core-boot" POKY_DEFAULT_EXTRA_RRECOMMENDS = "kernel-module-af-packet" -DISTRO_FEATURES_DEFAULT = "ipv4 ipv6 largefile usbhost wifi zeroconf virtualization" + +INIT_MANAGER ?= "mdev-busybox" +TCLIBC = "musl" + +# Disable wide char support for ncurses as we don't include it in +# in the LIBC features below. +# Leave native enable to avoid build failures +ENABLE_WIDEC = "false" +ENABLE_WIDEC_class-native = "true" + +# Drop native language support. This removes the +# eglibc->bash->gettext->libc-posix-clang-wchar dependency. +USE_NLS="no" SDK_VENDOR = "-rorodistsdk" SDK_VERSION := "${@'${DISTRO_VERSION}'.replace('snapshot-${DATE}','snapshot')}" diff --git a/recipes-containers/docker/docker-ce_git.bbappend b/recipes-containers/docker/docker-ce_git.bbappend index 89cf576..c51fc66 100644 --- a/recipes-containers/docker/docker-ce_git.bbappend +++ b/recipes-containers/docker/docker-ce_git.bbappend @@ -3,5 +3,16 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/files:" SRC_URI += " \ file://docker.init \ + file://S49cgroups_mount.sh \ " +do_install_append () { + install -d ${D}${sysconfdir}/ + install -d ${D}${sysconfdir}/rcS.d/ + install -m 0755 ${WORKDIR}/S49cgroups_mount.sh ${D}${sysconfdir}/rcS.d/ + + cd ${D}${sysconfdir}/rcS.d/ + ln -s ../init.d/docker.init S50docker.sh + +} + diff --git a/recipes-containers/docker/files/S49cgroups_mount.sh b/recipes-containers/docker/files/S49cgroups_mount.sh new file mode 100644 index 0000000..3584f8b --- /dev/null +++ b/recipes-containers/docker/files/S49cgroups_mount.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +case "${1}" in + start) + cgroups-mount + ;; + *) + echo "Usage: ${0} {start}" + exit 1 + ;; +esac + diff --git a/recipes-core/busybox/busybox_%.bbappend b/recipes-core/busybox/busybox_%.bbappend new file mode 100644 index 0000000..f0f2c96 --- /dev/null +++ b/recipes-core/busybox/busybox_%.bbappend @@ -0,0 +1,19 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" + +SRC_URI += " \ + file://S20load_modules.sh \ + file://fragments.cfg \ + file://ntp.conf \ + file://ntpd \ +" + +do_install_append () { + install -d ${D}${sysconfdir}/rcS.d/ + install -m 0644 ${WORKDIR}/ntp.conf ${D}${sysconfdir} + install -m 0755 ${WORKDIR}/ntpd ${D}${sysconfdir}/init.d/ + install -m 0755 ${WORKDIR}/S20load_modules.sh ${D}${sysconfdir}/rcS.d/ + + cd ${D}${sysconfdir}/rcS.d/ + ln -s ../init.d/ntpd S48ntpd.sh +} + diff --git a/recipes-core/busybox/files/S20load_modules.sh b/recipes-core/busybox/files/S20load_modules.sh new file mode 100644 index 0000000..4b46adf --- /dev/null +++ b/recipes-core/busybox/files/S20load_modules.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +LOAD_DIR="/etc/modules-load.d" +MODULES="$(ls $LOAD_DIR)" + +case "${1}" in + start) + for MOD in $MODULES; + do + while read module args; + do + # Ignore comments and blank lines + case "$module" in + ""|"#"*) continue;; + esac + + modprobe ${module} ${args} + done < $LOAD_DIR/$MOD + done + ;; + *) + echo "Usage: ${0} {start}" + exit 1 + ;; +esac + diff --git a/recipes-core/busybox/files/fragments.cfg b/recipes-core/busybox/files/fragments.cfg new file mode 100644 index 0000000..24d2bd9 --- /dev/null +++ b/recipes-core/busybox/files/fragments.cfg @@ -0,0 +1,5 @@ +CONFIG_NTPD=y +CONFIG_FEATURE_NTPD_SERVER=y +CONFIG_FEATURE_NTPD_CONF=y +CONFIG_FEATURE_NTP_AUTH=y + diff --git a/recipes-core/busybox/files/ntp.conf b/recipes-core/busybox/files/ntp.conf new file mode 100644 index 0000000..700991d --- /dev/null +++ b/recipes-core/busybox/files/ntp.conf @@ -0,0 +1,5 @@ +server 0.europe.pool.ntp.org +server 1.europe.pool.ntp.org +server 2.europe.pool.ntp.org +server 3.europe.pool.ntp.org + diff --git a/recipes-core/busybox/files/ntpd b/recipes-core/busybox/files/ntpd new file mode 100644 index 0000000..4a222af --- /dev/null +++ b/recipes-core/busybox/files/ntpd @@ -0,0 +1,12 @@ +#!/bin/sh + +case "${1}" in + start) + ntpd -q + ;; + *) + echo "Usage: ${0} {start}" + exit 1 + ;; +esac + diff --git a/recipes-core/images/docker-image.bb b/recipes-core/images/docker-image.bb index 5386270..bcec382 100644 --- a/recipes-core/images/docker-image.bb +++ b/recipes-core/images/docker-image.bb @@ -4,7 +4,7 @@ LICENSE = "MIT" require tiny-image-base.inc -IMAGE_INSTALL_append = " docker" +IMAGE_INSTALL_append = " initscripts init-ifupdown docker-ce" -export IMAGE_BASENAME = "tiny-image" +export IMAGE_BASENAME = "docker-image" diff --git a/recipes-core/images/tiny-image-base.inc b/recipes-core/images/tiny-image-base.inc index 16786b0..12d35dc 100644 --- a/recipes-core/images/tiny-image-base.inc +++ b/recipes-core/images/tiny-image-base.inc @@ -31,6 +31,7 @@ IMAGE_INSTALL += " \ " IMAGE_INSTALL_append_beaglebone-yocto = " linux-firmware-rtl8192cu" +#IMAGE_INSTALL_append_raspberrypi3_64 += " linux-firmware-bcm43430" IMAGE_INSTALL_append_bananapi-m3 += " linux-firmware-bcm43430" set_local_timezone() { 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 index 869d60a..88ce312 100644 --- a/recipes-core/init-ifupdown-1.0/init-ifupdown_1.0.bbappend +++ b/recipes-core/init-ifupdown-1.0/init-ifupdown_1.0.bbappend @@ -1,2 +1,8 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/files:" +do_install_append () { + mkdir -p ${D}${sysconfdir}/rcS.d/ + cd ${D}${sysconfdir}/rcS.d/ + ln -s ../init.d/networking S40networking.sh +} + diff --git a/recipes-kernel/linux-firmware/linux-firmware_%.bbappend b/recipes-kernel/linux-firmware/linux-firmware_%.bbappend new file mode 100644 index 0000000..2f28da7 --- /dev/null +++ b/recipes-kernel/linux-firmware/linux-firmware_%.bbappend @@ -0,0 +1,10 @@ +KERNEL_MODULE_AUTOLOAD += " brcmfmac" + +do_install_append () { + install -d ${D}/lib/ + install -d ${D}/lib/firmware/ + install -d ${D}/lib/firmware/brcm + cd ${D}/lib/firmware/brcm + ln -s brcmfmac43430-sdio.raspberrypi,3-model-b.txt brcmfmac43430-sdio.txt +} + diff --git a/recipes-kernel/linux/linux-raspberrypi_%.bbappend b/recipes-kernel/linux/linux-raspberrypi_%.bbappend new file mode 100644 index 0000000..4594474 --- /dev/null +++ b/recipes-kernel/linux/linux-raspberrypi_%.bbappend @@ -0,0 +1,2 @@ +KERNEL_MODULE_AUTOLOAD += " brcmfmac i2c-dev spi-bcm2835" + From f5a399e87a63543d5ffe2a32895fddb8560a6765 Mon Sep 17 00:00:00 2001 From: Thomas Klaehn Date: Sun, 26 Jan 2020 12:42:49 +0100 Subject: [PATCH 3/4] docker-image: add beaglebone --- buildconf/beaglebone-yocto/bblayers.conf.sample | 1 + buildconf/beaglebone-yocto/local.conf.sample | 2 ++ recipes-core/busybox/busybox_%.bbappend | 8 ++++---- recipes-kernel/linux/linux-yocto_5.2.bbappend | 2 ++ 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/buildconf/beaglebone-yocto/bblayers.conf.sample b/buildconf/beaglebone-yocto/bblayers.conf.sample index 5574c58..8870963 100644 --- a/buildconf/beaglebone-yocto/bblayers.conf.sample +++ b/buildconf/beaglebone-yocto/bblayers.conf.sample @@ -14,6 +14,7 @@ BBLAYERS ?= " \ ${TOPDIR}/../layers/meta-openembedded/meta-networking \ ${TOPDIR}/../layers/meta-openembedded/meta-python \ ${TOPDIR}/../layers/meta-virtualization \ + ${TOPDIR}/../layers/meta-raspberrypi \ ${TOPDIR}/../layers/meta-blackfinn \ " diff --git a/buildconf/beaglebone-yocto/local.conf.sample b/buildconf/beaglebone-yocto/local.conf.sample index 229fe51..fddfee5 100644 --- a/buildconf/beaglebone-yocto/local.conf.sample +++ b/buildconf/beaglebone-yocto/local.conf.sample @@ -15,6 +15,8 @@ USER_CLASSES ?= "buildstats image-mklibs image-prelink" IMAGE_BOOT_FILES_append = " uEnv.txt" +SERIAL_CONSOLES = "115200;ttyS0" + PATCHRESOLVE = "noop" BB_DISKMON_DIRS = "\ diff --git a/recipes-core/busybox/busybox_%.bbappend b/recipes-core/busybox/busybox_%.bbappend index f0f2c96..9ab7197 100644 --- a/recipes-core/busybox/busybox_%.bbappend +++ b/recipes-core/busybox/busybox_%.bbappend @@ -1,10 +1,10 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/files:" SRC_URI += " \ - file://S20load_modules.sh \ - file://fragments.cfg \ - file://ntp.conf \ - file://ntpd \ + file://S20load_modules.sh \ + file://fragments.cfg \ + file://ntp.conf \ + file://ntpd \ " do_install_append () { diff --git a/recipes-kernel/linux/linux-yocto_5.2.bbappend b/recipes-kernel/linux/linux-yocto_5.2.bbappend index dae764d..0cb6d49 100644 --- a/recipes-kernel/linux/linux-yocto_5.2.bbappend +++ b/recipes-kernel/linux/linux-yocto_5.2.bbappend @@ -3,6 +3,8 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=bbea815ee2795b2f4230826c0c6b8814" FILESEXTRAPATHS_prepend := "${THISDIR}/files:" +KERNEL_MODULE_AUTOLOAD += " rtl8192cu" + SRC_URI += " \ file://rtl8192cu.cfg \ file://enable_onboard_leds.cfg \ From ca186c316a4198ea74063872bbe894cad2f5a65f Mon Sep 17 00:00:00 2001 From: Thomas Klaehn Date: Thu, 30 Jan 2020 22:03:37 +0100 Subject: [PATCH 4/4] docker image: reorder recipes to prevent influence on console-images --- .../openssh/openssh_%.bbappend | 9 +++++ .../docker/docker-ce_git.bbappend | 15 +------- recipes-core/busybox/busybox-initcfg.bb | 28 +++++++++++++++ recipes-core/busybox/busybox_%.bbappend | 17 +--------- .../busybox}/files/S49cgroups_mount.sh | 0 recipes-core/images/console-image-base.inc | 1 - recipes-core/images/docker-image.bb | 4 +++ recipes-core/images/tiny-image-base.inc | 34 +++++++++---------- .../interfaces | 0 .../init-ifupdown_1.0.bbappend | 6 ---- 10 files changed, 60 insertions(+), 54 deletions(-) create mode 100644 recipes-connectivity/openssh/openssh_%.bbappend create mode 100644 recipes-core/busybox/busybox-initcfg.bb rename {recipes-containers/docker => recipes-core/busybox}/files/S49cgroups_mount.sh (100%) rename recipes-core/init-ifupdown-1.0/files/{raspberrypi3_64 => raspberrypi3-64}/interfaces (100%) diff --git a/recipes-connectivity/openssh/openssh_%.bbappend b/recipes-connectivity/openssh/openssh_%.bbappend new file mode 100644 index 0000000..d5a9e23 --- /dev/null +++ b/recipes-connectivity/openssh/openssh_%.bbappend @@ -0,0 +1,9 @@ +do_install_append () { + install -d ${D}${sysconfdir}/ + install -d ${D}${sysconfdir}/rcS.d/ + + cd ${D}${sysconfdir}/rcS.d/ + ln -s ../init.d/sshd S47sshd.sh + +} + diff --git a/recipes-containers/docker/docker-ce_git.bbappend b/recipes-containers/docker/docker-ce_git.bbappend index c51fc66..fe6fae9 100644 --- a/recipes-containers/docker/docker-ce_git.bbappend +++ b/recipes-containers/docker/docker-ce_git.bbappend @@ -1,18 +1,5 @@ LICENSE = "GPLv2" FILESEXTRAPATHS_prepend := "${THISDIR}/files:" -SRC_URI += " \ - file://docker.init \ - file://S49cgroups_mount.sh \ -" - -do_install_append () { - install -d ${D}${sysconfdir}/ - install -d ${D}${sysconfdir}/rcS.d/ - install -m 0755 ${WORKDIR}/S49cgroups_mount.sh ${D}${sysconfdir}/rcS.d/ - - cd ${D}${sysconfdir}/rcS.d/ - ln -s ../init.d/docker.init S50docker.sh - -} +SRC_URI += " file://docker.init" diff --git a/recipes-core/busybox/busybox-initcfg.bb b/recipes-core/busybox/busybox-initcfg.bb new file mode 100644 index 0000000..36d28ca --- /dev/null +++ b/recipes-core/busybox/busybox-initcfg.bb @@ -0,0 +1,28 @@ +LICENSE = "GPLv2" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6" +#file://COPYING;md5=bbea815ee2795b2f4230826c0c6b8814" + +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" + +SRC_URI += " \ + file://S20load_modules.sh \ + file://S49cgroups_mount.sh \ + file://ntp.conf \ + file://ntpd \ +" + +do_install_append () { + install -d ${D}${sysconfdir}/ + install -d ${D}${sysconfdir}/rcS.d/ + install -d ${D}${sysconfdir}/init.d/ + install -m 0644 ${WORKDIR}/ntp.conf ${D}${sysconfdir} + install -m 0755 ${WORKDIR}/ntpd ${D}${sysconfdir}/init.d/ + install -m 0755 ${WORKDIR}/S20load_modules.sh ${D}${sysconfdir}/rcS.d/ + install -m 0755 ${WORKDIR}/S49cgroups_mount.sh ${D}${sysconfdir}/rcS.d/ + + cd ${D}${sysconfdir}/rcS.d/ + ln -s ../init.d/networking S40networking.sh + ln -s ../init.d/ntpd S48ntpd.sh + ln -s ../init.d/docker.init S50docker.sh +} + diff --git a/recipes-core/busybox/busybox_%.bbappend b/recipes-core/busybox/busybox_%.bbappend index 9ab7197..672e5f8 100644 --- a/recipes-core/busybox/busybox_%.bbappend +++ b/recipes-core/busybox/busybox_%.bbappend @@ -1,19 +1,4 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/files:" -SRC_URI += " \ - file://S20load_modules.sh \ - file://fragments.cfg \ - file://ntp.conf \ - file://ntpd \ -" - -do_install_append () { - install -d ${D}${sysconfdir}/rcS.d/ - install -m 0644 ${WORKDIR}/ntp.conf ${D}${sysconfdir} - install -m 0755 ${WORKDIR}/ntpd ${D}${sysconfdir}/init.d/ - install -m 0755 ${WORKDIR}/S20load_modules.sh ${D}${sysconfdir}/rcS.d/ - - cd ${D}${sysconfdir}/rcS.d/ - ln -s ../init.d/ntpd S48ntpd.sh -} +SRC_URI += " file://fragments.cfg" diff --git a/recipes-containers/docker/files/S49cgroups_mount.sh b/recipes-core/busybox/files/S49cgroups_mount.sh similarity index 100% rename from recipes-containers/docker/files/S49cgroups_mount.sh rename to recipes-core/busybox/files/S49cgroups_mount.sh diff --git a/recipes-core/images/console-image-base.inc b/recipes-core/images/console-image-base.inc index a363ba9..d2ec6c4 100644 --- a/recipes-core/images/console-image-base.inc +++ b/recipes-core/images/console-image-base.inc @@ -40,7 +40,6 @@ EXTRA_TOOLS_INSTALL = " \ e2fsprogs-mke2fs \ ethtool \ findutils \ - htop \ i2c-tools \ less \ mc \ diff --git a/recipes-core/images/docker-image.bb b/recipes-core/images/docker-image.bb index bcec382..5e8977a 100644 --- a/recipes-core/images/docker-image.bb +++ b/recipes-core/images/docker-image.bb @@ -6,5 +6,9 @@ require tiny-image-base.inc IMAGE_INSTALL_append = " initscripts init-ifupdown docker-ce" +EXTRA_USERS_PARAMS += " \ + usermod -a -G docker tkl \ +" + export IMAGE_BASENAME = "docker-image" diff --git a/recipes-core/images/tiny-image-base.inc b/recipes-core/images/tiny-image-base.inc index 12d35dc..601dd73 100644 --- a/recipes-core/images/tiny-image-base.inc +++ b/recipes-core/images/tiny-image-base.inc @@ -5,45 +5,45 @@ require users.inc IMAGE_FEATURES += "package-management" CORE_OS = " \ - openssh \ - openssh-keygen \ - openssh-sftp-server \ - psplash \ - tzdata \ + busybox-initcfg \ + openssh \ + openssh-keygen \ + openssh-sftp-server \ + psplash \ + tzdata \ " KERNEL_EXTRA_INSTALL = " \ - kernel-modules \ + kernel-modules \ " WIFI_SUPPORT = " \ - wpa-supplicant \ + wpa-supplicant \ " EXTRA_TOOLS_INSTALL = " \ " IMAGE_INSTALL += " \ - ${CORE_OS} \ - ${EXTRA_TOOLS_INSTALL} \ - ${KERNEL_EXTRA_INSTALL} \ - ${WIFI_SUPPORT} \ + ${CORE_OS} \ + ${EXTRA_TOOLS_INSTALL} \ + ${KERNEL_EXTRA_INSTALL} \ + ${WIFI_SUPPORT} \ " IMAGE_INSTALL_append_beaglebone-yocto = " linux-firmware-rtl8192cu" -#IMAGE_INSTALL_append_raspberrypi3_64 += " linux-firmware-bcm43430" IMAGE_INSTALL_append_bananapi-m3 += " linux-firmware-bcm43430" set_local_timezone() { - ln -sf /usr/share/zoneinfo/Europe/Berlin ${IMAGE_ROOTFS}/etc/localtime + ln -sf /usr/share/zoneinfo/Europe/Berlin ${IMAGE_ROOTFS}/etc/localtime } disable_bootlogd() { - echo BOOTLOGD_ENABLE=no > ${IMAGE_ROOTFS}/etc/default/bootlogd + echo BOOTLOGD_ENABLE=no > ${IMAGE_ROOTFS}/etc/default/bootlogd } ROOTFS_POSTPROCESS_COMMAND += " \ - set_local_timezone ; \ - disable_bootlogd ; \ - " + set_local_timezone ; \ + disable_bootlogd ; \ +" diff --git a/recipes-core/init-ifupdown-1.0/files/raspberrypi3_64/interfaces b/recipes-core/init-ifupdown-1.0/files/raspberrypi3-64/interfaces similarity index 100% rename from recipes-core/init-ifupdown-1.0/files/raspberrypi3_64/interfaces rename to recipes-core/init-ifupdown-1.0/files/raspberrypi3-64/interfaces 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 index 88ce312..869d60a 100644 --- a/recipes-core/init-ifupdown-1.0/init-ifupdown_1.0.bbappend +++ b/recipes-core/init-ifupdown-1.0/init-ifupdown_1.0.bbappend @@ -1,8 +1,2 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/files:" -do_install_append () { - mkdir -p ${D}${sysconfdir}/rcS.d/ - cd ${D}${sysconfdir}/rcS.d/ - ln -s ../init.d/networking S40networking.sh -} -