From 3e1571bb6d3a0470d06b766dbaa3c432fd99a794 Mon Sep 17 00:00:00 2001 From: Christophe Priouzeau Date: Mon, 4 Feb 2019 15:40:04 +0100 Subject: [PATCH] Add busybox configuration for stm32mp machine Signed-off-by: Christophe Priouzeau --- ...1-miscutils-watchdog-Add-gettimeleft.patch | 38 +++++++++++++++++++ .../busybox/busybox/busybox-stm32mp.cfg | 13 +++++++ recipes-core/busybox/busybox/ifplugd.action | 20 ++++++++++ recipes-core/busybox/busybox/ifplugd.conf | 2 + recipes-core/busybox/busybox/ifplugd.sh | 5 +++ recipes-core/busybox/busybox_%.bbappend | 33 ++++++++++++++++ 6 files changed, 111 insertions(+) create mode 100644 recipes-core/busybox/busybox/0001-miscutils-watchdog-Add-gettimeleft.patch create mode 100644 recipes-core/busybox/busybox/busybox-stm32mp.cfg create mode 100644 recipes-core/busybox/busybox/ifplugd.action create mode 100644 recipes-core/busybox/busybox/ifplugd.conf create mode 100644 recipes-core/busybox/busybox/ifplugd.sh create mode 100644 recipes-core/busybox/busybox_%.bbappend diff --git a/recipes-core/busybox/busybox/0001-miscutils-watchdog-Add-gettimeleft.patch b/recipes-core/busybox/busybox/0001-miscutils-watchdog-Add-gettimeleft.patch new file mode 100644 index 0000000..8b89c7d --- /dev/null +++ b/recipes-core/busybox/busybox/0001-miscutils-watchdog-Add-gettimeleft.patch @@ -0,0 +1,38 @@ +From 08d9bcdef21f117511e109d28507c9f76045914f Mon Sep 17 00:00:00 2001 +From: Yannick Fertre +Date: Fri, 16 Sep 2016 16:59:37 +0200 +Subject: [PATCH] miscutils: watchdog: Add gettimeleft + +For purpose debug only, call of ioctl GETTIMELEFT + +Signed-off-by: Yannick Fertre +--- + /miscutils/watchdog.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a//miscutils/watchdog.c b//miscutils/watchdog.c +index d3a76ed..d8e1c0e 100644 +--- a//miscutils/watchdog.c ++++ b//miscutils/watchdog.c +@@ -50,6 +50,7 @@ int watchdog_main(int argc, char **argv) + unsigned opts; + unsigned stimer_duration; /* how often to restart */ + unsigned htimer_duration = 60000; /* reboots after N ms if not restarted */ ++ unsigned time_left; + char *st_arg; + char *ht_arg; + +@@ -105,6 +106,10 @@ int watchdog_main(int argc, char **argv) + */ + write(3, "", 1); /* write zero byte */ + usleep(stimer_duration * 1000L); ++ ++#ifdef WDIOC_GETTIMELEFT ++ ioctl_or_warn(3, WDIOC_GETTIMELEFT, &time_left); ++#endif + } + return EXIT_SUCCESS; /* - not reached, but gcc 4.2.1 is too dumb! */ + } +-- +1.9.1 + diff --git a/recipes-core/busybox/busybox/busybox-stm32mp.cfg b/recipes-core/busybox/busybox/busybox-stm32mp.cfg new file mode 100644 index 0000000..e2a3d48 --- /dev/null +++ b/recipes-core/busybox/busybox/busybox-stm32mp.cfg @@ -0,0 +1,13 @@ +# Enable MDEV feature for initramfs +CONFIG_MDEV=y +CONFIG_FEATURE_MDEV_CONF=y +CONFIG_FEATURE_MDEV_RENAME=y +CONFIG_FEATURE_MDEV_RENAME_REGEXP=y +CONFIG_FEATURE_MDEV_EXEC=y +CONFIG_FEATURE_MDEV_LOAD_FIRMWARE=y +CONFIG_WATCHDOG=y +CONFIG_SETSID=y +CONFIG_CTTYHACK=y +CONFIG_UDPSVD=y +CONFIG_TFTPD=y +CONFIG_IFPLUGD=y diff --git a/recipes-core/busybox/busybox/ifplugd.action b/recipes-core/busybox/busybox/ifplugd.action new file mode 100644 index 0000000..56a976b --- /dev/null +++ b/recipes-core/busybox/busybox/ifplugd.action @@ -0,0 +1,20 @@ +set -e + +#Ensure the correct values are received by the script +if [ -z "$1" ] || [ -z "$2" ] ; then +echo "Wrong arguments for ifplugd" > /dev/stderr +fi + +if [ "$2" = "up" ] +then +echo "ifplugd up" +ifup $1 +/sbin/udhcpc -D -s /usr/share/udhcpc/default.script +fi + +if [ "$2" = "down" ] +then +echo "ifplugd down" +ifdown $1 +#/sbin/ifconfig $1 down +fi diff --git a/recipes-core/busybox/busybox/ifplugd.conf b/recipes-core/busybox/busybox/ifplugd.conf new file mode 100644 index 0000000..fe213e8 --- /dev/null +++ b/recipes-core/busybox/busybox/ifplugd.conf @@ -0,0 +1,2 @@ +INTERFACES= "eth0" +ARGS="-fwI -u0 -d10" diff --git a/recipes-core/busybox/busybox/ifplugd.sh b/recipes-core/busybox/busybox/ifplugd.sh new file mode 100644 index 0000000..7ca6739 --- /dev/null +++ b/recipes-core/busybox/busybox/ifplugd.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +if [ -e /usr/sbin/ifplugd ]; then + /usr/sbin/ifplugd +fi diff --git a/recipes-core/busybox/busybox_%.bbappend b/recipes-core/busybox/busybox_%.bbappend new file mode 100644 index 0000000..9a57fdd --- /dev/null +++ b/recipes-core/busybox/busybox_%.bbappend @@ -0,0 +1,33 @@ +FILESEXTRAPATHS_prepend_stm32mpcommon := "${THISDIR}/${PN}:" + +SRC_URI_append_stm32mpcommon = " \ + file://${BUSYBOX_CONFIG_FRAGMENT} \ + file://0001-miscutils-watchdog-Add-gettimeleft.patch \ + file://ifplugd.conf \ + file://ifplugd.action \ + file://ifplugd.sh \ + " + +BUSYBOX_CONFIG_FRAGMENT_stm32mpcommon = "busybox-stm32mp.cfg" + +#inherit update-rc.d +DEPENDS_append_stm32mpcommon = " ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '', 'update-rc.d-native', d)}" + +do_configure_append_stm32mpcommon () { + # merge specific configuration to newly generated .config + merge_config.sh -m -r -O ${B} ${B}/.config ${WORKDIR}/${BUSYBOX_CONFIG_FRAGMENT} 1>&2 + # make sure to generate proper config file for busybox + cml1_do_configure +} + +do_install_append_stm32mpcommon () { + if [ "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '1', '0', d)}" = "0" ]; then + if grep -q "CONFIG_IFPLUGD=y" ${B}/.config; then + install -d ${D}${sysconfdir}/ifplugd + install -m 755 ${WORKDIR}/ifplugd.sh ${D}${sysconfdir}/init.d/ifplugd.sh + update-rc.d -r ${D} ifplugd.sh start 99 2 3 4 5 . + install -m 755 ${WORKDIR}/ifplugd.conf ${D}${sysconfdir}/ifplugd/ifplugd.conf + install -m 755 ${WORKDIR}/ifplugd.action ${D}${sysconfdir}/ifplugd/ifplugd.action + fi + fi +}