Filter results by

Update Environment Variables

This guide describes how to use U-Boot to view and edit U-Boot and Linux® environment variables.

Entering U-Boot Shell

To enter the U-Boot shell, hit any key during the boot countdown.

U-Boot 2016.01 (Apr 30 2016 - 14:23:32 +0900)
DRAM: 896 MiB
HW Revision: 1
MMC: NEXELL DWMMC: 0, NEXELL DWMMC: 1
In: serial
Out: serial
Err: serial
Net: eth0: ethernet@c0060000
Hit any key to stop autoboot: 0
ARTIK5#

U-Boot Environment Variables

The U-Boot environment is a block of memory that is kept in persistent storage and copied to RAM when U-Boot starts. It is used to store environment variables, which can be used to configure the system. The environment is protected by a CRC32 checksum.

Note: Editing U-Boot environment variables can affect boot controls, so do not edit them without knowledge of the system.

The printenv command lists the current environment variables and their settings.

ARTIK5# printenv
android_boot=setenv bootargs ${console} root=/dev/ram0 ${opts};run boot_cmd_initrd
android_format=gpt write mmc 0 $partitions_android;setenv bootcmd run android_boot;saveenv; mmc rescan; fastboot
baudrate=115200
boot_cmd=fatload mmc 0:1 $kernel_addr $kernel_file;fatload mmc 0:1 $fdtaddr $fdtfile;bootz $kernel_addr - $fdtaddr
boot_cmd_initrd=fatload mmc 0:1 $kernel_addr $kernel_file;fatload mmc 0:1 $fdtaddr $fdtfile;fatload mmc 0:1 $initrd_addr $initrd_file;bootz $kernel_addr $initrd_addr $fdtaddr
bootcmd=run ramfsboot
bootdelay=3
bootpart=1
console=console=ttySAC2,115200n8
consoleoff=set console=ram; saveenv; reset
consoleon=set console=console=ttySAC2,115200n8
fdtaddr=40800000
fdtfile=exynos3250-artik5.dtb
initrd_addr=43000000
initrd_file=uInitrd
kernel_addr=40008000
kernel_file=zImage
mmcboot=setenv bootargs ${console} root=/dev/mmcblk${rootdev}p${rootpart} ${root_rw} rootfstype=ext4 ${opts};run boot_cmd
opts=loglevel=4
partitions=uuid_disk=${uuid_gpt_disk};name=boot,start=1MiB,size=32MiB,uuid=${uuid_gpt_boot};name=modules,size=32MiB,uuid=${uuid_gpt_module};name=rootfs,size=-,uuid=${uuid_gpt_rootfs}
partitions_android=uuid_disk=${uuid_gpt_disk};name=boot,start=1MiB,size=32MiB,uuid=${uuid_gpt_boot};name=system,size=1024MiB,uuid=${uuid_gpt_system};name=cache,size=128MiB,uuid=${uuid_gpt_cache};name=userdata,size=-,uuid=${uuid_gpt_userdata}
ramfsboot=setenv bootargs ${console} root=/dev/mmcblk${rootdev}p${rootpart} ${root_rw} rootfstype=ext4 ${opts} ${recoverymode};run boot_cmd_initrd
recoveryboot=run sdrecovery; setenv recoverymode recovery;run ramfsboot
root_rw=rw
rootdev=0
rootfslen=100000
rootpart=3
sdrecovery=sdfuse format; sdfuse flashall 3
stderr=serial
stdin=serial
stdout=serial

Environment size: 1777/16380 bytes
ARTIK5#

Create/Edit Environment Variable (setenv)

The setenv command changes a value in the current environment, or creates a variable and assigns a value if it does not yet exist.

This example shows changing the log level of the Linux kernel. loglevel will be set to 7 to show more detailed kernel logs.

ARTIK5# setenv opts loglevel=7

Save Environment Variables Permanently (saveenv)

The saveenv command stores the environment variables to the eMMC/SDCard permanently, where they will remain stored even through a system reboot.

ARTIK5# saveenv
Saving Environment to MMC...
Writing to MMC(0)... done


Last updated on: