defaultv env update v2
Hi,
the following patch series update the update default env support by using getopts and allow us to specify via Kconfig the dependecy of the defaultenv
a secondi step could be to use the preprocessir to generate some part of it
Best Regards,
J.
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
PATCH 1/6 defaultenv: introduce CONFIG_DEFAULT_ENVIRONMENT_GENERIC to enable it
this will we usefull to enable functionnality if used
--- arch/arm/configs/neso_defconfig | 3 ++- arch/arm/configs/pca100_defconfig | 3 ++- arch/arm/configs/pcm037_defconfig | 3 ++- arch/arm/configs/pcm038_defconfig | 3 ++- arch/arm/configs/pcm043_defconfig | 3 ++- common/Kconfig | 13 +++++++++++++ common/Makefile | 10 ++++++++-- 7 files changed, 31 insertions(+), 7 deletions(-)
arch/arm/configs/neso_defconfig +2 -1
@@ -12,7 +12,8 @@ CONFIG_HUSH_FANCY_PROMPT=y CONFIG_CMDLINE_EDITING=y CONFIG_AUTO_COMPLETE=y CONFIG_PARTITION=y -CONFIG_DEFAULT_ENVIRONMENT_PATH="defaultenv arch/arm/boards/guf-neso/env" +CONFIG_DEFAULT_ENVIRONMENT_GENERIC=y +CONFIG_DEFAULT_ENVIRONMENT_PATH="arch/arm/boards/guf-neso/env" CONFIG_CMD_EDIT=y CONFIG_CMD_SLEEP=y CONFIG_CMD_SAVEENV=y
arch/arm/configs/pca100_defconfig +2 -1
@@ -12,7 +12,8 @@ CONFIG_HUSH_FANCY_PROMPT=y CONFIG_CMDLINE_EDITING=y CONFIG_AUTO_COMPLETE=y CONFIG_PARTITION=y -CONFIG_DEFAULT_ENVIRONMENT_PATH="defaultenv arch/arm/boards/phycard-i.MX27/env" +CONFIG_DEFAULT_ENVIRONMENT_GENERIC=y +CONFIG_DEFAULT_ENVIRONMENT_PATH="arch/arm/boards/phycard-i.MX27/env" CONFIG_CMD_EDIT=y CONFIG_CMD_SLEEP=y CONFIG_CMD_SAVEENV=y
arch/arm/configs/pcm037_defconfig +2 -1
@@ -10,7 +10,8 @@ CONFIG_HUSH_FANCY_PROMPT=y CONFIG_CMDLINE_EDITING=y CONFIG_AUTO_COMPLETE=y CONFIG_PARTITION=y -CONFIG_DEFAULT_ENVIRONMENT_PATH="defaultenv arch/arm/boards/pcm037/env" +CONFIG_DEFAULT_ENVIRONMENT_GENERIC=y +CONFIG_DEFAULT_ENVIRONMENT_PATH="arch/arm/boards/pcm037/env" CONFIG_CMD_EDIT=y CONFIG_CMD_SLEEP=y CONFIG_CMD_SAVEENV=y
arch/arm/configs/pcm038_defconfig +2 -1
@@ -13,7 +13,8 @@ CONFIG_HUSH_FANCY_PROMPT=y CONFIG_CMDLINE_EDITING=y CONFIG_AUTO_COMPLETE=y CONFIG_PARTITION=y -CONFIG_DEFAULT_ENVIRONMENT_PATH="defaultenv arch/arm/boards/pcm038/env" +CONFIG_DEFAULT_ENVIRONMENT_GENERIC=y +CONFIG_DEFAULT_ENVIRONMENT_PATH="arch/arm/boards/pcm038/env" CONFIG_CMD_EDIT=y CONFIG_CMD_SLEEP=y CONFIG_CMD_SAVEENV=y
arch/arm/configs/pcm043_defconfig +2 -1
@@ -13,7 +13,8 @@ CONFIG_HUSH_FANCY_PROMPT=y CONFIG_CMDLINE_EDITING=y CONFIG_AUTO_COMPLETE=y CONFIG_PARTITION=y -CONFIG_DEFAULT_ENVIRONMENT_PATH="defaultenv arch/arm/boards/pcm043/env" +CONFIG_DEFAULT_ENVIRONMENT_GENERIC=y +CONFIG_DEFAULT_ENVIRONMENT_PATH="arch/arm/boards/pcm043/env" CONFIG_CMD_EDIT=y CONFIG_CMD_SLEEP=y CONFIG_CMD_SAVEENV=y
common/Kconfig +13 -0
@@ -389,6 +389,19 @@ config DEFAULT_ENVIRONMENT Enabling this option will give you a default environment when the environment found in the environment sector is invalid +config DEFAULT_ENVIRONMENT_GENERIC + bool + depends on DEFAULT_ENVIRONMENT + select SHELL_HUSH + prompt "Default environment generic" + help + With this option barebox will use the generic default + environment found under defaultenv/ in the src tree. + The Directory given with DEFAULT_ENVIRONMENT_PATH + will be added to the default environment. This should + at least contain a /env/config file. + This will be able to overwrite the files from defaultenv. + config DEFAULT_ENVIRONMENT_PATH string depends on DEFAULT_ENVIRONMENT
common/Makefile +8 -2
@@ -26,12 +26,18 @@ ifdef CONFIG_DEFAULT_ENVIRONMENT $(obj)/startup.o: include/generated/barebox_default_env.h $(obj)/env.o: include/generated/barebox_default_env.h -ENV_FILES := $(shell cd $(srctree); for i in $(CONFIG_DEFAULT_ENVIRONMENT_PATH); do find $${i} -type f -exec readlink -f {} \;; done) +ifeq ($(CONFIG_DEFAULT_ENVIRONMENT_GENERIC),y) +DEFAULT_ENVIRONMENT_PATH = "defaultenv" +endif + +DEFAULT_ENVIRONMENT_PATH += $(CONFIG_DEFAULT_ENVIRONMENT_PATH) + +ENV_FILES := $(shell cd $(srctree); for i in $(DEFAULT_ENVIRONMENT_PATH); do find $${i} -type f -exec readlink -f {} \;; done) endif # ifdef CONFIG_DEFAULT_ENVIRONMENT barebox_default_env: $(ENV_FILES) - $(Q)$(srctree)/scripts/genenv $(srctree) $(objtree) $(CONFIG_DEFAULT_ENVIRONMENT_PATH) + $(Q)$(srctree)/scripts/genenv $(srctree) $(objtree) $(DEFAULT_ENVIRONMENT_PATH) include/generated/barebox_default_env.h: barebox_default_env $(Q)cat $< | $(objtree)/scripts/bin2c default_environment > $@
Signature · 7 lines
1.7.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 2/6 commands/crc32: add compare 2 files crc
In reply to Jean-Christophe PLAGNIOL-VILLARDadd -F options to compare to file crc
it's usefull to compare what you flash in a partition
it's selectable by CONFIG_CMD_CRC_CMP
--- commands/Kconfig | 5 ++ commands/crc.c | 111 ++++++++++++++++++++++++++++++++++++------------------ 2 files changed, 79 insertions(+), 37 deletions(-)
commands/Kconfig +5 -0
@@ -202,6 +202,11 @@ config CMD_CRC select CRC32 prompt "crc" +config CMD_CRC_CMP + tristate + depends on CMD_CRC + prompt "compare 2 files crc" + config CMD_MTEST tristate prompt "mtest"
commands/crc.c +74 -37
149 lines not on this page · raw message
Signature · 7 lines
1.7.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 3/6 defaultenv/update: merge update_rootfs and update_kernel
In reply to Jean-Christophe PLAGNIOL-VILLARDuse getopt to simplify it and prepare for xmodem support
--- common/Kconfig | 1 + defaultenv/bin/_update | 4 --- defaultenv/bin/_update_help | 8 +++++++ defaultenv/bin/init | 3 +- defaultenv/bin/update | 45 ++++++++++++++++++++++++++++++++++++++++++ defaultenv/bin/update_kernel | 15 -------------- defaultenv/bin/update_rootfs | 16 -------------- 7 files changed, 55 insertions(+), 37 deletions(-) create mode 100644 defaultenv/bin/_update_help create mode 100644 defaultenv/bin/update delete mode 100644 defaultenv/bin/update_kernel delete mode 100644 defaultenv/bin/update_rootfs
common/Kconfig +1 -0
@@ -393,6 +393,7 @@ config DEFAULT_ENVIRONMENT_GENERIC bool depends on DEFAULT_ENVIRONMENT select SHELL_HUSH + select HUSH_GETOPT prompt "Default environment generic" help With this option barebox will use the generic default
defaultenv/bin/_update +0 -4
@@ -10,10 +10,6 @@ if [ ! -e "$part" ]; then exit 1 fi -if [ $# = 1 ]; then - image=$1 -fi - if [ x$ip = xdhcp ]; then dhcp fi
defaultenv/bin/_update_help new file +8 -0
@@ -0,0 +1,8 @@ +#!/bin/sh + +echo "usage: $0 -t <kernel|rootfs> -d <nor|nand> [-f imagename]" +echo "update tools." +echo"" +echo "type update -t kernel -d <nor|nand> [-f imagename] to update kernel into flash" +echo "type update -t rootfs -d <nor|nand> [-f imagename] to update rootfs into flash" +
defaultenv/bin/init +1 -2
@@ -25,8 +25,7 @@ echo -n "Hit any key to stop autoboot: " timeout -a $autoboot_timeout if [ $? != 0 ]; then echo - echo "type update_kernel nand|nor [<imagename>] to update kernel into flash" - echo "type update_rootfs nand|nor [<imagename>] to update rootfs into flash" + update -h echo exit fi
defaultenv/bin/update new file +45 -0
45 lines not on this page · raw message
defaultenv/bin/update_kernel deleted +0 -15
@@ -1,15 +0,0 @@ -#!/bin/sh - -. /env/config -image=$kernelimage - -if [ x$1 = xnand ]; then - part=/dev/nand0.kernel.bb -elif [ x$1 = xnor ]; then - part=/dev/nor0.kernel -else - echo "usage: $0 nor|nand [imagename]" - exit 1 -fi - -. /env/bin/_update $2
defaultenv/bin/update_rootfs deleted +0 -16
@@ -1,16 +0,0 @@ -#!/bin/sh - -. /env/config - -image=$rootfsimage - -if [ x$1 = xnand ]; then - part=/dev/nand0.root.bb -elif [ x$1 = xnor ]; then - part=/dev/nor0.root -else - echo "usage: $0 nor|nand [imagename]" - exit 1 -fi - -. /env/bin/_update $2
Signature · 7 lines
1.7.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 4/6 defaultenv/update: add check crc32 options
In reply to Jean-Christophe PLAGNIOL-VILLARD--- common/Kconfig | 2 ++ defaultenv/bin/_update_help | 8 +++++--- defaultenv/bin/update | 8 +++++++- 3 files changed, 14 insertions(+), 4 deletions(-)
common/Kconfig +2 -0
@@ -394,6 +394,8 @@ config DEFAULT_ENVIRONMENT_GENERIC depends on DEFAULT_ENVIRONMENT select SHELL_HUSH select HUSH_GETOPT + select CMD_CRC + select CMD_CRC_CMP prompt "Default environment generic" help With this option barebox will use the generic default
defaultenv/bin/_update_help +5 -3
@@ -1,8 +1,10 @@ #!/bin/sh -echo "usage: $0 -t <kernel|rootfs> -d <nor|nand> [-f imagename]" +echo "usage: $0 -t <kernel|rootfs> -d <nor|nand> [-f imagename] -c" echo "update tools." -echo"" +echo "" +echo "options" +echo " -c to check the crc32 for the image and flashed one" +echo "" echo "type update -t kernel -d <nor|nand> [-f imagename] to update kernel into flash" echo "type update -t rootfs -d <nor|nand> [-f imagename] to update rootfs into flash" -
defaultenv/bin/update +7 -1
@@ -4,8 +4,9 @@ type="" device_type="" +check=n -while getopt "ht:d:f:" Option +while getopt "ht:d:f:c" Option do if [ ${Option} = t ]; then type=${OPTARG}
@@ -13,6 +14,8 @@ elif [ ${Option} = d ]; then device_type=${OPTARG} elif [ ${Option} = f ]; then imagename=${OPTARG} +elif [ ${Option} = c ]; then + check=y else . /env/bin/_update_help exit 0
@@ -43,3 +46,6 @@ else fi . /env/bin/_update +if [ x${check} = xy ]; then + crc32 -f $image -F $part +fi
Signature · 7 lines
1.7.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 5/6 defaultenv: add xmodem support for update
In reply to Jean-Christophe PLAGNIOL-VILLARDthe default mode is tftp to do not change the default behavior
--- defaultenv/bin/_update | 26 +++++++++++++++++--------- defaultenv/bin/_update_help | 21 +++++++++++---------- defaultenv/bin/update | 11 ++++++++++- 3 files changed, 38 insertions(+), 20 deletions(-)
rewrite defaultenv/bin/_update_help (65%)
defaultenv/bin/_update +17 -9
@@ -10,14 +10,16 @@ if [ ! -e "$part" ]; then exit 1 fi -if [ x$ip = xdhcp ]; then - dhcp -fi - -ping $eth0.serverip -if [ $? -ne 0 ] ; then - echo "Server did not reply! Update aborted." - exit 1 +if [ x$mode = xtftp ]; then + if [ x$ip = xdhcp ]; then + dhcp + fi + + ping $eth0.serverip + if [ $? -ne 0 ] ; then + echo "Server did not reply! Update aborted." + exit 1 + fi fi unprotect $part
@@ -30,6 +32,12 @@ erase $part echo echo "flashing $image to $part" echo -tftp $image $part + +if [ x$mode = xtftp ]; then + tftp $image $part +else + loadb -f $image -c + cp $image $part +fi protect $part
defaultenv/bin/_update_help +11 -10
@@ -1,10 +1,11 @@ -#!/bin/sh - -echo "usage: $0 -t <kernel|rootfs> -d <nor|nand> [-f imagename] -c" -echo "update tools." -echo "" -echo "options" -echo " -c to check the crc32 for the image and flashed one" -echo "" -echo "type update -t kernel -d <nor|nand> [-f imagename] to update kernel into flash" -echo "type update -t rootfs -d <nor|nand> [-f imagename] to update rootfs into flash" +#!/bin/sh + +echo "usage: $0 -t <kernel|rootfs> -d <nor|nand> [-m tftp|xmodem] [-f imagename] -c" +echo "update tools." +echo "" +echo "options" +echo " -c to check the crc32 for the image and flashed one" +echo "" +echo "default mode is tftp" +echo "type update -t kernel -d <nor|nand> [-m tftp|xmodem] [-f imagename] to update kernel into flash" +echo "type update -t rootfs -d <nor|nand> [-m tftp|xmodem] [-f imagename] to update rootfs into flash"
defaultenv/bin/update +10 -1
@@ -5,8 +5,9 @@ type="" device_type="" check=n +mode=tftp -while getopt "ht:d:f:c" Option +while getopt "ht:d:f:m:c" Option do if [ ${Option} = t ]; then type=${OPTARG}
@@ -16,6 +17,8 @@ elif [ ${Option} = f ]; then imagename=${OPTARG} elif [ ${Option} = c ]; then check=y +elif [ ${Option} = m ]; then + mode=${OPTARG} else . /env/bin/_update_help exit 0
@@ -45,6 +48,12 @@ else exit 1 fi +if [ x${mode} != xtftp ] && [ x${mode} != xxmodem ] ; then + echo "unsupported mode ${mode}." + . /env/bin/_update_help + exit 1 +fi + . /env/bin/_update if [ x${check} = xy ]; then crc32 -f $image -F $part
Signature · 7 lines
1.7.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 6/6 defaultenv: add update_barebox to update barebox easly via tftp or xmodem
In reply to Jean-Christophe PLAGNIOL-VILLARD--- defaultenv/bin/_update_help | 3 ++- defaultenv/bin/update | 5 +++++ 2 files changed, 7 insertions(+), 1 deletions(-)
defaultenv/bin/_update_help +2 -1
@@ -1,6 +1,6 @@ #!/bin/sh -echo "usage: $0 -t <kernel|rootfs> -d <nor|nand> [-m tftp|xmodem] [-f imagename] -c" +echo "usage: $0 -t <kernel|rootfs|barebox> -d <nor|nand> [-m tftp|xmodem] [-f imagename] -c" echo "update tools." echo "" echo "options"
@@ -9,3 +9,4 @@ echo "" echo "default mode is tftp" echo "type update -t kernel -d <nor|nand> [-m tftp|xmodem] [-f imagename] to update kernel into flash" echo "type update -t rootfs -d <nor|nand> [-m tftp|xmodem] [-f imagename] to update rootfs into flash" +echo "type update -t barebox -d <nor|nand> [-m tftp|xmodem] [-f imagename] to update barebox into flash"
defaultenv/bin/update +5 -0
@@ -30,6 +30,11 @@ if [ x${type} = xkernel ]; then elif [ x${type} = xrootfs ]; then image=$rootfsimage type=root +elif [ x${type} = xbarebox ]; then + image=$bareboximage + if [ x${image} = x ]; then + imamge=barebox.bin + fi else . /env/bin/_update_help exit 1
Signature · 7 lines
1.7.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 1/1 nhk8815: use defaultenv
In reply to Jean-Christophe PLAGNIOL-VILLARD--- arch/arm/boards/nhk8815/env/bin/_update | 36 ---------------- arch/arm/boards/nhk8815/env/bin/boot | 38 ----------------- arch/arm/boards/nhk8815/env/bin/init | 28 ------------ .../boards/nhk8815/env/bin/update_barebox_xmodem | 19 -------- arch/arm/boards/nhk8815/env/bin/update_kernel | 8 ---- arch/arm/boards/nhk8815/env/bin/update_root | 8 ---- arch/arm/boards/nhk8815/env/config | 44 +++++++++++++------ arch/arm/configs/nhk8815_defconfig | 5 +- 8 files changed, 33 insertions(+), 153 deletions(-) delete mode 100644 arch/arm/boards/nhk8815/env/bin/_update delete mode 100644 arch/arm/boards/nhk8815/env/bin/boot delete mode 100644 arch/arm/boards/nhk8815/env/bin/init delete mode 100644 arch/arm/boards/nhk8815/env/bin/update_barebox_xmodem delete mode 100644 arch/arm/boards/nhk8815/env/bin/update_kernel delete mode 100644 arch/arm/boards/nhk8815/env/bin/update_root
arch/arm/boards/nhk8815/env/bin/_update deleted +0 -36
@@ -1,36 +0,0 @@ -#!/bin/sh - -if [ -z "$part" -o -z "$image" ]; then - echo "define \$part and \$image" - exit 1 -fi - -if [ \! -e "$part" ]; then - echo "Partition $part does not exist" - exit 1 -fi - -if [ $# = 1 ]; then - image=$1 -fi - -if [ x$ip = xdhcp ]; then - dhcp -fi - -ping $eth0.serverip -if [ $? -ne 0 ] ; then - echo "update aborted" - exit 1 -fi - -unprotect $part - -echo -echo "erasing partition $part" -erase $part - -echo -echo "flashing $image to $part" -echo -tftp $image $part
arch/arm/boards/nhk8815/env/bin/boot deleted +0 -38
@@ -1,38 +0,0 @@ -#!/bin/sh - -. /env/config - -if [ x$1 = xflash ]; then - root=flash - kernel=flash -fi - -if [ x$1 = xnet ]; then - root=net - kernel=net -fi - -if [ x$ip = xdhcp ]; then - bootargs="$bootargs ip=dhcp" -else - bootargs="$bootargs ip=$eth0.ipaddr:$eth0.serverip:$eth0.gateway:$eth0.netmask:::" -fi - -if [ x$root = xflash ]; then - bootargs="$bootargs root=$rootpart rootfstype=jffs2" -else - bootargs="$bootargs root=/dev/nfs nfsroot=192.168.23.111:$nfsroot" -fi - -bootargs="$bootargs" - -if [ $kernel = net ]; then - if [ x$ip = xdhcp ]; then - dhcp - fi - tftp $uimage uImage - bootm uImage -else - bootm /dev/nor0.kernel -fi -
arch/arm/boards/nhk8815/env/bin/init deleted +0 -28
@@ -1,28 +0,0 @@ -#!/bin/sh - -PATH=/env/bin -export PATH - -. /env/config - -if [ -e /dev/nand0 ]; then - addpart /dev/nand0 $nand_parts - - # Uh, oh, hush first expands wildcards and then starts executing - # commands. What a bug! - source /env/bin/hush_hack -fi - -echo -echo -n "Hit any key to stop autoboot: " -timeout -a $autoboot_timeout -if [ $? != 0 ]; then - echo - echo "type update_kernel [<imagename>] to update kernel into flash" - echo "type udate_root [<imagename>] to update rootfs into flash" - echo "type update_barebox_xmodem nor to update barebox into flash" - echo - exit -fi - -boot
arch/arm/boards/nhk8815/env/bin/update_barebox_xmodem deleted +0 -19
@@ -1,19 +0,0 @@ -#!/bin/sh - -. /env/config - -part=/dev/nand0.barebox - -loadb -f barebox.bin -c - -unprotect $part -echo -echo "erasing partition $part" -erase $part - -echo -echo "flashing barebox.bin to $part" -echo -cp barebox.bin $part -crc32 -f barebox.bin -crc32 -f $part
arch/arm/boards/nhk8815/env/bin/update_kernel deleted +0 -8
@@ -1,8 +0,0 @@ -#!/bin/sh - -. /env/config - -image=$uimage -part=/dev/nand0.kernel - -. /env/bin/_update $1
arch/arm/boards/nhk8815/env/bin/update_root deleted +0 -8
@@ -1,8 +0,0 @@ -#!/bin/sh - -. /env/config - -image=$jffs2 -part=/dev/nand0.rootfs - -. /env/bin/_update $1
arch/arm/boards/nhk8815/env/config +30 -14
57 lines not on this page · raw message
arch/arm/configs/nhk8815_defconfig +3 -2
@@ -10,7 +10,8 @@ CONFIG_AUTO_COMPLETE=y CONFIG_MENU=y CONFIG_PASSWD_SUM_SHA1=y CONFIG_PARTITION=y -CONFIG_DEFAULT_ENVIRONMENT_PATH="arch/arm/boards/nhk8815/env" +CONFIG_DEFAULT_ENVIRONMENT_GENERIC=y +CONFIG_DEFAULT_ENVIRONMENT_PATH="defaultenv arch/arm/boards/nhk8815/env" CONFIG_CMD_EDIT=y CONFIG_CMD_SLEEP=y CONFIG_CMD_SAVEENV=y
@@ -22,8 +23,8 @@ CONFIG_CMD_MENU=y CONFIG_CMD_MENU_MANAGEMENT=y CONFIG_CMD_PASSWD=y CONFIG_CMD_ECHO_E=y +CONFIG_CMD_LOADB=y CONFIG_CMD_MEMINFO=y -CONFIG_CMD_CRC=y CONFIG_CMD_MTEST=y CONFIG_CMD_FLASH=y CONFIG_CMD_BOOTM_ZLIB=y
Signature · 7 lines
1.7.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox