Hi,
Can I modify the u-boot configuration after booting into the Linux? I don't want to do that by entering into the u-boot setting prompt to do this.
Thanks...
Hank
解決済! 解決策の投稿を見る。
Hi Huazhi,
Even I also referred the same link which u provided in above query. For getting the "fw_setenv", do the following steps.
In uboot:
1) give 'env' (optional parameter) in uboot and compile it
2) this will generate the 'fw_printenv' in the U-Boot directory tools/env
3) Copy the fw_env.config file too.
3) follow the next steps from the "U-boot environment variables in linux link"
Please let me know any additional details you want for fw_printenv and fw_setenv.
Best regards
Ajith P V
Hi Huazhi
While I am building the u-boot with env option i am getting some error. May be some tool chain issue. i am compiling with cross-compiler tools from Android.
ln -s ../../lib_generic/crc32.c crc32.c
crc32.c:14:20: error: stdint.h: No such file or directory
fw_env.c:27:19: error: errno.h: No such file or directory
fw_env.c:28:19: error: fcntl.h: No such file or directory
fw_env.c:29:19: error: stdio.h: No such file or directory
fw_env.c:30:20: error: stdlib.h: No such file or directory
fw_env.c:32:20: error: string.h: No such file or directory
fw_env.c:33:23: error: sys/types.h: No such file or directory
fw_env.c:34:23: error: sys/ioctl.h: No such file or directory
fw_env.c:35:22: error: sys/stat.h: No such file or directory
fw_env.c:36:20: error: unistd.h: No such file or directory
fw_env.c:43:27: error: mtd/mtd-user.h: No such file or directory
fw_env_main.c:42:19: error: stdio.h: No such file or directory
fw_env_main.c:43:20: error: string.h: No such file or directory
fw_env_main.c:44:20: error: stdlib.h: No such file or directory
/home/vijay/build/ch10-2.2/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi-gcc -Wall -DUSE_HOSTCC -I/home/vijay/work/allgo/env_uboot/uboot-imx/include crc32.c fw_env.c fw_env_main.c -o fw_printenv
crc32.c:14:20: error: stdint.h: No such file or directory
crc32.c:81: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'crc_table'
crc32.c:157: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'crc32'
crc32.c:204: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'crc32_wd'
fw_env.c:27:19: error: errno.h: No such file or directory
fw_env.c:28:19: error: fcntl.h: No such file or directory
fw_env.c:29:19: error: stdio.h: No such file or directory
fw_env.c:30:20: error: stdlib.h: No such file or directory
fw_env.c:32:20: error: string.h: No such file or directory
fw_env.c:33:23: error: sys/types.h: No such file or directory
fw_env.c:34:23: error: sys/ioctl.h: No such file or directory
fw_env.c:35:22: error: sys/stat.h: No such file or directory
fw_env.c:36:20: error: unistd.h: No such file or directory
fw_env.c:43:27: error: mtd/mtd-user.h: No such file or directory
fw_env.c:59: error: expected specifier-qualifier-list before 'ulong'
fw_env.c:69: error: unknown field 'mtd_type' specified in initializer
fw_env.c:69: error: 'MTD_ABSENT' undeclared here (not in a function)
fw_env.c:71: error: unknown field 'mtd_type' specified in initializer
fw_env.c:88: error: expected specifier-qualifier-list before 'uint32_t'
fw_env.c:93: error: expected specifier-qualifier-list before 'uint32_t'
fw_env.c:106: error: expected specifier-qualifier-list before 'uint32_t'
fw_env.c:113: error: unknown field 'flag_scheme' specified in initializer
fw_env.c:219: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'getenvsize'
fw_env.c: In function 'fw_getenv':
fw_env.c:239: error: 'struct environment' has no member named 'data'
fw_env.c:243: error: 'struct environment' has no member named 'data'
Thanks
Vijay
Any reason for your native compilation? It seems that the filesystem does not have the necessary headers.
Hi Huazhi,
Please do the changes which navanisrivastava mentioned in the reply. You have to change the fw_env.config with respect to your system modification rather than simply putting it into /etc. you can easily check this from /proc/mtd.
Once you configure the appropriate values in fw_env.config, then rest of the stuffs are pretty easy and same....
Best regards
Ajith P V
mine is SD card I do not find /proc/mtd exist in my directory do you have any suggestions ?
Hi Ajith,
Thanks for you reply again. Actually I have done some research about the config file. Here is the link I referred to...
bootloaders:u-boot:env [Analog Devices | Mixed-signal and Digital Signal Processing ICs]
My configuration is
# MTD device name Device offset Env.size Flash sector size number of sectors
/dev/mtd0 0xC0000 0x2000 0x2000
And fw_printenv always reported CRC error here.
Here is my console
root@freescale /media$ cat /proc/mtd
dev: size erasesize name
mtd0: 01000000 00080000 "bootloader"
mtd1: 00500000 00080000 "nand.kernel"
mtd2: 10000000 00080000 "nand.rootfs"
mtd3: 10000000 00080000 "nand.userfs1"
mtd4: 1eb00000 00080000 "nand.userfs2"
#define CONFIG_ENV_SECT_SIZE (8 * 1024)
#define CONFIG_ENV_SIZE CONFIG_ENV_SECT_SIZE
#if defined(CONFIG_FSL_ENV_IN_NAND)
#define CONFIG_ENV_IS_IN_NAND 1
#define CONFIG_ENV_OFFSET 0x200000
#elif defined(CONFIG_FSL_ENV_IN_MMC)
#define CONFIG_ENV_IS_IN_MMC 1
#define CONFIG_ENV_OFFSET (768 * 1024)
#elif defined(CONFIG_FSL_ENV_IN_SATA)
#define CONFIG_ENV_IS_IN_SATA 1
#define CONFIG_SATA_ENV_DEV 0
#define CONFIG_ENV_OFFSET (768 * 1024)
#elif defined(CONFIG_FSL_ENV_IN_SF)
#define CONFIG_ENV_IS_IN_SPI_FLASH 1
#define CONFIG_ENV_SPI_CS 1
#define CONFIG_ENV_OFFSET (768 * 1024)
#else
#define CONFIG_ENV_IS_NOWHERE
Hi Huazhi,
For fw_env.config, your configuration should contain-
MTD device name- /dev/mtdX
X should be the mtd block number in which your environment address is residing.
Device offset- This would always be 0x0000
Env.size- 0x2000 ( according to CONFIG_ENV_SIZE )
Flash sector size- (CONFIG_ENV_SIZE / Number of sectors)
Number of sectors- (CONFIG_ENV_SIZE / NAND Block Size(get it from datasheet) )
For your reference this is my configuration
# MTD device name | Device offset Env. size | Flash sector size | Number of sectors |
/dev/mtd1 0x0000 0x100000 0x20000 8
when-
#define CONFIG_ENV_SECT_SIZE | (1024 * 1024) |
and Block Size for my NAND is 128K
Hope it helps.. All the Best :smileyhappy::smileyhappy:
Hi Huazhi,
Even I also referred the same link which u provided in above query. For getting the "fw_setenv", do the following steps.
In uboot:
1) give 'env' (optional parameter) in uboot and compile it
2) this will generate the 'fw_printenv' in the U-Boot directory tools/env
3) Copy the fw_env.config file too.
3) follow the next steps from the "U-boot environment variables in linux link"
Please let me know any additional details you want for fw_printenv and fw_setenv.
Best regards
Ajith P V
Hi. Your are right. It worked. However when I ran it, it shows CRC checksum error.
Do you have any suggestion about this? Thanks again.
Hi Huazhi,
Please check fw_env.config file ( u-boot/tools/env/fw_env.config) and make required changes related to env size, Flash sector size and Number of sectors according to flash which you are using. I got similar error but on changing mentioned parameters i got desired output.
Hi,
How can I get the env size, Flash sector size and Number of sectors according to flash which I am using. I have a ls1021a-twr eva board and it's boot from SD card. I do not know how to set the right value in the fw_env.config
Please refer to my post here
Hi navanisrivastava,
Yes, this is what exactly has to be done. Appreciate for your sincere effort.
Thank you
Ajith P V
Hi, I have the same question , someone here can help me?
I think you can instruct U-Boot to load arguments from a file. Then, you can modify this file from Linux user space. Please, check U-Boot documentation.
Hi Huazhi,
I used the same uboot utility in i.MX257 board. its working for me..!
Best regards
Ajith P V
Hi Huazhi,
May I know which BSP you are using and how you configured the "fw_setenv"?
Ajith P V
Hi, Thank you for your replay. I'm using imx53 BSP 11.09 and the package I choose is u-boot tools. What did you choose?
I think you can create one file which contain the new boot param. Then use "dd" command in kernel to write the file to the u-boot param area.
I have tried to dump the "Uboot area" on the sd card. But the address of the uboot parameter turns to be different for different configurations.
I saw that there is a uboot utils which can do this easily and I enabled this option in my BSP build. But it just doesn't have that tool. Here is the link of the tool I'm talking about.
I believe there is no "easy" way to do that from linux prompt. You would need to copy a file to a memory region, raw way
What´s the use case?