# How to edit the bootcmd\_mfg u-boot variable to run a script when u-boot boots?

**URL:** <https://forums.digi.com/t/how-to-edit-the-bootcmd-mfg-u-boot-variable-to-run-a-script-when-u-boot-boots/21773>\
**Category:** Linux\
**Tags:** u-boot, embedded-linux\
**Created:** [September 15, 2020, 9:46am UTC](https://forums.digi.com/t/how-to-edit-the-bootcmd-mfg-u-boot-variable-to-run-a-script-when-u-boot-boots/21773 "2020-09-15T09:46:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anupam\_mz](https://avatars.discourse-cdn.com/v4/letter/a/f04885/32.png) [@anupam\_mz](https://forums.digi.com/u/anupam_mz)\
**Post date:** [September 15, 2020, 9:46am UTC](https://forums.digi.com/t/how-to-edit-the-bootcmd-mfg-u-boot-variable-to-run-a-script-when-u-boot-boots/21773/1 "2020-09-15T09:46:01Z")

</div>

I want to run a script to run some commands when u-boot boots. How and where do I modify the bootcmd\_mfg variable to achieve the same?

---

<div class="post-metadata">

**Author:** ![LeonidM](https://avatars.discourse-cdn.com/v4/letter/l/d26b3c/32.png) [@LeonidM](https://forums.digi.com/u/LeonidM)\
**Post date:** [September 15, 2020, 1:35pm UTC](https://forums.digi.com/t/how-to-edit-the-bootcmd-mfg-u-boot-variable-to-run-a-script-when-u-boot-boots/21773/2 "2020-09-15T13:35:26Z")

</div>

I think the variable you want to change is bootcmd not bootcmd\_mfg. You can change it like you change any other variable in u-boot:  
setenv bootcmd command  
saveenv

---

<div class="post-metadata">

**Author:** ![anupam\_mz](https://avatars.discourse-cdn.com/v4/letter/a/f04885/32.png) [@anupam\_mz](https://forums.digi.com/u/anupam_mz)\
**Post date:** [September 16, 2020, 8:41am UTC](https://forums.digi.com/t/how-to-edit-the-bootcmd-mfg-u-boot-variable-to-run-a-script-when-u-boot-boots/21773/3 "2020-09-16T08:41:32Z")

</div>

Thanks for your response. The bootcmd\_mfg variable is run when mfg tool is used to boot u-boot. I added the command to this variable and it worked.
