From 5c2852ff9ef62b95ac9c42e9d8dbd4c11ffb632d Mon Sep 17 00:00:00 2001 From: Jan Luebbe Date: Wed, 18 Jun 2014 21:41:02 +0200 Subject: [PATCH 01/16] commands: ls: add ll as an alias for ls -l This saves one second of user time on every interactive boot. Signed-off-by: Jan Luebbe Signed-off-by: Sascha Hauer --- commands/ls.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/commands/ls.c b/commands/ls.c index 344079030..f8144aecd 100644 --- a/commands/ls.c +++ b/commands/ls.c @@ -127,6 +127,9 @@ static int do_ls(int argc, char *argv[]) ulong flags = LS_COLUMN; struct string_list sl; + if (!strcmp(argv[0], "ll")) + flags &= ~LS_COLUMN; + while((opt = getopt(argc, argv, "RCl")) > 0) { switch(opt) { case 'R': @@ -219,3 +222,11 @@ BAREBOX_CMD_START(ls) BAREBOX_CMD_GROUP(CMD_GRP_FILE) BAREBOX_CMD_HELP(cmd_ls_help) BAREBOX_CMD_END + +BAREBOX_CMD_START(ll) + .cmd = do_ls, + BAREBOX_CMD_DESC("list a file or directory with details") + BAREBOX_CMD_OPTS("[-lCR] [FILEDIR...]") + BAREBOX_CMD_GROUP(CMD_GRP_FILE) + BAREBOX_CMD_HELP(cmd_ls_help) +BAREBOX_CMD_END From ffa9580561bbd5dbcf1bf5232164a55a29586c1c Mon Sep 17 00:00:00 2001 From: Jan Luebbe Date: Wed, 18 Jun 2014 21:43:18 +0200 Subject: [PATCH 02/16] ARM: AM335x: beaglebone: remove obsolete config The bootargs are now autogenerated by barebox and the hostname should not be preconfigured. Signed-off-by: Jan Luebbe Signed-off-by: Sascha Hauer --- .../beaglebone/defaultenv-beaglebone/config | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 arch/arm/boards/beaglebone/defaultenv-beaglebone/config diff --git a/arch/arm/boards/beaglebone/defaultenv-beaglebone/config b/arch/arm/boards/beaglebone/defaultenv-beaglebone/config deleted file mode 100644 index fbfa7d517..000000000 --- a/arch/arm/boards/beaglebone/defaultenv-beaglebone/config +++ /dev/null @@ -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=sd - -# base bootargs -global.linux.bootargs.base="console=ttyO0,115200n8" From 8316f29859e413413294663e39932fe17cf5a4d9 Mon Sep 17 00:00:00 2001 From: Jan Luebbe Date: Wed, 18 Jun 2014 21:43:19 +0200 Subject: [PATCH 03/16] ARM: AM335x: beaglebone: add simple script to change usb current limit Signed-off-by: Jan Luebbe Signed-off-by: Sascha Hauer --- .../beaglebone/defaultenv-beaglebone/init/usb-limit-1300 | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 arch/arm/boards/beaglebone/defaultenv-beaglebone/init/usb-limit-1300 diff --git a/arch/arm/boards/beaglebone/defaultenv-beaglebone/init/usb-limit-1300 b/arch/arm/boards/beaglebone/defaultenv-beaglebone/init/usb-limit-1300 new file mode 100644 index 000000000..56313bfdf --- /dev/null +++ b/arch/arm/boards/beaglebone/defaultenv-beaglebone/init/usb-limit-1300 @@ -0,0 +1,5 @@ +#!/bin/sh + +echo -n "changing USB current limit to 1300 mA... " +i2c_write -b 0 -a 0x24 -r 0x01 0x3e +echo "done" From b3a667cd841802074f5d97453c4ba6364c706c27 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Thu, 19 Jun 2014 11:57:45 +0200 Subject: [PATCH 04/16] remove unused boot-menu-add-entry The boot-menu-add-entry script no longer exists. Remove it from boot scripts. Signed-off-by: Sascha Hauer --- arch/arm/boards/archosg9/env/boot/sd-card-android | 5 ----- arch/arm/boards/archosg9/env/boot/sd-card-linux | 5 ----- arch/arm/boards/archosg9/env/boot/usb-android | 5 ----- arch/arm/boards/archosg9/env/boot/usb-linux | 5 ----- arch/arm/boards/at91sam9m10ihd/env/boot/android | 5 ----- arch/arm/boards/at91sam9m10ihd/env/boot/mmc | 5 ----- arch/arm/boards/at91sam9m10ihd/env/boot/net | 5 ----- arch/arm/boards/at91sam9m10ihd/env/boot/net-usb | 5 ----- arch/arm/boards/beagle/env/boot/mmc | 5 ----- arch/arm/boards/beagle/env/boot/nand-ubi | 5 ----- arch/arm/boards/beagle/env/boot/nand-ubi-dt | 5 ----- arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/sd | 5 ----- arch/arm/boards/ccxmx51/env/boot/nand | 5 ----- arch/arm/boards/clep7212/env/boot/nor | 5 ----- arch/arm/boards/crystalfontz-cfa10036/env/boot/mmc-ext3 | 5 ----- arch/arm/boards/datamodul-edm-qmx6/env/boot/mmc | 5 ----- arch/arm/boards/delphi-poc20/env/boot/mmc | 5 ----- arch/arm/boards/efika-mx-smartbook/env/boot/hd-internal | 5 ----- arch/arm/boards/efika-mx-smartbook/env/boot/mmc-left | 5 ----- arch/arm/boards/friendlyarm-mini2440/env/boot/nand | 5 ----- arch/arm/boards/guf-vincell/env/boot/nand-ubi | 5 ----- arch/arm/boards/highbank/env/boot/ahci | 5 ----- arch/arm/boards/highbank/env/boot/ahci-boot | 5 ----- arch/arm/boards/highbank/env/boot/mmc | 5 ----- arch/arm/boards/highbank/env/boot/mmc-boot | 5 ----- arch/arm/boards/highbank/env/boot/net | 5 ----- arch/arm/boards/highbank/env/boot/net-eth1 | 5 ----- arch/arm/boards/karo-tx25/env/boot/nand-ubi | 5 ----- arch/arm/boards/mx31moboard/env/boot/nor | 5 ----- arch/arm/boards/mx31moboard/env/boot/sd | 5 ----- arch/arm/boards/mx31moboard/env/boot/usbmsd | 5 ----- arch/arm/boards/panda/env/boot/mmc | 5 ----- arch/arm/boards/phytec-phycard-imx6/env/boot/nand | 5 ----- arch/arm/boards/phytec-phycard-imx6/env/boot/sd-ext3 | 5 ----- .../phytec-phycore-am335x/defaultenv-phycore-am335x/boot/mmc | 5 ----- .../defaultenv-phycore-am335x/boot/nand | 5 ----- .../phytec-phycore-am335x/defaultenv-phycore-am335x/boot/spi | 5 ----- arch/arm/boards/phytec-phycore-imx27/env/boot/nand-ubi | 5 ----- arch/arm/boards/phytec-phycore-imx31/env/boot/nand-ubi | 5 ----- arch/arm/boards/phytec-phycore-imx35/env/boot/nand-ubi | 5 ----- arch/arm/boards/telit-evk-pro3/env/boot/nand-ubi | 5 ----- defaultenv/defaultenv-2-base/boot/net | 5 ----- defaultenv/defaultenv-2-base/data/boot-template | 5 ----- defaultenv/defaultenv-2-dfu/boot/dfu | 5 ----- 44 files changed, 220 deletions(-) diff --git a/arch/arm/boards/archosg9/env/boot/sd-card-android b/arch/arm/boards/archosg9/env/boot/sd-card-android index a10a763af..bc2df696a 100644 --- a/arch/arm/boards/archosg9/env/boot/sd-card-android +++ b/arch/arm/boards/archosg9/env/boot/sd-card-android @@ -1,10 +1,5 @@ #!/bin/sh -if [ "$1" = menu ]; then - boot-menu-add-entry "$0" "Android from SD card" - exit -fi - path=/mnt/sd global.bootm.image=${path}/android global.bootm.initrd=${path}/initramfs.cpio.lzo diff --git a/arch/arm/boards/archosg9/env/boot/sd-card-linux b/arch/arm/boards/archosg9/env/boot/sd-card-linux index 2ba9b9e1c..b3eaa2437 100644 --- a/arch/arm/boards/archosg9/env/boot/sd-card-linux +++ b/arch/arm/boards/archosg9/env/boot/sd-card-linux @@ -1,10 +1,5 @@ #!/bin/sh -if [ "$1" = menu ]; then - boot-menu-add-entry "$0" "Linux from SD card" - exit -fi - path=/mnt/sd global.bootm.image=${path}/zImage initrd=${path}/initrd diff --git a/arch/arm/boards/archosg9/env/boot/usb-android b/arch/arm/boards/archosg9/env/boot/usb-android index a7ddabe49..e97e0ade6 100644 --- a/arch/arm/boards/archosg9/env/boot/usb-android +++ b/arch/arm/boards/archosg9/env/boot/usb-android @@ -1,10 +1,5 @@ #!/bin/sh -if [ "$1" = menu ]; then - boot-menu-add-entry "$0" "Android over usb" - exit -fi - path=/mnt/usb global.bootm.image=${path}/android global.bootm.initrd=${path}/initramfs.cpio.lzo diff --git a/arch/arm/boards/archosg9/env/boot/usb-linux b/arch/arm/boards/archosg9/env/boot/usb-linux index 12ae6381b..a257138d4 100644 --- a/arch/arm/boards/archosg9/env/boot/usb-linux +++ b/arch/arm/boards/archosg9/env/boot/usb-linux @@ -1,10 +1,5 @@ #!/bin/sh -if [ "$1" = menu ]; then - boot-menu-add-entry "$0" "Linux over usb" - exit -fi - path=/mnt/usb global.bootm.image=${path}/zImage initrd=${path}/initrd diff --git a/arch/arm/boards/at91sam9m10ihd/env/boot/android b/arch/arm/boards/at91sam9m10ihd/env/boot/android index e440f1806..8492e41f7 100644 --- a/arch/arm/boards/at91sam9m10ihd/env/boot/android +++ b/arch/arm/boards/at91sam9m10ihd/env/boot/android @@ -1,10 +1,5 @@ #!/bin/sh -if [ "$1" = menu ]; then - boot-menu-add-entry "$0" "android (nand)" - exit -fi - global.bootm.image="/dev/nand0.kernel.bb" global.linux.bootargs.dyn.root="root=/dev/mtdblock1 rootfstype=jffs2 rw init=/init rootdelay=1" # clean the mtdparts otherwise android does not boot diff --git a/arch/arm/boards/at91sam9m10ihd/env/boot/mmc b/arch/arm/boards/at91sam9m10ihd/env/boot/mmc index 89c66ee8f..8aeace4b9 100644 --- a/arch/arm/boards/at91sam9m10ihd/env/boot/mmc +++ b/arch/arm/boards/at91sam9m10ihd/env/boot/mmc @@ -1,10 +1,5 @@ #!/bin/sh -if [ "$1" = menu ]; then - boot-menu-add-entry "$0" "MMC slot" - exit -fi - path="/mnt/mmc" global.bootm.image="${path}/zimage" diff --git a/arch/arm/boards/at91sam9m10ihd/env/boot/net b/arch/arm/boards/at91sam9m10ihd/env/boot/net index cdb2520d3..7acc83122 100644 --- a/arch/arm/boards/at91sam9m10ihd/env/boot/net +++ b/arch/arm/boards/at91sam9m10ihd/env/boot/net @@ -1,10 +1,5 @@ #!/bin/sh -if [ "$1" = menu ]; then - boot-menu-add-entry "$0" "network (tftp, nfs) (macb)" - exit -fi - ethact eth0 path="/mnt/tftp" diff --git a/arch/arm/boards/at91sam9m10ihd/env/boot/net-usb b/arch/arm/boards/at91sam9m10ihd/env/boot/net-usb index 6e341a011..7b791a957 100644 --- a/arch/arm/boards/at91sam9m10ihd/env/boot/net-usb +++ b/arch/arm/boards/at91sam9m10ihd/env/boot/net-usb @@ -1,10 +1,5 @@ #!/bin/sh -if [ "$1" = menu ]; then - boot-menu-add-entry "$0" "network (tftp, nfs) (usb ethernet)" - exit -fi - usb -f ethact eth1 diff --git a/arch/arm/boards/beagle/env/boot/mmc b/arch/arm/boards/beagle/env/boot/mmc index 58bd55742..db638f8cf 100644 --- a/arch/arm/boards/beagle/env/boot/mmc +++ b/arch/arm/boards/beagle/env/boot/mmc @@ -1,10 +1,5 @@ #!/bin/sh -if [ "$1" = menu ]; then - boot-menu-add-entry "$0" "MMC (ext3)" - exit -fi - global.bootm.image="/boot/zImage" #global.bootm.oftree="/boot/oftree" global.linux.bootargs.dyn.root="root=mmcblk0p2 rootfstype=ext3 rootwait" diff --git a/arch/arm/boards/beagle/env/boot/nand-ubi b/arch/arm/boards/beagle/env/boot/nand-ubi index 3037fd4ca..e0ef90443 100644 --- a/arch/arm/boards/beagle/env/boot/nand-ubi +++ b/arch/arm/boards/beagle/env/boot/nand-ubi @@ -1,9 +1,4 @@ #!/bin/sh -if [ "$1" = menu ]; then - boot-menu-add-entry "$0" "nand (UBI)" - exit -fi - global.bootm.image="/dev/nand0.kernel.bb" global.linux.bootargs.dyn.root="root=ubi0:root ubi.mtd=nand0.root rootfstype=ubifs" diff --git a/arch/arm/boards/beagle/env/boot/nand-ubi-dt b/arch/arm/boards/beagle/env/boot/nand-ubi-dt index b7a1f192c..5fc0a6c53 100644 --- a/arch/arm/boards/beagle/env/boot/nand-ubi-dt +++ b/arch/arm/boards/beagle/env/boot/nand-ubi-dt @@ -1,10 +1,5 @@ #!/bin/sh -if [ "$1" = menu ]; then - boot-menu-add-entry "$0" "nand (UBI)" - exit -fi - global.bootm.image="/dev/nand0.kernel.bb" global.bootm.oftree="/dev/nand0.oftree.bb" global.linux.bootargs.dyn.root="root=ubi0:root ubi.mtd=nand0.root rootfstype=ubifs" diff --git a/arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/sd b/arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/sd index dce060542..aa94b2fa2 100644 --- a/arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/sd +++ b/arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/sd @@ -1,10 +1,5 @@ #!/bin/sh -if [ "$1" = menu ]; then - boot-menu-add-entry "$0" "kernel & rootfs on SD card" - exit -fi - global.bootm.image=/boot/uImage global.bootm.oftree=/boot/oftree #global.bootm.initrd= diff --git a/arch/arm/boards/ccxmx51/env/boot/nand b/arch/arm/boards/ccxmx51/env/boot/nand index bb114659e..d53f07ec5 100644 --- a/arch/arm/boards/ccxmx51/env/boot/nand +++ b/arch/arm/boards/ccxmx51/env/boot/nand @@ -1,9 +1,4 @@ #!/bin/sh -if [ "$1" = menu ]; then - boot-menu-add-entry "$0" "NAND Flash" - exit -fi - global.bootm.image="/dev/kernel" global.linux.bootargs.dyn.root="root=/dev/mtdblock3 ro" diff --git a/arch/arm/boards/clep7212/env/boot/nor b/arch/arm/boards/clep7212/env/boot/nor index df8c98388..d53f07ec5 100644 --- a/arch/arm/boards/clep7212/env/boot/nor +++ b/arch/arm/boards/clep7212/env/boot/nor @@ -1,9 +1,4 @@ #!/bin/sh -if [ "$1" = menu ]; then - boot-menu-add-entry "$0" "NOR Flash" - exit -fi - global.bootm.image="/dev/kernel" global.linux.bootargs.dyn.root="root=/dev/mtdblock3 ro" diff --git a/arch/arm/boards/crystalfontz-cfa10036/env/boot/mmc-ext3 b/arch/arm/boards/crystalfontz-cfa10036/env/boot/mmc-ext3 index 4d830edc6..e71ad19bf 100644 --- a/arch/arm/boards/crystalfontz-cfa10036/env/boot/mmc-ext3 +++ b/arch/arm/boards/crystalfontz-cfa10036/env/boot/mmc-ext3 @@ -1,10 +1,5 @@ #!/bin/sh -if [ "$1" = menu ]; then - boot-menu-add-entry "$0" "MMC (ext)" - exit -fi - global.bootm.image="/mnt/disk0.2/boot/zImage-${global.hostname}" global.bootm.oftree="/mnt/disk0.2/boot/oftree-${global.board.variant}" global.linux.bootargs.dyn.root="root=/dev/mmcblk0p3 rootfstype=ext3 rootwait" diff --git a/arch/arm/boards/datamodul-edm-qmx6/env/boot/mmc b/arch/arm/boards/datamodul-edm-qmx6/env/boot/mmc index e311763c4..d5e202f39 100644 --- a/arch/arm/boards/datamodul-edm-qmx6/env/boot/mmc +++ b/arch/arm/boards/datamodul-edm-qmx6/env/boot/mmc @@ -1,10 +1,5 @@ #!/bin/sh -if [ "$1" = menu ]; then - boot-menu-add-entry "$0" "MMC" - exit -fi - global.bootm.image="/mnt/mmc/zImage" global.bootm.oftree="/mnt/mmc/oftree" global.linux.bootargs.dyn.root="root=mmcblk0p2 rootfstype=ext3 rootwait" diff --git a/arch/arm/boards/delphi-poc20/env/boot/mmc b/arch/arm/boards/delphi-poc20/env/boot/mmc index e311763c4..d5e202f39 100644 --- a/arch/arm/boards/delphi-poc20/env/boot/mmc +++ b/arch/arm/boards/delphi-poc20/env/boot/mmc @@ -1,10 +1,5 @@ #!/bin/sh -if [ "$1" = menu ]; then - boot-menu-add-entry "$0" "MMC" - exit -fi - global.bootm.image="/mnt/mmc/zImage" global.bootm.oftree="/mnt/mmc/oftree" global.linux.bootargs.dyn.root="root=mmcblk0p2 rootfstype=ext3 rootwait" diff --git a/arch/arm/boards/efika-mx-smartbook/env/boot/hd-internal b/arch/arm/boards/efika-mx-smartbook/env/boot/hd-internal index ccd0f69bb..2233f1426 100644 --- a/arch/arm/boards/efika-mx-smartbook/env/boot/hd-internal +++ b/arch/arm/boards/efika-mx-smartbook/env/boot/hd-internal @@ -1,10 +1,5 @@ #!/bin/sh -if [ "$1" = menu ]; then - boot-menu-add-entry "$0" "internal harddisk" - exit -fi - path="/mnt/internal-hd0.0" global.bootm.image="${path}/linuximage" diff --git a/arch/arm/boards/efika-mx-smartbook/env/boot/mmc-left b/arch/arm/boards/efika-mx-smartbook/env/boot/mmc-left index 21935c6ff..da7bc0398 100644 --- a/arch/arm/boards/efika-mx-smartbook/env/boot/mmc-left +++ b/arch/arm/boards/efika-mx-smartbook/env/boot/mmc-left @@ -1,10 +1,5 @@ #!/bin/sh -if [ "$1" = menu ]; then - boot-menu-add-entry "$0" "left MMC slot" - exit -fi - path="/mnt/mmc-left.0" global.bootm.image="${path}/linuximage" diff --git a/arch/arm/boards/friendlyarm-mini2440/env/boot/nand b/arch/arm/boards/friendlyarm-mini2440/env/boot/nand index 3037fd4ca..e0ef90443 100644 --- a/arch/arm/boards/friendlyarm-mini2440/env/boot/nand +++ b/arch/arm/boards/friendlyarm-mini2440/env/boot/nand @@ -1,9 +1,4 @@ #!/bin/sh -if [ "$1" = menu ]; then - boot-menu-add-entry "$0" "nand (UBI)" - exit -fi - global.bootm.image="/dev/nand0.kernel.bb" global.linux.bootargs.dyn.root="root=ubi0:root ubi.mtd=nand0.root rootfstype=ubifs" diff --git a/arch/arm/boards/guf-vincell/env/boot/nand-ubi b/arch/arm/boards/guf-vincell/env/boot/nand-ubi index a3f748e74..510ac119b 100644 --- a/arch/arm/boards/guf-vincell/env/boot/nand-ubi +++ b/arch/arm/boards/guf-vincell/env/boot/nand-ubi @@ -1,10 +1,5 @@ #!/bin/sh -if [ "$1" = menu ]; then - boot-menu-add-entry "$0" "nand (UBI)" - exit -fi - global.bootm.image="/dev/nand0.kernel.bb" #global.bootm.oftree="/env/oftree" bootargs-root-ubi -r root -m nand0.root diff --git a/arch/arm/boards/highbank/env/boot/ahci b/arch/arm/boards/highbank/env/boot/ahci index 3bdb80993..46a8c1b32 100644 --- a/arch/arm/boards/highbank/env/boot/ahci +++ b/arch/arm/boards/highbank/env/boot/ahci @@ -1,10 +1,5 @@ #!/bin/sh -if [ "$1" = menu ]; then - boot-menu-add-entry "$0" "AHCI" - exit -fi - path="/mnt/ahci" global.bootm.image="${path}/zImage" diff --git a/arch/arm/boards/highbank/env/boot/ahci-boot b/arch/arm/boards/highbank/env/boot/ahci-boot index 0064a46fc..919eac54a 100644 --- a/arch/arm/boards/highbank/env/boot/ahci-boot +++ b/arch/arm/boards/highbank/env/boot/ahci-boot @@ -1,10 +1,5 @@ #!/bin/sh -if [ "$1" = menu ]; then - boot-menu-add-entry "$0" "AHCI (UEFI boot partiton)" - exit -fi - path="/mnt/ahci-boot" global.bootm.image="${path}/zImage" diff --git a/arch/arm/boards/highbank/env/boot/mmc b/arch/arm/boards/highbank/env/boot/mmc index 43a04b5d6..0fff5b4a8 100644 --- a/arch/arm/boards/highbank/env/boot/mmc +++ b/arch/arm/boards/highbank/env/boot/mmc @@ -1,10 +1,5 @@ #!/bin/sh -if [ "$1" = menu ]; then - boot-menu-add-entry "$0" "MMC slot" - exit -fi - path="/mnt/mmc" global.bootm.image="${path}/zimage" diff --git a/arch/arm/boards/highbank/env/boot/mmc-boot b/arch/arm/boards/highbank/env/boot/mmc-boot index 93cd99b68..f3ae301e1 100644 --- a/arch/arm/boards/highbank/env/boot/mmc-boot +++ b/arch/arm/boards/highbank/env/boot/mmc-boot @@ -1,10 +1,5 @@ #!/bin/sh -if [ "$1" = menu ]; then - boot-menu-add-entry "$0" "MMC slot (UEFI boot partiton)" - exit -fi - path="/mnt/mmc-boot" global.bootm.image="${path}/zimage" diff --git a/arch/arm/boards/highbank/env/boot/net b/arch/arm/boards/highbank/env/boot/net index 80862cdac..6a700087f 100644 --- a/arch/arm/boards/highbank/env/boot/net +++ b/arch/arm/boards/highbank/env/boot/net @@ -1,10 +1,5 @@ #!/bin/sh -if [ "$1" = menu ]; then - boot-menu-add-entry "$0" "network (tftp, nfs) (eth0)" - exit -fi - ethact eth0 path="/mnt/tftp" diff --git a/arch/arm/boards/highbank/env/boot/net-eth1 b/arch/arm/boards/highbank/env/boot/net-eth1 index d9e9804a0..1c70bdf3f 100644 --- a/arch/arm/boards/highbank/env/boot/net-eth1 +++ b/arch/arm/boards/highbank/env/boot/net-eth1 @@ -1,10 +1,5 @@ #!/bin/sh -if [ "$1" = menu ]; then - boot-menu-add-entry "$0" "network (tftp, nfs) (eth1)" - exit -fi - ethact eth1 path="/mnt/tftp" diff --git a/arch/arm/boards/karo-tx25/env/boot/nand-ubi b/arch/arm/boards/karo-tx25/env/boot/nand-ubi index 67b0cb4af..d555a538d 100644 --- a/arch/arm/boards/karo-tx25/env/boot/nand-ubi +++ b/arch/arm/boards/karo-tx25/env/boot/nand-ubi @@ -1,10 +1,5 @@ #!/bin/sh -if [ "$1" = menu ]; then - boot-menu-add-entry "$0" "nand (UBI)" - exit -fi - global.bootm.image="/dev/nand0.kernel.bb" #global.bootm.oftree="/env/oftree" global.linux.bootargs.dyn.root="root=ubi0:root ubi.mtd=nand0.root rootfstype=ubifs" diff --git a/arch/arm/boards/mx31moboard/env/boot/nor b/arch/arm/boards/mx31moboard/env/boot/nor index e36655c68..f584307d7 100644 --- a/arch/arm/boards/mx31moboard/env/boot/nor +++ b/arch/arm/boards/mx31moboard/env/boot/nor @@ -1,9 +1,4 @@ #!/bin/sh -if [ "$1" = menu ]; then - boot-menu-add-entry "$0" "NOR Flash" - exit -fi - global.bootm.image="/dev/nor0.kernel" global.linux.bootargs.dyn.root="root=/dev/mtdblock3 ro" diff --git a/arch/arm/boards/mx31moboard/env/boot/sd b/arch/arm/boards/mx31moboard/env/boot/sd index 16e734d80..a0c4da9e7 100644 --- a/arch/arm/boards/mx31moboard/env/boot/sd +++ b/arch/arm/boards/mx31moboard/env/boot/sd @@ -1,8 +1,3 @@ #!/bin/sh -if [ "$1" = menu ]; then - boot-menu-add-entry "$0" "SD Boot" - exit -fi - boot mci0 diff --git a/arch/arm/boards/mx31moboard/env/boot/usbmsd b/arch/arm/boards/mx31moboard/env/boot/usbmsd index 6a16d3ecb..208921da2 100644 --- a/arch/arm/boards/mx31moboard/env/boot/usbmsd +++ b/arch/arm/boards/mx31moboard/env/boot/usbmsd @@ -1,8 +1,3 @@ #!/bin/sh -if [ "$1" = menu ]; then - boot-menu-add-entry "$0" "USB Boot" - exit -fi - boot ehci0 diff --git a/arch/arm/boards/panda/env/boot/mmc b/arch/arm/boards/panda/env/boot/mmc index 58bd55742..db638f8cf 100644 --- a/arch/arm/boards/panda/env/boot/mmc +++ b/arch/arm/boards/panda/env/boot/mmc @@ -1,10 +1,5 @@ #!/bin/sh -if [ "$1" = menu ]; then - boot-menu-add-entry "$0" "MMC (ext3)" - exit -fi - global.bootm.image="/boot/zImage" #global.bootm.oftree="/boot/oftree" global.linux.bootargs.dyn.root="root=mmcblk0p2 rootfstype=ext3 rootwait" diff --git a/arch/arm/boards/phytec-phycard-imx6/env/boot/nand b/arch/arm/boards/phytec-phycard-imx6/env/boot/nand index a51da9e34..cf3b25c11 100644 --- a/arch/arm/boards/phytec-phycard-imx6/env/boot/nand +++ b/arch/arm/boards/phytec-phycard-imx6/env/boot/nand @@ -1,10 +1,5 @@ #!/bin/sh -if [ "$1" = menu ]; then - boot-menu-add-entry "$0" "Kernel:nand;rootfs:nand" - exit -fi - global.bootm.image="/dev/nand0.kernel.bb" #global.bootm.oftree="/env/oftree" bootargs-ip diff --git a/arch/arm/boards/phytec-phycard-imx6/env/boot/sd-ext3 b/arch/arm/boards/phytec-phycard-imx6/env/boot/sd-ext3 index fa1e9d68c..443563390 100644 --- a/arch/arm/boards/phytec-phycard-imx6/env/boot/sd-ext3 +++ b/arch/arm/boards/phytec-phycard-imx6/env/boot/sd-ext3 @@ -1,10 +1,5 @@ #!/bin/sh -if [ "$1" = menu ]; then - boot-menu-add-entry "$0" "MMC (ext3)" - exit -fi - global.bootm.image="/mnt/kernel/linuximage" #global.bootm.oftree="/boot/oftree" bootargs-ip diff --git a/arch/arm/boards/phytec-phycore-am335x/defaultenv-phycore-am335x/boot/mmc b/arch/arm/boards/phytec-phycore-am335x/defaultenv-phycore-am335x/boot/mmc index 93a235744..32854d12e 100644 --- a/arch/arm/boards/phytec-phycore-am335x/defaultenv-phycore-am335x/boot/mmc +++ b/arch/arm/boards/phytec-phycore-am335x/defaultenv-phycore-am335x/boot/mmc @@ -1,10 +1,5 @@ #!/bin/sh -if [ "$1" = menu ]; then - boot-menu-add-entry "$0" "kernel & rootfs on SD card" - exit -fi - global.bootm.image=/boot/uImage #global.bootm.oftree=/boot/oftree global.linux.bootargs.dyn.root="root=/dev/mmcblk0p2 rootfstype=ext3 rootwait" diff --git a/arch/arm/boards/phytec-phycore-am335x/defaultenv-phycore-am335x/boot/nand b/arch/arm/boards/phytec-phycore-am335x/defaultenv-phycore-am335x/boot/nand index 22d657ed9..cdfd93dce 100644 --- a/arch/arm/boards/phytec-phycore-am335x/defaultenv-phycore-am335x/boot/nand +++ b/arch/arm/boards/phytec-phycore-am335x/defaultenv-phycore-am335x/boot/nand @@ -1,10 +1,5 @@ #!/bin/sh -if [ "$1" = menu ]; then - boot-menu-add-entry "$0" "nand (UBI)" - exit -fi - global.bootm.image="/dev/nand0.kernel.bb" #global.bootm.oftree="/env/oftree" global.linux.bootargs.dyn.root="root=ubi0:root ubi.mtd=nand0.root,2048 rootfstype=ubifs" diff --git a/arch/arm/boards/phytec-phycore-am335x/defaultenv-phycore-am335x/boot/spi b/arch/arm/boards/phytec-phycore-am335x/defaultenv-phycore-am335x/boot/spi index 2d1018423..7a53d8481 100644 --- a/arch/arm/boards/phytec-phycore-am335x/defaultenv-phycore-am335x/boot/spi +++ b/arch/arm/boards/phytec-phycore-am335x/defaultenv-phycore-am335x/boot/spi @@ -1,10 +1,5 @@ #!/bin/sh -if [ "$1" = menu ]; then - boot-menu-add-entry "$0" "SPI NOR Flash" - exit -fi - global.bootm.image="/dev/m25p0.kernel" # Use rootfs form NAND for now as rootfs partition < 4MB diff --git a/arch/arm/boards/phytec-phycore-imx27/env/boot/nand-ubi b/arch/arm/boards/phytec-phycore-imx27/env/boot/nand-ubi index 67b0cb4af..d555a538d 100644 --- a/arch/arm/boards/phytec-phycore-imx27/env/boot/nand-ubi +++ b/arch/arm/boards/phytec-phycore-imx27/env/boot/nand-ubi @@ -1,10 +1,5 @@ #!/bin/sh -if [ "$1" = menu ]; then - boot-menu-add-entry "$0" "nand (UBI)" - exit -fi - global.bootm.image="/dev/nand0.kernel.bb" #global.bootm.oftree="/env/oftree" global.linux.bootargs.dyn.root="root=ubi0:root ubi.mtd=nand0.root rootfstype=ubifs" diff --git a/arch/arm/boards/phytec-phycore-imx31/env/boot/nand-ubi b/arch/arm/boards/phytec-phycore-imx31/env/boot/nand-ubi index 67b0cb4af..d555a538d 100644 --- a/arch/arm/boards/phytec-phycore-imx31/env/boot/nand-ubi +++ b/arch/arm/boards/phytec-phycore-imx31/env/boot/nand-ubi @@ -1,10 +1,5 @@ #!/bin/sh -if [ "$1" = menu ]; then - boot-menu-add-entry "$0" "nand (UBI)" - exit -fi - global.bootm.image="/dev/nand0.kernel.bb" #global.bootm.oftree="/env/oftree" global.linux.bootargs.dyn.root="root=ubi0:root ubi.mtd=nand0.root rootfstype=ubifs" diff --git a/arch/arm/boards/phytec-phycore-imx35/env/boot/nand-ubi b/arch/arm/boards/phytec-phycore-imx35/env/boot/nand-ubi index 67b0cb4af..d555a538d 100644 --- a/arch/arm/boards/phytec-phycore-imx35/env/boot/nand-ubi +++ b/arch/arm/boards/phytec-phycore-imx35/env/boot/nand-ubi @@ -1,10 +1,5 @@ #!/bin/sh -if [ "$1" = menu ]; then - boot-menu-add-entry "$0" "nand (UBI)" - exit -fi - global.bootm.image="/dev/nand0.kernel.bb" #global.bootm.oftree="/env/oftree" global.linux.bootargs.dyn.root="root=ubi0:root ubi.mtd=nand0.root rootfstype=ubifs" diff --git a/arch/arm/boards/telit-evk-pro3/env/boot/nand-ubi b/arch/arm/boards/telit-evk-pro3/env/boot/nand-ubi index 1987492df..da7cbddaa 100644 --- a/arch/arm/boards/telit-evk-pro3/env/boot/nand-ubi +++ b/arch/arm/boards/telit-evk-pro3/env/boot/nand-ubi @@ -1,10 +1,5 @@ #!/bin/sh -if [ "$1" = menu ]; then - boot-menu-add-entry "$0" "nand (UBI)" - exit -fi - global.bootm.image="/dev/nand0.kernel.bb" #global.bootm.oftree="/env/oftree" global.linux.bootargs.dyn.root="root=ubi0:rootfs ubi.mtd=nand0.rootfs rootfstype=ubifs" diff --git a/defaultenv/defaultenv-2-base/boot/net b/defaultenv/defaultenv-2-base/boot/net index 05bb728fa..ced2fadba 100644 --- a/defaultenv/defaultenv-2-base/boot/net +++ b/defaultenv/defaultenv-2-base/boot/net @@ -1,10 +1,5 @@ #!/bin/sh -if [ "$1" = menu ]; then - boot-menu-add-entry "$0" "network (tftp, nfs)" - exit -fi - path="/mnt/tftp" global.bootm.image="${path}/${global.user}-linux-${global.hostname}" diff --git a/defaultenv/defaultenv-2-base/data/boot-template b/defaultenv/defaultenv-2-base/data/boot-template index 929749903..689d98e1e 100644 --- a/defaultenv/defaultenv-2-base/data/boot-template +++ b/defaultenv/defaultenv-2-base/data/boot-template @@ -1,10 +1,5 @@ #!/bin/sh -if [ "$1" = menu ]; then - boot-menu-add-entry "$0" "" - exit -fi - global.bootm.image= #global.bootm.oftree= #global.bootm.initrd= diff --git a/defaultenv/defaultenv-2-dfu/boot/dfu b/defaultenv/defaultenv-2-dfu/boot/dfu index c9463b667..682091141 100644 --- a/defaultenv/defaultenv-2-dfu/boot/dfu +++ b/defaultenv/defaultenv-2-dfu/boot/dfu @@ -1,10 +1,5 @@ #!/bin/sh -if [ "$1" = menu ]; then - boot-menu-add-entry "$0" "Device Firmware upgrade (DFU)" - exit -fi - if [ -d /dfutmp ]; then rm -r /dfutmp fi From c9e2e08edcdce4205821226817686e62dc349eab Mon Sep 17 00:00:00 2001 From: Alexander Aring Date: Mon, 23 Jun 2014 10:00:00 +0200 Subject: [PATCH 05/16] common: resource: print conflicts as warning Crazy things happen if there are resource conflicts and a device probe runs dev_request_mem_region. The dev_request_mem_region returns a start pointer which is zero. The probe function doesn't check on this and probing the device on zero base address. To debug this in debug log level there are many other outputs. This patch replace the debug print to a warning printout. A conflict should normally never happen. If there is a conflict it's much easier to see it with this patch. Signed-off-by: Alexander Aring Signed-off-by: Sascha Hauer --- common/resource.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/resource.c b/common/resource.c index fe4680e3b..1ea2a7522 100644 --- a/common/resource.c +++ b/common/resource.c @@ -71,7 +71,7 @@ struct resource *__request_region(struct resource *parent, goto ok; if (start > r->end) continue; - debug("%s: 0x%08llx:0x%08llx conflicts with 0x%08llx:0x%08llx\n", + pr_warn("%s: 0x%08llx:0x%08llx conflicts with 0x%08llx:0x%08llx\n", __func__, (unsigned long long)start, (unsigned long long)end, From eab148a80c5ba33aeec4edd9c97a7facaecbecf3 Mon Sep 17 00:00:00 2001 From: Holger Schurig Date: Thu, 26 Jun 2014 10:49:16 +0200 Subject: [PATCH 06/16] sandbox: add bit manipulation stuff The functions are already in the sandbox, just the #defines are missing. Signed-off-by: Holger Schurig Signed-off-by: Sascha Hauer --- arch/sandbox/include/asm/bitops.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/sandbox/include/asm/bitops.h b/arch/sandbox/include/asm/bitops.h index 94646d4d0..447023da6 100644 --- a/arch/sandbox/include/asm/bitops.h +++ b/arch/sandbox/include/asm/bitops.h @@ -12,4 +12,11 @@ #include #include +#define set_bit(x, y) __set_bit(x, y) +#define clear_bit(x, y) __clear_bit(x, y) +#define change_bit(x, y) __change_bit(x, y) +#define test_and_set_bit(x, y) __test_and_set_bit(x, y) +#define test_and_clear_bit(x, y) __test_and_clear_bit(x, y) +#define test_and_change_bit(x, y) __test_and_change_bit(x, y) + #endif From ac705a462f680629afca71dba6bc766463b0356a Mon Sep 17 00:00:00 2001 From: "Robert P. J. Day" Date: Thu, 26 Jun 2014 16:25:05 -0400 Subject: [PATCH 07/16] Fix misspellings of "persistant" -> "persistent" in various places Fix misspellings of "persistent", including the renaming of a function to "register_persistant_environment". Signed-off-by: Robert P. J. Day Signed-off-by: Sascha Hauer --- .../arm/boards/chumby_falconwing/falconwing.c | 2 +- arch/arm/boards/freescale-mx23-evk/mx23-evk.c | 6 ++-- .../boards/imx233-olinuxino/imx23-olinuxino.c | 2 +- arch/x86/lib/barebox.lds.S | 2 +- arch/x86/mach-i386/include/mach/barebox.lds.h | 8 +++--- arch/x86/mach-x86.dox | 18 ++++++------ scripts/setupmbr/setupmbr.c | 28 +++++++++---------- 7 files changed, 33 insertions(+), 33 deletions(-) diff --git a/arch/arm/boards/chumby_falconwing/falconwing.c b/arch/arm/boards/chumby_falconwing/falconwing.c index 77581f668..6546680ff 100644 --- a/arch/arm/boards/chumby_falconwing/falconwing.c +++ b/arch/arm/boards/chumby_falconwing/falconwing.c @@ -355,7 +355,7 @@ make ARCH=arm CROSS_COMPILE=armv5compiler - Create four primary partitions on the MCI card - the first one for the bootlets (about 256 kiB) - - the second one for the persistant environment (size is up to you, at least 256k) + - the second one for the persistent environment (size is up to you, at least 256k) - the third one for the kernel (2 MiB ... 4 MiB in size) - the 4th one for the root filesystem which can fill the rest of the available space diff --git a/arch/arm/boards/freescale-mx23-evk/mx23-evk.c b/arch/arm/boards/freescale-mx23-evk/mx23-evk.c index 1eae37722..a5798ee5b 100644 --- a/arch/arm/boards/freescale-mx23-evk/mx23-evk.c +++ b/arch/arm/boards/freescale-mx23-evk/mx23-evk.c @@ -70,7 +70,7 @@ mem_initcall(mx23_evk_mem_init); * If this SD card is also the boot media, we can use the second partition * for our environment purpose (if present!). */ -static int register_persistant_environment(void) +static int register_persistent_environment(void) { struct cdev *cdev; @@ -116,9 +116,9 @@ static int mx23_evk_devices_init(void) add_generic_device("mxs_mci", DEVICE_ID_DYNAMIC, NULL, IMX_SSP1_BASE, 0x8000, IORESOURCE_MEM, &mci_pdata); - rc = register_persistant_environment(); + rc = register_persistent_environment(); if (rc != 0) - printf("Cannot create the 'env0' persistant " + printf("Cannot create the 'env0' persistent " "environment storage (%d)\n", rc); #ifdef CONFIG_USB_GADGET_DRIVER_ARC diff --git a/arch/arm/boards/imx233-olinuxino/imx23-olinuxino.c b/arch/arm/boards/imx233-olinuxino/imx23-olinuxino.c index fae4d9146..40a6bff48 100644 --- a/arch/arm/boards/imx233-olinuxino/imx23-olinuxino.c +++ b/arch/arm/boards/imx233-olinuxino/imx23-olinuxino.c @@ -180,7 +180,7 @@ the imx233-olinuxino with barebox - Create four primary partitions on the MCI card - the first one for the bootlets (about 256 kiB) - - the second one for the persistant environment + - the second one for the persistent environment (size is up to you, at least 256k) - the third one for the kernel (2 MiB ... 4 MiB in size) - the 4th one for the root filesystem which can fill the diff --git a/arch/x86/lib/barebox.lds.S b/arch/x86/lib/barebox.lds.S index 05d0f778e..6cf6b10d1 100644 --- a/arch/x86/lib/barebox.lds.S +++ b/arch/x86/lib/barebox.lds.S @@ -85,7 +85,7 @@ SECTIONS boot_disk = .; BYTE(0x00); /* boot disk number (provided by the BIOS) - /* information about the persistant environment storage */ + /* information about the persistent environment storage */ . = PATCH_AREA + PATCH_AREA_PERS_START; pers_env_storage = .; LONG(0x00000000); /* LBA start lower */ diff --git a/arch/x86/mach-i386/include/mach/barebox.lds.h b/arch/x86/mach-i386/include/mach/barebox.lds.h index 12eeeacd6..f6f634639 100644 --- a/arch/x86/mach-i386/include/mach/barebox.lds.h +++ b/arch/x86/mach-i386/include/mach/barebox.lds.h @@ -31,27 +31,27 @@ #define PATCH_AREA_BOOT_DEV 16 /** - * Offset where to store information about the persistant environment storage + * Offset where to store information about the persistent environment storage * It points to an LBA number (8 bytes) and defines the first sector of this * storage on disk. */ #define PATCH_AREA_PERS_START 20 /** - * Offset where to store information about the persistant environment storage + * Offset where to store information about the persistent environment storage * It points to a short number (2 bytes) and defines the sector count of this * storage on disk. */ #define PATCH_AREA_PERS_SIZE 28 /** - * Offset where to store information about the persistant environment storage + * Offset where to store information about the persistent environment storage * drive number (BIOS number, 1 byte) */ #define PATCH_AREA_PERS_DRIVE 30 /** - * Mark the persistant environment as not used + * Mark the persistent environment as not used */ #define PATCH_AREA_PERS_SIZE_UNUSED 0x000 diff --git a/arch/x86/mach-x86.dox b/arch/x86/mach-x86.dox index 661e905ba..3835a43d7 100644 --- a/arch/x86/mach-x86.dox +++ b/arch/x86/mach-x86.dox @@ -53,7 +53,7 @@ code. Thats why not the PIC is touched nor the IDT. @todo Add some notes about drive numbers used by the BIOS. They may change if one change orders in the BIOS setup. Drive orders and numbers may be different at BIOS runtime and Linux runtime! But these numbers are required -at BIOS runtime for booting and the persistant environment storage. +at BIOS runtime for booting and the persistent environment storage. @attention Currently there is a 4 GiB limit for the disk sizes! @@ -82,11 +82,11 @@ gets stored when this image will be written to a boot media. This information is required to load all parts of the image from the boot media at runtime. The image gets installed in two ways onto the boot media, depending on the -need for a persistant storage. +need for a persistent storage. -@subsection mach_x86_drive_layout_wops barebox's boot media layout without persistant storage +@subsection mach_x86_drive_layout_wops barebox's boot media layout without persistent storage -In this case @a barebox's persistant storage is anywhere: +In this case @a barebox's persistent storage is anywhere: @verbatim Sector Content @@ -100,9 +100,9 @@ In this case @a barebox's persistant storage is anywhere: 0 MBR, Partition table, boot code @endverbatim -@subsection mach_x86_drive_layout_wps barebox's boot media layout with persistant storage +@subsection mach_x86_drive_layout_wps barebox's boot media layout with persistent storage -@a barebox's persistant storage is part of the boot media (more +@a barebox's persistent storage is part of the boot media (more space required in front of the first partition) and interferes with the boot loader image itself: @@ -115,13 +115,13 @@ boot loader image itself: . 32 bit barebox code n+2 16 bit bootstrap code, BIOS calling code n+1 indirect sector - n end of persistant environment storage + n end of persistent environment storage . - 1 start of persistant environment storage + 1 start of persistent environment storage 0 MBR, Partition table, boot code @endverbatim -The information where the persistant storage is located is also stored into +The information where the persistent storage is located is also stored into the MBR at specific locations by @p setupmbr. The @a barebox runtime will use it to load and store all environment relevant data. diff --git a/scripts/setupmbr/setupmbr.c b/scripts/setupmbr/setupmbr.c index 0060c2e93..506ed19d9 100644 --- a/scripts/setupmbr/setupmbr.c +++ b/scripts/setupmbr/setupmbr.c @@ -140,7 +140,7 @@ static void invalidate_daps(struct DAPS *sector) * Create the indirect sector with the DAPS entries * @param daps_table Where to store the entries * @param size Size of the whole image in bytes - * @param pers_sector_count Count of sectors to skip after MBR for the persistant environment storage + * @param pers_sector_count Count of sectors to skip after MBR for the persistent environment storage * @return 0 on success * * This routine calculates the DAPS entries for the case the whole @@ -326,10 +326,10 @@ static int check_for_space(const void *hd_image, off_t size) } /** - * Setup the persistant environment storage information + * Setup the persistent environment storage information * @param patch_area Where to patch - * @param pers_sector_start Start sector of the persistant environment storage - * @param pers_sector_count Count of sectors for the persistant environment storage + * @param pers_sector_start Start sector of the persistent environment storage + * @param pers_sector_count Count of sectors for the persistent environment storage * @return 0 on success */ static int store_pers_env_info(void *patch_area, uint64_t pers_sector_start, long pers_sector_count) @@ -355,7 +355,7 @@ static int store_pers_env_info(void *patch_area, uint64_t pers_sector_start, lon * Prepare the MBR and indirect sector for runtime * @param fd_barebox barebox image to use * @param fd_hd Hard disk image to prepare - * @param pers_sector_count Count of sectors to skip after MBR for the persistant environment storage + * @param pers_sector_count Count of sectors to skip after MBR for the persistent environment storage * @return 0 on success * * This routine expects a prepared hard disk image file with a partition table @@ -390,7 +390,7 @@ static int barebox_overlay_mbr(int fd_barebox, int fd_hd, long pers_sector_count } /* - * the persistant environment storage is in front of the main + * the persistent environment storage is in front of the main * barebox image. To handle both, we need more space in front of the * the first partition. */ @@ -415,7 +415,7 @@ static int barebox_overlay_mbr(int fd_barebox, int fd_hd, long pers_sector_count /* * embed the barebox main image into the disk drive image, - * but keep the persistant environment storage untouched + * but keep the persistent environment storage untouched * (if defined), e.g. store the main image behind this special area. */ memcpy(hd_image + ((pers_sector_count + 1) * SECTOR_SIZE), @@ -471,7 +471,7 @@ static void print_usage(const char *pname) { printf("%s: Preparing a hard disk image for boot with barebox on x86.\n", pname); printf("Usage is\n %s [options] -m -d \n", pname); - printf(" [options] are:\n -s sector count of the persistant environment storage\n"); + printf(" [options] are:\n -s sector count of the persistent environment storage\n"); printf(" barebox's boot image file\n"); printf(" HD image to store the barebox image\n"); printf(" If no '-s ' was given, barebox occupies sectors 0 to n, else sector 0 and x+1 to n\n"); @@ -586,7 +586,7 @@ prepared in some special way: this does not collide with partitions on the boot media, the first partition must start at a sector behind the ones @a barebox occupies. @li @a barebox handles its runtime configuration in a special way: It stores it - in a binary way into some reserved sectors ("persistant storage"). + in a binary way into some reserved sectors ("persistent storage"). @section x86_bootloader_preparations Boot Preparations @@ -603,12 +603,12 @@ simple calulation: sectors = (\ + 511) / 512 To be able to store the runtime configuration, further free sectors are -required. Its up to you and your requirements, how large this persistant +required. Its up to you and your requirements, how large this persistent storage must be. If you need 16 kiB for this purpose, you need to keep additional 32 sectors free. For this example we are reserving 300 sectors for the @a barebox image and -additionaly 32 sectors for the persistant storage. So, the first partition on +additionaly 32 sectors for the persistent storage. So, the first partition on the boot media must start at sector 333 or later. Run the @p fdisk tool to setup such a partition table: @@ -672,7 +672,7 @@ In the next step, @a barebox gets installed to this boot media: This command writes the @a barebox image file './barebox.bin' onto the device @p /dev/sda. -The @p -s option will keep the persistant storage sectors free and untouched +The @p -s option will keep the persistent storage sectors free and untouched and set flags in the MBR to forward its existance, size and location to @a barebox at runtime. @p setupmbr also does not change the partition table. @@ -681,11 +681,11 @@ The @a barebox image gets stored on the boot media like this: @verbatim sector 0 1 33 333 |---|-------------|--------------- ~~~ ------------|-------------- - MBR persistant barebox first + MBR persistent barebox first storage main image partition @endverbatim -If the @p -s option is omitted, the "persistant storage" part simply does +If the @p -s option is omitted, the "persistent storage" part simply does not exist: @verbatim From 4076817b88bd1d57b7e7741784bbc593a383869d Mon Sep 17 00:00:00 2001 From: "Robert P. J. Day" Date: Mon, 30 Jun 2014 08:43:39 -0400 Subject: [PATCH 08/16] sdma.h: Typo, "interupt" -> "interrupt" Fix only two "interupt" misspellings in entire barebox codebase. Signed-off-by: Robert P. J. Day Signed-off-by: Sascha Hauer --- arch/ppc/mach-mpc5xxx/include/mach/sdma.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/ppc/mach-mpc5xxx/include/mach/sdma.h b/arch/ppc/mach-mpc5xxx/include/mach/sdma.h index 5e7ff5fff..6a25d79fb 100644 --- a/arch/ppc/mach-mpc5xxx/include/mach/sdma.h +++ b/arch/ppc/mach-mpc5xxx/include/mach/sdma.h @@ -82,11 +82,11 @@ ALL PARAMETERS ARE ALL LONGWORDS (FOUR BYTES EACH). sdma->IntPend = (1 << tasknum); \ } -/* get interupt pending bit of a task */ +/* get interrupt pending bit of a task */ #define SDMA_GET_PENDINGBIT(tasknum) \ ((*(vu_long *)(MPC5XXX_SDMA + 0x14)) & (1<<(tasknum))) -/* get interupt mask bit of a task */ +/* get interrupt mask bit of a task */ #define SDMA_GET_MASKBIT(tasknum) \ ((*(vu_long *)(MPC5XXX_SDMA + 0x18)) & (1<<(tasknum))) From a78452fd2d46bb2de86dbf31c3afeb4c8636ed50 Mon Sep 17 00:00:00 2001 From: Lucas Stach Date: Tue, 24 Jun 2014 08:33:16 +0200 Subject: [PATCH 09/16] scripts: tegra: add gitignore Keep the git status area clean of generated binaries. Signed-off-by: Lucas Stach Signed-off-by: Sascha Hauer --- scripts/tegra/.gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 scripts/tegra/.gitignore diff --git a/scripts/tegra/.gitignore b/scripts/tegra/.gitignore new file mode 100644 index 000000000..5d5891b24 --- /dev/null +++ b/scripts/tegra/.gitignore @@ -0,0 +1 @@ +cbootimage From 3746d5ebc625ff97940c6fdbb1f666a9d7b6c29a Mon Sep 17 00:00:00 2001 From: Rolf Evers-Fischer Date: Mon, 30 Jun 2014 14:27:30 +0200 Subject: [PATCH 10/16] boot: fix typo Signed-off-by: Rolf Evers-Fischer Signed-off-by: Sascha Hauer --- commands/boot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/boot.c b/commands/boot.c index ba26cac98..3341a05eb 100644 --- a/commands/boot.c +++ b/commands/boot.c @@ -151,7 +151,7 @@ static int bootscript_scan_path(struct blspec *blspec, const char *path) glob(files, 0, NULL, &globb); for (i = 0; i < globb.gl_pathc; i++) { - char *bootscript_path = globb.gl_pathv[i];; + char *bootscript_path = globb.gl_pathv[i]; if (*basename(bootscript_path) == '.') continue; From 9b0c2e47ef551986b7b87b536d49bc866e88a570 Mon Sep 17 00:00:00 2001 From: Antony Pavlov Date: Wed, 2 Jul 2014 01:04:25 +0400 Subject: [PATCH 11/16] mii-tool: make the 'No MII transceiver present!' message more clear Suppose you have two network controllers. The first one is ENC28J60 (it is in low power mode after start) the second one is always-enabled eth1. As ENC28J60 is in low power mode before enc28j60_eth_open() is called. ENC28J60's mii traceiver is in low power mode too so the mii traceiver's register are inaccessable. Here is a sample log just after barebox start: barebox:/ miitool miibus0: registered phy as /dev/phy0 No MII transceiver present!. miibus1: registered phy as /dev/phy1 phy1: eth1: negotiated 100baseTx-FD, link ok barebox:/ miitool No MII transceiver present!. phy1: eth1: negotiated 100baseTx-FD, link ok The 'No MII transceiver present!.' message is confusing here. This patch fixes the problem so the miitool output looks like this: barebox:/ miitool phy0: spieth0: No MII transceiver present!. phy1: eth1: negotiated 100baseTx-FD, link ok Signed-off-by: Antony Pavlov Signed-off-by: Sascha Hauer --- commands/miitool.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/commands/miitool.c b/commands/miitool.c index b08be9c68..3f205e93e 100644 --- a/commands/miitool.c +++ b/commands/miitool.c @@ -115,14 +115,14 @@ static int show_basic_mii(struct mii_bus *mii, struct phy_device *phydev, for (i = 0; i < 32; i++) mii_val[i] = mii->read(mii, phydev->addr, i); + printf("%s: %s%d: ", phydev->cdev.name, + mii->parent->name, mii->parent->id); + if (mii_val[MII_BMCR] == 0xffff || mii_val[MII_BMSR] == 0x0000) { fprintf(stderr, " No MII transceiver present!.\n"); return -1; } - printf("%s: %s%d: ", phydev->cdev.name, - mii->parent->name, mii->parent->id); - /* Descriptive rename. */ bmcr = mii_val[MII_BMCR]; bmsr = mii_val[MII_BMSR]; From ecb1dc0b1e859bca90bfb4b2d7c1d7fbb65e011b Mon Sep 17 00:00:00 2001 From: Holger Schurig Date: Tue, 1 Jul 2014 23:22:04 +0200 Subject: [PATCH 12/16] lzo: properly check for overruns Note: this is the same as 206a81c18401c0cde6e579164f752c4b147324ce in linux-git. The lzo decompressor can, if given some really crazy data, possibly overrun some variable types. Modify the checking logic to properly detect overruns before they happen. Reported-by: "Don A. Bailey" Tested-by: "Don A. Bailey" Signed-off-by: Holger Schurig Signed-off-by: Sascha Hauer --- lib/lzo/lzo1x_decompress_safe.c | 64 +++++++++++++++++++++------------ 1 file changed, 42 insertions(+), 22 deletions(-) diff --git a/lib/lzo/lzo1x_decompress_safe.c b/lib/lzo/lzo1x_decompress_safe.c index de795a3cf..48bedba82 100644 --- a/lib/lzo/lzo1x_decompress_safe.c +++ b/lib/lzo/lzo1x_decompress_safe.c @@ -16,14 +16,34 @@ #include #include "lzodefs.h" -#define HAVE_IP(x) ((size_t)(ip_end - ip) >= (size_t)(x)) -#define HAVE_OP(x) ((size_t)(op_end - op) >= (size_t)(x)) -#define NEED_IP(x) if (!HAVE_IP(x)) goto input_overrun -#define NEED_OP(x) if (!HAVE_OP(x)) goto output_overrun -#define TEST_LB(m_pos) if ((m_pos) < out) goto lookbehind_overrun +#define HAVE_IP(t, x) \ + (((size_t)(ip_end - ip) >= (size_t)(t + x)) && \ + (((t + x) >= t) && ((t + x) >= x))) + +#define HAVE_OP(t, x) \ + (((size_t)(op_end - op) >= (size_t)(t + x)) && \ + (((t + x) >= t) && ((t + x) >= x))) + +#define NEED_IP(t, x) \ + do { \ + if (!HAVE_IP(t, x)) \ + goto input_overrun; \ + } while (0) + +#define NEED_OP(t, x) \ + do { \ + if (!HAVE_OP(t, x)) \ + goto output_overrun; \ + } while (0) + +#define TEST_LB(m_pos) \ + do { \ + if ((m_pos) < out) \ + goto lookbehind_overrun; \ + } while (0) int lzo1x_decompress_safe(const unsigned char *in, size_t in_len, - unsigned char *out, size_t *out_len) + unsigned char *out, size_t *out_len) { unsigned char *op; const unsigned char *ip; @@ -55,14 +75,14 @@ int lzo1x_decompress_safe(const unsigned char *in, size_t in_len, while (unlikely(*ip == 0)) { t += 255; ip++; - NEED_IP(1); + NEED_IP(1, 0); } t += 15 + *ip++; } t += 3; copy_literal_run: #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) - if (likely(HAVE_IP(t + 15) && HAVE_OP(t + 15))) { + if (likely(HAVE_IP(t, 15) && HAVE_OP(t, 15))) { const unsigned char *ie = ip + t; unsigned char *oe = op + t; do { @@ -78,8 +98,8 @@ copy_literal_run: } else #endif { - NEED_OP(t); - NEED_IP(t + 3); + NEED_OP(t, 0); + NEED_IP(t, 3); do { *op++ = *ip++; } while (--t > 0); @@ -92,7 +112,7 @@ copy_literal_run: m_pos -= t >> 2; m_pos -= *ip++ << 2; TEST_LB(m_pos); - NEED_OP(2); + NEED_OP(2, 0); op[0] = m_pos[0]; op[1] = m_pos[1]; op += 2; @@ -116,10 +136,10 @@ copy_literal_run: while (unlikely(*ip == 0)) { t += 255; ip++; - NEED_IP(1); + NEED_IP(1, 0); } t += 31 + *ip++; - NEED_IP(2); + NEED_IP(2, 0); } m_pos = op - 1; next = get_unaligned_le16(ip); @@ -134,10 +154,10 @@ copy_literal_run: while (unlikely(*ip == 0)) { t += 255; ip++; - NEED_IP(1); + NEED_IP(1, 0); } t += 7 + *ip++; - NEED_IP(2); + NEED_IP(2, 0); } next = get_unaligned_le16(ip); ip += 2; @@ -151,7 +171,7 @@ copy_literal_run: #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) if (op - m_pos >= 8) { unsigned char *oe = op + t; - if (likely(HAVE_OP(t + 15))) { + if (likely(HAVE_OP(t, 15))) { do { COPY8(op, m_pos); op += 8; @@ -161,7 +181,7 @@ copy_literal_run: m_pos += 8; } while (op < oe); op = oe; - if (HAVE_IP(6)) { + if (HAVE_IP(6, 0)) { state = next; COPY4(op, ip); op += next; @@ -169,7 +189,7 @@ copy_literal_run: continue; } } else { - NEED_OP(t); + NEED_OP(t, 0); do { *op++ = *m_pos++; } while (op < oe); @@ -178,7 +198,7 @@ copy_literal_run: #endif { unsigned char *oe = op + t; - NEED_OP(t); + NEED_OP(t, 0); op[0] = m_pos[0]; op[1] = m_pos[1]; op += 2; @@ -191,15 +211,15 @@ match_next: state = next; t = next; #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) - if (likely(HAVE_IP(6) && HAVE_OP(4))) { + if (likely(HAVE_IP(6, 0) && HAVE_OP(4, 0))) { COPY4(op, ip); op += t; ip += t; } else #endif { - NEED_IP(t + 3); - NEED_OP(t); + NEED_IP(t, 3); + NEED_OP(t, 0); while (t > 0) { *op++ = *ip++; t--; From 918782bb0fbdc5c7b58f9a25411ba7ac5975122e Mon Sep 17 00:00:00 2001 From: Holger Schurig Date: Tue, 1 Jul 2014 23:22:05 +0200 Subject: [PATCH 13/16] lz4: ensure length does not wrap Note: this is the same as 206204a1162b995e2185275167b22468c00d6b36 in linux-git. Given some pathologically compressed data, lz4 could possibly decide to wrap a few internal variables, causing unknown things to happen. Catch this before the wrapping happens and abort the decompression. Reported-by: "Don A. Bailey" Signed-off-by: Holger Schurig Signed-off-by: Sascha Hauer --- lib/lz4/lz4_decompress.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/lz4/lz4_decompress.c b/lib/lz4/lz4_decompress.c index 8e64ce6ae..75cf08bd8 100644 --- a/lib/lz4/lz4_decompress.c +++ b/lib/lz4/lz4_decompress.c @@ -73,6 +73,8 @@ static int lz4_uncompress(const char *source, char *dest, int osize) len = *ip++; for (; len == 255; length += 255) len = *ip++; + if (unlikely(length > (size_t)(length + len))) + goto _output_error; length += len; } From 9d6df5154284d5909294d7b13195ca41500ff79a Mon Sep 17 00:00:00 2001 From: Holger Schurig Date: Tue, 1 Jul 2014 23:22:06 +0200 Subject: [PATCH 14/16] lz4: fix another possible overrun Note: this is the same as 4148c1f67abf823099b2d7db6851e4aea407f5ee in linux-git. There is one other possible overrun in the lz4 code as implemented by Linux at this point in time (which differs from the upstream lz4 codebase, but will get synced at in a future kernel release.) As pointed out by Don, we also need to check the overflow in the data itself. While we are at it, replace the odd error return value with just a "simple" -1 value as the return value is never used for anything other than a basic "did this work or not" check. Reported-by: "Don A. Bailey" Reported-by: Willy Tarreau Signed-off-by: Holger Schurig Signed-off-by: Sascha Hauer --- lib/lz4/lz4_decompress.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/lz4/lz4_decompress.c b/lib/lz4/lz4_decompress.c index 75cf08bd8..9f7bf1794 100644 --- a/lib/lz4/lz4_decompress.c +++ b/lib/lz4/lz4_decompress.c @@ -109,6 +109,8 @@ static int lz4_uncompress(const char *source, char *dest, int osize) if (length == ML_MASK) { for (; *ip == 255; length += 255) ip++; + if (unlikely(length > (size_t)(length + *ip))) + goto _output_error; length += *ip++; } @@ -158,7 +160,7 @@ static int lz4_uncompress(const char *source, char *dest, int osize) /* write overflow error detected */ _output_error: - return (int) (-(((char *)ip) - source)); + return -1; } static int lz4_uncompress_unknownoutputsize(const char *source, char *dest, From 6dd613f1bcf323507c7c6a6131bfb5a985a06c85 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Tue, 24 Jun 2014 12:07:00 +0200 Subject: [PATCH 15/16] string_list: Add string_list_for_each_entry macro To ease iterating over a string_list. Signed-off-by: Sascha Hauer --- include/stringlist.h | 3 +++ lib/stringlist.c | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/include/stringlist.h b/include/stringlist.h index 8738137c8..127998cb6 100644 --- a/include/stringlist.h +++ b/include/stringlist.h @@ -29,4 +29,7 @@ static inline void string_list_free(struct string_list *sl) } } +#define string_list_for_each_entry(entry, sl) \ + list_for_each_entry(entry, &(sl)->list, list) + #endif /* __STRINGLIST_H */ diff --git a/lib/stringlist.c b/lib/stringlist.c index a8af15d75..cc84944f7 100644 --- a/lib/stringlist.c +++ b/lib/stringlist.c @@ -64,7 +64,7 @@ int string_list_contains(struct string_list *sl, char *str) { struct string_list *entry; - list_for_each_entry(entry, &sl->list, list) { + string_list_for_each_entry(entry, sl) { if (!strcmp(str, entry->str)) return 1; } @@ -77,7 +77,7 @@ void string_list_print_by_column(struct string_list *sl) int len = 0, num, i; struct string_list *entry; - list_for_each_entry(entry, &sl->list, list) { + string_list_for_each_entry(entry, sl) { int l = strlen(entry->str) + 4; if (l > len) len = l; @@ -91,7 +91,7 @@ void string_list_print_by_column(struct string_list *sl) num = 1; i = 0; - list_for_each_entry(entry, &sl->list, list) { + string_list_for_each_entry(entry, sl) { if (!(++i % num)) printf("%s\n", entry->str); else From 10d63913999fbd5c02a2a8daecf877c24663bdca Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Tue, 24 Jun 2014 12:08:51 +0200 Subject: [PATCH 16/16] ls: sort files with -l Always collect directory entries in a string_list and evaluate it later. This makes sure that the files are printed alphabetically even when -l is given. Signed-off-by: Sascha Hauer --- commands/ls.c | 54 ++++++++++++++++++++++++++------------------------- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/commands/ls.c b/commands/ls.c index f8144aecd..1a5925d42 100644 --- a/commands/ls.c +++ b/commands/ls.c @@ -53,6 +53,8 @@ int ls(const char *path, ulong flags) char tmp[PATH_MAX]; struct stat s; struct string_list sl; + struct string_list *entry; + int ret; string_list_init(&sl); @@ -71,51 +73,51 @@ int ls(const char *path, ulong flags) if (!dir) return -errno; - while ((d = readdir(dir))) { - sprintf(tmp, "%s/%s", path, d->d_name); - if (flags & LS_COLUMN) { - string_list_add_sorted(&sl, d->d_name); - } else { - if (lstat(tmp, &s)) - goto out; - ls_one(d->d_name, tmp, &s); - } - } + while ((d = readdir(dir))) + string_list_add_sorted(&sl, d->d_name); closedir(dir); if (flags & LS_COLUMN) { string_list_print_by_column(&sl); - string_list_free(&sl); + } else { + string_list_for_each_entry(entry, &sl) { + sprintf(tmp, "%s/%s", path, entry->str); + ret = lstat(tmp, &s); + if (ret) { + printf("%s: %s\n", tmp, strerror(-ret)); + continue; + } + + ls_one(entry->str, tmp, &s); + } } if (!(flags & LS_RECURSIVE)) - return 0; + goto out; - dir = opendir(path); - if (!dir) { - errno = ENOENT; - return -ENOENT; - } - - while ((d = readdir(dir))) { - - if (!strcmp(d->d_name, ".")) + string_list_for_each_entry(entry, &sl) { + if (!strcmp(entry->str, ".")) continue; - if (!strcmp(d->d_name, "..")) + if (!strcmp(entry->str, "..")) continue; - sprintf(tmp, "%s/%s", path, d->d_name); + sprintf(tmp, "%s/%s", path, entry->str); + + ret = lstat(tmp, &s); + if (ret) { + printf("%s: %s\n", tmp, strerror(-ret)); + continue; + } - if (lstat(tmp, &s)) - goto out; if (s.st_mode & S_IFDIR) { char *norm = normalise_path(tmp); ls(norm, flags); free(norm); } } + out: - closedir(dir); + string_list_free(&sl); return 0; }