recipies-devtools: Add net-kexec package

This installs a script which is able to kexec a kernel through the network from
user space. As the proprietary bootloader is limited and does not offer such a
feature, this is a good alternative for developers.
This commit is contained in:
Romain Perier 2014-09-28 11:46:39 +00:00
parent 1cab262f9e
commit 57b071ccaa
2 changed files with 47 additions and 0 deletions

View File

@ -0,0 +1,27 @@
#!/bin/sh
# Copyright (C) 2014 Romain Perier <romain.perier@gmail.com>
# Released under the MIT license (see COPYING.MIT for the terms)
GATEWAY=$(route | grep default | sed 's/ [ ]*/:/g' | cut -d ':' -f 2)
fail() {
echo $1
exit 1
}
# If we are not already connected, connect eth0 with DHCP
ifconfig eth0 | grep 'inet addr:[0-9]*\.[0-9]*\.[0-9]*\.[0-9]* ' >/dev/null
if [ $? -ne 0 ]; then
echo "* Starting DHCP on eth0"
udhcpc -n -i eth0 || fail "Unable to establish a DHCP session with eth0"
fi
tftp -g -r zImage $GATEWAY >/dev/null || fail "Unable to get zImage throught TFTP"
echo "* Found zImage on $TFTP_SERVER"
echo -n "Do you want to reboot to the new kernel on the fly ? [y/n] "
read boot
if [ "$boot" = "y" ]; then
kexec -l zImage
kexec -e
fi

View File

@ -0,0 +1,20 @@
# Copyright (C) 2014 Romain Perier <romain.perier@gmail.com>
# Released under the MIT license (see COPYING.MIT for the terms)
SUMMARY = "Extremely basic script to kexec over the network"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
SRC_URI = "file://net-kexec.sh"
PR = "r1"
RDEPENDS_${PN} += "kexec"
do_install() {
install -d ${D}/sbin
install -m 0755 ${WORKDIR}/net-kexec.sh ${D}/sbin/net-kexec
}
inherit allarch
FILES_${PN} += "/sbin/net-kexec"