Changes between Version 18 and Version 19 of provisioning


Ignore:
Timestamp:
10/29/2021 08:29:19 PM (3 years ago)
Author:
Tim Harvey
Comment:

added details about provisioning uboot env

Legend:

Unmodified
Added
Removed
Modified
  • provisioning

    v18 v19  
    102102- partition editor (sgdisk and/or parted)
    103103- filesystem creation tools (ie e2fsprogs if using ext2/3/4)
    104 - u-boot-tools (fw_printenv/fw_setenv) if setting or altering uboot env
     104- u-boot-tools (fw_printenv/fw_setenv/mkenvimage) if setting or altering uboot env
    105105- networking support to fetch your filesystem tarballs (which could also come from removable storage)
    106106- optionally your provisioning script (or you can transfer this via network)
     
    387387
    388388Please read more about JTAG upload here: [wiki:jtag_instructions JTAG Instructions]
     389
     390
     391[=#ubootenv]
     392== U-Boot environment provisioning
     393The U-Boot bootloader uses environment variables and scripts to control the booting of a board. Often it is desirable to override the default environment the Gateworks BSP's create and create your own.
     394
     395The device, location, size, and redundancy details of how the U-Boot environment is stored vary from board to board based on U-Boot's configuration:
     396 * Venice: 32KiB (0x8000) redundant env stored at 16320KiB (0xff0000) offset for MMC
     397 * Newport: 32KiB (0x8000) redundant env stored at 16320KiB (0xff0000) offset for MMC
     398 * Ventana:
     399  - MMC: 128MiB redundant env stored at 709KiB offset
     400  - NAND: 128MiB redundant env stored at 16MiB offset
     401
     402There are some tools from the U-Boot project available in the u-boot-tools package that can be used to alter or create an env that can then be copied directly to flash:
     403 * fw_setenv / fw_getenv - requires a config file and can get or alter the env. If there is no valid env where the config file points to a default env hard coded into the bootloader will be returned.
     404 * mkenvimage - create an env image from scratch with a specified size and redundancy.
     405
     406For examples of how the default env is created for the various Gateworks products:
     407 - Venice BSP uses fw_setenv to alter the hard-coded default env. For details see:
     408  * https://github.com/Gateworks/bsp-venice/blob/master/Makefile
     409  * https://github.com/Gateworks/bsp-venice/blob/master/venice.env
     410  * https://github.com/Gateworks/bsp-venice/blob/master/fw_env.config
     411 - Newport BSP uses fw_setenv to alter the hard-coded default env. For details see:
     412  * https://github.com/Gateworks/bsp-newport/blob/sdk-10.1.1.0-newport/Makefile
     413  * https://github.com/Gateworks/bsp-newport/blob/sdk-10.1.1.0-newport/newport.env
     414  * https://github.com/Gateworks/bsp-newport/blob/sdk-10.1.1.0-newport/fw_env.config
     415 - Ventana firmware images have a blank env area therefore use hard-coded default env from U-Boot
     416
     417To create a specific env from scratch (ie without inheriting any defaults) use the {{{mkenvimage}}} tool from the u-boot-tools package
     418 1. Create an env.txt file with 'name=value' pairs. Be sure to include everything that is necessary as no defaults will be available other than variables that are set at runtime on the fly such as serial#, model, and macaddr:
     419{{{#!bash
     420cat << EOF >> env.txt
     421baudrate=115200
     422bootcmd=run distro_boot
     423...
     424EOF
     425}}}
     426{{{#!bash
     427cat << EOF >> env.txt
     428baudrate=115200
     429loadaddr=0x48200000
     430ipaddr=192.168.1.1
     431serverip=192.168.1.146
     432update_all=tftpboot $loadaddr venice/venice-focal-imx8mm.img.gz && gzwrite mmc 2 $loadaddr $filesize
     433update_env=tftpboot $loadaddr venice/env.bin && mmc dev 2 && mmc write $loadaddr 0x7f80 $filesize
     434EOF
     435}}}
     436 2. Use {{{mkenvimage}}}  taking care to specify the env size the bootloader is configured to use and specify '-r' for redundancy if the bootloader is configured for that:
     437  * Venice / Newport
     438{{{#!bash
     439mkenvimage -r -s $((32 * 1024)) -o env.bin env.txt
     440}}}
     441  * Ventana:
     442{{{#!bash
     443mkenvimage -r -s $((128 * 1024)) -o env.bin env.txt
     444}}}
     445 3. Place this image in FLASH:
     446  * Venice / Newport:
     447   - Example: compressed disk image for Venice / Newport:
     448{{{#!bash
     449gunzip disk.img.gz
     450dd if=env.bin of=disk.img bs=1K seek=16320 oflag=notrunc
     451gzip disk.img
     452}}}
     453   - Example: update from Linux:
     454{{{#!bash
     455dd if=env.bin of=/dev/mmcblk0 bs=1K seek=16320 oflag=notrunc
     456}}}
     457   - Example: update from U-Boot (16320KiB is equivalent to 0x7f80 512byte blocks in hex)
     458{{{#!bash
     459tftp $loadaddr env.bin && mmc write $loadaddr 0x7f80 $filesize
     460}}}
     461  * Ventana:
     462   - Example: JTAG binary image for a Ventana NAND device:
     463{{{#!bash
     464mkimage_jtag -e SPL@0 u-boot.img@14M env.bin@16M ubi@17M > image.bin
     465}}}
     466   - Example: update from Linux:
     467{{{#!bash
     468dd if=env.bin of=/dev/mmcblk0 bs=1K seek=16384 oflag=notrunc
     469}}}
     470   - Example: update from U-Boot (16384MiB is equivalent to 0x8000 512byte blocks in hex)
     471{{{#!bash
     472tftp $loadaddr env.bin && mmc write $loadaddr 0x8000 $filesize
     473}}}
    389474
    390475