Permalink
...
Comparing changes
Open a pull request
- 11 commits
- 8 files changed
- 0 commit comments
- 6 contributors
Unified
Split
Showing
with
609 additions
and 26 deletions.
- +109 −0 README
- +13 −0 arch/arm/lib/bootm.c
- +1 −0 common/Makefile
- +25 −24 common/cmd_nvedit.c
- +170 −0 common/env_fat.c
- +14 −1 include/configs/hardkernel/odroidc.h
- +7 −1 tools/Makefile
- +270 −0 tools/mkenvimage.c
View
109
README
| @@ -2710,6 +2710,115 @@ to save the current settings. | ||
| environment. If redundant environment is used, it will be copied to | ||
| CONFIG_NAND_ENV_DST + CONFIG_ENV_SIZE. | ||
| +- CONFIG_ENV_IS_IN_UBI: | ||
| + | ||
| + Define this if you have an UBI volume that you want to use for the | ||
| + environment. This has the benefit of wear-leveling the environment | ||
| + accesses, which is important on NAND. | ||
| + | ||
| + - CONFIG_ENV_UBI_PART: | ||
| + | ||
| + Define this to a string that is the mtd partition containing the UBI. | ||
| + | ||
| + - CONFIG_ENV_UBI_VOLUME: | ||
| + | ||
| + Define this to the name of the volume that you want to store the | ||
| + environment in. | ||
| + | ||
| + - CONFIG_ENV_UBI_VOLUME_REDUND: | ||
| + | ||
| + Define this to the name of another volume to store a second copy of | ||
| + the environment in. This will enable redundant environments in UBI. | ||
| + It is assumed that both volumes are in the same MTD partition. | ||
| + | ||
| + - CONFIG_UBI_SILENCE_MSG | ||
| + - CONFIG_UBIFS_SILENCE_MSG | ||
| + | ||
| + You will probably want to define these to avoid a really noisy system | ||
| + when storing the env in UBI. | ||
| + | ||
| +- CONFIG_ENV_IS_IN_FAT: | ||
| + Define this if you want to use the FAT file system for the environment. | ||
| + | ||
| + - FAT_ENV_INTERFACE: | ||
| + | ||
| + Define this to a string that is the name of the block device. | ||
| + | ||
| + - FAT_ENV_DEV_AND_PART: | ||
| + | ||
| + Define this to a string to specify the partition of the device. It can | ||
| + be as following: | ||
| + | ||
| + "D:P", "D:0", "D", "D:" or "D:auto" (D, P are integers. And P >= 1) | ||
| + - "D:P": device D partition P. Error occurs if device D has no | ||
| + partition table. | ||
| + - "D:0": device D. | ||
| + - "D" or "D:": device D partition 1 if device D has partition | ||
| + table, or the whole device D if has no partition | ||
| + table. | ||
| + - "D:auto": first partition in device D with bootable flag set. | ||
| + If none, first valid paratition in device D. If no | ||
| + partition table then means device D. | ||
| + | ||
| + - FAT_ENV_FILE: | ||
| + | ||
| + It's a string of the FAT file name. This file use to store the | ||
| + envrionment. | ||
| + | ||
| + - CONFIG_FAT_WRITE: | ||
| + This should be defined. Otherwise it cannot save the envrionment file. | ||
| + | ||
| +- CONFIG_ENV_IS_IN_MMC: | ||
| + | ||
| + Define this if you have an MMC device which you want to use for the | ||
| + environment. | ||
| + | ||
| + - CONFIG_SYS_MMC_ENV_DEV: | ||
| + | ||
| + Specifies which MMC device the environment is stored in. | ||
| + | ||
| + - CONFIG_SYS_MMC_ENV_PART (optional): | ||
| + | ||
| + Specifies which MMC partition the environment is stored in. If not | ||
| + set, defaults to partition 0, the user area. Common values might be | ||
| + 1 (first MMC boot partition), 2 (second MMC boot partition). | ||
| + | ||
| + - CONFIG_ENV_OFFSET: | ||
| + - CONFIG_ENV_SIZE: | ||
| + | ||
| + These two #defines specify the offset and size of the environment | ||
| + area within the specified MMC device. | ||
| + | ||
| + If offset is positive (the usual case), it is treated as relative to | ||
| + the start of the MMC partition. If offset is negative, it is treated | ||
| + as relative to the end of the MMC partition. This can be useful if | ||
| + your board may be fitted with different MMC devices, which have | ||
| + different sizes for the MMC partitions, and you always want the | ||
| + environment placed at the very end of the partition, to leave the | ||
| + maximum possible space before it, to store other data. | ||
| + | ||
| + These two values are in units of bytes, but must be aligned to an | ||
| + MMC sector boundary. | ||
| + | ||
| + - CONFIG_ENV_OFFSET_REDUND (optional): | ||
| + | ||
| + Specifies a second storage area, of CONFIG_ENV_SIZE size, used to | ||
| + hold a redundant copy of the environment data. This provides a | ||
| + valid backup copy in case the other copy is corrupted, e.g. due | ||
| + to a power failure during a "saveenv" operation. | ||
| + | ||
| + This value may also be positive or negative; this is handled in the | ||
| + same way as CONFIG_ENV_OFFSET. | ||
| + | ||
| + This value is also in units of bytes, but must also be aligned to | ||
| + an MMC sector boundary. | ||
| + | ||
| + - CONFIG_ENV_SIZE_REDUND (optional): | ||
| + | ||
| + This value need not be set, even when CONFIG_ENV_OFFSET_REDUND is | ||
| + set. If this value is set, it must be set to the same value as | ||
| + CONFIG_ENV_SIZE. | ||
| + | ||
| - CONFIG_SYS_SPI_INIT_OFFSET | ||
| Defines offset to the initial SPI buffer area in DPRAM. The | ||
View
13
arch/arm/lib/bootm.c
| @@ -29,6 +29,9 @@ | ||
| #include <fdt.h> | ||
| #include <libfdt.h> | ||
| #include <fdt_support.h> | ||
| +#if defined(CONFIG_MACH_MESON8_ODROIDC) | ||
| +#include <asm/arch/gpio.h> | ||
| +#endif | ||
| DECLARE_GLOBAL_DATA_PTR; | ||
| @@ -274,6 +277,16 @@ static int bootm_linux_fdt(int machid, bootm_headers_t *images) | ||
| announce_and_cleanup(); | ||
| +#if defined(CONFIG_MACH_MESON8_ODROIDC) | ||
| + amlogic_gpio_direction_output(GPIOAO_3, 1); // TF_3V3N_1V8 -> 1.8V | ||
| + amlogic_gpio_direction_output(GPIOY_12, 0); // TFLASH_VDD_EN -> disable | ||
| + | ||
| + udelay(500000); | ||
| + | ||
| + amlogic_gpio_direction_output(GPIOAO_3, 0); // TF_3V3N_1V8 -> 3.3V | ||
| + amlogic_gpio_direction_output(GPIOY_12, 1); // TFLASH_VDD_EN -> enable | ||
| +#endif | ||
| + | ||
| kernel_entry(0, machid, *of_flat_tree); | ||
| /* does not return */ | ||
View
1
common/Makefile
| @@ -62,6 +62,7 @@ COBJS-$(CONFIG_ENV_IS_IN_NVRAM) += env_embedded.o | ||
| COBJS-$(CONFIG_ENV_IS_IN_FLASH) += env_flash.o | ||
| COBJS-$(CONFIG_ENV_IS_IN_MG_DISK) += env_mgdisk.o | ||
| COBJS-$(CONFIG_ENV_IS_IN_MMC) += env_mmc.o | ||
| +COBJS-$(CONFIG_ENV_IS_IN_FAT) += env_fat.o | ||
| COBJS-$(CONFIG_ENV_IS_IN_NAND) += env_nand.o | ||
| ifeq ($(CONFIG_NEXT_NAND),y) | ||
View
49
common/cmd_nvedit.c
| @@ -59,6 +59,7 @@ DECLARE_GLOBAL_DATA_PTR; | ||
| !defined(CONFIG_ENV_IS_IN_DATAFLASH) && \ | ||
| !defined(CONFIG_ENV_IS_IN_MG_DISK) && \ | ||
| !defined(CONFIG_ENV_IS_IN_MMC) && \ | ||
| + !defined(CONFIG_ENV_IS_IN_FAT) && \ | ||
| !defined(CONFIG_ENV_IS_IN_NAND) && \ | ||
| !defined(CONFIG_ENV_IS_IN_NVRAM) && \ | ||
| !defined(CONFIG_ENV_IS_IN_ONENAND) && \ | ||
| @@ -70,7 +71,7 @@ DECLARE_GLOBAL_DATA_PTR; | ||
| !defined(CONFIG_SPI_NAND_EMMC_COMPATIBLE) &&\ | ||
| !defined(CONFIG_STORE_COMPATIBLE) | ||
| # error Define one of CONFIG_ENV_IS_IN_{EEPROM|FLASH|DATAFLASH|ONENAND|\ | ||
| -SPI_FLASH|MG_DISK|NVRAM|MMC|NOWHERE} | ||
| +SPI_FLASH|MG_DISK|NVRAM|MMC|FAT|NOWHERE} | ||
| #endif | ||
| #define XMK_STR(x) #x | ||
| @@ -172,7 +173,7 @@ int do_env_print (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) | ||
| int _do_env_set (int flag, int argc, char * const argv[]) | ||
| { | ||
| - | ||
| + | ||
| bd_t *bd = gd->bd; | ||
| int i, len; | ||
| int console = -1; | ||
| @@ -1041,8 +1042,8 @@ char * args[]= | ||
| "disp.fromleft" | ||
| }; | ||
| -void set_env_without_def() | ||
| -{ | ||
| +void set_env_without_def() | ||
| +{ | ||
| int size_args = sizeof(args)/sizeof(char*); | ||
| @@ -1051,7 +1052,7 @@ void set_env_without_def() | ||
| int do_defenv (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) | ||
| -{ | ||
| +{ | ||
| set_env_without_def(); | ||
| #ifdef CONFIG_STORE_COMPATIBLE | ||
| run_command("put store",0); | ||
| @@ -1084,7 +1085,7 @@ int do_defenv_without (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[] | ||
| char *init_val=NULL; | ||
| int i,envCnt=0; | ||
| - | ||
| + | ||
| #define CONFIG_ENV_NUMBER 80 //effective environment variable number of max | ||
| char *varName[CONFIG_ENV_NUMBER]; | ||
| char varValue[CONFIG_ENV_NUMBER][CONFIG_SYS_CBSIZE]; | ||
| @@ -1093,30 +1094,30 @@ int do_defenv_without (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[] | ||
| if (argc < 2) | ||
| return cmd_usage(cmdtp); | ||
| - | ||
| + | ||
| for(i=1;i<argc;i++) | ||
| { | ||
| init_val = getenv(argv[i]); //get environment variable value | ||
| if(init_val) | ||
| { | ||
| varName[envCnt] = argv[i]; | ||
| - strcpy(varValue[envCnt], init_val); | ||
| + strcpy(varValue[envCnt], init_val); | ||
| envCnt ++; | ||
| - | ||
| + | ||
| printf("%s = %s\n",varName[envCnt-1],varValue[envCnt-1]); | ||
| } | ||
| //else | ||
| // printf("## Error: \"%s\" not defined\n",argv[i]); | ||
| } | ||
| - | ||
| + | ||
| set_default_env(NULL); //defenv | ||
| if(envCnt>0) | ||
| { | ||
| for(i=0;i<envCnt;i++) | ||
| setenv((char *)varName[i],(char *)varValue[i]); //set specified environment variables | ||
| } | ||
| - | ||
| + | ||
| return 0; | ||
| } | ||
| @@ -1130,14 +1131,14 @@ U_BOOT_CMD( | ||
| #ifdef CONFIG_STORE_COMPATIBLE | ||
| void replace(char* org, char* find, char* rep) | ||
| -{ | ||
| - char *p1, *p2; | ||
| - while(p1 = strstr(org, find)){ | ||
| - p2 = p1 + strlen(find); | ||
| - memmove(p1 + strlen(rep), p2, strlen(p2) + 1); | ||
| - memcpy(p1, rep, strlen(rep)); | ||
| +{ | ||
| + char *p1, *p2; | ||
| + while(p1 = strstr(org, find)){ | ||
| + p2 = p1 + strlen(find); | ||
| + memmove(p1 + strlen(rep), p2, strlen(p2) + 1); | ||
| + memcpy(p1, rep, strlen(rep)); | ||
| } | ||
| - | ||
| + | ||
| return; | ||
| } | ||
| @@ -1148,11 +1149,11 @@ int put_storage(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) | ||
| char rep[20]; | ||
| unsigned char store=0,tmp = 0; | ||
| char *p1 = NULL, *p2; | ||
| - | ||
| + | ||
| if (argc < 2) | ||
| return cmd_usage(cmdtp); | ||
| - | ||
| - cmd = argv[1]; | ||
| + | ||
| + cmd = argv[1]; | ||
| if(!strcmp(cmd,"storage")){ | ||
| char env_bootargs[512]; | ||
| @@ -1178,7 +1179,7 @@ int put_storage(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) | ||
| return -1; | ||
| } | ||
| p2 = p1+strlen("storage")+1; | ||
| - | ||
| + | ||
| tmp = simple_strtoul(p2 ,NULL,16); | ||
| // printf("@put_storage: tmp %d store %d\n",tmp,store); | ||
| if(tmp!= store){ | ||
| @@ -1211,7 +1212,7 @@ int put_storage(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) | ||
| return -1; | ||
| } | ||
| p2 = p1+strlen("storage")+1; | ||
| - | ||
| + | ||
| tmp = simple_strtoul(p2 ,NULL,16); | ||
| // printf("@put_storage: tmp %d store %d\n",tmp,store); | ||
| if(tmp!= store){ | ||
| @@ -1229,7 +1230,7 @@ int put_storage(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) | ||
| }else{ | ||
| return cmd_usage(cmdtp); | ||
| } | ||
| - | ||
| + | ||
| return 0; | ||
| } | ||
Oops, something went wrong.