Skip to contentSkip to conversation

sunxi: Add a bootcmd_old to the default environment to boot old kernels

PATCH New Hans de Goede 2 participants 3 messages Oct 9, 2015 – Oct 11, 2015 Arm/Allwinner sunXi SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sunxi: Add a bootcmd_old to the default environment to boot old kernels

Add a bootcmd_old value to the default environment when building with CONFIG_OLD_SUNXI_KERNEL_COMPAT, this way people who occasionally want to boot an old kernel can do so by simply typing "run bootcmd_old" rather then needing to have 2 separe setups / sdcards for old and new kernels.

---
 include/configs/sunxi-common.h | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
include/configs/sunxi-common.h +17 -0
index 29745fe..37e9c6b 100644
@@ -464,6 +464,22 @@ extern int soft_i2c_gpio_scl;
 	func(PXE, pxe, na) \
 	func(DHCP, dhcp, na)
 
+#ifdef CONFIG_OLD_SUNXI_KERNEL_COMPAT
+#define BOOTCMD_OLD \
+	"root=/dev/mmcblk0p3 rootwait\0" \
+	"bootcmd_old=" \
+		"if ext2load mmc 0 0x44000000 uEnv.txt; then " \
+			"echo Loaded environment from uEnv.txt; " \
+			"env import -t 0x44000000 ${filesize}; " \
+		"fi; " \
+		"setenv bootargs console=${console} root=${root} ${extraargs}; " \
+		"ext2load mmc 0 0x43000000 script.bin && " \
+		"ext2load mmc 0 0x48000000 uImage && " \
+		"bootm 0x48000000\0"
+#else
+#define BOOTCMD_OLD
+#endif
+
 #include <config_distro_bootcmd.h>
 
 #ifdef CONFIG_USB_KEYBOARD
@@ -495,6 +511,7 @@ extern int soft_i2c_gpio_scl;
 	MTD_ENV_SETTINGS \
 	"fdtfile=" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0" \
 	"console=ttyS0,115200\0" \
+	BOOTCMD_OLD \
 	BOOTENV
 
 #else /* ifndef CONFIG_SPL_BUILD */
Signature · 1 line
2.5.0
#1 lore raw

PATCH 1/1 sunxi: Add a bootcmd_old to the default environment to boot old kernels

Quoted 4 lines · Hans de Goede

Add a bootcmd_old value to the default environment when building with CONFIG_OLD_SUNXI_KERNEL_COMPAT, this way people who occasionally want to boot an old kernel can do so by simply typing "run bootcmd_old" rather then needing to have 2 separe setups / sdcards for old and

"separate"?

"old" is a bit non-specific (e.g. there are also old mainline kernels). Perhaps bootcmd_sunxi_compat? It's a bit of a mouthful but it will tab complete b<tab>sun<tab> or close to that.

include/configs/sunxi-common.h extern int soft_i2c_gpio_scl; · line 469

Quoted 3 lines
include/configs/sunxi-common.h +3 -0
+#ifdef CONFIG_OLD_SUNXI_KERNEL_COMPAT
+#define BOOTCMD_OLD \
+	"root=/dev/mmcblk0p3 rootwait\0" \

Does something other than the below setenv bootargs rely on this? It'd be better not to pollute the default env with such a generically named thing. I suggest following the naming of the command, so root_sunxi_compat.

If it is important to have root= present e.g. for script.bin or uEnv.txt then perhaps put setenv root ${root_sunxi_compat} at the start of the command?

Quoted 25 lines
include/configs/sunxi-common.h +6 -0
+	"bootcmd_old=" \
+		"if ext2load mmc 0 0x44000000 uEnv.txt; then " \
+			"echo Loaded environment from uEnv.txt; " \
+			"env import -t 0x44000000 ${filesize}; " \
+		"fi; " \
+		"setenv bootargs console=${console} root=${root}

${extraargs}; " \

include/configs/sunxi-common.h +8 -0
+		"ext2load mmc 0 0x43000000 script.bin && " \
+		"ext2load mmc 0 0x48000000 uImage && " \
+		"bootm 0x48000000\0"
+#else
+#define BOOTCMD_OLD
+#endif
+
 #include <config_distro_bootcmd.h>
 
 #ifdef CONFIG_USB_KEYBOARD
@@ -495,6 +511,7 @@ extern int soft_i2c_gpio_scl;
 	MTD_ENV_SETTINGS \
 	"fdtfile=" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0" \
 	"console=ttyS0,115200\0" \
+	BOOTCMD_OLD \
 	BOOTENV
 
 #else /* ifndef CONFIG_SPL_BUILD */
#2 lore raw

PATCH 1/1 sunxi: Add a bootcmd_old to the default environment to boot old kernels

Hi,

Quoted 7 lines · Ian Campbell
Quoted 4 lines · Hans de Goede

Add a bootcmd_old value to the default environment when building with CONFIG_OLD_SUNXI_KERNEL_COMPAT, this way people who occasionally want to boot an old kernel can do so by simply typing "run bootcmd_old" rather then needing to have 2 separe setups / sdcards for old and

"separate"?

Yep, my bad.

Quoted 3 lines

"old" is a bit non-specific (e.g. there are also old mainline kernels). Perhaps bootcmd_sunxi_compat? It's a bit of a mouthful but it will tab complete b<tab>sun<tab> or close to that.

Ok, bootcmd_sunxi_compat it is.

Quoted 9 lines

include/configs/sunxi-common.h extern int soft_i2c_gpio_scl; · line 469

Quoted 3 lines
include/configs/sunxi-common.h +3 -0
+#ifdef CONFIG_OLD_SUNXI_KERNEL_COMPAT
+#define BOOTCMD_OLD \
+	"root=/dev/mmcblk0p3 rootwait\0" \

Does something other than the below setenv bootargs rely on this? It'd be better not to pollute the default env with such a generically named thing. I suggest following the naming of the command, so root_sunxi_compat.

Quoted 3 lines

If it is important to have root= present e.g. for script.bin or uEnv.txt then perhaps put setenv root ${root_sunxi_compat} at the start of the command?

Right, we need this because it is typically set from uEnv.txt, using setenv before importing uEnv.txt is a good idea though. And there is no need for the root_sunxi_compat indirection there IMHO.

Patch v2 with all this fixed coming up.

Quoted 25 lines
Quoted 25 lines
include/configs/sunxi-common.h +6 -0
+	"bootcmd_old=" \
+		"if ext2load mmc 0 0x44000000 uEnv.txt; then " \
+			"echo Loaded environment from uEnv.txt; " \
+			"env import -t 0x44000000 ${filesize}; " \
+		"fi; " \
+		"setenv bootargs console=${console} root=${root}

${extraargs}; " \

include/configs/sunxi-common.h +8 -0
+		"ext2load mmc 0 0x43000000 script.bin && " \
+		"ext2load mmc 0 0x48000000 uImage && " \
+		"bootm 0x48000000\0"
+#else
+#define BOOTCMD_OLD
+#endif
+
  #include <config_distro_bootcmd.h>
 
  #ifdef CONFIG_USB_KEYBOARD
@@ -495,6 +511,7 @@ extern int soft_i2c_gpio_scl;
  	MTD_ENV_SETTINGS \
  	"fdtfile=" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0" \
  	"console=ttyS0,115200\0" \
+	BOOTCMD_OLD \
  	BOOTENV
 
Quoted 1 line

include/configs/sunxi-common.h extern int soft_i2c_gpio_scl; · line 517

Quoted 1 line
include/configs/sunxi-common.h +0 -0
  #else /* ifndef CONFIG_SPL_BUILD */

Regards,

Hans