mirror of
https://git.yoctoproject.org/poky
synced 2026-09-24 22:36:21 +02:00
connman-conf: do nothing in qemu, do not touch eth0
qemu kernel itself is nowdays perfectly capable of setting up
what was passed in via ip=:
[ 1.676847] IP-Config: Complete:
[ 1.677768] device=eth0, hwaddr=52:54:00:12:34:02, ipaddr=192.168.7.2, mask=255.255.255.0, gw=192.168.7.1
[ 1.679933] host=192.168.7.2, domain=, nis-domain=(none)
[ 1.681201] bootserver=255.255.255.255, rootserver=255.255.255.255, rootpath=
[ 1.681203] nameserver0=8.8.8.8
connman-conf only does the same thing again by (badly and incompletely)
parsing those parameters with sed.
(From OE-Core rev: 3c25b89720417a7b1963f0a32c870208a5803950)
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
d907c29262
commit
a8e6024a02
@@ -1,36 +1,19 @@
|
|||||||
SUMMARY = "Connman config to setup wired interface on qemu machines"
|
SUMMARY = "Connman config to ignore wired interface on qemu machines"
|
||||||
DESCRIPTION = "This is the ConnMan configuration to set up a Wired \
|
DESCRIPTION = "This is the ConnMan configuration to avoid touching wired \
|
||||||
network interface for a qemu machine."
|
network interface inside qemu machines."
|
||||||
LICENSE = "GPLv2"
|
LICENSE = "GPLv2"
|
||||||
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6"
|
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6"
|
||||||
|
|
||||||
inherit systemd
|
|
||||||
|
|
||||||
SRC_URI:append:qemuall = " file://wired.config \
|
|
||||||
file://wired-setup \
|
|
||||||
file://wired-connection.service \
|
|
||||||
"
|
|
||||||
PR = "r2"
|
PR = "r2"
|
||||||
|
|
||||||
S = "${WORKDIR}"
|
S = "${WORKDIR}"
|
||||||
|
|
||||||
PACKAGE_ARCH = "${MACHINE_ARCH}"
|
PACKAGE_ARCH = "${MACHINE_ARCH}"
|
||||||
|
|
||||||
FILES:${PN} = "${localstatedir}/* ${datadir}/*"
|
FILES:${PN} = "${sysconfdir}/*"
|
||||||
|
|
||||||
do_install() {
|
# Kernel IP-Config is perfectly capable of setting up networking passed in via ip=
|
||||||
#Configure Wired network interface in case of qemu* machines
|
do_install:append:qemuall() {
|
||||||
if test -e ${WORKDIR}/wired.config &&
|
mkdir -p ${D}${sysconfdir}/default
|
||||||
test -e ${WORKDIR}/wired-setup &&
|
echo "export EXTRA_PARAM=\"-I eth0\"" > ${D}${sysconfdir}/default/connman
|
||||||
test -e ${WORKDIR}/wired-connection.service; then
|
|
||||||
install -d ${D}${localstatedir}/lib/connman
|
|
||||||
install -m 0644 ${WORKDIR}/wired.config ${D}${localstatedir}/lib/connman
|
|
||||||
install -d ${D}${datadir}/connman
|
|
||||||
install -m 0755 ${WORKDIR}/wired-setup ${D}${datadir}/connman
|
|
||||||
install -d ${D}${systemd_system_unitdir}
|
|
||||||
install -m 0644 ${WORKDIR}/wired-connection.service ${D}${systemd_system_unitdir}
|
|
||||||
sed -i -e 's|@SCRIPTDIR@|${datadir}/connman|g' ${D}${systemd_system_unitdir}/wired-connection.service
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SYSTEMD_SERVICE:${PN}:qemuall = "wired-connection.service"
|
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
[Unit]
|
|
||||||
Description=Setup a wired interface
|
|
||||||
Before=connman.service
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=oneshot
|
|
||||||
ExecStart=@SCRIPTDIR@/wired-setup
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=network.target
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
CONFIGF=/var/lib/connman/wired.config
|
|
||||||
|
|
||||||
# Extract wired network config from /proc/cmdline
|
|
||||||
NET_CONF=`cat /proc/cmdline |sed -ne 's/^.*ip=\([^ ]*\):\([^ ]*\):\([^ ]*\):\([^ ]*\).*$/\1\/\4\/\3/p'`
|
|
||||||
|
|
||||||
# Check if eth0 is already set via kernel cmdline
|
|
||||||
if [ "x$NET_CONF" = "x" ]; then
|
|
||||||
# Wired interface is not configured via kernel cmdline
|
|
||||||
# Remove connman config file template
|
|
||||||
rm -f ${CONFIGF}
|
|
||||||
else
|
|
||||||
# Setup a connman config accordingly
|
|
||||||
sed -i -e "s|^IPv4 =.*|IPv4 = ${NET_CONF}|" ${CONFIGF}
|
|
||||||
fi
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
[global]
|
|
||||||
Name = Wired
|
|
||||||
Description = Wired network configuration
|
|
||||||
|
|
||||||
[service_ethernet]
|
|
||||||
Type = ethernet
|
|
||||||
IPv4 =
|
|
||||||
MAC = 52:54:00:12:34:56
|
|
||||||
Nameservers = 8.8.8.8
|
|
||||||
@@ -27,7 +27,6 @@ while read dev mtpt fstype rest; do
|
|||||||
done
|
done
|
||||||
|
|
||||||
do_start() {
|
do_start() {
|
||||||
EXTRA_PARAM=""
|
|
||||||
if test $nfsroot -eq 1 ; then
|
if test $nfsroot -eq 1 ; then
|
||||||
NET_DEVS=`cat /proc/net/dev | sed -ne 's/^\([a-zA-Z0-9 ]*\):.*$/\1/p'`
|
NET_DEVS=`cat /proc/net/dev | sed -ne 's/^\([a-zA-Z0-9 ]*\):.*$/\1/p'`
|
||||||
NET_ADDR=`cat /proc/cmdline | sed -ne 's/^.*ip=\([^ :]*\).*$/\1/p'`
|
NET_ADDR=`cat /proc/cmdline | sed -ne 's/^.*ip=\([^ :]*\).*$/\1/p'`
|
||||||
@@ -36,13 +35,13 @@ do_start() {
|
|||||||
if [ "$NET_ADDR" = dhcp ]; then
|
if [ "$NET_ADDR" = dhcp ]; then
|
||||||
ethn=`ifconfig | grep "^eth" | sed -e "s/\(eth[0-9]\)\(.*\)/\1/"`
|
ethn=`ifconfig | grep "^eth" | sed -e "s/\(eth[0-9]\)\(.*\)/\1/"`
|
||||||
if [ ! -z "$ethn" ]; then
|
if [ ! -z "$ethn" ]; then
|
||||||
EXTRA_PARAM="-I $ethn"
|
EXTRA_PARAM="$EXTRA_PARAM -I $ethn"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
for i in $NET_DEVS; do
|
for i in $NET_DEVS; do
|
||||||
ADDR=`ifconfig $i | sed 's/addr://g' | sed -ne 's/^.*inet \([0-9.]*\) .*$/\1/p'`
|
ADDR=`ifconfig $i | sed 's/addr://g' | sed -ne 's/^.*inet \([0-9.]*\) .*$/\1/p'`
|
||||||
if [ "$NET_ADDR" = "$ADDR" ]; then
|
if [ "$NET_ADDR" = "$ADDR" ]; then
|
||||||
EXTRA_PARAM="-I $i"
|
EXTRA_PARAM="$EXTRA_PARAM -I $i"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|||||||
Reference in New Issue
Block a user