[PATCH 09/11] defaultenv-2: boot/net add bootp support

Sascha Hauer s.hauer at pengutronix.de
Sat Sep 8 11:09:36 EDT 2012


On Sat, Sep 08, 2012 at 04:37:13PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 15:56 Sat 08 Sep     , Sascha Hauer wrote:
> > On Fri, Sep 07, 2012 at 02:13:35PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>
> > > ---
> > >  defaultenv-2/base/boot/net |   35 ++++++++++++++++++++++++++++++++++-
> > >  1 file changed, 34 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/defaultenv-2/base/boot/net b/defaultenv-2/base/boot/net
> > > index 922bef1..ff05077 100644
> > > --- a/defaultenv-2/base/boot/net
> > > +++ b/defaultenv-2/base/boot/net
> > > @@ -7,8 +7,41 @@ fi
> > >  
> > >  path="/mnt/tftp"
> > >  
> > > +# to get the dhcp info (global.dhcp.rootpath, global.dhcp.bootfile, global.dhcp.oftree_file)
> > > +ifdown eth0
> > > +ifup eth0
> > 
> > If ifup has been called before the global.dhcp. variables are already
> > set. Why do you force to do this again?
> param dhcp may have changed I want to be sure we have the right one

Normally you would change it *before* doing network. If you have changed
it manually afterwards, then of course you have to make sure the changes
are effective using ifdown/ifup manually.

> > 
> > > +
> > >  global.bootm.image="${path}/${global.user}-linux-${global.hostname}"
> > >  #global.bootm.oftree="${path}/${global.user}-oftree-${global.hostname}"
> > > -nfsroot="/home/${global.user}/nfsroot/${global.hostname}"
> > > +
> > > +if [ -n "${global.dhcp.rootpath}" ]; then
> > > +	bootp=1
> > > +	nfsroot="${global.dhcp.rootpath}"
> > > +else
> > > +	nfsroot="/home/${global.user}/nfsroot/${global.hostname}"
> > > +fi
> > > +
> > > +if [ -n "${global.dhcp.bootfile}" -o -n "${global.dhcp.oftree_file}" ]; then
> > > +	bootp=1
> > > +	path="/mnt/dhcp"
> > > +
> > > +	if [ -d "${path}" ]; then
> > > +		umount "${path}"
> > > +	else
> > > +		mkdir "${path}"
> > > +	fi
> > > +	mount -t tftp $eth0.serverip "${path}"
> > 
> > That's exactly the path that's already mounted to /mnt/tftp. Why are you
> > doing this?
> evenif the ip is changed?

The ip won't change when you drop the ifdown/ifup above.

> > 
> > 
> > > +
> > > +	[ -n "${global.dhcp.bootfile}" ] && global.bootm.image="${path}/${global.dhcp.bootfile}"
> > > +	[ -n "${global.dhcp.oftree_file}" ] && global.bootm.oftree="${path}/${global.dhcp.oftree_file}"
> > > +fi
> > > +
> > > +if [ x${bootp} = x1 ]; then
> > > +	echo "Boot via bootp/dhcp on server ${eth0.serverip}"
> > > +	[ -n "${global.dhcp.bootfile}" ] && echo "bootm.image => ${global.dhcp.bootfile}"
> > > +	[ -n "${global.dhcp.oftree_file}" ] && echo "bootm.oftree => ${global.dhcp.oftree_file}"
> > > +	[ -n "${global.dhcp.rootpath}" ] && echo "nfsroot => ${global.dhcp.rootpath}"
> > > +fi
> > > +
> > >  bootargs-ip
> > >  bootargs-root-nfs -n "$nfsroot"
> > > -- 
> > > 1.7.10.4
> > > 
> > > 
> > > _______________________________________________
> > > barebox mailing list
> > > barebox at lists.infradead.org
> > > http://lists.infradead.org/mailman/listinfo/barebox
> > > 
> > 
> > -- 
> > Pengutronix e.K.                           |                             |
> > Industrial Linux Solutions                 | http://www.pengutronix.de/  |
> > Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
> > Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list