diff options
| author | John Ogness <john.ogness@linutronix.de> | 2017-12-19 11:16:28 +0100 |
|---|---|---|
| committer | John Ogness <john.ogness@linutronix.de> | 2017-12-19 11:16:28 +0100 |
| commit | 6e7e1b7172813fc4ecb60597f903dd21a4616159 (patch) | |
| tree | dbfe0b8f1a3d51c275722ba86d4ffe109ee88aef /distribution/yocto-advanced/meta-schulung-extended/recipes-core | |
| parent | 270520b4a2eac8725c8575c3180964289722e191 (diff) | |
update yocto-advanced: sync to devel/manut/yocto
The devel/manut/yocto heavily diverted from master. Sync
with latest version 8cd4956a9b48a316eab6dc6d1b1f6cd51362fecf.
Signed-off-by: John Ogness <john.ogness@linutronix.de>
Diffstat (limited to 'distribution/yocto-advanced/meta-schulung-extended/recipes-core')
9 files changed, 417 insertions, 0 deletions
diff --git a/distribution/yocto-advanced/meta-schulung-extended/recipes-core/busybox/busybox_1.24.1.bb b/distribution/yocto-advanced/meta-schulung-extended/recipes-core/busybox/busybox_1.24.1.bb new file mode 100644 index 0000000..de441f7 --- /dev/null +++ b/distribution/yocto-advanced/meta-schulung-extended/recipes-core/busybox/busybox_1.24.1.bb @@ -0,0 +1,64 @@ +# source file +SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.bz2;name=upstream" + +# source file checksums +SRC_URI[upstream.md5sum] = "be98a40cadf84ce2d6b05fa41a275c6a" +SRC_URI[upstream.sha256sum] = "37d03132cc078937360b392170b7a1d0e5b322eee9f57c0b82292a8b1f0afe3d" + +# license information +LICENSE = "GPLv2 & bzip2" +LIC_FILES_CHKSUM = "file://LICENSE;md5=de10de48642ab74318e893a61105afbb" + +# specify additional arguments used by "oe_runmake" +# - busybox requires "CROSS_COMPILE" to specify the toolchain prefix +# (${TARGET_PREFIX} is correctly set to this in bitbake.conf) +# - busybox requires "CONFIG_SYSROOT" to specify the sysroot +# - if V=1 is used the busybox Makefiles produce verbose build output, +# which helps to investigate any possible build errors +EXTRA_OEMAKE += "CROSS_COMPILE=${TARGET_PREFIX}" +EXTRA_OEMAKE += "CONFIG_SYSROOT=${PKG_CONFIG_SYSROOT_DIR}" +EXTRA_OEMAKE += "V=1" + +# configure busybox using the shipped defconfig +do_configure () { + oe_runmake defconfig +} + +# build busybox and the links file +# - the links file is a text file listing all the links that +# should be created to use all configured busybox features +# - ${TARGET_CC_ARCH} is set in bitbake.conf and specifies the architecture- +# specific compiler options (for example, hardware floating point) +# (busybox needs this additional information in CFLAGS) +do_compile () { + export CFLAGS="${TARGET_CC_ARCH} ${CFLAGS}" + oe_runmake busybox_unstripped + oe_runmake busybox.links +} + +# install the busybox binary and the links file +# - the links file needs to be adjusted if non-default definitions +# for ${prefix}, ${base_sbindir}, ${base_bindir} are used +do_install () { + # fixup the links file if bitbake is using different paths + test "${prefix}" != "/usr" && \ + sed -i -e "s:^/usr/:${prefix}/:" busybox.links + test "${base_sbindir}" != "/sbin" && \ + sed -i -e "s:^/sbin/:${base_sbindir}/:" busybox.links + test "${base_bindir}" != "/bin" && \ + sed -i -e "s:^/bin/:${base_bindir}/:" busybox.links + + install -D -m 0755 busybox_unstripped ${D}${base_bindir}/busybox + install -D -m 0644 busybox.links ${D}${datadir}/busybox/busybox.links + + # NOTE: We do _not_ create the busybox links here because it should + # _not_ be busybox's decision which files appear on the + # root filesystem. That is a decision to be made by the root + # filesystem recipe. A root filesystem recipe can use the + # links file to determine what links can be created. +} + +# the links file belongs in the -dev package +# (it will not be installed in the root filesystem) +# - the links file will be used when building the root filesystem +FILES_${PN}-dev_append = " ${datadir}/busybox/busybox.links" diff --git a/distribution/yocto-advanced/meta-schulung-extended/recipes-core/busybox/busybox_1.26.2.bb b/distribution/yocto-advanced/meta-schulung-extended/recipes-core/busybox/busybox_1.26.2.bb new file mode 100644 index 0000000..8eaf3f8 --- /dev/null +++ b/distribution/yocto-advanced/meta-schulung-extended/recipes-core/busybox/busybox_1.26.2.bb @@ -0,0 +1,83 @@ +# source file +SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.bz2;name=upstream \ + file://hwclock.sh \ + file://busybox-udhcpd \ +" + +# source file checksums +SRC_URI[upstream.md5sum] = "bb59d25ee2643db20f212eec539429f1" +SRC_URI[upstream.sha256sum] = "da3e44913fc1a9c9b7c5337ea5292da518683cbff32be630777f565d6036af16" + +# license information +LICENSE = "GPLv2 & bzip2" +LIC_FILES_CHKSUM = "file://LICENSE;md5=de10de48642ab74318e893a61105afbb" + +# specify additional arguments used by "oe_runmake" +# - busybox requires "CROSS_COMPILE" to specify the toolchain prefix +# (${TARGET_PREFIX} is correctly set to this in bitbake.conf) +# - busybox requires "CONFIG_SYSROOT" to specify the sysroot +# - if V=1 is used the busybox Makefiles produce verbose build output, +# which helps to investigate any possible build errors +EXTRA_OEMAKE += "CROSS_COMPILE=${TARGET_PREFIX}" +EXTRA_OEMAKE += "CONFIG_SYSROOT=${PKG_CONFIG_SYSROOT_DIR}" +EXTRA_OEMAKE += "V=1" + +# configure busybox using the shipped defconfig +do_configure () { + oe_runmake defconfig +} + +# build busybox and the links file +# - the links file is a text file listing all the links that +# should be created to use all configured busybox features +# - ${TARGET_CC_ARCH} is set in bitbake.conf and specifies the architecture- +# specific compiler options (for example, hardware floating point) +# (busybox needs this additional information in CFLAGS) +do_compile () { + export CFLAGS="${TARGET_CC_ARCH} ${CFLAGS}" + oe_runmake busybox_unstripped + oe_runmake busybox.links +} + +# install the busybox binary and the links file +# - the links file needs to be adjusted if non-default definitions +# for ${prefix}, ${base_sbindir}, ${base_bindir} are used +do_install () { + # fixup the links file if bitbake is using different paths + test "${prefix}" != "/usr" && \ + sed -i -e "s:^/usr/:${prefix}/:" busybox.links + test "${base_sbindir}" != "/sbin" && \ + sed -i -e "s:^/sbin/:${base_sbindir}/:" busybox.links + test "${base_bindir}" != "/bin" && \ + sed -i -e "s:^/bin/:${base_bindir}/:" busybox.links + + install -D -m 0755 busybox_unstripped ${D}${base_bindir}/busybox + install -D -m 0644 busybox.links ${D}${datadir}/busybox/busybox.links + + # NOTE: We do _not_ create the busybox links here because it should + # _not_ be busybox's decision which files appear on the + # root filesystem. That is a decision to be made by the root + # filesystem recipe. A root filesystem recipe can use the + # links file to determine what links can be created. + + install -d ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/hwclock.sh ${D}${sysconfdir}/init.d/ + install -m 0755 ${WORKDIR}/busybox-udhcpd ${D}${sysconfdir}/init.d/ +} + +# the links file belongs in the -dev package +# (it will not be installed in the root filesystem) +# - the links file will be used when building the root filesystem +FILES_${PN}-dev_append = " ${datadir}/busybox/busybox.links" + + +PACKAGES =+ "${PN}-httpd ${PN}-udhcpd ${PN}-udhcpc ${PN}-syslog ${PN}-mdev ${PN}-hwclock" + +FILES_${PN}-udhcpd = "${sysconfdir}/init.d/busybox-udhcpd" +FILES_${PN}-udhcpc = "${sysconfdir}/udhcpc.d ${datadir}/udhcpc" +FILES_${PN}-hwclock = "${sysconfdir}/init.d/hwclock.sh" + +INITSCRIPT_PACKAGES = "${PN}-udhcpd ${PN}-hwclock" + +INITSCRIPT_NAME_${PN}-hwclock = "hwclock.sh" +INITSCRIPT_NAME_${PN}-udhcpd = "busybox-udhcpd" diff --git a/distribution/yocto-advanced/meta-schulung-extended/recipes-core/busybox/files/busybox-udhcpd b/distribution/yocto-advanced/meta-schulung-extended/recipes-core/busybox/files/busybox-udhcpd new file mode 100755 index 0000000..c43903e --- /dev/null +++ b/distribution/yocto-advanced/meta-schulung-extended/recipes-core/busybox/files/busybox-udhcpd @@ -0,0 +1,43 @@ +#!/bin/sh +DAEMON=/usr/sbin/udhcpd +NAME=udhcpd +DESC="Busybox UDHCP Server" +ARGS="/etc/udhcpd.conf" + +test -f $DAEMON || exit 1 + +set -e + +case "$1" in + start) + echo -n "starting $DESC: $NAME... " + if [ ! -f /etc/udhcpd.conf ]; then + echo "error: /etc/udhcpd.conf is missing." + exit 1 + fi + /sbin/start-stop-daemon -S -b -n $NAME -a $DAEMON -- $ARGS + echo "done." + ;; + stop) + echo -n "stopping $DESC: $NAME... " + /sbin/start-stop-daemon -K -n $NAME + echo "done." + ;; + restart) + echo "restarting $DESC: $NAME... " + $0 stop + $0 start + echo "done." + ;; + reload) + echo -n "reloading $DESC: $NAME... " + killall -HUP $(basename ${DAEMON}) + echo "done." + ;; + *) + echo "Usage: $0 {start|stop|restart|reload}" + exit 1 + ;; +esac + +exit 0 diff --git a/distribution/yocto-advanced/meta-schulung-extended/recipes-core/busybox/files/hwclock.sh b/distribution/yocto-advanced/meta-schulung-extended/recipes-core/busybox/files/hwclock.sh new file mode 100644 index 0000000..be5f94d --- /dev/null +++ b/distribution/yocto-advanced/meta-schulung-extended/recipes-core/busybox/files/hwclock.sh @@ -0,0 +1,83 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: hwclock +# Required-Start: +# Required-Stop: $local_fs +# Default-Start: S +# Default-Stop: 0 6 +# Short-Description: Set system clock +# Description: Set system clock to hardware clock, according to the UTC +# setting in /etc/default/rcS (see also rcS(5)). +### END INIT INFO +# +# WARNING: If your hardware clock is not in UTC/GMT, this script +# must know the local time zone. This information is +# stored in /etc/localtime. This might be a problem if +# your /etc/localtime is a symlink to something in +# /usr/share/zoneinfo AND /usr isn't in the root +# partition! The workaround is to define TZ either +# in /etc/default/rcS, or in the proper place below. + +[ ! -x /sbin/hwclock ] && exit 0 + +[ -f /etc/default/rcS ] && . /etc/default/rcS + +[ "$UTC" = "yes" ] && tz="--utc" || tz="--localtime" +case "$1" in + start) + if [ "$VERBOSE" != no ] + then + echo "System time was `date`." + echo "Setting the System Clock using the Hardware Clock as reference..." + fi + + if [ "$HWCLOCKACCESS" != no ] + then + if [ -z "$TZ" ] + then + hwclock $tz --hctosys + else + TZ="$TZ" hwclock $tz --hctosys + fi + fi + + if [ "$VERBOSE" != no ] + then + echo "System Clock set. System local time is now `date`." + fi + ;; + stop|restart|reload|force-reload) + # + # Updates the Hardware Clock with the System Clock time. + # This will *override* any changes made to the Hardware Clock. + # + # WARNING: If you disable this, any changes to the system + # clock will not be carried across reboots. + # + if [ "$VERBOSE" != no ] + then + echo "Saving the System Clock time to the Hardware Clock..." + fi + if [ "$HWCLOCKACCESS" != no ] + then + hwclock $tz --systohc + fi + if [ "$VERBOSE" != no ] + then + echo "Hardware Clock updated to `date`." + fi + exit 0 + ;; + show) + if [ "$HWCLOCKACCESS" != no ] + then + hwclock $tz --show + fi + ;; + *) + echo "Usage: hwclock.sh {start|stop|show|reload|restart}" >&2 + echo " start sets kernel (system) clock from hardware (RTC) clock" >&2 + echo " stop and reload set hardware (RTC) clock from kernel (system) clock" >&2 + exit 1 + ;; +esac diff --git a/distribution/yocto-advanced/meta-schulung-extended/recipes-core/images/core-image-schulung.bb b/distribution/yocto-advanced/meta-schulung-extended/recipes-core/images/core-image-schulung.bb new file mode 100644 index 0000000..516bca3 --- /dev/null +++ b/distribution/yocto-advanced/meta-schulung-extended/recipes-core/images/core-image-schulung.bb @@ -0,0 +1,50 @@ +# use the core-image class (poky/meta/core-image.bbclass) +inherit core-image + +# add package management to the image +# (the package management type depends on PACKAGE_CLASSES) +IMAGE_FEATURES += "package-management" + +# do not install any particular locales +# (they are big and we don't need them) +IMAGE_LINUGUAS = " " + +# set the size of the partition for the image +# (see image.bbclass for related limits) +IMAGE_ROOTFS_SIZE ?= "32768" + +# specify packages for the root filesystem +# (IMAGE_INSTALL is defined in and used by core-image.bbclass +# for a list of packages to be installed, use = to ignore the +# packages added by 'packagegroup-core-boot') +# IMAGE_INSTALL += "hello schulung-rootfs openssh" +IMAGE_INSTALL = "hello schulung-rootfs" + +# set a root password +# inherit extrausers +# EXTRA_USERS_PARAMS = "usermod -P foo root;" + +# busybox must be installed so we have access to busybox.links +# (for DEPENDS packages, the -dev variant of the package +# is also installed in the sysroot) +DEPENDS += "busybox" + +# create a function to create the busybox links +# - anything copied to ${IMAGE_ROOTFS} will also appear in the root filesystem +# (this is set in bitbake.conf to ${WORKDIR}/rootfs) +setup_busybox_links () { + for lnfile in `cat ${PKG_CONFIG_SYSROOT_DIR}${datadir}/busybox/busybox.links`; do + # do not create /linuxrc link, we do not need it + test $lnfile = /linuxrc && continue + + # create parent directory if necessary + install -d ${IMAGE_ROOTFS}`dirname $lnfile` + + # link creation is allowed to fail if a file is already there + ln -s ${base_bindir}/busybox ${IMAGE_ROOTFS}$lnfile || true + done +} +# ...and have it called after the rootfs task is finished +do_rootfs[postfuncs] += "setup_busybox_links" + +# using "do_rootfs_append ()" as function would have the same effect diff --git a/distribution/yocto-advanced/meta-schulung-extended/recipes-core/keys/keys-native.bb b/distribution/yocto-advanced/meta-schulung-extended/recipes-core/keys/keys-native.bb new file mode 100644 index 0000000..0d97038 --- /dev/null +++ b/distribution/yocto-advanced/meta-schulung-extended/recipes-core/keys/keys-native.bb @@ -0,0 +1,27 @@ +# openssl is needed during build time to generate the keys +DEPENDS += "openssl-native dtc-native" + +# specify a license (required for packages) +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" + +# perform key generation as the compile task +do_compile () { + openssl genpkey -algorithm RSA -out dev.key \ + -pkeyopt rsa_keygen_bits:4096 + openssl req -batch -new -x509 -sha512 -key dev.key -out dev.crt + openssl x509 -noout -text -in dev.crt + + # this combined file could be used by kernel module signing + cat dev.crt dev.key > dev.pem +} + +# install the keys to the datadir +do_install () { + install -D -m 0644 dev.key ${D}/${datadir}/keys/dev.key + install -D -m 0644 dev.crt ${D}/${datadir}/keys/dev.crt + install -D -m 0644 dev.pem ${D}/${datadir}/keys/dev.pem +} + +# this is a native package +inherit native diff --git a/distribution/yocto-advanced/meta-schulung-extended/recipes-core/rootfs/files/busybox_inittab b/distribution/yocto-advanced/meta-schulung-extended/recipes-core/rootfs/files/busybox_inittab new file mode 100644 index 0000000..66942e4 --- /dev/null +++ b/distribution/yocto-advanced/meta-schulung-extended/recipes-core/rootfs/files/busybox_inittab @@ -0,0 +1,13 @@ +# Boot-time system configuration/initialization script. +# This is run first except when booting in single-user mode. +::sysinit:/etc/init.d/rcS + +# start an "askfirst" shell on the console (whatever that may be) +::askfirst:-/bin/sh + +# stuff to do when restarting the init process +::restart:/sbin/init + +# stuff to do before rebooting +::ctrlaltdel:/sbin/reboot +::shutdown:/bin/umount -a -r diff --git a/distribution/yocto-advanced/meta-schulung-extended/recipes-core/rootfs/files/rcS b/distribution/yocto-advanced/meta-schulung-extended/recipes-core/rootfs/files/rcS new file mode 100644 index 0000000..e0d039a --- /dev/null +++ b/distribution/yocto-advanced/meta-schulung-extended/recipes-core/rootfs/files/rcS @@ -0,0 +1,18 @@ +#!/bin/sh + +# mount important virtual filesystems +mount -t devtmpfs none /dev +mount -t proc none /proc +mount -t sysfs none /sys + +# make sure there is a startup direcdtory +test -d /etc/rcS.d || exit 0 + +# start all startup scripts in startup directory +for scr in `ls /etc/rcS.d`; do + case $scr in + S*) + /etc/rcS.d/$scr start + ;; + esac +done diff --git a/distribution/yocto-advanced/meta-schulung-extended/recipes-core/rootfs/schulung-rootfs_1.0.bb b/distribution/yocto-advanced/meta-schulung-extended/recipes-core/rootfs/schulung-rootfs_1.0.bb new file mode 100644 index 0000000..4c4992a --- /dev/null +++ b/distribution/yocto-advanced/meta-schulung-extended/recipes-core/rootfs/schulung-rootfs_1.0.bb @@ -0,0 +1,36 @@ +# license information +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" + +# increase this value to force a rebuild of the recipe +PR = "r0" + +# specify _runtime_ dependency on busybox (for package manager) +# (i.e. busybox can't be uninstalled because schulung-rootfs depends on it) +# - since runtime dependencies are related to specific packages, they are +# specified in per package variables (i.e. RDEPENDS_${PN}, not RDEPENDS) +RDEPENDS_${PN} = "busybox" + +# specify inittab configuration file and master startup script +SRC_URI = "file://busybox_inittab file://rcS" + +# install scripts, configurations, important empty directories +do_install () { + # install the scripts/configurations + install -D -m 0755 ${WORKDIR}/rcS ${D}${sysconfdir}/init.d/rcS + install -D -m 0644 ${WORKDIR}/busybox_inittab ${D}${sysconfdir}/inittab + + # create skeleton directories + install -d ${D}/tmp + install -d ${D}/dev + install -d ${D}/proc + install -d ${D}/sys +} + +# manually add some directories because they are not automatically identified +# (if this is not done, poky will complain about files +# in ${D} that do not belong to any package) +FILES_${PN} += "/tmp" +FILES_${PN} += "/dev" +FILES_${PN} += "/proc" +FILES_${PN} += "/sys" |
