Bump buidlroot version to 2018.02.6
This commit is contained in:
7
bsp/buildroot/package/ifupdown-scripts/Config.in
Normal file
7
bsp/buildroot/package/ifupdown-scripts/Config.in
Normal file
@@ -0,0 +1,7 @@
|
||||
config BR2_PACKAGE_IFUPDOWN_SCRIPTS
|
||||
bool "ifupdown scripts"
|
||||
default y if BR2_ROOTFS_SKELETON_DEFAULT
|
||||
depends on !BR2_PACKAGE_SYSTEMD_NETWORKD
|
||||
help
|
||||
Set of scripts used by ifupdown (either the standalone one,
|
||||
or the busybox one) to bring network up, or tear it down.
|
||||
30
bsp/buildroot/package/ifupdown-scripts/S40network
Executable file
30
bsp/buildroot/package/ifupdown-scripts/S40network
Executable file
@@ -0,0 +1,30 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Start the network....
|
||||
#
|
||||
|
||||
# Debian ifupdown needs the /run/network lock directory
|
||||
mkdir -p /run/network
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
printf "Starting network: "
|
||||
/sbin/ifup -a
|
||||
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
||||
;;
|
||||
stop)
|
||||
printf "Stopping network: "
|
||||
/sbin/ifdown -a
|
||||
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
||||
;;
|
||||
restart|reload)
|
||||
"$0" stop
|
||||
"$0" start
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit $?
|
||||
|
||||
55
bsp/buildroot/package/ifupdown-scripts/ifupdown-scripts.mk
Normal file
55
bsp/buildroot/package/ifupdown-scripts/ifupdown-scripts.mk
Normal file
@@ -0,0 +1,55 @@
|
||||
################################################################################
|
||||
#
|
||||
# ifupdown-scripts
|
||||
#
|
||||
################################################################################
|
||||
|
||||
define IFUPDOWN_SCRIPTS_LOCALHOST
|
||||
( \
|
||||
echo "# interface file auto-generated by buildroot"; \
|
||||
echo ; \
|
||||
echo "auto lo"; \
|
||||
echo "iface lo inet loopback"; \
|
||||
) > $(TARGET_DIR)/etc/network/interfaces
|
||||
endef
|
||||
|
||||
IFUPDOWN_SCRIPTS_DHCP_IFACE = $(call qstrip,$(BR2_SYSTEM_DHCP))
|
||||
|
||||
ifneq ($(IFUPDOWN_SCRIPTS_DHCP_IFACE),)
|
||||
define IFUPDOWN_SCRIPTS_DHCP
|
||||
( \
|
||||
echo ; \
|
||||
echo "auto $(IFUPDOWN_SCRIPTS_DHCP_IFACE)"; \
|
||||
echo "iface $(IFUPDOWN_SCRIPTS_DHCP_IFACE) inet dhcp"; \
|
||||
echo " pre-up /etc/network/nfs_check"; \
|
||||
echo " wait-delay 15"; \
|
||||
) >> $(TARGET_DIR)/etc/network/interfaces
|
||||
$(INSTALL) -m 0755 -D $(IFUPDOWN_SCRIPTS_PKGDIR)/nfs_check \
|
||||
$(TARGET_DIR)/etc/network/nfs_check
|
||||
endef
|
||||
endif
|
||||
|
||||
define IFUPDOWN_SCRIPTS_INSTALL_TARGET_CMDS
|
||||
mkdir -p $(TARGET_DIR)/etc/network
|
||||
$(call SYSTEM_RSYNC,$(IFUPDOWN_SCRIPTS_PKGDIR)/network,$(TARGET_DIR)/etc/network)
|
||||
$(IFUPDOWN_SCRIPTS_LOCALHOST)
|
||||
$(IFUPDOWN_SCRIPTS_DHCP)
|
||||
endef
|
||||
|
||||
define IFUPDOWN_SCRIPTS_INSTALL_INIT_SYSV
|
||||
$(INSTALL) -D -m 0755 $(IFUPDOWN_SCRIPTS_PKGDIR)/S40network \
|
||||
$(TARGET_DIR)/etc/init.d/S40network
|
||||
endef
|
||||
|
||||
# ifupdown-scripts can not be selected when systemd-networkd is
|
||||
# enabled, so if we are enabled with systemd, we must install our
|
||||
# own service file.
|
||||
define IFUPDOWN_SCRIPTS_INSTALL_INIT_SYSTEMD
|
||||
$(INSTALL) -D -m 644 $(IFUPDOWN_SCRIPTS_PKGDIR)/network.service \
|
||||
$(TARGET_DIR)/etc/systemd/system/network.service
|
||||
mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
|
||||
ln -fs ../network.service \
|
||||
$(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/network.service
|
||||
endef
|
||||
|
||||
$(eval $(generic-package))
|
||||
21
bsp/buildroot/package/ifupdown-scripts/network.service
Normal file
21
bsp/buildroot/package/ifupdown-scripts/network.service
Normal file
@@ -0,0 +1,21 @@
|
||||
[Unit]
|
||||
Description=Network Connectivity
|
||||
Wants=network.target
|
||||
Before=network.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
|
||||
# lo is brought up earlier, which will cause the upcoming "ifup -a" to fail
|
||||
# with exit code 1, due to an "ip: RTNETLINK answers: File exists" error during
|
||||
# its "ip addr add ..." command, subsequently causing this unit to fail even
|
||||
# though it is a benign error. Flushing the lo address with the command below
|
||||
# before ifup prevents this failure.
|
||||
ExecStart=/sbin/ip addr flush dev lo
|
||||
|
||||
ExecStart=/sbin/ifup -a
|
||||
ExecStop=/sbin/ifdown -a
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
21
bsp/buildroot/package/ifupdown-scripts/network/if-pre-up.d/wait_iface
Executable file
21
bsp/buildroot/package/ifupdown-scripts/network/if-pre-up.d/wait_iface
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
|
||||
# In case we have a slow-to-appear interface (e.g. eth-over-USB),
|
||||
# and we need to configure it, wait until it appears, but not too
|
||||
# long either. IF_WAIT_DELAY is in seconds.
|
||||
|
||||
if [ "${IF_WAIT_DELAY}" -a ! -e "/sys/class/net/${IFACE}" ]; then
|
||||
printf "Waiting for interface %s to appear" "${IFACE}"
|
||||
while [ ${IF_WAIT_DELAY} -gt 0 ]; do
|
||||
if [ -e "/sys/class/net/${IFACE}" ]; then
|
||||
printf "\n"
|
||||
exit 0
|
||||
fi
|
||||
sleep 1
|
||||
printf "."
|
||||
: $((IF_WAIT_DELAY -= 1))
|
||||
done
|
||||
printf " timeout!\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
20
bsp/buildroot/package/ifupdown-scripts/nfs_check
Executable file
20
bsp/buildroot/package/ifupdown-scripts/nfs_check
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
|
||||
# This allows NFS booting to work while also being able to configure
|
||||
# the network interface via DHCP when not NFS booting. Otherwise, a
|
||||
# NFS booted system will likely hang during DHCP configuration.
|
||||
|
||||
# Attempting to configure the network interface used for NFS will
|
||||
# initially bring that network down. Since the root filesystem is
|
||||
# accessed over this network, the system hangs.
|
||||
|
||||
# This script is run by ifup and will attempt to detect if a NFS root
|
||||
# mount uses the interface to be configured (IFACE), and if so does
|
||||
# not configure it. This should allow the same build to be disk/flash
|
||||
# booted or NFS booted.
|
||||
|
||||
nfsip=`sed -n '/^[^ ]*:.* \/ nfs.*[ ,]addr=\([0-9.]\+\).*/s//\1/p' /proc/mounts`
|
||||
if [ -n "$nfsip" ] && ip route get to "$nfsip" | grep -q "dev $IFACE"; then
|
||||
echo Skipping $IFACE, used for NFS from $nfsip
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user