Skip to contentSkip to conversation

mpc83xx: fix the broken on the mpc83xx boards

PATCH New Kevin Hao 3 participants 5 messages Jul 8, 2016 – Jul 20, 2016

lore
Share & tools
lore

Kevin Hao

author
#0 lore raw

cover mpc83xx: fix the broken on the mpc83xx boards

Hi,

Robert P. J. Day reported that the latest u-boot can't work on mpc8315erdb board. There are two bugs in the config of this board. This patch series tries to fix these two issue for all the mpc83xx boards. Only run test on mpc8315erdb board. Just build test for other boards.

Kevin Hao (2):
mpc83xx: fix the corruption of u-boot when saveenv
mpc83xx: make it bootable with the latest kernel

 include/configs/MPC8308RDB.h  | 3 ++-
 include/configs/MPC8313ERDB.h | 5 +++--
 include/configs/MPC8315ERDB.h | 5 +++--
 include/configs/MPC8323ERDB.h | 3 ++-
 include/configs/MPC832XEMDS.h | 3 ++-
 include/configs/MPC8349EMDS.h | 3 ++-
 include/configs/MPC8349ITX.h  | 3 ++-
 include/configs/MPC837XEMDS.h | 3 ++-
 include/configs/MPC837XERDB.h | 3 ++-
 9 files changed, 20 insertions(+), 11 deletions(-)
Signature · 1 line
2.8.1
author
#1 lore raw

PATCH 1/2 mpc83xx: fix the corruption of u-boot when saveenv

Robert P. J. Day has pointed that the value of SYS_MONITOR_LEN in MPC8315ERDB.h is smaller than the u-boot.bin. This will cause the overlap between the code of u-boot and the environment variable. So when executing saveenv, it will corrupt the code of u-boot and causes the board not boot. Fix this for all the mpc83xx boards by reserving a 512K area.

---
 include/configs/MPC8308RDB.h  | 2 +-
 include/configs/MPC8313ERDB.h | 2 +-
 include/configs/MPC8315ERDB.h | 2 +-
 include/configs/MPC8323ERDB.h | 2 +-
 include/configs/MPC832XEMDS.h | 2 +-
 include/configs/MPC8349EMDS.h | 2 +-
 include/configs/MPC8349ITX.h  | 2 +-
 include/configs/MPC837XEMDS.h | 2 +-
 include/configs/MPC837XERDB.h | 2 +-
 9 files changed, 9 insertions(+), 9 deletions(-)
include/configs/MPC8308RDB.h +1 -1
index 578325cd05eb..e809dcfc5c85 100644
@@ -203,7 +203,7 @@
  */
 #define CONFIG_SYS_MONITOR_BASE	CONFIG_SYS_TEXT_BASE /* start of monitor */
 
-#define CONFIG_SYS_MONITOR_LEN	(384 * 1024) /* Reserve 384 kB for Mon */
+#define CONFIG_SYS_MONITOR_LEN	(512 * 1024) /* Reserve 512 kB for Mon */
 #define CONFIG_SYS_MALLOC_LEN	(512 * 1024) /* Reserved for malloc */
 
 /*
include/configs/MPC8313ERDB.h +1 -1
index 5613a4a0cd28..1947cf1fd369 100644
@@ -241,7 +241,7 @@
 #define CONFIG_SYS_INIT_SP_OFFSET	CONFIG_SYS_GBL_DATA_OFFSET
 
 /* CONFIG_SYS_MONITOR_LEN must be a multiple of CONFIG_ENV_SECT_SIZE */
-#define CONFIG_SYS_MONITOR_LEN	(384 * 1024)	/* Reserve 384 kB for Mon */
+#define CONFIG_SYS_MONITOR_LEN	(512 * 1024)	/* Reserve 512 kB for Mon */
 #define CONFIG_SYS_MALLOC_LEN	(512 * 1024)	/* Reserved for malloc */
 
 /*
include/configs/MPC8315ERDB.h +1 -1
index 7ce5f5993736..5b23f9401c5e 100644
@@ -169,7 +169,7 @@
 /*
  * The reserved memory
  */
-#define CONFIG_SYS_MONITOR_LEN	(384 * 1024) /* Reserve 384 kB for Mon */
+#define CONFIG_SYS_MONITOR_LEN	(512 * 1024) /* Reserve 512 kB for Mon */
 #define CONFIG_SYS_MALLOC_LEN	(512 * 1024) /* Reserved for malloc */
 
 /*
include/configs/MPC8323ERDB.h +1 -1
index 13f954d00edd..6680b5938e64 100644
@@ -156,7 +156,7 @@
 #endif
 
 /* CONFIG_SYS_MONITOR_LEN must be a multiple of CONFIG_ENV_SECT_SIZE */
-#define CONFIG_SYS_MONITOR_LEN	(384 * 1024)	/* Reserve 384 kB for Mon */
+#define CONFIG_SYS_MONITOR_LEN	(512 * 1024)	/* Reserve 512 kB for Mon */
 #define CONFIG_SYS_MALLOC_LEN	(256 * 1024)	/* Reserved for malloc */
 
 /*
include/configs/MPC832XEMDS.h +1 -1
index fd482606adab..babbd1a8e824 100644
@@ -168,7 +168,7 @@
 #endif
 
 /* CONFIG_SYS_MONITOR_LEN must be a multiple of CONFIG_ENV_SECT_SIZE */
-#define CONFIG_SYS_MONITOR_LEN	(384 * 1024)	/* Reserve 384 kB for Mon */
+#define CONFIG_SYS_MONITOR_LEN	(512 * 1024)	/* Reserve 512 kB for Mon */
 #define CONFIG_SYS_MALLOC_LEN	(256 * 1024)	/* Reserved for malloc */
 
 /*
include/configs/MPC8349EMDS.h +1 -1
index 288b126d02ef..0c44097519b0 100644
@@ -225,7 +225,7 @@
 			(CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
 #define CONFIG_SYS_INIT_SP_OFFSET	CONFIG_SYS_GBL_DATA_OFFSET
 
-#define CONFIG_SYS_MONITOR_LEN	(384 * 1024)	/* Reserve 384 kB for Mon */
+#define CONFIG_SYS_MONITOR_LEN	(512 * 1024)	/* Reserve 512 kB for Mon */
 #define CONFIG_SYS_MALLOC_LEN	(256 * 1024)	/* Reserved for malloc */
 
 /*
include/configs/MPC8349ITX.h +1 -1
index 2721255254fb..a7c37e1ebe9c 100644
@@ -330,7 +330,7 @@ boards, we say we have two, but don't display a message if we find only one. */
 #define CONFIG_SYS_INIT_SP_OFFSET	CONFIG_SYS_GBL_DATA_OFFSET
 
 /* CONFIG_SYS_MONITOR_LEN must be a multiple of CONFIG_ENV_SECT_SIZE */
-#define CONFIG_SYS_MONITOR_LEN	(384 * 1024) /* Reserve 384 kB for Mon */
+#define CONFIG_SYS_MONITOR_LEN	(512 * 1024) /* Reserve 512 kB for Mon */
 #define CONFIG_SYS_MALLOC_LEN	(256 * 1024) /* Reserved for malloc */
 
 /*
include/configs/MPC837XEMDS.h +1 -1
index 921d5f399d25..8bc72d562feb 100644
@@ -200,7 +200,7 @@
 #endif
 
 /* CONFIG_SYS_MONITOR_LEN must be a multiple of CONFIG_ENV_SECT_SIZE */
-#define CONFIG_SYS_MONITOR_LEN	(384 * 1024) /* Reserve 384 kB for Mon */
+#define CONFIG_SYS_MONITOR_LEN	(512 * 1024) /* Reserve 512 kB for Mon */
 #define CONFIG_SYS_MALLOC_LEN	(512 * 1024) /* Reserved for malloc */
 
 /*
include/configs/MPC837XERDB.h +1 -1
index bb06e89b4ea0..8962959156be 100644
@@ -225,7 +225,7 @@
 #undef	CONFIG_SYS_RAMBOOT
 #endif
 
-#define CONFIG_SYS_MONITOR_LEN	(384 * 1024) /* Reserve 384 kB for Mon */
+#define CONFIG_SYS_MONITOR_LEN	(512 * 1024) /* Reserve 512 kB for Mon */
 #define CONFIG_SYS_MALLOC_LEN	(512 * 1024) /* Reserved for malloc */
 
 /*
Signature · 1 line
2.8.1
#2 lore raw

PATCH 1/2 mpc83xx: fix the corruption of u-boot when saveenv

Quoted 9 lines · Kevin Hao

Robert P. J. Day has pointed that the value of SYS_MONITOR_LEN in MPC8315ERDB.h is smaller than the u-boot.bin. This will cause the overlap between the code of u-boot and the environment variable. So when executing saveenv, it will corrupt the code of u-boot and causes the board not boot. Fix this for all the mpc83xx boards by reserving a 512K area.

Quoted 12 lines
---
 include/configs/MPC8308RDB.h  | 2 +-
 include/configs/MPC8313ERDB.h | 2 +-
 include/configs/MPC8315ERDB.h | 2 +-
 include/configs/MPC8323ERDB.h | 2 +-
 include/configs/MPC832XEMDS.h | 2 +-
 include/configs/MPC8349EMDS.h | 2 +-
 include/configs/MPC8349ITX.h  | 2 +-
 include/configs/MPC837XEMDS.h | 2 +-
 include/configs/MPC837XERDB.h | 2 +-
 9 files changed, 9 insertions(+), 9 deletions(-)

I don't have any mpc83xx board to test the change. But it looks OK.

Sinan, do you have any comment for this and next patch in this set?

York

#3 lore raw

PATCH 1/2 mpc83xx: fix the corruption of u-boot when saveenv

Hi York

Quoted 23 lines · york sun
Quoted 9 lines · Kevin Hao

Robert P. J. Day has pointed that the value of SYS_MONITOR_LEN in MPC8315ERDB.h is smaller than the u-boot.bin. This will cause the overlap between the code of u-boot and the environment variable. So when executing saveenv, it will corrupt the code of u-boot and causes the board not boot. Fix this for all the mpc83xx boards by reserving a 512K area.

Quoted 12 lines
---
 include/configs/MPC8308RDB.h  | 2 +-
 include/configs/MPC8313ERDB.h | 2 +-
 include/configs/MPC8315ERDB.h | 2 +-
 include/configs/MPC8323ERDB.h | 2 +-
 include/configs/MPC832XEMDS.h | 2 +-
 include/configs/MPC8349EMDS.h | 2 +-
 include/configs/MPC8349ITX.h  | 2 +-
 include/configs/MPC837XEMDS.h | 2 +-
 include/configs/MPC837XERDB.h | 2 +-
 9 files changed, 9 insertions(+), 9 deletions(-)
Quoted 3 lines

I don't have any mpc83xx board to test the change. But it looks OK.

Sinan, do you have any comment for this and next patch in this set?

I am travelling now but I could test several MPC83xx boards sometimes
next week if you prefer to wait for test. Otherwise the patch looks fine.

Regards
Sinan Akman

author
#4 lore raw

PATCH 2/2 mpc83xx: make it bootable with the latest kernel

In reply to Kevin Hao

Due to the blow up of the latest kernel size, the default gnuzip size (8M) seems too small. The yocto kernel size I built for mpc8315erdb board is 5294393, and it can't be boot by using the latest u-boot. So expand gnuzip buffer for all the mpc83xx boards to fix this issue.

Robert P. J. Day also pointed that the kernel partition on the NAND flash is also too small, fix it at the same time.

---
 include/configs/MPC8308RDB.h  | 1 +
 include/configs/MPC8313ERDB.h | 3 ++-
 include/configs/MPC8315ERDB.h | 3 ++-
 include/configs/MPC8323ERDB.h | 1 +
 include/configs/MPC832XEMDS.h | 1 +
 include/configs/MPC8349EMDS.h | 1 +
 include/configs/MPC8349ITX.h  | 1 +
 include/configs/MPC837XEMDS.h | 1 +
 include/configs/MPC837XERDB.h | 1 +
 9 files changed, 11 insertions(+), 2 deletions(-)
include/configs/MPC8308RDB.h +1 -0
index e809dcfc5c85..5b804648edb8 100644
@@ -452,6 +452,7 @@
  * the maximum mapped by the Linux kernel during initialization.
  */
 #define CONFIG_SYS_BOOTMAPSZ	(256 << 20) /* Initial Memory map for Linux */
+#define CONFIG_SYS_BOOTM_LEN	(64 << 20)	/* Increase max gunzip size */
 
 /*
  * Core HID Setup
include/configs/MPC8313ERDB.h +2 -1
index 1947cf1fd369..1c4e082d4ec6 100644
@@ -268,7 +268,7 @@
 #define CONFIG_CMD_MTDPARTS
 #define MTDIDS_DEFAULT			"nand0=e2800000.flash"
 #define MTDPARTS_DEFAULT		\
-	"mtdparts=e2800000.flash:512k(uboot),128k(env),3m at 1m(kernel),-(fs)"
+	"mtdparts=e2800000.flash:512k(uboot),128k(env),6m at 1m(kernel),-(fs)"
 
 #define CONFIG_SYS_MAX_NAND_DEVICE	1
 #define CONFIG_CMD_NAND 1
@@ -502,6 +502,7 @@
  */
 				/* Initial Memory map for Linux*/
 #define CONFIG_SYS_BOOTMAPSZ	(256 << 20)
+#define CONFIG_SYS_BOOTM_LEN	(64 << 20)	/* Increase max gunzip size */
 
 #define CONFIG_SYS_RCWH_PCIHOST 0x80000000	/* PCIHOST  */
 
include/configs/MPC8315ERDB.h +2 -1
index 5b23f9401c5e..23a2e34ce729 100644
@@ -241,7 +241,7 @@
 #define CONFIG_CMD_MTDPARTS
 #define MTDIDS_DEFAULT			"nand0=e0600000.flash"
 #define MTDPARTS_DEFAULT		\
-	"mtdparts=e0600000.flash:512k(uboot),128k(env),3m at 1m(kernel),-(fs)"
+	"mtdparts=e0600000.flash:512k(uboot),128k(env),6m@1m(kernel),-(fs)"
 
 #define CONFIG_SYS_MAX_NAND_DEVICE	1
 #define CONFIG_CMD_NAND			1
@@ -489,6 +489,7 @@
  * the maximum mapped by the Linux kernel during initialization.
  */
 #define CONFIG_SYS_BOOTMAPSZ	(256 << 20) /* Initial Memory map for Linux */
+#define CONFIG_SYS_BOOTM_LEN	(64 << 20)	/* Increase max gunzip size */
 
 /*
  * Core HID Setup
include/configs/MPC8323ERDB.h +1 -0
index 6680b5938e64..095c0d8dcadc 100644
@@ -359,6 +359,7 @@
  */
 					/* Initial Memory map for Linux */
 #define CONFIG_SYS_BOOTMAPSZ		(256 << 20)
+#define CONFIG_SYS_BOOTM_LEN	(64 << 20)	/* Increase max gunzip size */
 
 /*
  * Core HID Setup
include/configs/MPC832XEMDS.h +1 -0
index babbd1a8e824..18418e398e53 100644
@@ -441,6 +441,7 @@
  */
 					/* Initial Memory map for Linux */
 #define CONFIG_SYS_BOOTMAPSZ		(256 << 20)
+#define CONFIG_SYS_BOOTM_LEN	(64 << 20)	/* Increase max gunzip size */
 
 /*
  * Core HID Setup
include/configs/MPC8349EMDS.h +1 -0
index 0c44097519b0..a2fa783a77e9 100644
@@ -508,6 +508,7 @@
  */
 				/* Initial Memory map for Linux*/
 #define CONFIG_SYS_BOOTMAPSZ	(256 << 20)
+#define CONFIG_SYS_BOOTM_LEN	(64 << 20)	/* Increase max gunzip size */
 
 #define CONFIG_SYS_RCWH_PCIHOST 0x80000000 /* PCIHOST  */
 
include/configs/MPC8349ITX.h +1 -0
index a7c37e1ebe9c..c11c0cf8250d 100644
@@ -544,6 +544,7 @@ boards, we say we have two, but don't display a message if we find only one. */
  */
 				/* Initial Memory map for Linux*/
 #define CONFIG_SYS_BOOTMAPSZ	(256 << 20)
+#define CONFIG_SYS_BOOTM_LEN	(64 << 20)	/* Increase max gunzip size */
 
 #define CONFIG_SYS_HRCW_LOW (\
 	HRCWL_LCL_BUS_TO_SCB_CLK_1X1 |\
include/configs/MPC837XEMDS.h +1 -0
index 8bc72d562feb..b2dc1890c743 100644
@@ -522,6 +522,7 @@ extern int board_pci_host_broken(void);
  * the maximum mapped by the Linux kernel during initialization.
  */
 #define CONFIG_SYS_BOOTMAPSZ	(256 << 20) /* Initial Memory map for Linux */
+#define CONFIG_SYS_BOOTM_LEN	(64 << 20)	/* Increase max gunzip size */
 
 /*
  * Core HID Setup
include/configs/MPC837XERDB.h +1 -0
index 8962959156be..8eb87ebde502 100644
@@ -533,6 +533,7 @@
  * the maximum mapped by the Linux kernel during initialization.
  */
 #define CONFIG_SYS_BOOTMAPSZ	(256 << 20) /* Initial Memory map for Linux */
+#define CONFIG_SYS_BOOTM_LEN	(64 << 20)	/* Increase max gunzip size */
 
 /*
  * Core HID Setup
Signature · 1 line
2.8.1