Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] Allow a single DHCP configuration via the system configuration submenu
Date: Wed, 17 Dec 2014 21:29:00 +0100	[thread overview]
Message-ID: <20141217212900.0df35c02@free-electrons.com> (raw)
In-Reply-To: <1418832946-28337-1-git-send-email-jeremy.rosen@openwide.fr>

Dear J?r?my Rosen,

On Wed, 17 Dec 2014 17:15:46 +0100, J?r?my Rosen wrote:

>  support/scripts/generate-network-config.sh | 24 ++++++++++++++++++++++++

Do we really need a helper script to do this?

NETWORK_IFACES = $(TARGET_DIR)/etc/network/interfaces
NETWORK_DHCP_IFACE = $(call qstrip,$(BR2_SIMPLE_DHCP_INTERFACE))

define NETWORK_ADD_DHCP_INTERFACE
	echo "auto $(NETWORK_DHCP_IFACE)" >> $(NETWORK_IFACES)
	echo "iface $(NETWORK_DHCP_IFACE) inet dhcp" >> $(NETWORK_IFACES)
endef

define NETWORK_CREATE_IFACES_FILE
	rm -f $(NETWORK_IFACES)
	echo "auto lo" >> $(NETWORK_IFACES)
	echo "iface lo inet loopback" >> $(NETWORK_IFACES)
	$(NETWORK_ADD_DHCP_INTERFACE)
endef

TARGET_FINALIZE_HOOKS += NETWORK_CREATE_IFACES_FILE

> +config BR2_SIMPLE_DHCP
> +	bool "automatic network configuration via DHCP"
> +	default n
> +	depends on !BR2_PACKAGE_SYSTEMD_NETWORKD
> +	help
> +	  Automatically do a DHCP request on startup on selected interface at 
> +	  startup. For more complicated setups use an overlay.
> +
> +comment "automatic network configuration via DHCP is not compatible with networkd"
> +	depends on BR2_PACKAGE_SYSTEMD_NETWORKD
> +
> +config BR2_SIMPLE_DHCP_INTERFACE
> +	string "name of the physical network interface to run DHCP on"
> +	depends on BR2_SIMPLE_DHCP
> +	default eth0
> +	help
> +	  The name of the network interface to configure automatically

Why two options? Just make the BR2_SIMPLE_DHCP_INTERFACE empty by
default (does nothing), and when non-empty, used as the DHCP network
interface.

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

  parent reply	other threads:[~2014-12-17 20:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-17 16:15 [Buildroot] [PATCH] Allow a single DHCP configuration via the system configuration submenu Jérémy Rosen
2014-12-17 16:30 ` Samuel Martin
2014-12-17 16:37   ` Jeremy Rosen
2014-12-17 20:29 ` Thomas Petazzoni [this message]
2014-12-18  8:04   ` Jeremy Rosen

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=20141217212900.0df35c02@free-electrons.com \
    --to=thomas.petazzoni@free-electrons.com \
    --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