Message ID | 1542388417-21123-1-git-send-email-diego.rondini@kynetics.com |
---|---|
State | Accepted |
Headers | show |
Series | [meta-swupdate] initscripts-swupdate: define virtual package | expand |
Hi Diego, On 16/11/18 18:13, Diego Rondini wrote: > Define virtual/initscripts-swupdate so that different packages can runtime > provide (RPROVIDES) a different implementation. Rename existing implementation > to initscripts-swupdate-usb. > Ok - I thought the current implementation as a single use case where a rescue is started by inserting a US stick. Of course, more as one use case is possible, and I welcome further initscripts-swupdate-* into mainline. Acked-by: Stefano Babic <sbabic@denx.de> Best regards, Stefano Babic > Signed-off-by: Diego Rondini <diego.rondini@kynetics.com> > --- > .../initscripts-swupdate-usb.bb | 25 +++++++ > .../initscripts-swupdate-usb/rcS.swupdate | 77 ++++++++++++++++++++++ > .../initscripts-swupdate/initscripts-swupdate.bb | 23 ------- > .../initscripts-swupdate/rcS.swupdate | 77 ---------------------- > recipes-extended/images/swupdate-image.inc | 2 +- > 5 files changed, 103 insertions(+), 101 deletions(-) > create mode 100644 recipes-core/initscripts-swupdate/initscripts-swupdate-usb.bb > create mode 100755 recipes-core/initscripts-swupdate/initscripts-swupdate-usb/rcS.swupdate > delete mode 100644 recipes-core/initscripts-swupdate/initscripts-swupdate.bb > delete mode 100755 recipes-core/initscripts-swupdate/initscripts-swupdate/rcS.swupdate > > diff --git a/recipes-core/initscripts-swupdate/initscripts-swupdate-usb.bb b/recipes-core/initscripts-swupdate/initscripts-swupdate-usb.bb > new file mode 100644 > index 0000000..774552e > --- /dev/null > +++ b/recipes-core/initscripts-swupdate/initscripts-swupdate-usb.bb > @@ -0,0 +1,25 @@ > +SUMMARY = "Different startup scripts" > +SECTION = "base" > +PR = "r0" > +LICENSE = "MIT" > +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" > + > +SRC_URI = "file://rcS.swupdate \ > + " > + > +RPROVIDES_${PN} += "virtual/initscripts-swupdate" > + > +S = "${WORKDIR}" > + > +do_install () { > + install -d ${D}/${sysconfdir}/init.d > + install -d ${D}${base_sbindir} > + install -m 755 ${S}/rcS.swupdate ${D}${base_sbindir}/init > +} > + > +PACKAGES = "${PN}" > +FILES_${PN} = "/" > + > +PACKAGE_ARCH = "all" > + > +CONFFILES_${PN} = "" > diff --git a/recipes-core/initscripts-swupdate/initscripts-swupdate-usb/rcS.swupdate b/recipes-core/initscripts-swupdate/initscripts-swupdate-usb/rcS.swupdate > new file mode 100755 > index 0000000..6b53533 > --- /dev/null > +++ b/recipes-core/initscripts-swupdate/initscripts-swupdate-usb/rcS.swupdate > @@ -0,0 +1,77 @@ > +#!/bin/sh > + > +PATH=/sbin:/bin:/usr/sbin:/usr/bin > +USB=/mnt > + > +umask 022 > +mount -t proc proc /proc > +mount sysfs /sys -t sysfs > +if [ -e /proc/cpu/alignment ]; then > + echo "3" > /proc/cpu/alignment > +fi > + > +echo 0 > /proc/sys/kernel/printk > +echo 100 > /sys/class/backlight/pwm-backlight/brightness > + > +mount_usb() { > +found=0 > +for i in /dev/sda?;do > + if [ $i == "/dev/sda?" ];then > + break > + fi > + mount $i ${USB} 2>/dev/null > + > + if [ $? != 0 ];then > + continue > + fi > + > + return 0 > +done > + > +# Try to mount a USB without partition table > + mount /dev/sda ${USB} 2>/dev/null > + return $? > + > +} > + > +rotation=0 > +if [ -e /etc/rotation ]; then > + read rotation < /etc/rotation > +fi > + > + > +# wait until the device node is created > + > +echo "Checking for application software" > +echo "---------------------------------" > +echo " " > + > +cp /etc/fw_env.config /tmp/. > + > +while [ 1 ];do > + echo "Waiting for USB Pen..." > + sleep 3 > + > + mount_usb > + if [ $? == 0 ];then > + break > + fi > +done > + > +echo " " > +echo "Starting Software Update" > +echo "------------------------" > +swupdate -i "${USB}/*.swu" -v > +if [ $? == 0 ];then > + echo "SUCCESS !" > +else > + echo "FAILURE !" > +fi > + > +while [ 1 ]; do > + echo "Please reboot the system !" > + sleep 90 > + reboot > +done > + > +exit 0 > diff --git a/recipes-core/initscripts-swupdate/initscripts-swupdate.bb b/recipes-core/initscripts-swupdate/initscripts-swupdate.bb > deleted file mode 100644 > index e9ec6f2..0000000 > --- a/recipes-core/initscripts-swupdate/initscripts-swupdate.bb > +++ /dev/null > @@ -1,23 +0,0 @@ > -SUMMARY = "Different startup scripts" > -SECTION = "base" > -PR = "r0" > -LICENSE = "MIT" > -LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" > - > -SRC_URI = "file://rcS.swupdate \ > - " > - > -S = "${WORKDIR}" > - > -do_install () { > - install -d ${D}/${sysconfdir}/init.d > - install -d ${D}${base_sbindir} > - install -m 755 ${S}/rcS.swupdate ${D}${base_sbindir}/init > -} > - > -PACKAGES = "${PN}" > -FILES_${PN} = "/" > - > -PACKAGE_ARCH = "${MACHINE_ARCH}" > - > -CONFFILES_${PN} = "" > diff --git a/recipes-core/initscripts-swupdate/initscripts-swupdate/rcS.swupdate b/recipes-core/initscripts-swupdate/initscripts-swupdate/rcS.swupdate > deleted file mode 100755 > index 6b53533..0000000 > --- a/recipes-core/initscripts-swupdate/initscripts-swupdate/rcS.swupdate > +++ /dev/null > @@ -1,77 +0,0 @@ > -#!/bin/sh > - > -PATH=/sbin:/bin:/usr/sbin:/usr/bin > -USB=/mnt > - > -umask 022 > -mount -t proc proc /proc > -mount sysfs /sys -t sysfs > -if [ -e /proc/cpu/alignment ]; then > - echo "3" > /proc/cpu/alignment > -fi > - > -echo 0 > /proc/sys/kernel/printk > -echo 100 > /sys/class/backlight/pwm-backlight/brightness > - > -mount_usb() { > -found=0 > -for i in /dev/sda?;do > - if [ $i == "/dev/sda?" ];then > - break > - fi > - mount $i ${USB} 2>/dev/null > - > - if [ $? != 0 ];then > - continue > - fi > - > - return 0 > -done > - > -# Try to mount a USB without partition table > - mount /dev/sda ${USB} 2>/dev/null > - return $? > - > -} > - > -rotation=0 > -if [ -e /etc/rotation ]; then > - read rotation < /etc/rotation > -fi > - > - > -# wait until the device node is created > - > -echo "Checking for application software" > -echo "---------------------------------" > -echo " " > - > -cp /etc/fw_env.config /tmp/. > - > -while [ 1 ];do > - echo "Waiting for USB Pen..." > - sleep 3 > - > - mount_usb > - if [ $? == 0 ];then > - break > - fi > -done > - > -echo " " > -echo "Starting Software Update" > -echo "------------------------" > -swupdate -i "${USB}/*.swu" -v > -if [ $? == 0 ];then > - echo "SUCCESS !" > -else > - echo "FAILURE !" > -fi > - > -while [ 1 ]; do > - echo "Please reboot the system !" > - sleep 90 > - reboot > -done > - > -exit 0 > diff --git a/recipes-extended/images/swupdate-image.inc b/recipes-extended/images/swupdate-image.inc > index 3ef94b1..2fa66c7 100644 > --- a/recipes-extended/images/swupdate-image.inc > +++ b/recipes-extended/images/swupdate-image.inc > @@ -12,7 +12,7 @@ IMAGE_INSTALL = "base-files \ > libconfig \ > swupdate \ > swupdate-www \ > - ${@bb.utils.contains('SWUPDATE_INIT', 'tiny', 'initscripts-swupdate', 'initscripts sysvinit', d)} \ > + ${@bb.utils.contains('SWUPDATE_INIT', 'tiny', 'virtual/initscripts-swupdate', 'initscripts sysvinit', d)} \ > util-linux-sfdisk \ > " > >
diff --git a/recipes-core/initscripts-swupdate/initscripts-swupdate-usb.bb b/recipes-core/initscripts-swupdate/initscripts-swupdate-usb.bb new file mode 100644 index 0000000..774552e --- /dev/null +++ b/recipes-core/initscripts-swupdate/initscripts-swupdate-usb.bb @@ -0,0 +1,25 @@ +SUMMARY = "Different startup scripts" +SECTION = "base" +PR = "r0" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" + +SRC_URI = "file://rcS.swupdate \ + " + +RPROVIDES_${PN} += "virtual/initscripts-swupdate" + +S = "${WORKDIR}" + +do_install () { + install -d ${D}/${sysconfdir}/init.d + install -d ${D}${base_sbindir} + install -m 755 ${S}/rcS.swupdate ${D}${base_sbindir}/init +} + +PACKAGES = "${PN}" +FILES_${PN} = "/" + +PACKAGE_ARCH = "all" + +CONFFILES_${PN} = "" diff --git a/recipes-core/initscripts-swupdate/initscripts-swupdate-usb/rcS.swupdate b/recipes-core/initscripts-swupdate/initscripts-swupdate-usb/rcS.swupdate new file mode 100755 index 0000000..6b53533 --- /dev/null +++ b/recipes-core/initscripts-swupdate/initscripts-swupdate-usb/rcS.swupdate @@ -0,0 +1,77 @@ +#!/bin/sh + +PATH=/sbin:/bin:/usr/sbin:/usr/bin +USB=/mnt + +umask 022 +mount -t proc proc /proc +mount sysfs /sys -t sysfs +if [ -e /proc/cpu/alignment ]; then + echo "3" > /proc/cpu/alignment +fi + +echo 0 > /proc/sys/kernel/printk +echo 100 > /sys/class/backlight/pwm-backlight/brightness + +mount_usb() { +found=0 +for i in /dev/sda?;do + if [ $i == "/dev/sda?" ];then + break + fi + mount $i ${USB} 2>/dev/null + + if [ $? != 0 ];then + continue + fi + + return 0 +done + +# Try to mount a USB without partition table + mount /dev/sda ${USB} 2>/dev/null + return $? + +} + +rotation=0 +if [ -e /etc/rotation ]; then + read rotation < /etc/rotation +fi + + +# wait until the device node is created + +echo "Checking for application software" +echo "---------------------------------" +echo " " + +cp /etc/fw_env.config /tmp/. + +while [ 1 ];do + echo "Waiting for USB Pen..." + sleep 3 + + mount_usb + if [ $? == 0 ];then + break + fi +done + +echo " " +echo "Starting Software Update" +echo "------------------------" +swupdate -i "${USB}/*.swu" -v +if [ $? == 0 ];then + echo "SUCCESS !" +else + echo "FAILURE !" +fi + +while [ 1 ]; do + echo "Please reboot the system !" + sleep 90 + reboot +done + +exit 0 diff --git a/recipes-core/initscripts-swupdate/initscripts-swupdate.bb b/recipes-core/initscripts-swupdate/initscripts-swupdate.bb deleted file mode 100644 index e9ec6f2..0000000 --- a/recipes-core/initscripts-swupdate/initscripts-swupdate.bb +++ /dev/null @@ -1,23 +0,0 @@ -SUMMARY = "Different startup scripts" -SECTION = "base" -PR = "r0" -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" - -SRC_URI = "file://rcS.swupdate \ - " - -S = "${WORKDIR}" - -do_install () { - install -d ${D}/${sysconfdir}/init.d - install -d ${D}${base_sbindir} - install -m 755 ${S}/rcS.swupdate ${D}${base_sbindir}/init -} - -PACKAGES = "${PN}" -FILES_${PN} = "/" - -PACKAGE_ARCH = "${MACHINE_ARCH}" - -CONFFILES_${PN} = "" diff --git a/recipes-core/initscripts-swupdate/initscripts-swupdate/rcS.swupdate b/recipes-core/initscripts-swupdate/initscripts-swupdate/rcS.swupdate deleted file mode 100755 index 6b53533..0000000 --- a/recipes-core/initscripts-swupdate/initscripts-swupdate/rcS.swupdate +++ /dev/null @@ -1,77 +0,0 @@ -#!/bin/sh - -PATH=/sbin:/bin:/usr/sbin:/usr/bin -USB=/mnt - -umask 022 -mount -t proc proc /proc -mount sysfs /sys -t sysfs -if [ -e /proc/cpu/alignment ]; then - echo "3" > /proc/cpu/alignment -fi - -echo 0 > /proc/sys/kernel/printk -echo 100 > /sys/class/backlight/pwm-backlight/brightness - -mount_usb() { -found=0 -for i in /dev/sda?;do - if [ $i == "/dev/sda?" ];then - break - fi - mount $i ${USB} 2>/dev/null - - if [ $? != 0 ];then - continue - fi - - return 0 -done - -# Try to mount a USB without partition table - mount /dev/sda ${USB} 2>/dev/null - return $? - -} - -rotation=0 -if [ -e /etc/rotation ]; then - read rotation < /etc/rotation -fi - - -# wait until the device node is created - -echo "Checking for application software" -echo "---------------------------------" -echo " " - -cp /etc/fw_env.config /tmp/. - -while [ 1 ];do - echo "Waiting for USB Pen..." - sleep 3 - - mount_usb - if [ $? == 0 ];then - break - fi -done - -echo " " -echo "Starting Software Update" -echo "------------------------" -swupdate -i "${USB}/*.swu" -v -if [ $? == 0 ];then - echo "SUCCESS !" -else - echo "FAILURE !" -fi - -while [ 1 ]; do - echo "Please reboot the system !" - sleep 90 - reboot -done - -exit 0 diff --git a/recipes-extended/images/swupdate-image.inc b/recipes-extended/images/swupdate-image.inc index 3ef94b1..2fa66c7 100644 --- a/recipes-extended/images/swupdate-image.inc +++ b/recipes-extended/images/swupdate-image.inc @@ -12,7 +12,7 @@ IMAGE_INSTALL = "base-files \ libconfig \ swupdate \ swupdate-www \ - ${@bb.utils.contains('SWUPDATE_INIT', 'tiny', 'initscripts-swupdate', 'initscripts sysvinit', d)} \ + ${@bb.utils.contains('SWUPDATE_INIT', 'tiny', 'virtual/initscripts-swupdate', 'initscripts sysvinit', d)} \ util-linux-sfdisk \ "
Define virtual/initscripts-swupdate so that different packages can runtime provide (RPROVIDES) a different implementation. Rename existing implementation to initscripts-swupdate-usb. Signed-off-by: Diego Rondini <diego.rondini@kynetics.com> --- .../initscripts-swupdate-usb.bb | 25 +++++++ .../initscripts-swupdate-usb/rcS.swupdate | 77 ++++++++++++++++++++++ .../initscripts-swupdate/initscripts-swupdate.bb | 23 ------- .../initscripts-swupdate/rcS.swupdate | 77 ---------------------- recipes-extended/images/swupdate-image.inc | 2 +- 5 files changed, 103 insertions(+), 101 deletions(-) create mode 100644 recipes-core/initscripts-swupdate/initscripts-swupdate-usb.bb create mode 100755 recipes-core/initscripts-swupdate/initscripts-swupdate-usb/rcS.swupdate delete mode 100644 recipes-core/initscripts-swupdate/initscripts-swupdate.bb delete mode 100755 recipes-core/initscripts-swupdate/initscripts-swupdate/rcS.swupdate