9
0
Fork 0

Merge branch 'for-next/boot-sequence-dhcp'

Conflicts:
	drivers/net/miidev.c
This commit is contained in:
Sascha Hauer 2012-10-03 21:10:30 +02:00
commit ed4645cf13
56 changed files with 432 additions and 246 deletions

View File

@ -3,7 +3,7 @@
# use 'dhcp' to do dhcp in barebox and in kernel
# use 'none' if you want to skip kernel ip autoconfiguration
ip=dhcp-barebox
dhcp_vendor_id=barebox-at91rm9200ek
global.dhcp.vendor_id=barebox-at91rm9200ek
# or set your networking parameters here
#eth0.ipaddr=a.b.c.d

View File

@ -6,9 +6,9 @@ ip=dhcp-barebox
if [ x$armlinux_architecture = x1099 ]
then
dhcp_vendor_id=barebox-at91sam9260ek
global.dhcp.vendor_id=barebox-at91sam9260ek
else
dhcp_vendor_id=barebox-at91sam9g20ek
global.dhcp.vendor_id=barebox-at91sam9g20ek
fi
# or set your networking parameters here

View File

@ -6,9 +6,9 @@ ip=dhcp-barebox
if [ x$armlinux_architecture = x848 ]
then
dhcp_vendor_id=barebox-at91sam9261ek
global.dhcp.vendor_id=barebox-at91sam9261ek
else
dhcp_vendor_id=barebox-at91sam9g10ek
global.dhcp.vendor_id=barebox-at91sam9g10ek
fi
# or set your networking parameters here

View File

@ -3,7 +3,7 @@
# use 'dhcp' to do dhcp in barebox and in kernel
# use 'none' if you want to skip kernel ip autoconfiguration
ip=dhcp-barebox
dhcp_vendor_id=barebox-at91sam9263ek
global.dhcp.vendor_id=barebox-at91sam9263ek
# or set your networking parameters here
#eth0.ipaddr=a.b.c.d

View File

@ -3,7 +3,7 @@
# use 'dhcp' to do dhcp in barebox and in kernel
# use 'none' if you want to skip kernel ip autoconfiguration
ip=dhcp-barebox
dhcp_vendor_id=barebox-at91sam9m10g45ek
global.dhcp.vendor_id=barebox-at91sam9m10g45ek
# or set your networking parameters here
#eth0.ipaddr=a.b.c.d

View File

@ -3,7 +3,7 @@
# use 'dhcp' to do dhcp in barebox and in kernel
# use 'none' if you want to skip kernel ip autoconfiguration
ip=dhcp-barebox
dhcp_vendor_id=barebox-at91sam9x5ek
global.dhcp.vendor_id=barebox-at91sam9x5ek
# or set your networking parameters here
#eth0.ipaddr=a.b.c.d

View File

@ -1,6 +1,6 @@
#!/bin/sh
hostname=falconwing
global.hostname=falconwing
# use 'dhcp' to do dhcp in barebox and in kernel
# use 'none' if you want to skip kernel ip autoconfiguration

View File

@ -5,7 +5,7 @@ otg_mode="device"
# video : can be CMO-QVGA, URT-WVGA, DVI-VGA or DVI-SVGA
video="CMO-QVGA"
hostname=eukrea-cpuimx25
global.hostname=eukrea-cpuimx25
# use 'dhcp' to do dhcp in barebox and in kernel
# use 'none' if you want to skip kernel ip autoconfiguration
@ -24,16 +24,16 @@ rootfs_loc=nand
# rootfs
rootfs_type=ubifs
rootfsimage=$hostname/rootfs.$rootfs_type
rootfsimage=${global.hostname}/rootfs.$rootfs_type
# kernel
kernelimage=$hostname/uImage-${hostname}.bin
kernelimage=${global.hostname}/uImage-${global.hostname}.bin
# barebox and it's env
bareboximage=$hostname/barebox-${hostname}.bin
bareboxenvimage=$hostname/bareboxenv-${hostname}.bin
bareboximage=${global.hostname}/barebox-${global.hostname}.bin
bareboxenvimage=${global.hostname}/bareboxenv-${global.hostname}.bin
nfsroot="$eth0.serverip:/srv/nfs/$hostname"
nfsroot="$eth0.serverip:/srv/nfs/${global.hostname}"
autoboot_timeout=1
@ -42,7 +42,7 @@ bootargs="console=ttymxc0,115200 otg_mode=$otg_mode video=imxfb:$video"
nand_parts="256k(barebox)ro,128k(bareboxenv),3M(kernel),-(root)"
rootfs_mtdblock_nand=3
nand_device="mxc_nand"
ubiroot="$hostname-rootfs"
ubiroot="${global.hostname}-rootfs"
device_type="nand"
# set a fancy prompt (if support is compiled in)

View File

@ -5,7 +5,7 @@ otg_mode="device"
# video : can be CMO-QVGA, URT-WVGA, DVI-VGA or DVI-SVGA
video="CMO-QVGA"
hostname=eukrea-cpuimx35
global.hostname=eukrea-cpuimx35
# use 'dhcp' to do dhcp in barebox and in kernel
# use 'none' if you want to skip kernel ip autoconfiguration
@ -24,16 +24,16 @@ rootfs_loc=nand
# rootfs
rootfs_type=ubifs
rootfsimage=$hostname/rootfs.$rootfs_type
rootfsimage=${global.hostname}/rootfs.$rootfs_type
# kernel
kernelimage=$hostname/uImage-${hostname}.bin
kernelimage=${global.hostname}/uImage-${global.hostname}.bin
# barebox and it's env
bareboximage=$hostname/barebox-${hostname}.bin
bareboxenvimage=$hostname/bareboxenv-${hostname}.bin
bareboximage=${global.hostname}/barebox-${global.hostname}.bin
bareboxenvimage=${global.hostname}/bareboxenv-${global.hostname}.bin
nfsroot="$eth0.serverip:/srv/nfs/$hostname"
nfsroot="$eth0.serverip:/srv/nfs/${global.hostname}"
autoboot_timeout=1
@ -42,7 +42,7 @@ bootargs="console=ttymxc0,115200 otg_mode=$otg_mode video=mx3fb:$video"
nand_parts="256k(barebox)ro,128k(bareboxenv),3M(kernel),-(root)"
rootfs_mtdblock_nand=3
nand_device="mxc_nand"
ubiroot="$hostname-rootfs"
ubiroot="${global.hostname}-rootfs"
device_type="nand"
# set a fancy prompt (if support is compiled in)

View File

@ -8,7 +8,7 @@ video="CMO-QVGA"
# screen type : can be 'tft' or 'dvi'
screen_type="tft"
hostname=eukrea-cpuimx51
global.hostname=eukrea-cpuimx51
# use 'dhcp' to do dhcp in barebox and in kernel
# use 'none' if you want to skip kernel ip autoconfiguration
@ -27,16 +27,16 @@ rootfs_loc=nand
# rootfs
rootfs_type=ubifs
rootfsimage=$hostname/rootfs.$rootfs_type
rootfsimage=${global.hostname}/rootfs.$rootfs_type
# kernel
kernelimage=$hostname/uImage-${hostname}.bin
kernelimage=${global.hostname}/uImage-${global.hostname}.bin
# barebox and it's env
bareboximage=$hostname/barebox-${hostname}.bin
bareboxenvimage=$hostname/bareboxenv-${hostname}.bin
bareboximage=${global.hostname}/barebox-${global.hostname}.bin
bareboxenvimage=${global.hostname}/bareboxenv-${global.hostname}.bin
nfsroot="$eth0.serverip:/srv/nfs/$hostname"
nfsroot="$eth0.serverip:/srv/nfs/${global.hostname}"
autoboot_timeout=1
@ -45,7 +45,7 @@ bootargs="console=ttymxc0,115200 otg_mode=$otg_mode video=$video screen_type=$sc
nand_parts="256k(barebox)ro,128k(bareboxenv),3M(kernel),-(root)"
rootfs_mtdblock_nand=3
nand_device="mxc_nand"
ubiroot="$hostname-rootfs"
ubiroot="${global.hostname}-rootfs"
device_type="nand"
# set a fancy prompt (if support is compiled in)

View File

@ -1,6 +1,6 @@
#!/bin/sh
hostname=mx28-evk
global.hostname=mx28-evk
#user=
# use 'dhcp' to do dhcp in barebox and in kernel
@ -24,21 +24,21 @@ rootfs_loc=net
rootfs_type=ext2
# where is the rootfs in case of 'rootfs_loc=disk' (linux name)
rootfs_part_linux_dev=mmcblk0p4
rootfsimage=rootfs-${hostname}.$rootfs_type
rootfsimage=rootfs-${global.hostname}.$rootfs_type
# where is the kernel image in case of 'kernel_loc=disk'
kernel_part=disk0.2
kernelimage=zImage-$hostname
bareboximage=barebox-${hostname}.bin
bareboxenvimage=barebox-${hostname}.bin
kernelimage=zImage-${global.hostname}
bareboximage=barebox-${global.hostname}.bin
bareboxenvimage=barebox-${global.hostname}.bin
if [ -n $user ]; then
bareboximage="$user"-"$bareboximage"
bareboxenvimage="$user"-"$bareboxenvimage"
kernelimage="$user"-"$kernelimage"
rootfsimage="$user"-"$rootfsimage"
nfsroot="/home/$user/nfsroot/$hostname"
nfsroot="/home/$user/nfsroot/${global.hostname}"
else
nfsroot="/path/to/nfs/root"
fi

View File

@ -1,6 +1,6 @@
#!/bin/sh
hostname=mx35-3stack
global.hostname=mx35-3stack
eth0.serverip=
user=
@ -21,16 +21,16 @@ rootfs_loc=net
# can be either 'jffs2' or 'ubifs'
rootfs_type=ubifs
rootfsimage=root-$hostname.$rootfs_type
rootfsimage=root-${global.hostname}.$rootfs_type
kernelimage=zImage-$hostname
#kernelimage=uImage-$hostname
#kernelimage=Image-$hostname
#kernelimage=Image-$hostname.lzo
kernelimage=zImage-${global.hostname}
#kernelimage=uImage-${global.hostname}
#kernelimage=Image-${global.hostname}
#kernelimage=Image-${global.hostname}.lzo
if [ -n $user ]; then
kernelimage="$user"-"$kernelimage"
nfsroot="$eth0.serverip:/home/$user/nfsroot/$hostname"
nfsroot="$eth0.serverip:/home/$user/nfsroot/${global.hostname}"
rootfsimage="$user"-"$rootfsimage"
else
nfsroot="$eth0.serverip:/path/to/nfs/root"

View File

@ -1,13 +1,13 @@
#!/bin/sh
hostname=loco
global.hostname=loco
eth0.serverip=
user=
# use 'dhcp' to do dhcp in barebox and in kernel
# use 'none' if you want to skip kernel ip autoconfiguration
ip=dhcp
dhcp_vendor_id=barebox-mx53-loco
global.dhcp.vendor_id=barebox-mx53-loco
# or set your networking parameters here
#eth0.ipaddr=a.b.c.d
@ -22,16 +22,16 @@ rootfs_loc=net
# can be either 'jffs2' or 'ubifs'
rootfs_type=ubifs
rootfsimage=root-$hostname.$rootfs_type
rootfsimage=root-${global.hostname}.$rootfs_type
kernelimage=zImage-$hostname
#kernelimage=uImage-$hostname
#kernelimage=Image-$hostname
#kernelimage=Image-$hostname.lzo
kernelimage=zImage-${global.hostname}
#kernelimage=uImage-${global.hostname}
#kernelimage=Image-${global.hostname}
#kernelimage=Image-${global.hostname}.lzo
if [ -n $user ]; then
kernelimage="$user"-"$kernelimage"
nfsroot="$eth0.serverip:/home/$user/nfsroot/$hostname"
nfsroot="$eth0.serverip:/home/$user/nfsroot/${global.hostname}"
rootfsimage="$user"-"$rootfsimage"
else
nfsroot="$eth0.serverip:/path/to/nfs/root"

View File

@ -1,6 +1,6 @@
#!/bin/sh
hostname=loco
global.hostname=loco
eth0.serverip=
user=
@ -21,16 +21,16 @@ rootfs_loc=net
# can be either 'jffs2' or 'ubifs'
rootfs_type=ubifs
rootfsimage=root-$hostname.$rootfs_type
rootfsimage=root-${global.hostname}.$rootfs_type
kernelimage=zImage-$hostname
#kernelimage=uImage-$hostname
#kernelimage=Image-$hostname
#kernelimage=Image-$hostname.lzo
kernelimage=zImage-${global.hostname}
#kernelimage=uImage-${global.hostname}
#kernelimage=Image-${global.hostname}
#kernelimage=Image-${global.hostname}.lzo
if [ -n $user ]; then
kernelimage="$user"-"$kernelimage"
nfsroot="$eth0.serverip:/home/$user/nfsroot/$hostname"
nfsroot="$eth0.serverip:/home/$user/nfsroot/${global.hostname}"
rootfsimage="$user"-"$rootfsimage"
else
nfsroot="$eth0.serverip:/path/to/nfs/root"

View File

@ -1,6 +1,6 @@
#!/bin/sh
hostname=mini2440
global.hostname=mini2440
eth0.serverip=
user=
@ -21,16 +21,16 @@ rootfs_loc=net
# can be either 'jffs2' or 'ubifs'
rootfs_type=ubifs
rootfsimage=root-${hostname}.${rootfs_type}
rootfsimage=root-${global.hostname}.${rootfs_type}
kernelimage=zImage-${hostname}
#kernelimage=uImage-$hostname
#kernelimage=Image-$hostname
#kernelimage=Image-$hostname.lzo
kernelimage=zImage-${global.hostname}
#kernelimage=uImage-${global.hostname}
#kernelimage=Image-${global.hostname}
#kernelimage=Image-${global.hostname}.lzo
if [ -n $user ]; then
kernelimage="${user}"-"${kernelimage}"
nfsroot="${eth0.serverip}:/home/${user}/nfsroot/${hostname}"
nfsroot="${eth0.serverip}:/home/${user}/nfsroot/${global.hostname}"
rootfsimage="${user}"-"${rootfsimage}"
else
nfsroot="${eth0.serverip}:/path/to/nfs/root"

View File

@ -1,6 +1,6 @@
#!/bin/sh
hostname=cupid
global.hostname=cupid
eth0.serverip=
user=
@ -21,16 +21,16 @@ rootfs_loc=net
# can be either 'jffs2' or 'ubifs'
rootfs_type=ubifs
rootfsimage=root-$hostname.$rootfs_type
rootfsimage=root-${global.hostname}.$rootfs_type
kernelimage=zImage-$hostname
#kernelimage=uImage-$hostname
#kernelimage=Image-$hostname
#kernelimage=Image-$hostname.lzo
kernelimage=zImage-${global.hostname}
#kernelimage=uImage-${global.hostname}
#kernelimage=Image-${global.hostname}
#kernelimage=Image-${global.hostname}.lzo
if [ -n $user ]; then
kernelimage="$user"-"$kernelimage"
nfsroot="$eth0.serverip:/home/$user/nfsroot/$hostname"
nfsroot="$eth0.serverip:/home/$user/nfsroot/${global.hostname}"
rootfsimage="$user"-"$rootfsimage"
else
nfsroot="$eth0.serverip:/path/to/nfs/root"

View File

@ -1,6 +1,6 @@
#!/bin/sh
hostname=guf-neso
global.hostname=guf-neso
eth0.serverip=
user=
@ -21,16 +21,16 @@ rootfs_loc=net
# can be either 'jffs2' or 'ubifs'
rootfs_type=ubifs
rootfsimage=root-$hostname.$rootfs_type
rootfsimage=root-${global.hostname}.$rootfs_type
kernelimage=zImage-$hostname
#kernelimage=uImage-$hostname
#kernelimage=Image-$hostname
#kernelimage=Image-$hostname.lzo
kernelimage=zImage-${global.hostname}
#kernelimage=uImage-${global.hostname}
#kernelimage=Image-${global.hostname}
#kernelimage=Image-${global.hostname}.lzo
if [ -n $user ]; then
kernelimage="$user"-"$kernelimage"
nfsroot="$eth0.serverip:/home/$user/nfsroot/$hostname"
nfsroot="$eth0.serverip:/home/$user/nfsroot/${global.hostname}"
rootfsimage="$user"-"$rootfsimage"
else
nfsroot="$eth0.serverip:/path/to/nfs/root"

View File

@ -1,5 +1,5 @@
hostname=tx25
global.hostname=tx25
baseboard=tx28stk5
user=
@ -21,16 +21,16 @@ rootfs_loc=net
# can be either 'jffs2' or 'ubifs'
rootfs_type=ubifs
rootfsimage=root-$hostname.$rootfs_type
rootfsimage=root-${global.hostname}.$rootfs_type
kernelimage=zImage-$hostname
#kernelimage=uImage-$hostname
#kernelimage=Image-$hostname
#kernelimage=Image-$hostname.lzo
kernelimage=zImage-${global.hostname}
#kernelimage=uImage-${global.hostname}
#kernelimage=Image-${global.hostname}
#kernelimage=Image-${global.hostname}.lzo
if [ -n $user ]; then
kernelimage="$user"-"$kernelimage"
nfsroot="$eth0.serverip:/home/$user/nfsroot/$hostname"
nfsroot="$eth0.serverip:/home/$user/nfsroot/${global.hostname}"
rootfsimage="$user"-"$rootfsimage"
else
nfsroot="$eth0.serverip:/path/to/nfs/root"

View File

@ -1,7 +1,7 @@
#
#
hostname=tx28
global.hostname=tx28
baseboard=tx28stk5
# use 'dhcp' to do dhcp in barebox and in kernel
@ -22,16 +22,16 @@ rootfs_loc=net
# can be either 'jffs2' or 'ubifs'
rootfs_type=ubifs
rootfsimage=root-$hostname.$rootfs_type
rootfsimage=root-${global.hostname}.$rootfs_type
kernelimage=zImage-$hostname
#kernelimage=uImage-$hostname
#kernelimage=Image-$hostname
#kernelimage=Image-$hostname.lzo
kernelimage=zImage-${global.hostname}
#kernelimage=uImage-${global.hostname}
#kernelimage=Image-${global.hostname}
#kernelimage=Image-${global.hostname}.lzo
if [ -n $user ]; then
kernelimage="$user"-"$kernelimage"
nfsroot="$eth0.serverip:/home/$user/nfsroot/$hostname"
nfsroot="$eth0.serverip:/home/$user/nfsroot/${global.hostname}"
rootfsimage="$user"-"$rootfsimage"
else
nfsroot="$eth0.serverip:/path/to/nfs/root"

View File

@ -1,6 +1,6 @@
#!/bin/sh
hostname=panda
global.hostname=panda
user=
# use 'dhcp' to do dhcp in barebox and in kernel
@ -18,14 +18,14 @@ kernel_loc=tftp
# can be either 'net', 'nor', 'nand' or 'initrd'
rootfs_loc=net
kernelimage=zImage-$hostname
#kernelimage=uImage-$hostname
#kernelimage=Image-$hostname
#kernelimage=Image-${hostname}.lzo
kernelimage=zImage-${global.hostname}
#kernelimage=uImage-${global.hostname}
#kernelimage=Image-${global.hostname}
#kernelimage=Image-${global.hostname}.lzo
if [ -n $user ]; then
kernelimage="$user"-"$kernelimage"
nfsroot="$eth0.serverip:/home/$user/nfsroot/$hostname"
nfsroot="$eth0.serverip:/home/$user/nfsroot/${global.hostname}"
rootfsimage="$user"-"$rootfsimage"
else
nfsroot="$eth0.serverip:/path/to/nfs/root"

View File

@ -1,6 +1,6 @@
#!/bin/sh
hostname=pcm027
global.hostname=pcm027
eth0.serverip=
user=
@ -21,16 +21,16 @@ rootfs_loc=net
# can be either 'jffs2' or 'ubifs'
rootfs_type=ubifs
rootfsimage=root-$hostname.$rootfs_type
rootfsimage=root-${global.hostname}.$rootfs_type
kernelimage=zImage-$hostname
#kernelimage=uImage-$hostname
#kernelimage=Image-$hostname
#kernelimage=Image-$hostname.lzo
kernelimage=zImage-${global.hostname}
#kernelimage=uImage-${global.hostname}
#kernelimage=Image-${global.hostname}
#kernelimage=Image-${global.hostname}.lzo
if [ -n $user ]; then
kernelimage="$user"-"$kernelimage"
nfsroot="$eth0.serverip:/home/$user/nfsroot/$hostname"
nfsroot="$eth0.serverip:/home/$user/nfsroot/${global.hostname}"
rootfsimage="$user"-"$rootfsimage"
else
nfsroot="$eth0.serverip:/path/to/nfs/root"

View File

@ -1,6 +1,6 @@
#!/bin/sh
hostname=pcm037
global.hostname=pcm037
eth0.serverip=
user=
@ -21,16 +21,16 @@ rootfs_loc=net
# can be either 'jffs2' or 'ubifs'
rootfs_type=ubifs
rootfsimage=root-$hostname.$rootfs_type
rootfsimage=root-${global.hostname}.$rootfs_type
kernelimage=zImage-$hostname
#kernelimage=uImage-$hostname
#kernelimage=Image-$hostname
#kernelimage=Image-$hostname.lzo
kernelimage=zImage-${global.hostname}
#kernelimage=uImage-${global.hostname}
#kernelimage=Image-${global.hostname}
#kernelimage=Image-${global.hostname}.lzo
if [ -n $user ]; then
kernelimage="$user"-"$kernelimage"
nfsroot="$eth0.serverip:/home/$user/nfsroot/$hostname"
nfsroot="$eth0.serverip:/home/$user/nfsroot/${global.hostname}"
rootfsimage="$user"-"$rootfsimage"
else
nfsroot="$eth0.serverip:/path/to/nfs/root"

View File

@ -1,6 +1,6 @@
#!/bin/sh
hostname=pcm043
global.hostname=pcm043
eth0.serverip=
user=
@ -21,16 +21,16 @@ rootfs_loc=net
# can be either 'jffs2' or 'ubifs'
rootfs_type=ubifs
rootfsimage=root-$hostname.$rootfs_type
rootfsimage=root-${global.hostname}.$rootfs_type
kernelimage=zImage-$hostname
#kernelimage=uImage-$hostname
#kernelimage=Image-$hostname
#kernelimage=Image-$hostname.lzo
kernelimage=zImage-${global.hostname}
#kernelimage=uImage-${global.hostname}
#kernelimage=Image-${global.hostname}
#kernelimage=Image-${global.hostname}.lzo
if [ -n $user ]; then
kernelimage="$user"-"$kernelimage"
nfsroot="$eth0.serverip:/home/$user/nfsroot/$hostname"
nfsroot="$eth0.serverip:/home/$user/nfsroot/${global.hostname}"
rootfsimage="$user"-"$rootfsimage"
else
nfsroot="$eth0.serverip:/path/to/nfs/root"

View File

@ -1,6 +1,6 @@
#!/bin/sh
hostname=pcm049
global.hostname=pcm049
eth0.serverip=
user=
@ -21,16 +21,16 @@ rootfs_loc=net
# can be either 'jffs2' or 'ubifs'
rootfs_type=ubifs
rootfsimage=root-${hostname}.$rootfs_type
rootfsimage=root-${global.hostname}.$rootfs_type
kernelimage=zImage-$hostname
#kernelimage=uImage-$hostname
#kernelimage=Image-$hostname
#kernelimage=Image-${hostname}.lzo
kernelimage=zImage-${global.hostname}
#kernelimage=uImage-${global.hostname}
#kernelimage=Image-${global.hostname}
#kernelimage=Image-${global.hostname}.lzo
if [ -n $user ]; then
kernelimage="$user"-"$kernelimage"
nfsroot="$eth0.serverip:/home/$user/nfsroot/$hostname"
nfsroot="$eth0.serverip:/home/$user/nfsroot/${global.hostname}"
rootfsimage="$user"-"$rootfsimage"
else
nfsroot="$eth0.serverip:/path/to/nfs/root"

View File

@ -1,6 +1,6 @@
#!/bin/sh
hostname=pcaal1
global.hostname=pcaal1
#user=
# Enter MAC address here if not retrieved automatically
@ -26,26 +26,26 @@ rootfs_loc=nand
rootfs_type=jffs2
# where is the rootfs in case of 'rootfs_loc=disk' (linux name)
rootfs_part_linux_dev=mmcblk0p4
rootfsimage=rootfs-${hostname}.$rootfs_type
rootfsimage=rootfs-${global.hostname}.$rootfs_type
# where is the kernel image in case of 'kernel_loc=disk'
kernel_part=disk0.2
# The image type of the kernel. Can be uimage, zimage, raw or raw_lzo
#kernelimage=zImage-$hostname
kernelimage=uImage-$hostname
#kernelimage=Image-$hostname
#kernelimage=Image-$hostname.lzo
#kernelimage=zImage-${global.hostname}
kernelimage=uImage-${global.hostname}
#kernelimage=Image-${global.hostname}
#kernelimage=Image-${global.hostname}.lzo
bareboximage=barebox-${hostname}.bin
bareboxenvimage=barebox-${hostname}.bin
bareboximage=barebox-${global.hostname}.bin
bareboxenvimage=barebox-${global.hostname}.bin
if [ -n $user ]; then
bareboximage="$user"-"$bareboximage"
bareboxenvimage="$user"-"$bareboxenvimage"
kernelimage="$user"-"$kernelimage"
rootfsimage="$user"-"$rootfsimage"
nfsroot="/home/$user/nfsroot/$hostname"
nfsroot="/home/$user/nfsroot/${global.hostname}"
else
nfsroot="/path/to/nfs/root"
fi

View File

@ -1,6 +1,6 @@
#!/bin/sh
hostname=pcaaxl2
global.hostname=pcaaxl2
user=
# use 'dhcp' to do dhcp in barebox and in kernel
@ -20,16 +20,16 @@ rootfs_loc=net
# can be either 'jffs2' or 'ubifs'
rootfs_type=ubifs
rootfsimage=root-${hostname}.$rootfs_type
rootfsimage=root-${global.hostname}.$rootfs_type
kernelimage=zImage-$hostname
#kernelimage=uImage-$hostname
#kernelimage=Image-$hostname
#kernelimage=Image-${hostname}.lzo
kernelimage=zImage-${global.hostname}
#kernelimage=uImage-${global.hostname}
#kernelimage=Image-${global.hostname}
#kernelimage=Image-${global.hostname}.lzo
if [ -n $user ]; then
kernelimage="$user"-"$kernelimage"
nfsroot="$eth0.serverip:/home/$user/nfsroot/$hostname"
nfsroot="$eth0.serverip:/home/$user/nfsroot/${global.hostname}"
rootfsimage="$user"-"$rootfsimage"
else
nfsroot="$eth0.serverip:/path/to/nfs/root"

View File

@ -1,6 +1,6 @@
#!/bin/sh
hostname=pca100
global.hostname=pca100
eth0.serverip=
user=
@ -21,16 +21,16 @@ rootfs_loc=net
# can be either 'jffs2' or 'ubifs'
rootfs_type=ubifs
rootfsimage=root-$hostname.$rootfs_type
rootfsimage=root-${global.hostname}.$rootfs_type
kernelimage=zImage-$hostname
#kernelimage=uImage-$hostname
#kernelimage=Image-$hostname
#kernelimage=Image-$hostname.lzo
kernelimage=zImage-${global.hostname}
#kernelimage=uImage-${global.hostname}
#kernelimage=Image-${global.hostname}
#kernelimage=Image-${global.hostname}.lzo
if [ -n $user ]; then
kernelimage="$user"-"$kernelimage"
nfsroot="$eth0.serverip:/home/$user/nfsroot/$hostname"
nfsroot="$eth0.serverip:/home/$user/nfsroot/${global.hostname}"
rootfsimage="$user"-"$rootfsimage"
else
nfsroot="$eth0.serverip:/path/to/nfs/root"

View File

@ -3,7 +3,7 @@
# use 'dhcp' to do dhcp in barebox and in kernel
# use 'none' if you want to skip kernel ip autoconfiguration
ip=dhcp-barebox
dhcp_vendor_id=barebox-qil-a9260
global.dhcp.vendor_id=barebox-qil-a9260
# or set your networking parameters here
#eth0.ipaddr=a.b.c.d

View File

@ -1,6 +1,6 @@
#!/bin/sh
hostname=scb9328
global.hostname=scb9328
eth0.serverip=
user=
@ -21,16 +21,16 @@ rootfs_loc=net
# can be either 'jffs2' or 'ubifs'
rootfs_type=ubifs
rootfsimage=root-$hostname.$rootfs_type
rootfsimage=root-${global.hostname}.$rootfs_type
kernelimage=zImage-$hostname
#kernelimage=uImage-$hostname
#kernelimage=Image-$hostname
#kernelimage=Image-$hostname.lzo
kernelimage=zImage-${global.hostname}
#kernelimage=uImage-${global.hostname}
#kernelimage=Image-${global.hostname}
#kernelimage=Image-${global.hostname}.lzo
if [ -n $user ]; then
kernelimage="$user"-"$kernelimage"
nfsroot="$eth0.serverip:/home/$user/nfsroot/$hostname"
nfsroot="$eth0.serverip:/home/$user/nfsroot/${global.hostname}"
rootfsimage="$user"-"$rootfsimage"
else
nfsroot="$eth0.serverip:/path/to/nfs/root"

View File

@ -3,9 +3,9 @@
# use 'dhcp' to do dhcp in barebox and in kernel
# use 'none' if you want to skip kernel ip autoconfiguration
ip=dhcp-barebox
[ x$armlinux_architecture = x2058 ] && dhcp_vendor_id=barebox-tny-a9260
[ x$armlinux_architecture = x2059 ] && dhcp_vendor_id=barebox-tny-a9g20
[ x$armlinux_architecture = x2140 ] && dhcp_vendor_id=barebox-tny-a9263
[ x$armlinux_architecture = x2058 ] && global.dhcp.vendor_id=barebox-tny-a9260
[ x$armlinux_architecture = x2059 ] && global.dhcp.vendor_id=barebox-tny-a9g20
[ x$armlinux_architecture = x2140 ] && global.dhcp.vendor_id=barebox-tny-a9263
# or set your networking parameters here
#eth0.ipaddr=a.b.c.d

View File

@ -3,9 +3,9 @@
# use 'dhcp' to do dhcp in barebox and in kernel
# use 'none' if you want to skip kernel ip autoconfiguration
ip=dhcp-barebox
[ x$armlinux_architecture = x1709 ] && dhcp_vendor_id=barebox-usb-a9260
[ x$armlinux_architecture = x1710 ] && dhcp_vendor_id=barebox-usb-a9263
[ x$armlinux_architecture = x1841 ] && dhcp_vendor_id=barebox-usb-a9g20
[ x$armlinux_architecture = x1709 ] && global.dhcp.vendor_id=barebox-usb-a9260
[ x$armlinux_architecture = x1710 ] && global.dhcp.vendor_id=barebox-usb-a9263
[ x$armlinux_architecture = x1841 ] && global.dhcp.vendor_id=barebox-usb-a9g20
# or set your networking parameters here
#eth0.ipaddr=a.b.c.d

View File

@ -33,10 +33,9 @@ static int do_echo(int argc, char *argv[])
int fd = stdout, opt, newline = 1;
char *file = NULL;
int oflags = O_WRONLY | O_CREAT;
#ifdef CONFIG_CMD_ECHO_E
char str[CONFIG_CBSIZE];
int process_escape = 0;
#endif
/* We can't use getopt() here because we want to
* echo all things we don't understand.
*/
@ -66,11 +65,9 @@ static int do_echo(int argc, char *argv[])
goto no_optarg_out;
optind++;
break;
#ifdef CONFIG_CMD_ECHO_E
case 'e':
process_escape = 1;
process_escape = IS_ENABLED(CONFIG_CMD_ECHO_E);
break;
#endif
default:
goto exit_parse;
}
@ -89,13 +86,12 @@ exit_parse:
for (i = optind; i < argc; i++) {
if (i > optind)
fputc(fd, ' ');
#ifdef CONFIG_CMD_ECHO_E
if (process_escape) {
process_escape_sequence(argv[i], str, CONFIG_CBSIZE);
fputs(fd, str);
} else
#endif
} else {
fputs(fd, argv[i]);
}
}
if (newline)

View File

@ -24,39 +24,68 @@
#include <command.h>
#include <globalvar.h>
#include <environment.h>
#include <getopt.h>
static int do_global(int argc, char *argv[])
static int globalvar_set(char* name, char* value)
{
int ret;
char *value;
if (argc != 2)
return COMMAND_ERROR_USAGE;
value = strchr(argv[1], '=');
if (value) {
*value = 0;
value++;
}
ret = globalvar_add_simple(argv[1]);
ret = globalvar_add_simple(name);
if (value) {
char *name = asprintf("global.%s", argv[1]);
ret = setenv(name, value);
free(name);
char *tmp = asprintf("global.%s", name);
ret = setenv(tmp, value);
free(tmp);
}
return ret ? 1 : 0;
}
static int do_global(int argc, char *argv[])
{
int opt;
int do_set_match = 0;
char *value;
while ((opt = getopt(argc, argv, "r")) > 0) {
switch (opt) {
case 'r':
do_set_match = 1;
break;
}
}
argc -= optind;
argv += optind;
if (argc != 1)
return COMMAND_ERROR_USAGE;
value = strchr(argv[0], '=');
if (value) {
*value = 0;
value++;
}
if (do_set_match) {
if (!value)
value = "";
globalvar_set_match(argv[0], value);
return 0;
}
return globalvar_set(argv[0], value);
}
BAREBOX_CMD_HELP_START(global)
BAREBOX_CMD_HELP_USAGE("global <var>[=<value]\n")
BAREBOX_CMD_HELP_USAGE("global [-r] <var>[=<value]\n")
BAREBOX_CMD_HELP_SHORT("add a new global variable named <var>, optionally set to <value>\n")
BAREBOX_CMD_HELP_SHORT("-r to set a value to of all globalvars beginning with 'match'")
BAREBOX_CMD_HELP_END
BAREBOX_CMD_START(global)
.cmd = do_global,
.usage = "create global variables",
.usage = "create or set global variables",
BAREBOX_CMD_HELP(cmd_global_help)
BAREBOX_CMD_END

View File

@ -575,6 +575,7 @@ config DEFAULT_ENVIRONMENT_GENERIC
select CMD_CRC
select CMD_CRC_CMP
select CMD_AUTOMOUNT if HAVE_DEFAULT_ENVIRONMENT_NEW
select CMD_GLOBAL
prompt "Default environment generic"
help
With this option barebox will use the generic default

View File

@ -46,6 +46,16 @@ char *globalvar_get_match(const char *match, const char *seperator)
return val;
}
void globalvar_set_match(const char *match, const char *val)
{
struct param_d *param;
list_for_each_entry(param, &global_device.parameters, list) {
if (!strncmp(match, param->name, strlen(match)))
dev_set_param(&global_device, param->name, val);
}
}
/*
* globalvar_add_simple
*

View File

@ -33,6 +33,10 @@ while getopt "vdhl" opt; do
fi
done
# clear linux.bootargs.dyn.* and bootm.*
global -r linux.bootargs.dyn.
global -r bootm.
if [ $# = 0 ]; then
scr="$global.boot.default"
else

View File

@ -5,7 +5,7 @@
. /env/network/eth0
if [ $ip = dhcp ]; then
global.linux.bootargs.ip="ip=dhcp"
global.linux.bootargs.dyn.ip="ip=dhcp"
else
global.linux.bootargs.ip="ip=$ipaddr:$serverip:$gateway:$netmask::eth0:"
global.linux.bootargs.dyn.ip="ip=$ipaddr:$serverip:$gateway:$netmask::eth0:"
fi

View File

@ -4,4 +4,4 @@
ifup eth0
global.linux.bootargs.ip="ip=$eth0.ipaddr:$eth0.serverip:$eth0.gateway:$eth0.netmask::eth0:"
global.linux.bootargs.dyn.ip="ip=$eth0.ipaddr:$eth0.serverip:$eth0.gateway:$eth0.netmask::eth0:"

View File

@ -2,4 +2,4 @@
# Do dhcp in Linux
global.linux.bootargs.ip="ip=dhcp"
global.linux.bootargs.dyn.ip="ip=dhcp"

View File

@ -2,4 +2,4 @@
# disable ip setup in Linux
global.linux.bootargs.ip="ip=none"
global.linux.bootargs.dyn.ip="ip=none"

View File

@ -23,4 +23,4 @@ if [ -z "${fstype}" ]; then
exit 1
fi
global.linux.bootargs.root="root=/dev/$part rootfstype=$fstype rootwait"
global.linux.bootargs.dyn.root="root=/dev/$part rootfstype=$fstype rootwait"

View File

@ -9,4 +9,4 @@ while getopt "m:r:" opt; do
fi
done
global.linux.bootargs.root="root=/dev/$part rootfstype=ext$type rootwait"
global.linux.bootargs.dyn.root="root=/dev/$part rootfstype=ext$type rootwait"

View File

@ -13,4 +13,4 @@ while getopt "i:h" opt; do
fi
done
global.linux.bootargs.root="root=/dev/ram0 rdinit=${rdinit}"
global.linux.bootargs.dyn.root="root=/dev/ram0 rdinit=${rdinit}"

View File

@ -18,4 +18,4 @@ if [ -z "$mtd" ]; then
exit 1
fi
global.linux.bootargs.root="root=$mtd rootfstype=jffs2"
global.linux.bootargs.dyn.root="root=$mtd rootfstype=jffs2"

View File

@ -17,4 +17,4 @@ if [ -n ${serverip} ]; then
nfsroot="$serverip:$nfsroot"
fi
global.linux.bootargs.root="root=/dev/nfs nfsroot=$nfsroot,v3,tcp"
global.linux.bootargs.dyn.root="root=/dev/nfs nfsroot=$nfsroot,v3,tcp"

View File

@ -21,4 +21,4 @@ if [ -z "$mtd" ]; then
exit 1
fi
global.linux.bootargs.root="root=ubi0:$ubiroot ubi.mtd=$mtd rootfstype=ubifs"
global.linux.bootargs.dyn.root="root=ubi0:$ubiroot ubi.mtd=$mtd rootfstype=ubifs"

View File

@ -8,8 +8,9 @@ global autoboot_timeout=3
global boot.default=net
global allow_color=true
global linux.bootargs.base
global linux.bootargs.ip
global linux.bootargs.root
#linux.bootargs.dyn.* will be clearer at the beginning of boot
global linux.bootargs.dyn.ip
global linux.bootargs.dyn.root
global editcmd=sedit
/env/init/general

View File

@ -11,7 +11,7 @@ global.bootm.initrd="${path}/initramfs"
bootargs-root-initrd
#global.bootm.oftree=<path to oftree>
global.linux.bootargs.root="root=/dev/ram0"
global.linux.bootargs.dyn.root="root=/dev/ram0"
#bootargs-root-nfs -n "<path on server>" -s <serverip>
#bootargs-root-ubi -r <volume> -m <mtdname>

View File

@ -1,5 +1,9 @@
#!/bin/sh
if [ ${global.allow_color} != "true" ]; then
exit
fi
# Colors
export RED='\e[1;31m'
export BLUE='\e[1;34m'

View File

@ -2,6 +2,7 @@
# ip setting (static/dhcp)
ip=dhcp
global.dhcp.vendor_id=barebox-${global.hostname}
# static setup used if ip=static
ipaddr=

View File

@ -3,9 +3,7 @@
savepath=$PATH
export menupath=$PATH:/env/menu
if [ ${global.allow_color} = "true" ]; then
. /env/data/ansi-colors
fi
. /env/data/ansi-colors
while true; do
export PATH=${menupath}

View File

@ -44,14 +44,14 @@ fi
if [ x$ip = xdhcp -o x$ip = "xdhcp-barebox" ]; then
if [ x$kernel_loc = xnfs -o x$kernel_loc = xtftp ]; then
dhcp
if [ x$rootpath != x ]; then
nfsroot=$rootpath
if [ x${global.dhcp.rootpath} != x ]; then
nfsroot=${global.dhcp.rootpath}
fi
if [ x$bootfile != x ]; then
kernelimage=$bootfile
if [ x${global.dhcp.bootfile} != x ]; then
kernelimage=${global.dhcp.bootfile}
fi
if [ x$dhcp_oftree_file != x ]; then
oftreeimage=$dhcp_oftree_file
if [ x$global.dhcp.oftree_file} != x ]; then
oftreeimage=${global.dhcp.oftree_file}
fi
fi
fi

View File

@ -3,6 +3,8 @@
PATH=/env/bin
export PATH
global hostname
. /env/config
if [ -e /dev/nor0 -a -n "$nor_parts" ]; then
addpart /dev/nor0 $nor_parts

View File

@ -11,7 +11,7 @@ fi
# use 'dhcp' to do dhcp in barebox and in kernel
# use 'none' if you want to skip kernel ip autoconfiguration
ip=dhcp
dhcp_vendor_id=barebox
global.dhcp.vendor_id=barebox
# or set your networking parameters here
#eth0.ipaddr=a.b.c.d
@ -31,25 +31,25 @@ oftree_loc=tftp
rootfs_type=ubifs
# where is the rootfs in case of 'rootfs_loc=disk' (linux name)
rootfs_part_linux_dev=mmcblk0p4
rootfsimage=rootfs-${hostname}.$rootfs_type
rootfsimage=rootfs-${global.hostname}.$rootfs_type
# where is the kernel image in case of 'kernel_loc=disk'
kernel_part=disk0.2
kernelimage=zImage-$hostname
#kernelimage=uImage-$hostname
#kernelimage=Image-$hostname
#kernelimage=Image-$hostname.lzo
kernelimage=zImage-${global.hostname}
#kernelimage=uImage-${global.hostname}
#kernelimage=Image-${global.hostname}
#kernelimage=Image-${global.hostname}.lzo
bareboximage=barebox-${hostname}.bin
bareboxenvimage=barebox-${hostname}.bin
bareboximage=barebox-${global.hostname}.bin
bareboxenvimage=barebox-${global.hostname}.bin
if [ -n $user ]; then
bareboximage="$user"-"$bareboximage"
bareboxenvimage="$user"-"$bareboxenvimage"
kernelimage="$user"-"$kernelimage"
rootfsimage="$user"-"$rootfsimage"
nfsroot="/home/$user/nfsroot/$hostname"
nfsroot="/home/$user/nfsroot/${global.hostname}"
else
nfsroot="/path/to/nfs/root"
fi

View File

@ -1,6 +1,7 @@
#ifndef __GLOBALVAR_H
#define __GLOBALVAR_H
#ifdef CONFIG_GLOBALVAR
int globalvar_add_simple(const char *name);
int globalvar_add(const char *name,
@ -8,5 +9,27 @@ int globalvar_add(const char *name,
const char *(*get)(struct device_d *, struct param_d *p),
unsigned long flags);
char *globalvar_get_match(const char *match, const char *seperator);
void globalvar_set_match(const char *match, const char *val);
#else
static inline int globalvar_add_simple(const char *name)
{
return 0;
}
static inline int globalvar_add(const char *name,
int (*set)(struct device_d *dev, struct param_d *p, const char *val),
const char *(*get)(struct device_d *, struct param_d *p),
unsigned long flags)
{
return 0;
}
static inline char *globalvar_get_match(const char *match, const char *seperator)
{
return NULL;
}
static inline void globalvar_set_match(const char *match, const char *val) {}
#endif
#endif /* __GLOBALVAR_H */

View File

@ -19,6 +19,10 @@
#include <magicvar.h>
#include <linux/err.h>
#include <getopt.h>
#include <globalvar.h>
#include <init.h>
#define DHCP_DEFAULT_RETRY 20
#define OPT_SIZE 312 /* Minimum DHCP Options size per RFC2131 - results in 576 byte pkt */
@ -78,11 +82,39 @@ static IPaddr_t net_dhcp_server_ip;
static uint64_t dhcp_start;
static char dhcp_tftpname[256];
static const char* dhcp_get_barebox_global(const char * var)
{
char * var_global = asprintf("global.dhcp.%s", var);
const char *val;
if (!var_global)
return NULL;
val = getenv(var_global);
free(var_global);
return val;
}
static int dhcp_set_barebox_global(const char * var, char *val)
{
char * var_global = asprintf("global.dhcp.%s", var);
int ret;
if (!var_global)
return -ENOMEM;
ret = setenv(var_global, val);
free(var_global);
return ret;
}
struct dhcp_opt {
unsigned char option;
/* request automatically the option when creating the DHCP request */
bool optional;
bool copy_only_if_valid;
const char *barebox_var_name;
const char *barebox_dhcp_global;
void (*handle)(struct dhcp_opt *opt, unsigned char *data, int tlen);
void *data;
@ -123,7 +155,15 @@ static void env_str_handle(struct dhcp_opt *opt, unsigned char *popt, int optlen
memcpy(tmp, popt, optlen);
tmp[optlen] = 0;
setenv(opt->barebox_var_name, tmp);
if (opt->copy_only_if_valid && !strlen(tmp))
return;
if (opt->barebox_var_name)
setenv(opt->barebox_var_name, tmp);
if (opt->barebox_dhcp_global)
dhcp_set_barebox_global(opt->barebox_dhcp_global, tmp);
}
static void copy_uint32_handle(struct dhcp_opt *opt, unsigned char *popt, int optlen)
@ -174,8 +214,9 @@ struct dhcp_opt dhcp_options[] = {
.barebox_var_name = "net.nameserver",
}, {
.option = 12,
.copy_only_if_valid = 1,
.handle = env_str_handle,
.barebox_var_name = "hostname",
.barebox_var_name = "global.hostname",
}, {
.option = 15,
.handle = env_str_handle,
@ -183,7 +224,7 @@ struct dhcp_opt dhcp_options[] = {
}, {
.option = 17,
.handle = env_str_handle,
.barebox_var_name = "rootpath",
.barebox_dhcp_global = "rootpath",
}, {
.option = 51,
.handle = copy_uint32_handle,
@ -196,22 +237,23 @@ struct dhcp_opt dhcp_options[] = {
}, {
.option = 66,
.handle = env_str_handle,
.barebox_var_name = "dhcp_tftp_server_name",
.barebox_dhcp_global = "tftp_server_name",
.data = dhcp_tftpname,
}, {
.option = 67,
.handle = bootfile_vendorex_handle,
.barebox_var_name = "bootfile",
.barebox_dhcp_global = "bootfile",
}, {
.option = 224,
.handle = env_str_handle,
.barebox_var_name = "dhcp_oftree_file",
.barebox_dhcp_global = "oftree_file",
},
};
struct dhcp_param {
unsigned char option;
const char *barebox_var_name;
const char *barebox_dhcp_global;
int (*handle)(struct dhcp_param *param, u8 *e);
void *data;
};
@ -224,6 +266,9 @@ static int dhcp_set_string_options(struct dhcp_param *param, u8 *e)
if (!str && param->barebox_var_name)
str = (char*)getenv(param->barebox_var_name);
if (!str && param->barebox_dhcp_global)
str = (char*)dhcp_get_barebox_global(param->barebox_dhcp_global);
if (!str)
return 0;
@ -248,23 +293,23 @@ struct dhcp_param dhcp_params[] = {
{
.option = DHCP_HOSTNAME,
.handle = dhcp_set_string_options,
.barebox_var_name = "hostname",
.barebox_var_name = "global.hostname",
}, {
.option = DHCP_VENDOR_ID,
.handle = dhcp_set_string_options,
.barebox_var_name = "dhcp_vendor_id",
.barebox_dhcp_global = "vendor_id",
}, {
.option = DHCP_CLIENT_ID,
.handle = dhcp_set_string_options,
.barebox_var_name = "dhcp_client_id",
.barebox_dhcp_global = "client_id",
}, {
.option = DHCP_USER_CLASS,
.handle = dhcp_set_string_options,
.barebox_var_name = "dhcp_user_class",
.barebox_dhcp_global = "user_class",
}, {
.option = DHCP_CLIENT_UUID,
.handle = dhcp_set_string_options,
.barebox_var_name = "dhcp_client_uuid",
.barebox_dhcp_global = "client_uuid",
}
};
@ -345,8 +390,10 @@ static void bootp_copy_net_params(struct bootp *bp)
if (tmp_ip != 0)
net_set_serverip(tmp_ip);
if (strlen(bp->bp_file) > 0)
if (strlen(bp->bp_file) > 0) {
setenv("bootfile", bp->bp_file);
dhcp_set_barebox_global("bootfile", bp->bp_file);
}
debug("bootfile: %s\n", bp->bp_file);
}
@ -607,20 +654,74 @@ static void dhcp_reset_env(void)
for (i = 0; i < ARRAY_SIZE(dhcp_options); i++) {
opt = &dhcp_options[i];
if (!opt->barebox_var_name)
if (!opt->barebox_var_name || opt->copy_only_if_valid)
continue;
setenv(opt->barebox_var_name,"");
if (opt->barebox_dhcp_global)
dhcp_set_barebox_global(opt->barebox_dhcp_global,"");
}
}
static void dhcp_global_add(const char *var)
{
char * var_global = asprintf("dhcp.%s", var);
if (!var_global)
return;
globalvar_add_simple(var_global);
free(var_global);
}
static int dhcp_global_init(void)
{
struct dhcp_opt *opt;
struct dhcp_param *param;
int i;
for (i = 0; i < ARRAY_SIZE(dhcp_options); i++) {
opt = &dhcp_options[i];
if (!opt->barebox_dhcp_global)
continue;
dhcp_global_add(opt->barebox_dhcp_global);
}
for (i = 0; i < ARRAY_SIZE(dhcp_params); i++) {
param = &dhcp_params[i];
if (!param->barebox_dhcp_global)
continue;
dhcp_global_add(param->barebox_dhcp_global);
}
return 0;
}
late_initcall(dhcp_global_init);
static void dhcp_getenv_int(const char *name, int *i)
{
const char* str = getenv(name);
if (!str)
return;
*i = simple_strtoul(str, NULL, 10);
}
static int do_dhcp(int argc, char *argv[])
{
int ret, opt;
int retries = DHCP_DEFAULT_RETRY;
dhcp_reset_env();
while((opt = getopt(argc, argv, "H:v:c:u:U:")) > 0) {
dhcp_getenv_int("global.dhcp.retries", &retries);
while((opt = getopt(argc, argv, "H:v:c:u:U:r:")) > 0) {
switch(opt) {
case 'H':
dhcp_set_param_data(DHCP_HOSTNAME, optarg);
@ -637,9 +738,17 @@ static int do_dhcp(int argc, char *argv[])
case 'U':
dhcp_set_param_data(DHCP_USER_CLASS, optarg);
break;
case 'r':
retries = simple_strtoul(optarg, NULL, 10);
break;
}
}
if (!retries) {
printf("retries is set to zero, set it to %d\n", DHCP_DEFAULT_RETRY);
retries = DHCP_DEFAULT_RETRY;
}
dhcp_con = net_udp_new(0xffffffff, PORT_BOOTPS, dhcp_handler, NULL);
if (IS_ERR(dhcp_con)) {
ret = PTR_ERR(dhcp_con);
@ -660,11 +769,17 @@ static int do_dhcp(int argc, char *argv[])
while (dhcp_state != BOUND) {
if (ctrlc())
break;
if (!retries) {
ret = -ETIMEDOUT;
goto out1;
}
net_poll();
if (is_timeout(dhcp_start, 3 * SECOND)) {
dhcp_start = get_time_ns();
printf("T ");
ret = bootp_request();
/* no need to check if retries > 0 as we check if != 0 */
retries--;
if (ret)
goto out1;
}
@ -676,7 +791,7 @@ out:
if (ret)
printf("dhcp failed: %s\n", strerror(-ret));
return ret ? 1 : 0;
return ret;
}
BAREBOX_CMD_HELP_START(dhcp)
@ -699,7 +814,8 @@ BAREBOX_CMD_HELP_OPT ("-u <client_uuid>",
BAREBOX_CMD_HELP_OPT ("-U <user_class>",
"DHCP User class (code 77) submitted in DHCP requests. It can\n"
"be used in the DHCP server's configuration to select options\n"
"(e.g. bootfile or server) which are valid for barebox clients only.\n");
"(e.g. bootfile or server) which are valid for barebox clients only.\n")
BAREBOX_CMD_HELP_OPT ("-r <retry>", "retry limit by default "__stringify(DHCP_DEFAULT_RETRY)"\n");
BAREBOX_CMD_HELP_END
BAREBOX_CMD_START(dhcp)
@ -709,12 +825,13 @@ BAREBOX_CMD_START(dhcp)
BAREBOX_CMD_COMPLETE(empty_complete)
BAREBOX_CMD_END
BAREBOX_MAGICVAR(bootfile, "bootfile returned from DHCP request");
BAREBOX_MAGICVAR(hostname, "hostname to send or returned from DHCP request");
BAREBOX_MAGICVAR(rootpath, "rootpath returned from DHCP request");
BAREBOX_MAGICVAR(dhcp_vendor_id, "vendor id to send to the DHCP server");
BAREBOX_MAGICVAR(dhcp_client_uuid, "cliend uuid to send to the DHCP server");
BAREBOX_MAGICVAR(dhcp_client_id, "cliend id to send to the DHCP server");
BAREBOX_MAGICVAR(dhcp_user_class, "user class to send to the DHCP server");
BAREBOX_MAGICVAR(dhcp_tftp_server_name, "TFTP server Name returned from DHCP request");
BAREBOX_MAGICVAR(dhcp_oftree_file, "OF tree returned from DHCP request (option 224)");
BAREBOX_MAGICVAR_NAMED(global_hostname, global.hostname, "hostname to send or returned from DHCP request");
BAREBOX_MAGICVAR_NAMED(global_dhcp_bootfile, global.dhcp.bootfile, "bootfile returned from DHCP request");
BAREBOX_MAGICVAR_NAMED(global_dhcp_rootpath, global.dhcp.rootpath, "rootpath returned from DHCP request");
BAREBOX_MAGICVAR_NAMED(global_dhcp_vendor_id, global.dhcp.vendor_id, "vendor id to send to the DHCP server");
BAREBOX_MAGICVAR_NAMED(global_dhcp_client_uuid, global.dhcp.client_uuid, "cliend uuid to send to the DHCP server");
BAREBOX_MAGICVAR_NAMED(global_dhcp_client_id, global.dhcp.client_id, "cliend id to send to the DHCP server");
BAREBOX_MAGICVAR_NAMED(global_dhcp_user_class, global.dhcp.user_class, "user class to send to the DHCP server");
BAREBOX_MAGICVAR_NAMED(global_dhcp_tftp_server_name, global.dhcp.tftp_server_name, "TFTP server Name returned from DHCP request");
BAREBOX_MAGICVAR_NAMED(global_dhcp_oftree_file, global.dhcp.oftree_file, "OF tree returned from DHCP request (option 224)");
BAREBOX_MAGICVAR_NAMED(global_dhcp_retries, global.dhcp.retries, "retry limit");