Changes between Version 12 and Version 13 of ventana/bootloader
- Timestamp:
- 12/07/2018 04:26:44 PM (6 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
ventana/bootloader
v12 v13 461 461 [=#uboot-envtools] 462 462 === U-Boot envtools (fw_printenv / fw_setenv) === 463 The {{{fw_printenv}}} and {{{fw_setenv}}} tools from U-Boot provide a way to allow reading and writing to U-Boot's env variables provided you have a proper configuration file. On OpenWrt these are in the {{{uboot-envtools}}} package and on Ubuntu they are in the {{{u-boot-tools}}} package. In order to use u-boot envtools environment must be saved at least once. 464 465 In bootloader: 463 The {{{fw_printenv}}} and {{{fw_setenv}}} tools from U-Boot provide a way to allow reading and writing to U-Boot's env variables provided you have a proper configuration file. On OpenWrt these are in the {{{uboot-envtools}}} package and on Ubuntu they are in the {{{u-boot-tools}}} package. In order to use u-boot envtools in Linux for Ventana the environment must be saved at least once in the bootloader: 466 464 {{{#!bash 467 465 saveenv … … 493 491 494 492 495 It is important to realize the meaning of the '''Warning: Bad CRC, using default environment''' message. This means that the non-volatile env area is empty or corrupt (Note that this is the way Gateworks boards ship by default) and that the built-in env within U-Boot will be used.493 It is important to realize the meaning of the '''Warning: Bad CRC, using default environment''' message. This means that the non-volatile env area is empty or corrupt (Note that this is the way Gateworks Ventana boards ship by default) and that the built-in env within U-Boot will be used. 496 494 497 495 If you use {{{fw_setenv}}} on an environment in this state it will properly set the variable you specify and all other variables will continue to use their built-in default values within U-Boot. Essentially you are 'overriding' the defaults as you would expect. … … 499 497 500 498 ==== Configuring u-boot-tools 501 A file defining where your environment is located must be present for u-boot-tools to work. Without this file you will receive an error: 502 {{{#!bash 503 Cannot parse config file '/etc/fw_env.config': No such file or directory 504 }}} 499 A file defining where your environment is located must be provided to {{{fw_printenv}}} and {{{fw_setenv}}} with the {{{-c <file>}}} paramater. Note that older versions of these tools lacked this argument and required the config file to be in {{{/etc/fw_env.config}}} 500 505 501 Examples: 506 502 * Ventana booting from NAND 507 503 {{{#!bash 508 504 #Create config file 509 cat << EOF > /etc/fw_env.config505 cat << EOF > ventana_nand_env.config 510 506 # device offset size erasesize 511 507 /dev/mtd1 0x0 0x20000 0x40000 … … 516 512 {{{#!bash 517 513 #Create config file 518 cat << EOF > /etc/fw_env.config514 cat << EOF > ventana_mmc_env.config 519 515 # device offset size erasesize 520 516 /dev/mmcblk0 0xb1400 0x20000 0x20000 … … 522 518 EOF 523 519 }}} 524 * A file for building an image520 * A file that can be flashed later on NAND or inserted to a JTAG image: 525 521 {{{#!bash 526 522 #Create config file 527 cat << EOF > /working/fw_env.config523 cat << EOF > fw_env.config 528 524 # device offset size erasesize 529 525 envVentana.bin 0x00000 0x20000 530 envVentana.bin 0x 20000 0x20000526 envVentana.bin 0x80000 0x20000 531 527 EOF 532 528 }}} 533 529 534 This will define the device being used, offset according to flash layout, size from flash map, and size of erase block (unless the device is a file). 530 This will define the device being used, offset according to flash layout, size from flash map, and size of erase block (unless the device is a file). Ventana U-boot environment is redundant hence two entries, both locations need their variables updated. 535 531 536 532 ==== Usage example … … 538 534 {{{#!bash 539 535 # display environment 540 fw_printenv 536 fw_printenv -c fw_env.config 541 537 # set environment variable 542 fw_setenv foo bar #foo being variable name bar being value variable will be set to538 fw_setenv -c fw_env.config foo bar #foo being variable name bar being value variable will be set to 543 539 #second example 544 fw_setenv ipaddr 192.168.1.10540 fw_setenv -c fw_env.config ipaddr 192.168.1.10 545 541 #print single environment variable 546 fw_printenv foo542 fw_printenv -c fw_env.config foo 547 543 #second example 548 544 fw_printenv ipaddr