]>
Commit | Line | Data |
---|---|---|
83d290c5 | 1 | // SPDX-License-Identifier: GPL-2.0+ |
c609719b WD |
2 | /* |
3 | * (C) Copyright 2001 | |
4 | * Erik Theisen, Wave 7 Optics, [email protected]. | |
c609719b WD |
5 | */ |
6 | ||
f33f3e07 YS |
7 | #include <linux/kconfig.h> |
8 | ||
dc17fb6d | 9 | #ifndef __ASSEMBLY__ |
bd2a23ac | 10 | #define __ASSEMBLY__ /* Dirty trick to get only #defines */ |
dc17fb6d | 11 | #endif |
bd2a23ac | 12 | #define __ASM_STUB_PROCESSOR_H__ /* don't include asm/processor. */ |
c609719b | 13 | #include <config.h> |
dc17fb6d | 14 | #undef __ASSEMBLY__ |
f3998fdc | 15 | #include <env_internal.h> |
5368c55d | 16 | #include <linux/stringify.h> |
c609719b | 17 | |
bd2a23ac | 18 | /* Handle HOSTS that have prepended crap on symbol names, not TARGETS. */ |
c609719b WD |
19 | #if defined(__APPLE__) |
20 | /* Leading underscore on symbols */ | |
21 | # define SYM_CHAR "_" | |
22 | #else /* No leading character on symbols */ | |
23 | # define SYM_CHAR | |
24 | #endif | |
25 | ||
a747a7f3 WD |
26 | /* |
27 | * Generate embedded environment table | |
28 | * inside U-Boot image, if needed. | |
29 | */ | |
c3eb3fe4 | 30 | #if defined(ENV_IS_EMBEDDED) || defined(CONFIG_BUILD_ENVCRC) |
c609719b | 31 | /* |
7653942b | 32 | * Put the environment in the .text section when we are building |
c609719b | 33 | * U-Boot proper. The host based program "tools/envcrc" does not need |
7653942b | 34 | * a seperate section. |
c609719b | 35 | */ |
7653942b | 36 | #if defined(USE_HOSTCC) /* Native for 'tools/envcrc' */ |
23ac79ff | 37 | # define __UBOOT_ENV_SECTION__(name) /*XXX DO_NOT_DEL_THIS_COMMENT*/ |
c609719b WD |
38 | |
39 | #else /* Environment is embedded in U-Boot's .text section */ | |
40 | /* XXX - This only works with GNU C */ | |
23ac79ff | 41 | # define __UBOOT_ENV_SECTION__(name) __attribute__ ((section(".text."#name))) |
c609719b WD |
42 | #endif |
43 | ||
44 | /* | |
45 | * Macros to generate global absolutes. | |
46 | */ | |
4087bc88 | 47 | #if defined(__bfin__) |
bd2a23ac IG |
48 | # define GEN_SET_VALUE(name, value) \ |
49 | asm(".set " GEN_SYMNAME(name) ", " GEN_VALUE(value)) | |
4087bc88 | 50 | #else |
bd2a23ac IG |
51 | # define GEN_SET_VALUE(name, value) \ |
52 | asm(GEN_SYMNAME(name) " = " GEN_VALUE(value)) | |
53 | #endif | |
54 | #define GEN_SYMNAME(str) SYM_CHAR #str | |
55 | #define GEN_VALUE(str) #str | |
56 | #define GEN_ABS(name, value) \ | |
57 | asm(".globl " GEN_SYMNAME(name)); \ | |
58 | GEN_SET_VALUE(name, value) | |
c609719b | 59 | |
c609719b WD |
60 | /* |
61 | * Check to see if we are building with a | |
62 | * computed CRC. Otherwise define it as ~0. | |
63 | */ | |
64 | #if !defined(ENV_CRC) | |
bd2a23ac | 65 | # define ENV_CRC (~0) |
c609719b WD |
66 | #endif |
67 | ||
ddd8418f JH |
68 | #define DEFAULT_ENV_INSTANCE_EMBEDDED |
69 | #include <env_default.h> | |
70 | ||
0e8d1586 | 71 | #ifdef CONFIG_ENV_ADDR_REDUND |
23ac79ff | 72 | env_t redundand_environment __UBOOT_ENV_SECTION__(redundand_environment) = { |
c609719b WD |
73 | 0, /* CRC Sum: invalid */ |
74 | 0, /* Flags: invalid */ | |
75 | { | |
76 | "\0" | |
77 | } | |
78 | }; | |
0e8d1586 | 79 | #endif /* CONFIG_ENV_ADDR_REDUND */ |
c609719b WD |
80 | |
81 | /* | |
82 | * These will end up in the .text section | |
83 | * if the environment strings are embedded | |
84 | * in the image. When this is used for | |
85 | * tools/envcrc, they are placed in the | |
86 | * .data/.sdata section. | |
87 | * | |
88 | */ | |
23ac79ff | 89 | unsigned long env_size __UBOOT_ENV_SECTION__(env_size) = sizeof(env_t); |
c609719b WD |
90 | |
91 | /* | |
92 | * Add in absolutes. | |
93 | */ | |
a09fea1d | 94 | GEN_ABS(env_offset, (CONFIG_ENV_ADDR - CONFIG_SYS_FLASH_BASE)); |
a747a7f3 WD |
95 | |
96 | #endif /* ENV_IS_EMBEDDED */ |