From: thln <th.ln@ap3.fr>
To: buildroot@busybox.net
Subject: [Buildroot] Network configuration form buildroot menu (dhcp + static ip)
Date: Tue, 07 Apr 2015 14:23:25 +0200 [thread overview]
Message-ID: <5523CC3D.1080002@ap3.fr> (raw)
Hello,
I use the version 2015-02 of buildroot.
I want to configure the network interface as static ip.
In the old version of buildroot, I modified the "interfaces" file
located in output/target/etc/network/.
But now my settings are systematically re-written.
So I modified Config.in and system.mk to select the configuration
directly in the menu of buildroot.
I hope it will be usefull for others users. so see below the diff file.
diff -u ../original/Config.in system/Config.in
--- ../original/Config.in 2015-03-01 22:26:12.000000000 +0100
+++ system/Config.in 2015-04-07 12:00:54.022641402 +0200
@@ -326,7 +326,57 @@
endif # BR2_ROOTFS_SKELETON_DEFAULT
+config BR2_SYSTEM_NETWORK
+menu "Network interface setting"
+ depends on !BR2_PACKAGE_SYSTEMD_NETWORKD && (BR2_PACKAGE_BUSYBOX ||
BR2_PACKAGE_IFUPDOWN)
+
+config BR2_SYSTEM_NETWORK_CONFIG
+choice
+ prompt "Network configuration"
+ default BR2_SYSTEM_NETWORK_NO_CONFIG
+ help
+ Select a configuration.
+
+config BR2_SYSTEM_NETWORK_NO_CONFIG
+ bool "no configuration"
+config BR2_SYSTEM_NETWORK_CONFIG_STATIC
+ bool "static ip"
+config BR2_SYSTEM_NETWORK_CONFIG_DHCP
+ bool "dhcp"
+endchoice
+
+if BR2_SYSTEM_NETWORK_CONFIG_STATIC
+config BR2_SYSTEM_NETWORK_CONFIG_STATIC_NAME
+ string "Network interface nane"
+ default "eth0"
+ help
+ Enter here the name of the network interface (E.G. eth0) to
+ automatically configure at bootup.
+config BR2_SYSTEM_NETWORK_CONFIG_STATIC_IP
+ string "Network static ip address"
+ default ""
+ help
+ Enter here the ip address of the network interface (E.G. 192.168.0.1)
+ to automatically configure at bootup.
+
+config BR2_SYSTEM_NETWORK_CONFIG_STATIC_MASK
+ string "Network static netmask"
+ default "255.255.255.0"
+ help
+ Enter here the netmask of the network interface (E.G. 255.255.255.0)
+ to automatically configure at bootup.
+
+config BR2_SYSTEM_NETWORK_CONFIG_STATIC_GW
+ string "Network static ip gateway address"
+ default ""
+ help
+ Enter here the ip gateway address of the network interface
+ to automatically configure at bootup.
+endif
+
+
+if BR2_SYSTEM_NETWORK_CONFIG_DHCP
config BR2_SYSTEM_DHCP
string "Network interface to configure through DHCP"
default ""
@@ -345,6 +395,11 @@
comment "automatic network configuration via DHCP needs ifupdown or
busybox"
depends on !(BR2_PACKAGE_BUSYBOX || BR2_PACKAGE_IFUPDOWN)
+endif #BR2_SYSTEM_NETWORK_CONFIG_DHCP
+
+endmenu
+
+
config BR2_TARGET_TZ_INFO
bool "Install timezone info"
Seulement dans system/: Config.in~
Seulement dans system/: device_table_dev.txt
Seulement dans system/: device_table.txt
Seulement dans system/: skeleton
diff -u ../original/system.mk system/system.mk
--- ../original/system.mk 2015-03-01 22:26:12.000000000 +0100
+++ system/system.mk 2015-04-07 11:47:42.850642300 +0200
@@ -59,10 +59,28 @@
endef
endif
+
+NETWORK_STATIC_IFACE = $(call
qstrip,$(BR2_SYSTEM_NETWORK_CONFIG_STATIC_NAME))
+ifneq ($(NETWORK_STATIC_IFACE),)
+define SET_NETWORK_STATIC
+ ( \
+ echo ; \
+ echo "auto $(NETWORK_STATIC_IFACE)"; \
+ echo "iface $(NETWORK_STATIC_IFACE) inet static"; \
+ echo " address $(BR2_SYSTEM_NETWORK_CONFIG_STATIC_IP)"; \
+ echo " netmask $(BR2_SYSTEM_NETWORK_CONFIG_STATIC_MASK)"; \
+ echo " gateway $(BR2_SYSTEM_NETWORK_CONFIG_STATIC_GW)"; \
+ ) >> $(TARGET_DIR)/etc/network/interfaces
+endef
+endif
+
+
+
define SET_NETWORK
mkdir -p $(TARGET_DIR)/etc/network/
$(SET_NETWORK_LOCALHOST)
$(SET_NETWORK_DHCP)
+ $(SET_NETWORK_STATIC)
endef
TARGET_FINALIZE_HOOKS += SET_NETWORK
Seulement dans system/: system.mk~
next reply other threads:[~2015-04-07 12:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-07 12:23 thln [this message]
2015-04-07 12:35 ` [Buildroot] Network configuration form buildroot menu (dhcp + static ip) Thomas Petazzoni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5523CC3D.1080002@ap3.fr \
--to=th.ln@ap3.fr \
--cc=buildroot@busybox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox