]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
TQM8xx[LM]: Fix broken environment alignment.
authorWolfgang Denk <wd@denx.de>
Sun, 16 Sep 2007 15:10:04 +0000 (17:10 +0200)
committerWolfgang Denk <wd@denx.de>
Sun, 16 Sep 2007 15:20:37 +0000 (17:20 +0200)
With recent toolchains, the environment sectors were no longer aligned to
sector boundaries. The reason was a combination of two bugs:

1) common/environment.c assumed that CONFIG_TQM8xxL would be defined
   for all TQM8xxL and TQM8xxM boards. But "include/common.h", where
   this gets defined, is not included here (and cannot be included
   without causing lots of problems).

   Added a new #define CFG_USE_PPCENV for all boards which really
   want to put the environment is a ".ppcenv" section.

2) The linker scripts just include environment.o, silently assuming
   that the objects in that file are really in the order in which
   they are coded in the C file, i. e. "environment" first, then
   "redundand_environment", and "env_size" last. However, current
   toolchains (GCC-4.x) reorder the objects, causing the environment
   data not to start on a flash sector boundary:

   Instead of: we got:

40008000 T environment 40008000 T env_size
4000c000 T redundand_environment 40008004 T redundand_environment
40010000 T env_size 4000c004 T environment

   Note: this patch fixes just the first part, and cures the alignment
   problem by making sure that "env_size" gets placed correctly. However,
   we still have a potential issue because primary and redundant
   environment sectors are actually swapped, i. e. we have now:

40008000 T redundand_environment
4000c000 T environment
40010000 T env_size

   This shall be fixed in the next version.

Signed-off-by: Wolfgang Denk <wd@denx.de>
26 files changed:
board/fads/fads.h
common/environment.c
include/configs/CATcenter.h
include/configs/FADS823.h
include/configs/FADS850SAR.h
include/configs/ICU862.h
include/configs/M5271EVB.h
include/configs/PPChameleonEVB.h
include/configs/R360MPI.h
include/configs/RRvision.h
include/configs/TQM823L.h
include/configs/TQM823M.h
include/configs/TQM850L.h
include/configs/TQM850M.h
include/configs/TQM855L.h
include/configs/TQM855M.h
include/configs/TQM860L.h
include/configs/TQM860M.h
include/configs/TQM862L.h
include/configs/TQM862M.h
include/configs/TQM866M.h
include/configs/cmi_mpc5xx.h
include/configs/hymod.h
include/configs/idmr.h
include/configs/trab.h
include/configs/virtlab2.h

index a7fe2e9019ce6316ba047771ac7469b356bcce16..dea8a0dc10082c0a52b26ea95ade74a0350e6421 100644 (file)
 #define CFG_ENV_SECT_SIZE      0x40000 /* see README - env sector total size   */
 #define CFG_ENV_OFFSET         CFG_ENV_SECT_SIZE
 #define        CFG_ENV_SIZE            0x4000  /* Total Size of Environment            */
+#define        CFG_USE_PPCENV                  /* Environment embedded in sect .ppcenv */
 
 #define        CFG_DIRECT_FLASH_TFTP
 
index 1d425a73097e90b12c0feab738ff7863563a4951..24257f7c527b40282e99f1271c95c436a73a7fa9 100644 (file)
  * a seperate section.  Note that ENV_CRC is only defined when building
  * U-Boot itself.
  */
-#if (defined(CONFIG_CMI)       || \
-     defined(CONFIG_FADS)      || \
-     defined(CONFIG_HYMOD)     || \
-     defined(CONFIG_ICU862)    || \
-     defined(CONFIG_R360MPI)   || \
-     defined(CONFIG_TQM8xxL)   || \
-     defined(CONFIG_RRVISION)  || \
-     defined(CONFIG_TRAB)      || \
-     defined(CONFIG_PPCHAMELEONEVB) || \
-     defined(CONFIG_M5271EVB)  || \
-     defined(CONFIG_IDMR)      || \
-     defined(CONFIG_NAND_U_BOOT))      && \
+#if (defined(CFG_USE_PPCENV) || defined(CONFIG_NAND_U_BOOT)) && \
      defined(ENV_CRC) /* Environment embedded in U-Boot .ppcenv section */
 /* XXX - This only works with GNU C */
 #  define __PPCENV__ __attribute__ ((section(".ppcenv")))
index 62a2eaa23659e5d1c667c596f2f3466c78410456..0321650f3d2103e69fdc047af57ae7e1e32e5e4b 100644 (file)
 #define CFG_ENV_ADDR_REDUND    0xFFFFA000
 #define CFG_ENV_SIZE_REDUND    0x2000
 
+#define        CFG_USE_PPCENV                  /* Environment embedded in sect .ppcenv */
+
 #define CFG_NVRAM_BASE_ADDR    0xF0000500              /* NVRAM base address   */
 #define CFG_NVRAM_SIZE         242                     /* NVRAM size           */
 
index a562b2fa4e86486875329e14c1ac0c0eb10d19e6..f810af2ceca6fdb37397a3a83726c678c929e890 100644 (file)
 #define        CFG_ENV_IS_IN_FLASH     1
 #define CFG_ENV_OFFSET         0x00040000      /* Offset of Environment Sector */
 #define        CFG_ENV_SIZE            0x40000 /* Total Size of Environment Sector     */
+#define        CFG_USE_PPCENV                  /* Environment embedded in sect .ppcenv */
 
 /*-----------------------------------------------------------------------
  * Cache Configuration
index c8ce25957b02a5e412f0f309301d488fd2977863..a09c0e0393fd4b4ee5056029a2a28de674f048e0 100644 (file)
 #define        CFG_ENV_IS_IN_FLASH     1
 #define CFG_ENV_OFFSET         0x00040000      /* Offset of Environment Sector */
 #define        CFG_ENV_SIZE            0x40000 /* Total Size of Environment Sector     */
+#define        CFG_USE_PPCENV                  /* Environment embedded in sect .ppcenv */
 
 /*-----------------------------------------------------------------------
  * Cache Configuration
index 27a5bc302fc1446ffe57bd74fb2a3548e8c8eb3f..da54cef534f96695517b12412ef7c2ce73c222d4 100644 (file)
 
 #define CFG_ENV_SECT_SIZE      0x40000 /* Total Size of Environment sector     */
 #define        CFG_ENV_SIZE            0x4000  /* Used Size of Environment Sector      */
+#define        CFG_USE_PPCENV                  /* Environment embedded in sect .ppcenv */
 
 /*-----------------------------------------------------------------------
  * Cache Configuration
index 0f97050f21357a098d3d6942f3244c043ed73ca1..798ec0c7a4c4eccf5ea7e4513ebc866ed784b9cc 100644 (file)
  */
 #ifndef CONFIG_MONITOR_IS_IN_RAM
 #define CFG_ENV_OFFSET         0x4000
-#define CFG_ENV_SECT_SIZE      0x2000
-#define CFG_ENV_IS_IN_FLASH    1
 #else
 #define CFG_ENV_ADDR           0xffe04000
+#endif
 #define CFG_ENV_SECT_SIZE      0x2000
 #define CFG_ENV_IS_IN_FLASH    1
-#endif
+#define        CFG_USE_PPCENV                  /* Environment embedded in sect .ppcenv */
 
 /*
  * BOOTP options
index dd1decdcd9499d9fc5344e03f04e8514c5eea16d..8a74c4f5c907195b9f875940ed6ac2f5016414c0 100644 (file)
 #define CFG_ENV_ADDR_REDUND    0xFFFFA000
 #define CFG_ENV_SIZE_REDUND    0x2000
 
+#define        CFG_USE_PPCENV                  /* Environment embedded in sect .ppcenv */
+
 #endif /* ENVIRONMENT_IN_EEPROM */
 
 
index 516ec643d6543f68c87e3fd23f4dc57017c99161..a98b4af29e305878ecf732fdbfa3f38b41339cf9 100644 (file)
 #define        CFG_ENV_OFFSET          0x40000 /* Offset of Environment                */
 #define        CFG_ENV_SECT_SIZE       0x20000 /* Total Size of Environment sector     */
 #define        CFG_ENV_SIZE            0x4000  /* Used Size of Environment sector      */
+#define        CFG_USE_PPCENV                  /* Environment embedded in sect .ppcenv */
 
 /*-----------------------------------------------------------------------
  * Cache Configuration
index 1e6e8c0aa233039f87289072137383355c3c3a75..32e228545455d95c7e6fede53c82f51528bdc9f8 100644 (file)
 #define CFG_ENV_OFFSET_REDUND  (CFG_ENV_OFFSET+CFG_ENV_SIZE)
 #define CFG_ENV_SIZE_REDUND    (CFG_ENV_SIZE)
 
+#define        CFG_USE_PPCENV                  /* Environment embedded in sect .ppcenv */
+
 /*-----------------------------------------------------------------------
  * Cache Configuration
  */
index 384789b132883d039bc8cc79a074639bdbb4a449..7a3801026fbd5d2ed17c1515ab6b7992e021b964 100644 (file)
 #define CFG_ENV_OFFSET_REDUND  (CFG_ENV_OFFSET+CFG_ENV_SIZE)
 #define CFG_ENV_SIZE_REDUND    (CFG_ENV_SIZE)
 
+#define        CFG_USE_PPCENV                  /* Environment embedded in sect .ppcenv */
+
 /*-----------------------------------------------------------------------
  * Hardware Information Block
  */
index 47f416b49d40df7cbccfbe1d81915c55536d5f5f..e8b6a80b19e44b716b5904487926839cd89f2946 100644 (file)
 #define CFG_ENV_OFFSET_REDUND  (CFG_ENV_OFFSET+CFG_ENV_SECT_SIZE)
 #define CFG_ENV_SIZE_REDUND    (CFG_ENV_SIZE)
 
+#define        CFG_USE_PPCENV                  /* Environment embedded in sect .ppcenv */
+
 /*-----------------------------------------------------------------------
  * Hardware Information Block
  */
index e4b0bd279609753ed7d660275bea79c820dc8c8d..beeca6343e823983e24f44e2a1a827aa2d4fa1d3 100644 (file)
 #define CFG_ENV_OFFSET_REDUND  (CFG_ENV_OFFSET+CFG_ENV_SIZE)
 #define CFG_ENV_SIZE_REDUND    (CFG_ENV_SIZE)
 
+#define        CFG_USE_PPCENV                  /* Environment embedded in sect .ppcenv */
+
 /*-----------------------------------------------------------------------
  * Hardware Information Block
  */
index f26c46e99a79d1a7a59c6911b017c9edb7a8340c..d5609c1d485d3323736a3c556ac55a83117962ed 100644 (file)
 #define CFG_ENV_OFFSET_REDUND  (CFG_ENV_OFFSET+CFG_ENV_SECT_SIZE)
 #define CFG_ENV_SIZE_REDUND    (CFG_ENV_SIZE)
 
+#define        CFG_USE_PPCENV                  /* Environment embedded in sect .ppcenv */
+
 /*-----------------------------------------------------------------------
  * Hardware Information Block
  */
index 330c931cc13c10358ff4d7f9342139d8add7daae..e35b5b2ac1edf88464997431095a0dd2f371ca8f 100644 (file)
 #define CFG_ENV_OFFSET_REDUND  (CFG_ENV_OFFSET+CFG_ENV_SIZE)
 #define CFG_ENV_SIZE_REDUND    (CFG_ENV_SIZE)
 
+#define        CFG_USE_PPCENV                  /* Environment embedded in sect .ppcenv */
+
 /*-----------------------------------------------------------------------
  * Hardware Information Block
  */
index 77c2f114a2dcf33498f61a76edc53d8d1897ca7a..cd5212eff8eaa77ab465e8dcf4962eee8c889deb 100644 (file)
 #define CFG_ENV_OFFSET_REDUND  (CFG_ENV_OFFSET+CFG_ENV_SECT_SIZE)
 #define CFG_ENV_SIZE_REDUND    (CFG_ENV_SIZE)
 
+#define        CFG_USE_PPCENV                  /* Environment embedded in sect .ppcenv */
+
 /*-----------------------------------------------------------------------
  * Hardware Information Block
  */
index a903c2b3421ed66e1d06307c5e9e0462a9181413..d5838dbf372a0772d52c599f9bf60a26137797c9 100644 (file)
 #define CFG_ENV_OFFSET_REDUND  (CFG_ENV_OFFSET+CFG_ENV_SIZE)
 #define CFG_ENV_SIZE_REDUND    (CFG_ENV_SIZE)
 
+#define        CFG_USE_PPCENV                  /* Environment embedded in sect .ppcenv */
+
 /*-----------------------------------------------------------------------
  * Hardware Information Block
  */
index b905a0a635a9b922f982276ba31f965d3d55ca68..684b86f2efe4119db5e96e4127bc7ba8ed3a1b39 100644 (file)
 #define CFG_ENV_OFFSET_REDUND  (CFG_ENV_OFFSET+CFG_ENV_SECT_SIZE)
 #define CFG_ENV_SIZE_REDUND    (CFG_ENV_SIZE)
 
+#define        CFG_USE_PPCENV                  /* Environment embedded in sect .ppcenv */
+
 /*-----------------------------------------------------------------------
  * Hardware Information Block
  */
index d8ddf37fa9493a55bfe9e459299b54609126322e..f09d3d1654f6921ef15012ea3f142473521fa9a5 100644 (file)
 #define CFG_ENV_OFFSET_REDUND  (CFG_ENV_OFFSET+CFG_ENV_SIZE)
 #define CFG_ENV_SIZE_REDUND    (CFG_ENV_SIZE)
 
+#define        CFG_USE_PPCENV                  /* Environment embedded in sect .ppcenv */
+
 /*-----------------------------------------------------------------------
  * Hardware Information Block
  */
index 50607f0e5231e7dc18f9acef358b66c4364ce3f1..039aa3af428f04c00e29b5fbcaa5dce2da548a69 100644 (file)
 #define CFG_ENV_OFFSET_REDUND  (CFG_ENV_OFFSET+CFG_ENV_SECT_SIZE)
 #define CFG_ENV_SIZE_REDUND    (CFG_ENV_SIZE)
 
+#define        CFG_USE_PPCENV                  /* Environment embedded in sect .ppcenv */
+
 /*-----------------------------------------------------------------------
  * Hardware Information Block
  */
index ea310c42350a5bc3f0b384161f1a64ea1064c4f1..0d778919a2b0772aee9f005ac6c5ef1f1de24e15 100644 (file)
 #define CFG_ENV_OFFSET_REDUND  (CFG_ENV_OFFSET+CFG_ENV_SECT_SIZE)
 #define CFG_ENV_SIZE_REDUND    (CFG_ENV_SIZE)
 
+#define        CFG_USE_PPCENV                  /* Environment embedded in sect .ppcenv */
+
 /*-----------------------------------------------------------------------
  * Hardware Information Block
  */
index 85c2b96fec7e28b116770021af68f2b281f11c19..a869364c605779cf6aacd8cb977a170b426f18d9 100644 (file)
 #define        CFG_ENV_IS_IN_FLASH     1
 
 #ifdef CFG_ENV_IS_IN_FLASH
-#define CFG_ENV_OFFSET         0x00020000              /* Environment starts at this adress    */
-#define        CFG_ENV_SIZE            0x00010000              /* Set whole sector as env              */
+#define CFG_ENV_OFFSET         0x00020000      /* Environment starts at this adress    */
+#define        CFG_ENV_SIZE            0x00010000      /* Set whole sector as env              */
+#define        CFG_USE_PPCENV                          /* Environment embedded in sect .ppcenv */
 #endif
 
 /*-----------------------------------------------------------------------
index 2f64ec238c652ef3e3862d8aa53ca4aa50a47d43..2547afb3cf0d8a3915936ff01acd3478517258ff 100644 (file)
 #define        CFG_ENV_SIZE            0x40000 /* Total Size of Environment Sector */
 #define CFG_ENV_SECT_SIZE      0x40000 /* see README - env sect real size */
 #define        CFG_ENV_ADDR    (CFG_FLASH_BASE+CFG_MONITOR_LEN-CFG_ENV_SECT_SIZE)
+#define        CFG_USE_PPCENV                  /* Environment embedded in sect .ppcenv */
 
 /*-----------------------------------------------------------------------
  * Cache Configuration
index 404e88a4fcde235f8921d72d16bb9380c41e743d..3821ebcf0d1e4f7d9e63cf1ad6717e6432a0eec9 100644 (file)
 #define CFG_ENV_IS_IN_FLASH
 #endif /* !CONFIG_MONITOR_IS_IN_RAM */
 
+#define        CFG_USE_PPCENV                  /* Environment embedded in sect .ppcenv */
+
 #define CFG_PROMPT             "=> "
 #define CFG_LONGHELP                           /* undef to save memory */
 
index dbccea28ad364dbde5e92ed0ad7fa5a5d02463ad..b9088a89abd89b0b1e69e03e27d1bb102f724913 100644 (file)
 #define CFG_ENV_OFFSET_REDUND  (CFG_ENV_ADDR+CFG_ENV_SECT_SIZE)
 #define CFG_ENV_SIZE_REDUND    (CFG_ENV_SIZE)
 
+#define        CFG_USE_PPCENV                  /* Environment embedded in sect .ppcenv */
+
 /* Initial value of the on-board touch screen brightness */
 #define CFG_BRIGHTNESS 0x20
 
index 561a8bc47b5906ef25b3ca9dfd502e1026236c3b..edae6f4b984e8c4929f0a10ac61fe75c975ecec1 100644 (file)
 #define CFG_ENV_OFFSET_REDUND  (CFG_ENV_OFFSET+CFG_ENV_SIZE)
 #define CFG_ENV_SIZE_REDUND    (CFG_ENV_SIZE)
 
+#define        CFG_USE_PPCENV                  /* Environment embedded in sect .ppcenv */
+
 /*-----------------------------------------------------------------------
  * Hardware Information Block
  */