9
0
Fork 0

defaultenv-2: Make use of nonvolatile variables

This moves the variable assignments previously done in /env/config-board
to non volatile variables in /env/nv/. This makes the settings adjustable
by the user without editing a file.

Most of the changes are simple conversions which for many boards makes
/env/config-board unnecessary. Some boards had some logic to assign
global.boot.default based on the current bootsource. This has been
moved to /env/init/bootsource. An additional check is added to not
overwrite a nv.boot.default should it exist.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Sascha Hauer 2014-11-06 09:56:43 +01:00
parent 32e879f0a3
commit 7962e7a0b4
75 changed files with 84 additions and 225 deletions

View File

@ -1,5 +1,9 @@
#!/bin/sh
if [ -n "$nv.boot.default" ]; then
exit
fi
if [ -f /mnt/sd/zImage ]; then
global.boot.default=sd-card-linux
elif [ -f /mnt/sd/android ]; then

View File

@ -1,19 +0,0 @@
#!/bin/sh
# change network settings in /env/network/eth0
# change mtd partition settings and automountpoints in /env/init/*
# set to false if you do not want to have colors
global.allow_color=true
# user (used for network filenames)
global.user=none
# timeout in seconds before the default boot entry is started
global.autoboot_timeout=3
# default boot entry (one of /env/boot/*)
global.boot.default=android
# base bootargs
#global.linux.bootargs.base="console=ttyS0,115200"

View File

@ -1,8 +0,0 @@
#!/bin/sh
# board defaults, do not change in running system. Change /env/config
# instead
global.hostname=at91sam9m10ihd
global.linux.bootargs.base="console=ttyS0,115200"
global.boot.default=android

View File

@ -0,0 +1 @@
android

View File

@ -0,0 +1 @@
at91sam9m10ihd

View File

@ -0,0 +1 @@
console=ttyS0,115200

View File

@ -1,6 +0,0 @@
#!/bin/sh
# board defaults, do not change in running system. Change /env/config
# instead
global.linux.bootargs.base="console=ttyPS1,115200"

View File

@ -0,0 +1 @@
console=ttyPS1,115200

View File

@ -1,6 +0,0 @@
#!/bin/sh
# board defaults, do not change in running system. Change /env/config
# instead
global.linux.bootargs.base="console=ttyO2,115200"

View File

@ -0,0 +1 @@
console=ttyO2,115200

View File

@ -1,10 +0,0 @@
#!/bin/sh
# Timeout in seconds before the default boot entry is started
global.autoboot_timeout=2
# Default boot entry (one of /env/boot/*)
global.boot.default=nand
# Board bootargs
global.linux.bootargs.base="earlyprintk console=ttymxc0,115200n8"

View File

@ -0,0 +1 @@
2

View File

@ -0,0 +1 @@
nand

View File

@ -0,0 +1 @@
earlyprintk console=ttymxc0,115200n8

View File

@ -1,12 +0,0 @@
#!/bin/sh
# Timeout in seconds before the default boot entry is started
global.autoboot_timeout=2
# Default boot entry (one of /env/boot/*)
if [ -e /dev/nor0 ]; then
global.boot.default=nor
fi
# Board bootargs
global.linux.bootargs.base="earlyprintk console=ttyCL0,57600n8"

View File

@ -0,0 +1,9 @@
#!/bin/sh
if [ -n "$nv.boot.default" ]; then
exit
fi
if [ -e /dev/nor0 ]; then
global.boot.default=nor
fi

View File

@ -0,0 +1 @@
2

View File

@ -0,0 +1 @@
earlyprintk console=ttyCL0,57600n8

View File

@ -1,6 +0,0 @@
#!/bin/sh
# board defaults, do not change in running system. Change /env/config
# instead
global.linux.bootargs.base="console=ttyAMA0,115200"

View File

@ -1,12 +0,0 @@
#!/bin/sh
if [ "$1" = menu ]; then
init-menu-add-entry "$0" "general config settings"
exit
fi
# timeout in seconds before the default boot entry is started
global.autoboot_timeout=3
# default boot entry (one of /env/boot/*)
global.boot.default=mmc-ext3

View File

@ -0,0 +1 @@
mmc-ext3

View File

@ -0,0 +1 @@
console=ttyAMA0,115200

View File

@ -1,29 +0,0 @@
#!/bin/sh
# change network settings in /env/network/eth0
# change mtd partition settings and automountpoints in /env/init/*
#global.hostname=
# set to false if you do not want to have colors
global.allow_color=true
# user (used for network filenames)
global.user=none
# timeout in seconds before the default boot entry is started
global.autoboot_timeout=1
# default boot entry (one of /env/boot/*)
# (if not overwritten here, the bootdevice barebox comes from
# is used)
#global.boot.default=net
# base bootargs
global.linux.bootargs.base="console=tty1"
# suitable for 800MHz
global linux.bootargs.lpj="lpj=3997696"
# speed up booting by being more quiet
global linux.bootargs.quiet="quiet"

View File

@ -1,5 +1,9 @@
#!/bin/sh
if [ -n "$nv.boot.default" ]; then
exit
fi
# by default pick kernel from MMC card if booting from
# it, otherwise default to boot from internal harddisk

View File

@ -0,0 +1 @@
1

View File

@ -0,0 +1 @@
console=tty1

View File

@ -0,0 +1 @@
lpj=3997696

View File

@ -0,0 +1 @@
quiet

View File

@ -1,7 +0,0 @@
#!/bin/sh
# board defaults, do not change in running system. Change /env/config
# instead
global.hostname=e9
global.boot.default=$bootsource$bootsource_instance

View File

@ -0,0 +1,7 @@
#!/bin/sh
if [ -n "$nv.boot.default" ]; then
exit
fi
global.boot.default=$bootsource$bootsource_instance

View File

@ -0,0 +1 @@
e9

View File

@ -1,6 +0,0 @@
#!/bin/sh
# board defaults, do not change in running system. Change /env/config
# instead
global.linux.bootargs.base="console=ttymxc3,115200"

View File

@ -1,7 +0,0 @@
#!/bin/sh
# board defaults, do not change in running system. Change /env/config
# instead
global.hostname=vincell
global.linux.bootargs.base="console=ttymxc0,115200"

View File

@ -0,0 +1 @@
vincell

View File

@ -0,0 +1 @@
console=ttymxc0,115200

View File

@ -1,10 +0,0 @@
#!/bin/sh
# board defaults, do not change in running system. Change /env/config
# instead
global.allow_color=true
global.autoboot_timeout=3
global.bootm.oftree="/dev/dtb"
global.linux.bootargs.base="console=ttyAMA0,115200n8 CONSOLE=/dev/ttyAMA0"
global.boot.default=/env/boot.d

View File

@ -0,0 +1 @@
/env/boot.d

View File

@ -0,0 +1 @@
console=ttyAMA0,115200n8 CONSOLE=/dev/ttyAMA0

View File

@ -0,0 +1 @@
/dev/dtb

View File

@ -1,7 +0,0 @@
#!/bin/sh
# board defaults, do not change in running system. Change /env/config
# instead
global.boot.default="usbmsd sd nor"
global.linux.bootargs.base="console=ttymxc0,921600"

View File

@ -0,0 +1 @@
usbmsd sd nor

View File

@ -0,0 +1 @@
console=ttymxc0,921600

View File

@ -1,6 +0,0 @@
#!/bin/sh
# board defaults, do not change in running system. Change /env/config
# instead
global.linux.bootargs.base="console=ttyO2,115200"

View File

@ -0,0 +1 @@
console=ttyO2,115200

View File

@ -1,9 +0,0 @@
#!/bin/sh
# board defaults, do not change in running system. Change /env/config
# instead
global.boot.default=nand
global.hostname=phyCARD-i.MX6
global.linux.bootargs.base="console=ttymxc2,115200"

View File

@ -0,0 +1 @@
console=ttymxc2,115200

View File

@ -0,0 +1 @@
phyCARD-i.MX6

View File

@ -1,10 +1,8 @@
#!/bin/sh
# board defaults, do not change in running system. Change /env/config
# instead
global.hostname=pcm051
global.linux.bootargs.base="console=ttyO0,115200"
if [ -n "$nv.boot.default" ]; then
exit
fi
if [ $bootsource = mmc ]; then
global.boot.default="mmc nand spi net"

View File

@ -0,0 +1,4 @@
#!/bin/sh
#otg1.mode=peripheral
usbgadget -a -A /dev/nand0.kernel.bb(kernel)

View File

@ -0,0 +1 @@
console=ttyO0,115200

View File

@ -1,6 +0,0 @@
#!/bin/sh
# board defaults, do not change in running system. Change /env/config
# instead
global.linux.bootargs.base="console=ttymxc0,115200"

View File

@ -0,0 +1 @@
console=ttymxc0,115200

View File

@ -1,6 +0,0 @@
#!/bin/sh
# board defaults, do not change in running system. Change /env/config
# instead
global.linux.bootargs.base="console=ttymxc0,115200"

View File

@ -0,0 +1 @@
console=ttymxc0,115200

View File

@ -1,10 +1,8 @@
#!/bin/sh
# board defaults, do not change in running system. Change /env/config
# instead
global.hostname=pfla03
global.linux.bootargs.base="console=ttyO0,115200"
if [ -n "$nv.boot.default" ]; then
exit
fi
if [ $bootsource = mmc ]; then
global.boot.default="mmc nand spi net"

View File

@ -0,0 +1 @@
console=ttyO0,115200

View File

@ -1,9 +0,0 @@
#!/bin/sh
# board defaults, do not change in running system. Change /env/config
# instead
global.boot.default=nand
global.hostname=phyFLEX-i.MX6
global.linux.bootargs.base="console=ttymxc3,115200"

View File

@ -0,0 +1 @@
phyFLEX-i.MX6

View File

@ -0,0 +1 @@
console=ttymxc3,115200

View File

@ -1,6 +0,0 @@
#!/bin/sh
# board defaults, do not change in running system. Change /env/config
# instead
global.linux.bootargs.base="console=ttyS2,115200"

View File

@ -0,0 +1 @@
console=ttyS2,115200

View File

@ -1,8 +0,0 @@
#!/bin/sh
# board defaults, do not change in running system. Change /env/config
# instead
global.hostname=evk-pro3
global.linux.bootargs.base="console=ttyS0,115200"
global.boot.default=nand-ubi

View File

@ -0,0 +1 @@
nand-ubi

View File

@ -0,0 +1 @@
console=ttyS0,115200

View File

@ -0,0 +1 @@
evk-pro3

View File

@ -631,6 +631,7 @@ config DEFAULT_ENVIRONMENT_GENERIC_NEW
select CMD_BASENAME
select CMD_READLINK
select CMD_DIRNAME
select CMD_NV
select FLEXIBLE_BOOTARGS
select CMD_BOOT
select NET_CMD_IFUP if NET

View File

@ -16,9 +16,12 @@ global editcmd
[ -z "${global.hostname}" ] && global.hostname=generic
[ -z "${global.user}" ] && global.user=none
magicvar -a global.user "username (used in network filenames)"
[ -z "${global.autoboot_timeout}" ] && global.autoboot_timeout=3
magicvar -a global.autoboot_timeout "timeout in seconds before automatic booting"
[ -z "${global.boot.default}" ] && global.boot.default=net
[ -z "${global.allow_color}" ] && global.allow_color=true
magicvar -a global.allow_color "Allow color on the console (boolean)"
[ -z "${global.editcmd}" ] && global.editcmd=sedit
[ -e /env/config-board ] && /env/config-board

View File

@ -3,23 +3,5 @@
# change network settings in /env/network/eth0
# change mtd partition settings and automountpoints in /env/init/*
#global.hostname=
# set to false if you do not want to have colors
#global.allow_color=true
# user (used for network filenames)
#global.user=none
# timeout in seconds before the default boot entry is started
#global.autoboot_timeout=3
# list of boot entries. These are executed in order until one
# succeeds. An entry can be:
# - a filename in /env/boot/
# - a full path to a directory. All files in this directory are
# treated as boot files and executed in alphabetical order
#global.boot.default=net
# base bootargs
#global.linux.bootargs.base="console=ttyS0,115200"
# The settings that used to be here are in nv variables now.
# See 'help nv', 'magicvar'

View File

@ -0,0 +1 @@
true

View File

@ -0,0 +1 @@
3

View File

@ -0,0 +1 @@
none