mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-08-01 21:23:51 -09:00
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:
committed by
Peter Korsgaard
parent
d538b8bf93
commit
f4f62a3c16
@@ -38,6 +38,35 @@ ifneq ($(TARGET_GENERIC_ROOT_PASSWD),)
|
||||
TARGETS += host-mkpasswd
|
||||
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)
|
||||
|
||||
define SYSTEM_ROOT_PASSWD
|
||||
|
||||
Reference in New Issue
Block a user