Create new U-Boot Environment Variable

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Create new U-Boot Environment Variable

Jump to solution
2,301 Views
MichaelBMiner
Contributor IV

Hello,

I have implemented SWUpdate and I can successfully upgrade my kernel and OS. Now I am trying to create two new U-Boot environment variables.

CONFIG_KERNEL_TO_RUN and CONFIG_SWUPDATE_BOOTCMD. The idea is CONFIG_KERNEL_TO_RUN can have the values 0 or 1. If the value is 1 run the SWUpdate kernel to receive a new update, or run the default image kernel. 

To add these new variables I am attempting to patch the mx6ul_14x14_evk.h file in build-fb/tmp/work/imx6ull14x14evk-poky-linux-gnueabi/u-boot-imx/2021.04-r0. My patch is properly applied but when I run my device and enter the bootloader, running printenv my new setting is not present. 

 

Note I have only attempted to add CONFIG_SWUPDATE_BOOTCMD at this point. Here is my patch file. 

--- a/include/configs/mx6ul_14x14_evk.h	2023-02-23 15:43:58.407930365 -0600
+++ b/include/configs/mx6ul_14x14_evk.h	2023-02-23 15:41:52.594126013 -0600
@@ -120,6 +120,7 @@
 	"boot_fdt=try\0" \
 	"ip_dyn=yes\0" \
 	"splashimage=0x8c000000\0" \
+	"swupdate_bootcmd="__stringify(CONFIG_SWUPDATE_BOOTCMD)"\0" \
 	"mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \
 	"mmcpart=" __stringify(CONFIG_SYS_MMC_IMG_LOAD_PART) "\0" \
 	"mmcroot=" CONFIG_MMCROOT " rootwait rw\0" \
@@ -218,6 +219,17 @@
 			   "fi; " \
 		   "fi; " \
 	   "else run netboot; fi"
+	   
+#define CONFIG_SWUPDATE_BOOTCMD \
+	"setenv bootargs console=ttymxc0,115200 root=/dev/ram0 rootfstype=ext4 rw ;" \
+	"load mmc 1:3 0x83000000 /swupdate-image-imx6ull14x14evk.ext4.gz.u-boot;" \
+	"load mmc 1 0x82a00000 imx6ull-14x14-evk.dtb;" \
+	"load mmc 1 0x80800000 zImage;" \
+	"load mmc 1 0x83000000 300000 100000;" \
+	"setenv root /dev/ram0;" \
+	"setenv rootfstype ext4;" \
+	"setenv fw_env_config /etc/fw_env.config;" \
+	"bootz 0x80800000 0x83000000 0x82a00000;"	   
 #endif
 
 /* Miscellaneous configurable options */

Is there something I am missing? I figured if I told uboot about this new setting it would just appear. 

Labels (2)
Tags (1)
0 Kudos
Reply
1 Solution
2,277 Views
MichaelBMiner
Contributor IV

Dumb mistake I was patching the wrong header file. I was patching mx6ul_14x14_evk.h but needed to patch mx6ullevk.h.

 

I found this by looking into the file tmp/work/imx6ull14x14evk-poky-linux-gnueabi/u-boot-imx/2021.04-r0/build/mx6ull_14x14_evk_emmc_config/include/config.h which contains

/* Automatically generated - do not edit */
#define CONFIG_IMX_CONFIG	board/freescale/mx6ullevk/imximage.cfg
#define CONFIG_BOARDDIR board/freescale/mx6ullevk
#include <config_uncmd_spl.h>
#include <configs/mx6ullevk.h>
#include <asm/config.h>
#include <linux/kconfig.h>
#include <config_fallbacks.h>

View solution in original post

0 Kudos
Reply
2 Replies
2,300 Views
MichaelBMiner
Contributor IV

To test SWUpdate I was manually running the commands 

setenv swupdate_bootcmd "setenv bootargs console=ttymxc0,115200 root=/dev/ram0 rootfstype=ext4 rw ; load mmc 1:3 0x83000000 /swupdate-image-imx6ull14x14evk.ext4.gz.u-boot;load mmc 1 0x82a00000 imx6ull-14x14-evk.dtb;load mmc 1 0x80800000 zImage;load mmc 1 0x83000000 300000 100000;setenv root /dev/ram0;setenv rootfstype ext4;setenv fw_env_config /etc/fw_env.config;bootz 0x80800000 0x83000000 0x82a00000"
savenev
run swupdate_bootcmd

I am now trying to automate this process.

0 Kudos
Reply
2,278 Views
MichaelBMiner
Contributor IV

Dumb mistake I was patching the wrong header file. I was patching mx6ul_14x14_evk.h but needed to patch mx6ullevk.h.

 

I found this by looking into the file tmp/work/imx6ull14x14evk-poky-linux-gnueabi/u-boot-imx/2021.04-r0/build/mx6ull_14x14_evk_emmc_config/include/config.h which contains

/* Automatically generated - do not edit */
#define CONFIG_IMX_CONFIG	board/freescale/mx6ullevk/imximage.cfg
#define CONFIG_BOARDDIR board/freescale/mx6ullevk
#include <config_uncmd_spl.h>
#include <configs/mx6ullevk.h>
#include <asm/config.h>
#include <linux/kconfig.h>
#include <config_fallbacks.h>
0 Kudos
Reply