Skip to contentSkip to conversation

arm: boards: phytec-som-am335x: Update boot scripts

PATCH Superseded Daniel Schultz 2 participants 4 messages Jun 20, 2017 – Jun 27, 2017 Arm (32-bit)

v5 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH v5 1/1 arm: boards: phytec-som-am335x: Update boot scripts

Expand the boot scripts with EMMC and add a default file source for expansions.

Removed "rw" and "rootwait" bootargs from existing boot scripts. Added "rootflags='data=journal'" bootarg to SD card boot script.

---
 .../phytec-som-am335x/defaultenv-physom-am335x/boot/emmc |  5 +++++
 .../phytec-som-am335x/defaultenv-physom-am335x/boot/mmc  |  7 +++----
 .../phytec-som-am335x/defaultenv-physom-am335x/boot/nand |  2 +-
 .../phytec-som-am335x/defaultenv-physom-am335x/boot/spi  |  2 +-
 .../defaultenv-physom-am335x/init/bootsource             | 16 ++++++++++++----
 5 files changed, 22 insertions(+), 10 deletions(-)
 create mode 100644 arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/emmc
arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/emmc new file +5 -0
new file mode 100644
index 0000000..b1792a6
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+global.bootm.image=/mnt/mmc1.0/linuximage
+global.bootm.oftree=/mnt/mmc1.0/oftree
+global.linux.bootargs.dyn.root="root=/dev/mmcblk1p2 rootflags='data=journal'"
arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/mmc +3 -4
index 834669d..77a076d 100644
@@ -1,6 +1,5 @@
 #!/bin/sh
 
-global.bootm.image=/boot/linuximage
-global.bootm.oftree=/boot/oftree
-
-global.linux.bootargs.dyn.root="root=/dev/mmcblk0p2 rw rootwait"
+global.bootm.image=/mnt/mmc0.0/linuximage
+global.bootm.oftree=/mnt/mmc0.0/oftree
+global.linux.bootargs.dyn.root="root=/dev/mmcblk0p2 rootflags='data=journal'"
arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/nand +1 -1
index ece44b7..33f5f02 100644
@@ -5,4 +5,4 @@
 global.bootm.image="/dev/nand0.root.ubi.kernel"
 global.bootm.oftree="/dev/nand0.root.ubi.oftree"
 
-global.linux.bootargs.dyn.root="root=ubi0:root ubi.mtd=root rw rootfstype=ubifs"
+global.linux.bootargs.dyn.root="root=ubi0:root ubi.mtd=root rootfstype=ubifs"
arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/spi +1 -1
index 71c5834..a321aa9 100644
@@ -4,4 +4,4 @@ global.bootm.image="/dev/m25p0.kernel"
 global.bootm.oftree="/dev/m25p0.oftree"
 
 # Use rootfs from NAND
-global.linux.bootargs.dyn.root="root=ubi0:root ubi.mtd=nand0.root rw rootfstype=ubifs"
+global.linux.bootargs.dyn.root="root=ubi0:root ubi.mtd=nand0.root rootfstype=ubifs"
arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/init/bootsource +12 -4
index 3f2ff4b..61a0879 100644
@@ -4,12 +4,20 @@ if [ -n "$nv.boot.default" ]; then
 	exit
 fi
 
-if [ $bootsource = mmc ]; then
-	global.boot.default="mmc nand spi net"
+if [ -e /dev/mmc1.0 ]; then
+	nvmem="emmc"
+else
+	nvmem="nand"
+fi
+
+if [ $bootsource = mmc -a $bootsource_instance = 1 ]; then
+	global.boot.default="emmc mmc spi net"
+elif [ $bootsource = mmc -a $bootsource_instance = 0 ]; then
+	global.boot.default="mmc $nvmem spi net"
 elif [ $bootsource = nand ]; then
 	global.boot.default="nand spi mmc net"
 elif [ $bootsource = spi ]; then
-	global.boot.default="spi nand mmc net"
+	global.boot.default="spi $nvmem mmc net"
 elif [ $bootsource = net ]; then
-	global.boot.default="net nand spi mmc"
+	global.boot.default="net $nvmem spi mmc"
 fi
Signature · 7 lines
1.9.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw
Quoted 4 lines · Daniel Schultz

Expand the boot scripts with EMMC and add a default file source for expansions.

Removed "rw" and "rootwait" bootargs from existing boot scripts.

Why is "rootwait" removed? From my experience adding "rootwait" is pretty essential when booting from mmc. Has that changed?

Quoted 12 lines
arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/init/bootsource +9 -2
-if [ $bootsource = mmc ]; then
-	global.boot.default="mmc nand spi net"
+if [ -e /dev/mmc1.0 ]; then
+	nvmem="emmc"
+else
+	nvmem="nand"
+fi
+
+if [ $bootsource = mmc -a $bootsource_instance = 1 ]; then
+	global.boot.default="emmc mmc spi net"
+elif [ $bootsource = mmc -a $bootsource_instance = 0 ]; then

arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/init/bootsource if [ -n "$nv.boot.default" ]; then · line 23

Quoted 10 lines
arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/init/bootsource +3 -2
+	global.boot.default="mmc $nvmem spi net"
 elif [ $bootsource = nand ]; then
 	global.boot.default="nand spi mmc net"
 elif [ $bootsource = spi ]; then
-	global.boot.default="spi nand mmc net"
+	global.boot.default="spi $nvmem mmc net"
 elif [ $bootsource = net ]; then
-	global.boot.default="net nand spi mmc"
+	global.boot.default="net $nvmem spi mmc"
 fi

Normally the desired behaviour is that the bootsource can be changed persistently by setting nv.boot.default to the desired source. This does not work when global.boot.default gets overwritten after the nvvars have been read from the environment.

This behaviour is not changed with this patch, but I would welcome a patch that changes this script to the desired behaviour. This could be done by changing global.boot.default only when nv.boot.default is empty.

Sascha

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

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#2 lore raw

Hi Sascha,

Am 26.06.2017 um 08:35 schrieb Sascha Hauer:

Quoted 9 lines · Daniel Schultz
Quoted 4 lines

Expand the boot scripts with EMMC and add a default file source for expansions.

Removed "rw" and "rootwait" bootargs from existing boot scripts.

Why is "rootwait" removed? From my experience adding "rootwait" is pretty essential when booting from mmc. Has that changed?

Ah that's a good point! We add these commands in Yocto, but I forgot the use case without Yocto. So I will add a nv/linux.bootargs.rootfs file with "rootwait ro fsck.repair=yes" (fsck.repair is a systemd unit).

Quoted 28 lines
Quoted 12 lines
arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/init/bootsource +9 -2
-if [ $bootsource = mmc ]; then
-	global.boot.default="mmc nand spi net"
+if [ -e /dev/mmc1.0 ]; then
+	nvmem="emmc"
+else
+	nvmem="nand"
+fi
+
+if [ $bootsource = mmc -a $bootsource_instance = 1 ]; then
+	global.boot.default="emmc mmc spi net"
+elif [ $bootsource = mmc -a $bootsource_instance = 0 ]; then

arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/init/bootsource if [ -n "$nv.boot.default" ]; then · line 23

Quoted 10 lines
arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/init/bootsource +3 -2
+	global.boot.default="mmc $nvmem spi net"
  elif [ $bootsource = nand ]; then
  	global.boot.default="nand spi mmc net"
  elif [ $bootsource = spi ]; then
-	global.boot.default="spi nand mmc net"
+	global.boot.default="spi $nvmem mmc net"
  elif [ $bootsource = net ]; then
-	global.boot.default="net nand spi mmc"
+	global.boot.default="net $nvmem spi mmc"
  fi

Normally the desired behaviour is that the bootsource can be changed persistently by setting nv.boot.default to the desired source. This does not work when global.boot.default gets overwritten after the nvvars have been read from the environment.

Quoted 5 lines

This behaviour is not changed with this patch, but I would welcome a patch that changes this script to the desired behaviour. This could be done by changing global.boot.default only when nv.boot.default is empty.

This is already implemented by a test above these changes, isn't it?

snippet from init/bootsource:
1 #!/bin/sh

2

3 if [ -n "$nv.boot.default" ]; then

4 exit

5 fi

6

7 if [ -e /dev/mmc1.0 ]; then
...

Quoted 2 lines

Sascha

Signature · 8 lines
Mit freundlichen Grüßen,
With best regards,
  Daniel Schultz

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#3 lore raw
Quoted 15 lines · Daniel Schultz

Hi Sascha,

Quoted 10 lines

Normally the desired behaviour is that the bootsource can be changed persistently by setting nv.boot.default to the desired source. This does not work when global.boot.default gets overwritten after the nvvars have been read from the environment.

This behaviour is not changed with this patch, but I would welcome a patch that changes this script to the desired behaviour. This could be done by changing global.boot.default only when nv.boot.default is empty.

This is already implemented by a test above these changes, isn't it?

Quoted 7 lines

snippet from init/bootsource:
1 #!/bin/sh

2
3 if [ -n "$nv.boot.default" ]; then
4 exit
5 fi

Yes, right, that already does it. Sorry for the noise.

Sascha

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

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox