Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jeremy Rosen <jeremy.rosen@openwide.fr>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] Allow a single DHCP configuration via the system configuration submenu
Date: Thu, 18 Dec 2014 09:04:17 +0100 (CET)	[thread overview]
Message-ID: <940385025.29419441.1418889857770.JavaMail.root@openwide.fr> (raw)
In-Reply-To: <20141217212900.0df35c02@free-electrons.com>


----- Mail original -----
> 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?
>

That's... debatable. I think it's a bit long for inline, but it's 
a matter of taste. I'll inline in simplify it (do everythin without
functions to shorten a bit)

 
> 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.
> 

I did it for better presentation in the menuconfig menu, I thought
one option to activate and then another one to set, rather than
an empty-by-default one was cleaner... but if you think a single
one is better it's easy to change...


I'll wait for more comments and submit a v2 when I have more feedback


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

      reply	other threads:[~2014-12-18  8:04 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
2014-12-18  8:04   ` Jeremy Rosen [this message]

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=940385025.29419441.1418889857770.JavaMail.root@openwide.fr \
    --to=jeremy.rosen@openwide.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