LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Password
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.

Notices


Reply
  Search this Thread
Old 01-17-2019, 10:11 AM   #1
efriel_linux
LQ Newbie
 
Registered: Jan 2019
Posts: 2

Rep: Reputation: Disabled
Unhappy U-Boot environment variable not updating


I am trying to network boot Linux via TFTP and so when u-boot executes it says on the console, "ipaddr not set".

Yet when I print the variable ipaddr it shows the ip address is correct.
i.e. 'printenv ipaddr' -> ipaddr=192.168.1.20

Everytime I change the u-boot configuration I have to issue the command, "env default -a" in the u-boot to update the environment variables because they never seem to update for some reason.

Anyone know how to solve this to update the variables without manually issuing commands?

By the way I am booting the fsbl, bitstream and u-boot via sd card.



Code:
/* PREBOOT */
#define CONFIG_PREBOOT  "echo U-BOOT for ${hostname};setenv preboot; echo; dhcp"

/* Extra U-Boot Env settings */
#define CONFIG_EXTRA_ENV_SETTINGS \ 
        SERIAL_MULTI \
        CONSOLE_ARG \
        PSSERIAL0 \
        "nc=setenv stdout nc;setenv stdin nc;\0" \
        "ethaddr=\0" \
        "ipaddr=192.168.1.20\0" \
        "serverip=192.168.1.5\0"        \
        "kernel_load_address=0xa00000\0"        \
        "sdboot=echo boot Petalinux; mmcinfo && fatload mmc 0 ${netstart} ${kernel_img} && bootm \0" \
        "tftp_boot=mmcinfo;echo *** BOOTING FROM TFTP SERVER ***; tftpboot ${kernel_load_address} ${serverip}:${kernel_img} \0" \
        "autoload=no\0" \
        "clobstart=0x04000000\0" \
        "netstart=0x04000000\0" \
        "dtbnetstart=0x05800000\0" \
        "loadaddr=0x04000000\0" \
        "boot_img=BOOT.BIN\0" \ 
        "load_boot=tftpboot ${clobstart} ${boot_img}\0" \
        "update_boot=setenv img boot; setenv psize ${bootsize}; setenv installcmd \"install_boot\"; run load_boot ${installcmd}; setenv img; setenv psize; setenv installcmd\0" \
        "install_boot=mmcinfo && fatwrite mmc 0 ${clobstart} ${boot_img} ${filesize}\0" \
        "bootenvsize=0x20000\0" \
        "bootenvstart=0x300000\0" \
        "eraseenv=sf probe 0 && sf erase ${bootenvstart} ${bootenvsize}\0" \
        "jffs2_img=rootfs.jffs2\0" \
        "load_jffs2=tftpboot ${clobstart} ${jffs2_img}\0" \
        "update_jffs2=setenv img jffs2; setenv psize ${jffs2size}; setenv installcmd \"install_jffs2\"; run load_jffs2 test_img; setenv img; setenv psize; setenv installcmd\0" \
        "sd_update_jffs2=echo Updating jffs2 from SD; mmcinfo && fatload mmc 0:1 ${clobstart} ${jffs2_img} && run install_jffs2\0" \
        "install_jffs2=sf probe 0 && sf erase ${jffs2start} ${jffs2size} && " \
                "sf write ${clobstart} ${jffs2start} ${filesize}\0" \
        "kernel_img=image.ub\0" \
        "load_kernel=tftpboot ${clobstart} ${kernel_img}\0" \
        "update_kernel=setenv img kernel; setenv psize ${kernelsize}; setenv installcmd \"install_kernel\"; run load_kernel ${installcmd}; setenv img; setenv psize; setenv installcmd\0" \
        "install_kernel=mmcinfo && fatwrite mmc 0 ${clobstart} ${kernel_img} ${filesize}\0" \
        "cp_kernel2ram=mmcinfo && fatload mmc 0 ${netstart} ${kernel_img}\0" \
        "dtb_img=system.dtb\0" \
        "load_dtb=tftpboot ${clobstart} ${dtb_img}\0" \
        "update_dtb=setenv img dtb; setenv psize ${dtbsize}; setenv installcmd \"install_dtb\"; run load_dtb test_img; setenv img; setenv psize; setenv installcmd\0" \
        "sd_update_dtb=echo Updating dtb from SD; mmcinfo && fatload mmc 0:1 ${clobstart} ${dtb_img} && run install_dtb\0" \
        "fault=echo ${img} image size is greater than allocated place - partition ${img} is NOT UPDATED\0" \
        "test_crc=if imi ${clobstart}; then run test_img; else echo ${img} Bad CRC - ${img} is NOT UPDATED; fi\0" \
        "test_img=setenv var \"if test ${filesize} -gt ${psize}\\; then run fault\\; else run ${installcmd}\\; fi\"; run var; setenv var\0" \
        "netboot=tftpboot ${netstart} ${kernel_img} && bootm\0" \
        "default_bootcmd=run cp_kernel2ram && bootm ${netstart}\0" \
        "bootcmd_tftp=run tftp_boot && bootm ${kernel_load_address}\0"  \
""

/* BOOTCOMMAND */
#define CONFIG_BOOTCOMMAND      "run bootcmd_tftp"

#undef CONFIG_SPL_BUILD /* Disable SPL by default*/

#endif /* __PLNX_CONFIG_H */

Last edited by efriel_linux; 01-17-2019 at 10:25 AM. Reason: Insert code
 
Old 01-18-2019, 05:10 PM   #2
blue_z
Member
 
Registered: Jul 2015
Location: USA
Distribution: Ubuntu, Lubuntu, Mint, custom embedded
Posts: 90

Rep: Reputation: Disabled
Quote:
Originally Posted by efriel_linux View Post
Everytime I change the u-boot configuration I have to issue the command, "env default -a" in the u-boot to update the environment variables because they never seem to update for some reason.
You seem to be conflating the three sets of environment variables in U-Boot.

The default environment is the set of environment variables that are defined in source code, i.e. what you seem to call "the u-boot configuration".

The saved environment is the set of environment variables that are retained in persistent storage. They have to be written using the saveenv command, and are validated using a CRC32 checkword.

The active environment is the set of environment variables that are held in RAM while U-Boot executes.
On startup U-Boot tries to populate the active environment with the saved environment, but only if the CRC32 checkword confirms the integrity of the saved environment.
When validation is successful, the environment variables from the persistent storage (silently) become the active environment.
When validation fails, a notice is displayed, "Warning: Bad CRC, using default environment", and the environment variables from the default environment become the active environment.


Quote:
Originally Posted by efriel_linux View Post
Anyone know how to solve this to update the variables without manually issuing commands?
There is no automatic "update" of environment variables from the default environment to the saved environment.
If you clobber the saved environment (e.g. delete the uEnv.txt file), then on startup U-Boot will be forced to use the default environment.
Or instead of making your changes to the U-Boot source code, build a custom uEnv.txt file that is installed with the updated U-Boot executable.


Regards
 
Old 01-21-2019, 05:01 AM   #3
efriel_linux
LQ Newbie
 
Registered: Jan 2019
Posts: 2

Original Poster
Rep: Reputation: Disabled
Yes that makes sense!

Thanks for the feedback I will go with that approach
 
Old 01-22-2019, 02:39 PM   #4
sharnbrooke
LQ Newbie
 
Registered: Jul 2018
Posts: 6

Rep: Reputation: Disabled
I get the following error message after trying to update Linux. How can I eliminate this problem, Please?

GPG error: https://dl.winehq.org/wine-builds/ubuntu bionic InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 76F1A20FF987672FThe repository 'https://dl.winehq.org/wine-builds/ubuntu bionic InRelease' is not signed.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Environment variable that dynamically changes when another variable is changed youtoo Linux - Newbie 4 02-17-2016 02:44 AM
rpm changes are not updating immediately and updating after some time. shri_22ram Linux - Newbie 1 05-13-2013 01:50 PM
Add new environment variable in U-Boot........How? parmeshwer Linux - Software 2 03-07-2009 05:19 AM
AWK a variable Ouptut to a new variable and using the new variable with the old one alertroshannow Linux - Newbie 4 02-16-2009 01:08 AM
environment variable at boot nasht Linux - Software 2 09-16-2005 04:51 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer

All times are GMT -5. The time now is 02:59 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration