I am trying to implement A/B partition for Beaglebone Black using Yocto.
I am stuck with an issue where i am not able to pass the environment variables between u-boot and Linux. Even though swupdate is successful and ustate is set to 1 in Linux, but the variable is not seen by u-boot environment variable.
Steps I have done:
I have integrated swupdate with yocto and have used Kirkstone versions.
swupdate-yocto/layers$ git clone git://
git.yoctoproject.org/poky -b kirkstone
swupdate-yocto/layers$ git clone
https://github.com/openembedded/meta-openembedded.git -b kirkstone
swupdate-yocto/layers$ git clone
https://github.com/sbabic/meta-swupdate -b kirkstone
swupdate-yocto/layers$ git clone
https://github.com/sbabic/meta-swupdate-boards.git -b kirkstone
and loaded the image on to sdcard, booted the beaglebone with it and flashed to the emmc.(swupdate is done on emmc and not sdcard)
Now i try to swupdate through swupdate webserver , but it failed with the error
[INFO ] : SWUPDATE started : Software Update started !
[TRACE] : SWUPDATE running : [network_initializer] : Software update started
[TRACE] : SWUPDATE running : [extract_file_to_tmp] : Found file
[TRACE] : SWUPDATE running : [extract_file_to_tmp] : filename sw-description
[TRACE] : SWUPDATE running : [extract_file_to_tmp] : size 1154
[DEBUG] : SWUPDATE running : [parse_cfg] : Parsing config file /tmp/sw-description
[TRACE] : SWUPDATE running : [get_common_fields] : Version 0.1.0
[TRACE] : SWUPDATE running : [get_common_fields] : reboot_required 1
[TRACE] : SWUPDATE running : [parse_hw_compatibility] : Accepted Hw Revision : 1.0
[TRACE] : SWUPDATE running : [_parse_images] : Found compressed Image: core-image-full-cmdline-beaglebone-yocto.ext4.gz in device : /dev/mmcblk0p2 for handler raw
[TRACE] : SWUPDATE running : [_parse_scripts] : Found Script: emmcsetup.lua
[TRACE] : SWUPDATE running : [_parse_bootloader] : Bootloader var: bootcmd_legacy_mmc1 = setenv mmcdev 1;setenv bootpart 1:2; run mmcboot
[TRACE] : SWUPDATE running : [_parse_bootloader] : Bootloader var: boot_targets = legacy_mmc1 mmc1 nand0 pxe dhcp
[TRACE] : SWUPDATE running : [parse] : Number of found artifacts: 1
[TRACE] : SWUPDATE running : [parse] : Number of scripts: 1
[TRACE] : SWUPDATE running : [parse] : Number of steps to be run: 3
[TRACE] : SWUPDATE running : [check_hw_compatibility] : Hardware beaglebone Revision: 1.0
[TRACE] : SWUPDATE running : [check_hw_compatibility] : Hardware compatibility verified
[DEBUG] : SWUPDATE running : [preupdatecmd] : Running Pre-update command
[TRACE] : SWUPDATE running : [extract_files] : Found file
[TRACE] : SWUPDATE running : [extract_files] : filename emmcsetup.lua
[TRACE] : SWUPDATE running : [extract_files] : size 1691 required
[TRACE] : SWUPDATE running : [extract_files] : Found file
[TRACE] : SWUPDATE running : [extract_files] : filename core-image-full-cmdline-beaglebone-yocto.ext4.gz
[TRACE] : SWUPDATE running : [extract_files] : size 38299703 required
[TRACE] : SWUPDATE running : [extract_padding] : Expecting up to 512 padding bytes at end-of-file
[TRACE] : SWUPDATE running : [network_initializer] : Valid image found: copying to FLASH
[WARN ] : SWUPDATE running : [bootloader_initialize] : Cannot read environment, using default
[ERROR] : SWUPDATE failed [0] ERROR uboot.c : bootloader_initialize : 59 : Error: Cannot read default environment from file
[WARN ] : SWUPDATE running : [bootloader_initialize] : Cannot read environment, using default
[ERROR] : SWUPDATE failed [0] ERROR uboot.c : bootloader_initialize : 59 : Error: Cannot read default environment from file
[WARN ] : SWUPDATE running : [update_transaction_state] : Cannot persistently store in_progress update state.
Going through the mailing list, i could find the problem was fw_printenv/fw_setenv did not work on my linux shell
fw_printenv
Cannot read environment, using default
Cannot read default environment from file
and my fw_env.config was
root@beaglebone-yocto:~# cat /etc/fw_env.config
# Block device example
/dev/mmcblk1boot1 0x00000 0x20000
/dev/mmcblk1boot1 0x20000 0x20000
I manually copied u-boot-initial-env from /build/tmp/work/beaglebone_yocto-poky-linux-gnueabi/u-boot/1_2022.01-r0
to /etc directory after that I could see
fw_prnt_env works
arch=arm
baudrate=115200
board=am335x
board_name=am335x
boot_a_script=load ${devtype} ${devnum}:${distro_bootpart} ${scriptaddr} ${prefix}${script}; source ${scriptadd}
boot_efi_binary=load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} efi/boot/bootarm.efi; if fdt addri
boot_efi_bootmgr=if fdt addr ${fdt_addr_r}; then bootefi bootmgr ${fdt_addr_r};else bootefi bootmgr;fi
boot_extlinux=sysboot ${devtype} ${devnum}:${distro_bootpart} any ${scriptaddr} ${prefix}${boot_syslinux_conf}
boot_fdt=try
and swupdate is sucessful
[DEBUG] : SWUPDATE running : [channel_get] : Trying to GET
http://papero:8080/default/controller/v1/bbb[TRACE] : SWUPDATE running : [extract_padding] : Expecting up to 512 padding bytes at end-of-file
[TRACE] : SWUPDATE running : [network_initializer] : Valid image found: copying to FLASH
[INFO ] : SWUPDATE running : Installation in progress
[TRACE] : SWUPDATE running : [start_lua_script] : Calling Lua /tmp/scripts/emmcsetup.lua
[TRACE] : SWUPDATE running : [run_lua_script] : LUA Exit: is boolean 1
[TRACE] : SWUPDATE running : [install_single_image] : Found installer for stream core-image-full-cmdline-beaglw
* Could not resolve host: papero
* Closing connection 7
[ERROR] : SWUPDATE failed [0] ERROR channel_curl.c : channel_get : 1549 : Channel get operation failed (6): 'Co'
[ERROR] : SWUPDATE failed [0] ERROR swupdate_vars.c : swupdate_vars_get : 89 : Failed to get variable action_id
[INFO ] : SWUPDATE running : [server_start] : Sleeping for 10s until retrying...
[TRACE] : SWUPDATE running : [start_lua_script] : Calling Lua /tmp/scripts/emmcsetup.lua
[TRACE] : SWUPDATE running : [run_lua_script] : LUA Exit: is boolean 1
[TRACE] : SWUPDATE running : [run_lua_script] : Script output: Post installed script called script end
[INFO ] : SWUPDATE successful ! SWUPDATE successful !
[DEBUG] : SWUPDATE running : [postupdate] : Running Post-update command
[TRACE] : SWUPDATE running : [network_initializer] : Main thread sleep again !
[INFO ] : No SWUPDATE running : Waiting for requests...
and ustate is updated
spibusno=0
spiimgsize=0x362000
spiroot=/dev/mtdblock4 rw
spirootfstype=jffs2
spisrcaddr=0xe0000
static_ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}::off
usb_boot=usb start; if usb dev ${devnum}; then devtype=usb; run scan_dev_for_boot_part; fi
ustate=1 ---------> ustate is updated
vendor=ti
Again i reboot and at the uboot command prompt when i print environment variables, i cannot see ustate.
That means i have updated 2 different copies of environment variables
I understand, just by copying u-boot-initial-env to /etc won't work.
1, I have added following to u-boot defconfig am335x_evm_defconfig
CONFIG_ENV_SIZE=0x20000
CONFIG_ENV_IS_IN_EMMC=y
CONFIG_ENV_OFFSET=0x0
CONFIG_SYS_MMC_ENV_DEV=1
CONFIG_SYS_MMC_ENV_PART=2
CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
CONFIG_SYS_ENV_OFFSET_REDUND=(CONFIG_ENV_OFFSET + CONFIG_ENV_SIZE)
2, I cannot see u-boot.env under /boot . Do we need to have uboot.env and uboot-redund.env created under /boot
3, How to get the address from which u-boot is printing the environment variables ? from which loction ?
I am stuck here, please send me points to solve this issue.
Thanks in Advance
Thomas