Changes between Version 12 and Version 13 of ventana/bootloader


Ignore:
Timestamp:
12/07/2018 04:26:44 PM (6 years ago)
Author:
Tim Harvey
Comment:

updated uboot-envtools usage

Legend:

Unmodified
Added
Removed
Modified
  • ventana/bootloader

    v12 v13  
    461461[=#uboot-envtools]
    462462=== 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:
     463The {{{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:
    466464{{{#!bash
    467465saveenv
     
    493491
    494492
    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.
     493It 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.
    496494
    497495If 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.
     
    499497
    500498==== 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 }}}
     499A 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
    505501Examples:
    506502* Ventana booting from NAND
    507503{{{#!bash
    508504#Create config file
    509 cat << EOF > /etc/fw_env.config
     505cat << EOF > ventana_nand_env.config
    510506# device  offset size erasesize
    511507/dev/mtd1 0x0 0x20000 0x40000
     
    516512{{{#!bash
    517513#Create config file
    518 cat << EOF > /etc/fw_env.config
     514cat << EOF > ventana_mmc_env.config
    519515# device  offset size erasesize
    520516/dev/mmcblk0 0xb1400 0x20000 0x20000
     
    522518EOF
    523519}}}
    524 * A file for building an image
     520* A file that can be flashed later on NAND or inserted to a JTAG image:
    525521{{{#!bash
    526522#Create config file
    527 cat << EOF > /working/fw_env.config
     523cat << EOF > fw_env.config
    528524# device  offset size erasesize
    529525envVentana.bin 0x00000 0x20000
    530 envVentana.bin 0x20000 0x20000
     526envVentana.bin 0x80000 0x20000
    531527EOF
    532528}}}
    533529
    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).  Ventana U-boot environment is redundant hence two entries, both locations need their variables updated. 
     530This 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. 
    535531
    536532==== Usage example
     
    538534{{{#!bash
    539535# display environment
    540 fw_printenv
     536fw_printenv -c fw_env.config
    541537# set environment variable
    542 fw_setenv foo bar #foo being variable name bar being value variable will be set to
     538fw_setenv  -c fw_env.config foo bar #foo being variable name bar being value variable will be set to
    543539#second example
    544 fw_setenv ipaddr 192.168.1.10
     540fw_setenv  -c fw_env.config ipaddr 192.168.1.10
    545541#print single environment variable
    546 fw_printenv foo
     542fw_printenv  -c fw_env.config foo
    547543#second example
    548544fw_printenv ipaddr