Allow a single DHCP configuration via the system configuration submenu
This patch allows the setup of simple a single interface to be automatically brought up and configured via DHCP on system startup. The interface name can be set via a configuration option. This patch does not support systemd-networkd, any complex network configuration should be done via overlay of /etc/network/interfaces or the relevant networkd configuration file [Peter: rename to BR2_SYSTEM_DHCP, tweak help text & implementation] Signed-off-by: Jérémy Rosen <jeremy.rosen@openwide.fr> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
This commit is contained in:
parent
d538b8bf93
commit
f4f62a3c16
@ -326,6 +326,26 @@ config BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW
|
|||||||
|
|
||||||
endif # BR2_ROOTFS_SKELETON_DEFAULT
|
endif # BR2_ROOTFS_SKELETON_DEFAULT
|
||||||
|
|
||||||
|
|
||||||
|
config BR2_SYSTEM_DHCP
|
||||||
|
string "Network interface to configure through DHCP"
|
||||||
|
default ""
|
||||||
|
depends on !BR2_PACKAGE_SYSTEMD_NETWORKD && (BR2_PACKAGE_BUSYBOX || BR2_PACKAGE_IFUPDOWN)
|
||||||
|
help
|
||||||
|
Enter here the name of the network interface (E.G. eth0) to
|
||||||
|
automatically configure through DHCP at bootup.
|
||||||
|
|
||||||
|
If left empty, no automatic DHCP requests will take place.
|
||||||
|
|
||||||
|
For more complicated network setups use an overlay to overwrite
|
||||||
|
/etc/network/interfaces or add a networkd configuration file.
|
||||||
|
|
||||||
|
comment "automatic network configuration via DHCP is not compatible with networkd"
|
||||||
|
depends on BR2_PACKAGE_SYSTEMD_NETWORKD
|
||||||
|
|
||||||
|
comment "automatic network configuration via DHCP needs ifupdown or busybox"
|
||||||
|
depends on !(BR2_PACKAGE_BUSYBOX || BR2_PACKAGE_IFUPDOWN)
|
||||||
|
|
||||||
config BR2_TARGET_TZ_INFO
|
config BR2_TARGET_TZ_INFO
|
||||||
bool "Install timezone info"
|
bool "Install timezone info"
|
||||||
# No timezone for musl; only for uClibc or (e)glibc.
|
# No timezone for musl; only for uClibc or (e)glibc.
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
# Configure Loopback
|
|
||||||
auto lo
|
|
||||||
iface lo inet loopback
|
|
||||||
|
|
@ -38,6 +38,35 @@ ifneq ($(TARGET_GENERIC_ROOT_PASSWD),)
|
|||||||
TARGETS += host-mkpasswd
|
TARGETS += host-mkpasswd
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
define SET_NETWORK_LOCALHOST
|
||||||
|
( \
|
||||||
|
echo "# interface file auto-generated by buildroot"; \
|
||||||
|
echo ; \
|
||||||
|
echo "auto lo"; \
|
||||||
|
echo "iface lo inet loopback"; \
|
||||||
|
) > $(TARGET_DIR)/etc/network/interfaces
|
||||||
|
endef
|
||||||
|
|
||||||
|
NETWORK_DHCP_IFACE = $(call qstrip,$(BR2_SYSTEM_DHCP))
|
||||||
|
|
||||||
|
ifneq ($(NETWORK_DHCP_IFACE),)
|
||||||
|
define SET_NETWORK_DHCP
|
||||||
|
( \
|
||||||
|
echo ; \
|
||||||
|
echo "auto $(NETWORK_DHCP_IFACE)"; \
|
||||||
|
echo "iface $(NETWORK_DHCP_IFACE) inet dhcp"; \
|
||||||
|
) >> $(TARGET_DIR)/etc/network/interfaces
|
||||||
|
endef
|
||||||
|
endif
|
||||||
|
|
||||||
|
define SET_NETWORK
|
||||||
|
mkdir -p $(TARGET_DIR)/etc/network/
|
||||||
|
$(SET_NETWORK_LOCALHOST)
|
||||||
|
$(SET_NETWORK_DHCP)
|
||||||
|
endef
|
||||||
|
|
||||||
|
TARGET_FINALIZE_HOOKS += SET_NETWORK
|
||||||
|
|
||||||
ifeq ($(BR2_ROOTFS_SKELETON_DEFAULT),y)
|
ifeq ($(BR2_ROOTFS_SKELETON_DEFAULT),y)
|
||||||
|
|
||||||
define SYSTEM_ROOT_PASSWD
|
define SYSTEM_ROOT_PASSWD
|
||||||
|
Loading…
Reference in New Issue
Block a user